Move poll shifts form partial to a component
Thanks to it, we can move a few helper methods to the component.
This commit is contained in:
20
app/assets/javascripts/admin/poll/shifts/form.js
Normal file
20
app/assets/javascripts/admin/poll/shifts/form.js
Normal file
@@ -0,0 +1,20 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
App.AdminPollShiftsForm = {
|
||||
initialize: function() {
|
||||
$("select[class='js-poll-shifts']").on({
|
||||
change: function() {
|
||||
switch ($(this).val()) {
|
||||
case "vote_collection":
|
||||
$("select[class='js-shift-vote-collection-dates']").show();
|
||||
$("select[class='js-shift-recount-scrutiny-dates']").hide();
|
||||
break;
|
||||
case "recount_scrutiny":
|
||||
$("select[class='js-shift-recount-scrutiny-dates']").show();
|
||||
$("select[class='js-shift-vote-collection-dates']").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}).call(this);
|
||||
Reference in New Issue
Block a user