combine sleect2 creation into single class

This commit is contained in:
John Mitchell
2016-02-16 14:37:57 +00:00
parent ffcb8ec65d
commit b3667ce56a
3 changed files with 16 additions and 101 deletions

View File

@@ -52,59 +52,13 @@ export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait', '$s
var callSelect2 = function() { var callSelect2 = function() {
CreateSelect2({ CreateSelect2({
element: '#schedulerTimeZone', element: '.MakeSelect2',
multiple: false
});
CreateSelect2({
element: '#schedulerFrequency',
multiple: false
});
CreateSelect2({
element: '#monthlyWeekDay',
multiple: false
});
CreateSelect2({
element: '#monthlyOccurrence',
multiple: false
});
CreateSelect2({
element: '#monthlyOccurrence',
multiple: false
});
CreateSelect2({
element: '#yearlyMonth',
multiple: false
});
CreateSelect2({
element: '#yearlyWeekDay',
multiple: false
});
CreateSelect2({
element: '#yearlyOccurrence',
multiple: false
});
CreateSelect2({
element: '#yearlyOtherMonth',
multiple: false
});
CreateSelect2({
element: '#schedulerEnd',
multiple: false multiple: false
}); });
}; };
$scope.$on("updateSchedulerSelects", function() { $scope.$on("updateSchedulerSelects", function() {
callSelect2(); callSelect2();
console.log("select2 is called");
}); });
callSelect2(); callSelect2();

View File

@@ -56,59 +56,13 @@ export default ['$compile', '$state', '$stateParams', 'EditSchedule', 'Wait', '$
var callSelect2 = function() { var callSelect2 = function() {
CreateSelect2({ CreateSelect2({
element: '#schedulerTimeZone', element: '.MakeSelect2',
multiple: false
});
CreateSelect2({
element: '#schedulerFrequency',
multiple: false
});
CreateSelect2({
element: '#monthlyWeekDay',
multiple: false
});
CreateSelect2({
element: '#monthlyOccurrence',
multiple: false
});
CreateSelect2({
element: '#monthlyOccurrence',
multiple: false
});
CreateSelect2({
element: '#yearlyMonth',
multiple: false
});
CreateSelect2({
element: '#yearlyWeekDay',
multiple: false
});
CreateSelect2({
element: '#yearlyOccurrence',
multiple: false
});
CreateSelect2({
element: '#yearlyOtherMonth',
multiple: false
});
CreateSelect2({
element: '#schedulerEnd',
multiple: false multiple: false
}); });
}; };
$scope.$on("updateSchedulerSelects", function() { $scope.$on("updateSchedulerSelects", function() {
callSelect2(); callSelect2();
console.log("select2 is called");
}); });
callSelect2(); callSelect2();

View File

@@ -145,6 +145,7 @@
Local Time Zone Local Time Zone
</label> </label>
<select <select
class="MakeSelect2"
name="schedulerTimeZone" name="schedulerTimeZone"
id="schedulerTimeZone" id="schedulerTimeZone"
ng-model="schedulerTimeZone" ng-model="schedulerTimeZone"
@@ -160,6 +161,7 @@
</label> </label>
<select name="schedulerFrequency" <select name="schedulerFrequency"
id="schedulerFrequency" id="schedulerFrequency"
class="MakeSelect2"
ng-model="schedulerFrequency" ng-model="schedulerFrequency"
ng-options="f.name for f in frequencyOptions" ng-options="f.name for f in frequencyOptions"
required class="form-control input-sm" required class="form-control input-sm"
@@ -254,7 +256,8 @@
ng-model="$parent.monthlyOccurrence" ng-model="$parent.monthlyOccurrence"
ng-options="o.name for o in occurrences" ng-options="o.name for o in occurrences"
ng-disabled="monthlyRepeatOption != 'other'" ng-disabled="monthlyRepeatOption != 'other'"
class="form-control input-sm class=" MakeSelect2 form-control
input-sm
RepeatFrequencyOptions-spacedSelect RepeatFrequencyOptions-spacedSelect
RepeatFrequencyOptions-monthlyOccurence" RepeatFrequencyOptions-monthlyOccurence"
> >
@@ -264,7 +267,7 @@
ng-model="$parent.monthlyWeekDay" ng-model="$parent.monthlyWeekDay"
ng-options="w.name for w in weekdays" ng-options="w.name for w in weekdays"
ng-disabled="monthlyRepeatOption != 'other'" ng-disabled="monthlyRepeatOption != 'other'"
class="form-control input-sm" > class="MakeSelect2 form-control input-sm" >
</select> </select>
</div> </div>
</div> </div>
@@ -291,7 +294,7 @@
ng-model="$parent.yearlyMonth" ng-model="$parent.yearlyMonth"
ng-options="m.name for m in months" ng-options="m.name for m in months"
ng-disabled="yearlyRepeatOption != 'month'" ng-disabled="yearlyRepeatOption != 'month'"
class="form-control input-sm class="MakeSelect2 form-control input-sm
RepeatFrequencyOptions-spacedSelect" RepeatFrequencyOptions-spacedSelect"
> >
</select> </select>
@@ -335,7 +338,8 @@
ng-model="$parent.yearlyOccurrence" ng-model="$parent.yearlyOccurrence"
ng-options="o.name for o in occurrences" ng-options="o.name for o in occurrences"
ng-disabled="yearlyRepeatOption != 'other'" ng-disabled="yearlyRepeatOption != 'other'"
class="form-control input-sm class="MakeSelect2
form-control input-sm
RepeatFrequencyOptions-spacedSelect RepeatFrequencyOptions-spacedSelect
RepeatFrequencyOptions-yearlyOccurence RepeatFrequencyOptions-yearlyOccurence
RepeatFrequencyOptions-thirdSelect" RepeatFrequencyOptions-thirdSelect"
@@ -346,7 +350,8 @@
ng-model="$parent.yearlyWeekDay" ng-model="$parent.yearlyWeekDay"
ng-options="w.name for w in weekdays" ng-options="w.name for w in weekdays"
ng-disabled="yearlyRepeatOption != 'other'" ng-disabled="yearlyRepeatOption != 'other'"
class="form-control input-sm class="MakeSelect2
form-control input-sm
RepeatFrequencyOptions-spacedSelect RepeatFrequencyOptions-spacedSelect
RepeatFrequencyOptions-thirdSelect" RepeatFrequencyOptions-thirdSelect"
> >
@@ -356,7 +361,8 @@
ng-model="$parent.yearlyOtherMonth" ng-model="$parent.yearlyOtherMonth"
ng-options="m.name for m in months" ng-options="m.name for m in months"
ng-disabled="yearlyRepeatOption != 'other'" ng-disabled="yearlyRepeatOption != 'other'"
class="form-control input-sm class="MakeSelect2
form-control input-sm
RepeatFrequencyOptions-thirdSelect"> RepeatFrequencyOptions-thirdSelect">
</select> </select>
</div> </div>
@@ -451,7 +457,8 @@
ng-model="$parent.schedulerEnd" ng-model="$parent.schedulerEnd"
ng-options="e.name for e in endOptions" ng-options="e.name for e in endOptions"
required required
class="form-control input-sm" class="MakeSelect2
form-control input-sm"
ng-change="schedulerEndChange()"> ng-change="schedulerEndChange()">
</select> </select>
</div> </div>