Switch date selects for shift tasks
This commit is contained in:
@@ -67,6 +67,7 @@
|
||||
//= require tree_navigator
|
||||
//= require custom
|
||||
//= require tag_autocomplete
|
||||
//= require polls_admin
|
||||
|
||||
var initialize_modules = function() {
|
||||
App.Comments.initialize();
|
||||
@@ -103,6 +104,7 @@ var initialize_modules = function() {
|
||||
App.Documentable.initialize();
|
||||
App.Imageable.initialize();
|
||||
App.TagAutocomplete.initialize();
|
||||
App.PollsAdmin.initialize();
|
||||
};
|
||||
|
||||
$(function(){
|
||||
|
||||
12
app/assets/javascripts/polls_admin.js.coffee
Normal file
12
app/assets/javascripts/polls_admin.js.coffee
Normal file
@@ -0,0 +1,12 @@
|
||||
App.PollsAdmin =
|
||||
|
||||
initialize: ->
|
||||
$("select[class='js-poll-shifts']").on
|
||||
change: ->
|
||||
switch ($(this).val())
|
||||
when 'vote_collection'
|
||||
$("select[class='js-shift-vote-collection-dates']").show();
|
||||
$("select[class='js-shift-recount-scrutiny-dates']").hide();
|
||||
when 'recount_scrutiny'
|
||||
$("select[class='js-shift-recount-scrutiny-dates']").show();
|
||||
$("select[class='js-shift-vote-collection-dates']").hide();
|
||||
@@ -16,20 +16,24 @@
|
||||
<label><%= t("admin.poll_shifts.new.task") %></label>
|
||||
<%= f.select :task,
|
||||
Poll::Shift.tasks.map {|k,v| [t("admin.poll_shifts.#{k}"), k]},
|
||||
prompt: t("admin.poll_shifts.new.select_task"),
|
||||
label: false %>
|
||||
{ prompt: t("admin.poll_shifts.new.select_task"),
|
||||
label: false },
|
||||
class: 'js-poll-shifts' %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-3 column">
|
||||
<label><%= t("admin.poll_shifts.new.date") %></label>
|
||||
<%= select 'shift[date]', 'vote_collection_date',
|
||||
options_for_select(shift_vote_collection_dates(@polls)),
|
||||
prompt: t("admin.poll_shifts.new.select_date"),
|
||||
label: false %>
|
||||
options_for_select(shift_vote_collection_dates(@polls)),
|
||||
{ prompt: t("admin.poll_shifts.new.select_date"),
|
||||
label: false },
|
||||
class: 'js-shift-vote-collection-dates' %>
|
||||
<%= select 'shift[date]', 'recount_scrutiny_date',
|
||||
options_for_select(shift_recount_scrutiny_dates(@polls)),
|
||||
prompt: t("admin.poll_shifts.new.select_date"),
|
||||
label: false %>
|
||||
options_for_select(shift_recount_scrutiny_dates(@polls)),
|
||||
{ prompt: t("admin.poll_shifts.new.select_date"),
|
||||
label: false },
|
||||
class: 'js-shift-recount-scrutiny-dates',
|
||||
hidden: 'hidden' %>
|
||||
</div>
|
||||
|
||||
<%= f.hidden_field :booth_id, value: @booth.id %>
|
||||
|
||||
Reference in New Issue
Block a user