Merge branch 'master' into polls-persist-officer-data

This commit is contained in:
BertoCQ
2017-09-11 00:11:36 +02:00
committed by GitHub
45 changed files with 421 additions and 128 deletions

View File

@@ -15,8 +15,7 @@
<thead>
<th><%= t("admin.booths.index.name") %></th>
<th><%= t("admin.booths.index.location") %></th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th class="text-right"><%= t("admin.actions.actions") %></th>
</thead>
<tbody>
<% @booths.each do |booth| %>

View File

@@ -15,7 +15,6 @@
<thead>
<th><%= t("admin.poll_officer_assignments.index.table_name") %></th>
<th><%= t("admin.poll_officer_assignments.index.table_email") %></th>
<th class="text-right"><%= t("admin.actions.actions") %></th>
</thead>
<tbody>
<% @officers.each do |officer| %>
@@ -28,11 +27,6 @@
<td>
<%= officer.email %>
</td>
<td class="text-right">
<%= link_to t("admin.poll_officer_assignments.index.edit_officer_assignments"),
by_officer_admin_poll_officer_assignments_path(@poll, officer_id: officer.id),
class: "button hollow" %>
</td>
</tr>
<% end %>
</tbody>
@@ -40,4 +34,4 @@
<%= paginate @officers %>
<% end %>
</div>
</div>

View File

@@ -26,6 +26,17 @@
ckeditor: { language: I18n.locale } %>
</div>
<div class="documents small-12" data-max-documents="<%= Poll::Question.max_documents_allowed %>">
<%= render 'documents/nested_documents', documentable: @question %>
</div>
<div class="small-12">
<%= f.label :video_url, t("proposals.form.proposal_video_url") %>
<p class="help-text" id="video-url-help-text"><%= t("proposals.form.proposal_video_url_note") %></p>
<%= f.text_field :video_url, placeholder: t("proposals.form.proposal_video_url"), label: false,
aria: {describedby: "video-url-help-text"} %>
</div>
<div class="row">
<div class="actions small-12 medium-4 column margin-top">
<%= f.submit(class: "button expanded", value: t("shared.save")) %>

View File

@@ -40,6 +40,21 @@
<%= @question.description %>
</p>
<% if @question.video_url.present? %>
<p>
<strong><%= t("admin.questions.show.video_url") %></strong>
<br>
<a href="<%= @question.video_url %>"><%= @question.video_url %></a>
</p>
<% end %>
<% if @question.documents.any? %>
<p>
<strong><%= t("admin.questions.show.documents") %></strong>
<br>
<a href="<%= @question.documents.first.attachment.url %>"><%= @question.documents.first.title %></a>
</p>
<% end %>
<%= link_to t("admin.questions.show.preview"), question_path(@question) %>
</div>

View File

@@ -0,0 +1,30 @@
<%= form_for @shift, as: :shift, url: admin_booth_shifts_path do |f| %>
<%= render "shared/errors", resource: @shift %>
<fieldset class="fieldset">
<legend>
<%= t("admin.poll_shifts.new.new_shift") %>
</legend>
<div class="small-12 medium-4 column highlight padding">
<strong><%= t("admin.poll_shifts.new.officer") %></strong>
<br><%= @officer.name %>
<%= f.hidden_field :officer_id, value: @officer.id %>
</div>
<div class="small-12 medium-4 column">
<label><%= t("admin.poll_shifts.new.date") %></label>
<%= f.select :date,
shift_dates_select_options(@polls),
prompt: t("admin.poll_shifts.new.select_date"),
label: false %>
</div>
<%= f.hidden_field :booth_id, value: @booth.id %>
<div class="small-12 medium-4 column">
<%= f.submit t("admin.poll_shifts.new.add_shift"),
class: "button expanded margin-top" %>
</div>
</fieldset>
<% end %>

View File

@@ -0,0 +1,19 @@
<div class="row">
<div class="small-12 medium-6 column">
<%= form_tag search_officers_admin_booth_shifts_path,
method: :get, remote: true do |f| %>
<div class="input-group">
<%= text_field_tag :search,
@search,
placeholder: t("admin.poll_shifts.new.search_officer_placeholder"),
id: "search-officers" %>
<div class="input-group-button">
<%= submit_tag t("admin.poll_shifts.new.search_officer_button"),
class: "button" %>
</div>
</div>
<% end %>
</div>
</div>
<div id="search-officers-results"></div>

View File

@@ -0,0 +1,36 @@
<% if @officers.blank? %>
<div class="callout alert margin-bottom">
<%= t('admin.shared.no_search_results') %>
</div>
<% else %>
<h3><%= t('admin.shared.search_results') %></h3>
<table>
<thead>
<tr>
<th><%= t("admin.poll_shifts.new.table_name") %></th>
<th><%= t("admin.poll_shifts.new.table_email") %></th>
<th class="text-right">
<%= t("admin.poll_shifts.new.table_shift") %>
</th>
</tr>
</thead>
<tbody>
<% @officers.each do |user| %>
<tr>
<td>
<%= user.name %>
</td>
<td>
<%= user.email %>
</td>
<td class="text-right">
<%= link_to t("admin.poll_shifts.new.edit_shifts"),
new_admin_booth_shift_path(officer_id: user.poll_officer.id),
class: "button hollow" %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>

View File

@@ -1,10 +1,10 @@
<h3><%= t("admin.poll_shifts.new.assignments") %></h3>
<h3><%= t("admin.poll_shifts.new.shifts") %></h3>
<table class="fixed">
<thead>
<tr>
<th><%= t("admin.poll_shifts.new.date") %></th>
<th><%= t("admin.poll_shifts.new.officer") %></th>
<th class="text-right"><%= t("admin.poll_shifts.new.assignment") %></th>
<th class="text-right"><%= t("admin.poll_shifts.new.shift") %></th>
</tr>
</thead>
<tbody>
@@ -13,7 +13,7 @@
<td><%= l(shift.date.to_date, format: :long) %></td>
<td><%= shift.officer_name %></td>
<td class="text-right">
<%= link_to t("admin.poll_shifts.new.remove_assignment"),
<%= link_to t("admin.poll_shifts.new.remove_shift"),
admin_booth_shift_path(@booth, shift),
method: :delete,
class: "button hollow alert" %>

View File

@@ -2,45 +2,21 @@
<h2><%= @booth.name %></h2>
<%= form_for @shift, as: :shift, url: admin_booth_shifts_path do |f| %>
<%= render "shared/errors", resource: @shift %>
<fieldset class="fieldset">
<legend>
<%= t("admin.poll_shifts.new.new_assignment") %>
</legend>
<div class="small-12 medium-4 column">
<label><%= t("admin.poll_shifts.new.date") %></label>
<%= f.select :date,
shift_dates_select_options(@polls),
prompt: t("admin.poll_shifts.new.select_date"),
label: false %>
</div>
<div class="small-12 medium-4 column">
<label><%= t("admin.poll_shifts.new.officer") %></label>
<%= f.select :officer_id,
officer_select_options(@officers),
prompt: t("admin.poll_shifts.new.select_officer"),
label: false %>
</div>
<%= f.hidden_field :booth_id, value: @booth.id %>
<div class="small-12 medium-4 column">
<%= f.submit t("admin.poll_shifts.new.add_assignment"),
class: "button expanded hollow margin-top" %>
</div>
</fieldset>
<% if @officer.blank? %>
<p>
<%= t("admin.poll_shifts.new.search_officer_text") %>
</p>
<%= render "search_officers" %>
<% else %>
<%= render "form" %>
<% end %>
<div id="shifts">
<% if @shifts.empty? %>
<div class="callout primary margin-top">
<%= t("admin.poll_shifts.new.no_assignments") %>
<div class="callout primary">
<%= t("admin.poll_shifts.new.no_shifts") %>
</div>
<% else %>
<%= render "shifts" %>
<% end %>
</div>
</div>

View File

@@ -0,0 +1 @@
$("#search-officers-results").html("<%= j render 'search_officers_results' %>");