Merge branch 'master' into 1954-remove_question_show_and_description
This commit is contained in:
@@ -310,6 +310,10 @@
|
|||||||
.budget-investment-new,
|
.budget-investment-new,
|
||||||
.proposal-form,
|
.proposal-form,
|
||||||
.proposal-edit,
|
.proposal-edit,
|
||||||
|
.new_poll_question,
|
||||||
|
.edit_poll_question,
|
||||||
|
.new_poll,
|
||||||
|
.edit_poll,
|
||||||
.poll-question-form {
|
.poll-question-form {
|
||||||
@include direct-uploads;
|
@include direct-uploads;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class Admin::Poll::PollsController < Admin::Poll::BaseController
|
class Admin::Poll::PollsController < Admin::Poll::BaseController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
before_action :load_search, only: [:search_booths, :search_questions, :search_officers]
|
before_action :load_search, only: [:search_booths, :search_officers]
|
||||||
before_action :load_geozones, only: [:new, :create, :edit, :update]
|
before_action :load_geozones, only: [:new, :create, :edit, :update]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@@ -47,25 +47,6 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
|||||||
redirect_to admin_poll_path(@poll), notice: notice
|
redirect_to admin_poll_path(@poll), notice: notice
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_question
|
|
||||||
question = ::Poll::Question.find(params[:question_id])
|
|
||||||
|
|
||||||
if @poll.questions.include? question
|
|
||||||
@poll.questions.delete(question)
|
|
||||||
notice = t("admin.polls.flash.question_removed")
|
|
||||||
else
|
|
||||||
notice = t("admin.polls.flash.error_on_question_removed")
|
|
||||||
end
|
|
||||||
redirect_to admin_poll_path(@poll), notice: notice
|
|
||||||
end
|
|
||||||
|
|
||||||
def search_questions
|
|
||||||
@questions = ::Poll::Question.where("poll_id IS ? OR poll_id != ?", nil, @poll.id).search(search: @search).order(title: :asc)
|
|
||||||
respond_to do |format|
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def load_geozones
|
def load_geozones
|
||||||
@@ -73,7 +54,9 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def poll_params
|
def poll_params
|
||||||
params.require(:poll).permit(:name, :starts_at, :ends_at, :geozone_restricted, geozone_ids: [])
|
params.require(:poll).permit(:name, :starts_at, :ends_at, :geozone_restricted, :summary, :description,
|
||||||
|
geozone_ids: [],
|
||||||
|
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy])
|
||||||
end
|
end
|
||||||
|
|
||||||
def search_params
|
def search_params
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ class Officing::PollsController < Officing::BaseController
|
|||||||
|
|
||||||
def final
|
def final
|
||||||
@polls = if current_user.poll_officer?
|
@polls = if current_user.poll_officer?
|
||||||
current_user.poll_officer.final_days_assigned_polls.select {|poll| poll.ends_at > 2.weeks.ago && poll.expired?}
|
current_user.poll_officer.final_days_assigned_polls.select do |poll|
|
||||||
|
poll.ends_at > 2.weeks.ago && poll.expired? || poll.ends_at.today?
|
||||||
|
end
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class Officing::ResultsController < Officing::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def load_poll
|
def load_poll
|
||||||
@poll = ::Poll.expired.includes(:questions).find(params[:poll_id])
|
@poll = ::Poll.includes(:questions).find(params[:poll_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_officer_assignment
|
def load_officer_assignment
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ module Abilities
|
|||||||
|
|
||||||
can [:index, :create, :edit, :update, :destroy], Geozone
|
can [:index, :create, :edit, :update, :destroy], Geozone
|
||||||
|
|
||||||
can [:read, :create, :update, :destroy, :add_question, :remove_question, :search_booths, :search_questions, :search_officers], Poll
|
can [:read, :create, :update, :destroy, :add_question, :search_booths, :search_officers], Poll
|
||||||
can [:read, :create, :update, :destroy, :available], Poll::Booth
|
can [:read, :create, :update, :destroy, :available], Poll::Booth
|
||||||
can [:search, :create, :index, :destroy], ::Poll::Officer
|
can [:search, :create, :index, :destroy], ::Poll::Officer
|
||||||
can [:create, :destroy], ::Poll::BoothAssignment
|
can [:create, :destroy], ::Poll::BoothAssignment
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
class Poll < ActiveRecord::Base
|
class Poll < ActiveRecord::Base
|
||||||
|
include Imageable
|
||||||
|
|
||||||
has_many :booth_assignments, class_name: "Poll::BoothAssignment"
|
has_many :booth_assignments, class_name: "Poll::BoothAssignment"
|
||||||
has_many :booths, through: :booth_assignments
|
has_many :booths, through: :booth_assignments
|
||||||
has_many :partial_results, through: :booth_assignments
|
has_many :partial_results, through: :booth_assignments
|
||||||
|
|||||||
@@ -14,15 +14,15 @@
|
|||||||
|
|
||||||
<div class="tabs-content" data-tabs-content="booths-tabs">
|
<div class="tabs-content" data-tabs-content="booths-tabs">
|
||||||
<ul class="tabs" data-tabs id="booths-tabs">
|
<ul class="tabs" data-tabs id="booths-tabs">
|
||||||
<li class="tabs-title is-active">
|
<li class="tabs-title">
|
||||||
<%= link_to t("admin.poll_booth_assignments.show.officers"), "#tab-officers" %>
|
<%= link_to t("admin.poll_booth_assignments.show.officers"), "#tab-officers" %>
|
||||||
</li>
|
</li>
|
||||||
<li class="tabs-title">
|
<li class="tabs-title is-active">
|
||||||
<%= link_to t("admin.poll_booth_assignments.show.recounts"), "#tab-recounts" %>
|
<%= link_to t("admin.poll_booth_assignments.show.recounts"), "#tab-recounts" %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tabs-panel is-active" id="tab-officers">
|
<div class="tabs-panel" id="tab-officers">
|
||||||
<% if @booth_assignment.officers.empty? %>
|
<% if @booth_assignment.officers.empty? %>
|
||||||
<div class="callout primary margin-top">
|
<div class="callout primary margin-top">
|
||||||
<%= t("admin.poll_booth_assignments.show.no_officers") %>
|
<%= t("admin.poll_booth_assignments.show.no_officers") %>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tabs-panel" id="tab-recounts">
|
<div class="tabs-panel is-active" id="tab-recounts">
|
||||||
<h3><%= t("admin.poll_booth_assignments.show.recounts_list") %></h3>
|
<h3><%= t("admin.poll_booth_assignments.show.recounts_list") %></h3>
|
||||||
|
|
||||||
<table id="totals">
|
<table id="totals">
|
||||||
|
|||||||
@@ -6,11 +6,13 @@
|
|||||||
<%= booth.location %>
|
<%= booth.location %>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<%= link_to t("admin.booths.booth.shifts"),
|
<% if controller_name == "shifts" || controller_name == "booths" && action_name == "available" %>
|
||||||
new_admin_booth_shift_path(booth),
|
<%= link_to t("admin.booths.booth.shifts"),
|
||||||
class: "button hollow" %>
|
new_admin_booth_shift_path(booth),
|
||||||
<%= link_to t("admin.actions.edit"),
|
class: "button hollow" %>
|
||||||
edit_admin_booth_path(booth),
|
<%= link_to t("admin.actions.edit"),
|
||||||
class: "button hollow" %>
|
edit_admin_booth_path(booth),
|
||||||
|
class: "button hollow" %>
|
||||||
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
<h2 class="inline-block"><%= t("admin.booths.index.title") %></h2>
|
<h2 class="inline-block"><%= t("admin.booths.index.title") %></h2>
|
||||||
|
|
||||||
<%= link_to t("admin.booths.index.add_booth"), new_admin_booth_path,
|
<% if controller_name == "booths" && action_name != "available" %>
|
||||||
class: "button success float-right" %>
|
<%= link_to t("admin.booths.index.add_booth"), new_admin_booth_path, class: "button success float-right" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if @booths.empty? %>
|
<% if @booths.empty? %>
|
||||||
<div class="callout primary">
|
<div class="callout primary">
|
||||||
|
|||||||
@@ -12,29 +12,19 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th><%= t("admin.poll_officer_assignments.index.table_name") %></th>
|
<th><%= t("admin.poll_officer_assignments.index.table_name") %></th>
|
||||||
<th><%= t("admin.poll_officer_assignments.index.table_email") %></th>
|
<th><%= t("admin.poll_officer_assignments.index.table_email") %></th>
|
||||||
<th class="text-center"><%= t("admin.polls.show.table_assignment") %></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @officers.each do |user| %>
|
<% @officers.each do |user| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<%= user.name %>
|
<strong>
|
||||||
|
<%= link_to user.name, by_officer_admin_poll_officer_assignments_path(@poll, officer_id: user.id) %>
|
||||||
|
</strong>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= user.email %>
|
<%= user.email %>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-center">
|
|
||||||
<% if @poll.officer_ids.include?(user.poll_officer.id) %>
|
|
||||||
<%= link_to t("admin.poll_officer_assignments.index.edit_officer_assignments"),
|
|
||||||
by_officer_admin_poll_officer_assignments_path(@poll, officer_id: user.poll_officer.id),
|
|
||||||
class: "button hollow alert" %>
|
|
||||||
<% else %>
|
|
||||||
<%= link_to t("admin.poll_officer_assignments.index.add_officer_assignments"),
|
|
||||||
by_officer_admin_poll_officer_assignments_path(@poll, officer_id: user.poll_officer.id),
|
|
||||||
class: "button hollow" %>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -27,30 +27,4 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><%= t("admin.poll_officer_assignments.by_officer.total_recounts") %></h3>
|
|
||||||
<table id="total_recount_list" class="fixed">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><%= t("admin.poll_officer_assignments.by_officer.date") %></th>
|
|
||||||
<th><%= t("admin.poll_officer_assignments.by_officer.booth") %></th>
|
|
||||||
<th class="text-right"><%= t("admin.poll_officer_assignments.by_officer.total_recount") %></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% @officer_assignments.each do |officer_assignment| %>
|
|
||||||
<tr id="total_recount_<%= officer_assignment.date.to_date.strftime('%Y%m%d') %>">
|
|
||||||
<td><%= l(officer_assignment.date.to_date) %></td>
|
|
||||||
<td><%= booth_name_with_location(officer_assignment.booth_assignment.booth) %></td>
|
|
||||||
<td class="text-right">
|
|
||||||
<% if officer_assignment.recounts.any? %>
|
|
||||||
<%= officer_assignment.recounts.to_a.sum(&:total_amount) %>
|
|
||||||
<% else %>
|
|
||||||
<span>-</span>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<% if officer.persisted? %>
|
<% if officer.persisted? %>
|
||||||
<%= link_to t('admin.poll_officers.officer.delete'),
|
<%= link_to t('admin.poll_officers.officer.delete'),
|
||||||
admin_poll_officer_path(officer),
|
admin_officer_path(officer),
|
||||||
method: :delete,
|
method: :delete,
|
||||||
class: "button hollow alert" %>
|
class: "button hollow alert" %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|||||||
@@ -19,6 +19,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="small-12 column">
|
||||||
|
<%=f.text_area :summary, rows: 4%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="small-12 column">
|
||||||
|
<%=f.text_area :description, rows: 8%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<%= render 'images/admin_image', imageable: @poll, f: f %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="small-6 medium-6 column">
|
<div class="small-6 medium-6 column">
|
||||||
<%= f.check_box :geozone_restricted, data: { checkbox_toggle: "#geozones" } %>
|
<%= f.check_box :geozone_restricted, data: { checkbox_toggle: "#geozones" } %>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= t('admin.polls.show.table_title') %></th>
|
<th><%= t('admin.polls.show.table_title') %></th>
|
||||||
<th class="text-right"><%= t('admin.polls.show.table_assignment') %></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<% @poll.questions.each do |question| %>
|
<% @poll.questions.each do |question| %>
|
||||||
@@ -19,12 +18,6 @@
|
|||||||
<%= link_to question.title, admin_question_path(question) %>
|
<%= link_to question.title, admin_question_path(question) %>
|
||||||
</strong>
|
</strong>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
|
||||||
<%= link_to t('admin.polls.show.remove_question'),
|
|
||||||
remove_question_admin_poll_path(poll_id: @poll.id, question_id: question.id),
|
|
||||||
class: "button hollow alert",
|
|
||||||
method: :patch %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="small-12 medium-6 column">
|
|
||||||
<%= form_tag(search_questions_admin_poll_path(@poll), method: :get, remote: true) do |f| %>
|
|
||||||
<div class="input-group">
|
|
||||||
<%= text_field_tag :search,
|
|
||||||
@search,
|
|
||||||
placeholder: t("admin.shared.poll_questions_search.placeholder"), id: "search-questions" %>
|
|
||||||
|
|
||||||
<div class="input-group-button">
|
|
||||||
<%= submit_tag t("admin.shared.poll_questions_search.button"), class: "button" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="search-questions-results"></div>
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<% if @questions.blank? %>
|
|
||||||
<div class="callout alert margin-bottom">
|
|
||||||
<%= t('admin.shared.no_search_results') %>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
|
||||||
<h3><%= t('admin.shared.search_results') %></h3>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if @questions.any? %>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><%= t("admin.polls.show.table_name") %></th>
|
|
||||||
<th class="text-center"><%= t("admin.polls.show.table_assignment") %></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% @questions.each do |question| %>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<%= question.title %>
|
|
||||||
</td>
|
|
||||||
<td class="text-center">
|
|
||||||
<%= link_to t("admin.polls.show.add_question"),
|
|
||||||
add_question_admin_poll_path(poll_id: @poll.id, question_id: question.id),
|
|
||||||
method: :patch,
|
|
||||||
class: "button hollow" %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% end %>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
$("#search-questions-results").html("<%= j render 'search_questions_results' %>");
|
|
||||||
@@ -3,6 +3,5 @@
|
|||||||
<div id="poll-resources">
|
<div id="poll-resources">
|
||||||
<%= render "subnav" %>
|
<%= render "subnav" %>
|
||||||
|
|
||||||
<%= render "search_questions" %>
|
|
||||||
<%= render "questions" %>
|
<%= render "questions" %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
45
app/views/images/_admin_image.html.erb
Normal file
45
app/views/images/_admin_image.html.erb
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<div class="images small-12 column">
|
||||||
|
<div>
|
||||||
|
<%= f.label :image, t("images.form.admin_title") %>
|
||||||
|
|
||||||
|
|
||||||
|
<%= link_to_add_association t('images.form.add_new_image'), f, :image,
|
||||||
|
force_non_association_create: true,
|
||||||
|
partial: "images/image_fields",
|
||||||
|
id: "new_image_link",
|
||||||
|
class: "button hollow",
|
||||||
|
render_options: {
|
||||||
|
locals: { imageable: imageable }
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
association_insertion_node: "#nested-image",
|
||||||
|
association_insertion_method: "append"
|
||||||
|
} %>
|
||||||
|
|
||||||
|
<div id="nested-image">
|
||||||
|
<%= f.fields_for :image do |image_builder| %>
|
||||||
|
|
||||||
|
<div id="<%= dom_id(image_builder.object) %>" class="image direct-upload nested-fields">
|
||||||
|
<%= image_builder.hidden_field :id %>
|
||||||
|
<%= image_builder.hidden_field :user_id, value: current_user.id %>
|
||||||
|
<%= image_builder.hidden_field :cached_attachment %>
|
||||||
|
|
||||||
|
<%= image_builder.text_field :title, placeholder: t("images.form.title_placeholder"), label: "#{t("images.form.admin_alt_text")}" %>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="attachment-actions">
|
||||||
|
<div class="small-12 column action-add attachment-errors image-attachment">
|
||||||
|
<%= render_image_attachment(image_builder, imageable, image_builder.object) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="small-12 column">
|
||||||
|
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -152,6 +152,8 @@ en:
|
|||||||
starts_at: "Start Date"
|
starts_at: "Start Date"
|
||||||
ends_at: "Closing Date"
|
ends_at: "Closing Date"
|
||||||
geozone_restricted: "Restricted by geozone"
|
geozone_restricted: "Restricted by geozone"
|
||||||
|
summary: "Summary"
|
||||||
|
description: "Description"
|
||||||
poll/question:
|
poll/question:
|
||||||
title: "Question"
|
title: "Question"
|
||||||
valid_answers: "Posibles answers"
|
valid_answers: "Posibles answers"
|
||||||
|
|||||||
@@ -489,15 +489,11 @@ en:
|
|||||||
no_officers: "There are no officers assigned to this poll."
|
no_officers: "There are no officers assigned to this poll."
|
||||||
table_name: "Name"
|
table_name: "Name"
|
||||||
table_email: "Email"
|
table_email: "Email"
|
||||||
add_officer_assignments: "Add shifts as officer"
|
|
||||||
edit_officer_assignments: "Edit officing shifts"
|
|
||||||
by_officer:
|
by_officer:
|
||||||
date: "Date"
|
date: "Date"
|
||||||
booth: "Booth"
|
booth: "Booth"
|
||||||
assignments: "Officing shifts in this poll"
|
assignments: "Officing shifts in this poll"
|
||||||
no_assignments: "This user has no officing shifts in this poll."
|
no_assignments: "This user has no officing shifts in this poll."
|
||||||
total_recounts: "Total recounts"
|
|
||||||
total_recount: "Total recount (by officer)"
|
|
||||||
poll_shifts:
|
poll_shifts:
|
||||||
new:
|
new:
|
||||||
add_shift: "Add shift"
|
add_shift: "Add shift"
|
||||||
@@ -570,16 +566,10 @@ en:
|
|||||||
results_tab: Results
|
results_tab: Results
|
||||||
no_questions: "There are no questions assigned to this poll."
|
no_questions: "There are no questions assigned to this poll."
|
||||||
questions_title: "List of questions"
|
questions_title: "List of questions"
|
||||||
remove_question: "Remove question from poll"
|
|
||||||
add_question: "Include question"
|
|
||||||
table_title: "Title"
|
table_title: "Title"
|
||||||
table_assignment: "Assignment"
|
|
||||||
table_name: "Name"
|
|
||||||
flash:
|
flash:
|
||||||
question_added: "Question added to this poll"
|
question_added: "Question added to this poll"
|
||||||
error_on_question_added: "Question could not be assigned to this poll"
|
error_on_question_added: "Question could not be assigned to this poll"
|
||||||
question_removed: "Question removed from this poll"
|
|
||||||
error_on_question_removed: "Question could not be removed from this poll"
|
|
||||||
questions:
|
questions:
|
||||||
index:
|
index:
|
||||||
title: "Questions"
|
title: "Questions"
|
||||||
@@ -606,7 +596,6 @@ en:
|
|||||||
description: Description
|
description: Description
|
||||||
video_url: External video
|
video_url: External video
|
||||||
documents: Documents (1)
|
documents: Documents (1)
|
||||||
preview: View on website
|
|
||||||
recounts:
|
recounts:
|
||||||
index:
|
index:
|
||||||
title: "Recounts"
|
title: "Recounts"
|
||||||
|
|||||||
@@ -494,7 +494,7 @@ en:
|
|||||||
create_question: "Create question"
|
create_question: "Create question"
|
||||||
default_valid_answers: "Yes, No"
|
default_valid_answers: "Yes, No"
|
||||||
show:
|
show:
|
||||||
answer_this_question: "Answer this question"
|
answer_this_question: "Go to voting page"
|
||||||
original_proposal: "Original proposal"
|
original_proposal: "Original proposal"
|
||||||
author: "Created by"
|
author: "Created by"
|
||||||
dates_title: "Participation dates"
|
dates_title: "Participation dates"
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ en:
|
|||||||
delete_button: Remove image
|
delete_button: Remove image
|
||||||
note: "You can upload one image of following content types: %{accepted_content_types}, up to %{max_file_size} MB."
|
note: "You can upload one image of following content types: %{accepted_content_types}, up to %{max_file_size} MB."
|
||||||
add_new_image: Add image
|
add_new_image: Add image
|
||||||
|
title_placeholder: Add a descriptive title for the image
|
||||||
|
admin_title: "Main image of the poll"
|
||||||
|
admin_alt_text: "Alternative text for the image"
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
destroy:
|
destroy:
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ es:
|
|||||||
starts_at: "Fecha de apertura"
|
starts_at: "Fecha de apertura"
|
||||||
ends_at: "Fecha de cierre"
|
ends_at: "Fecha de cierre"
|
||||||
geozone_restricted: "Restringida por zonas"
|
geozone_restricted: "Restringida por zonas"
|
||||||
|
summary: "Resumen"
|
||||||
|
description: "Descripción"
|
||||||
poll/question:
|
poll/question:
|
||||||
title: "Pregunta"
|
title: "Pregunta"
|
||||||
valid_answers: "Posibles respuestas"
|
valid_answers: "Posibles respuestas"
|
||||||
|
|||||||
@@ -489,15 +489,11 @@ es:
|
|||||||
no_officers: "No hay presidentes de mesa asignados a esta votación."
|
no_officers: "No hay presidentes de mesa asignados a esta votación."
|
||||||
table_name: "Nombre"
|
table_name: "Nombre"
|
||||||
table_email: "Email"
|
table_email: "Email"
|
||||||
add_officer_assignments: "Añadir turnos como presidente de mesa"
|
|
||||||
edit_officer_assignments: "Editar turnos"
|
|
||||||
by_officer:
|
by_officer:
|
||||||
date: "Fecha"
|
date: "Fecha"
|
||||||
booth: "Urna"
|
booth: "Urna"
|
||||||
assignments: "Turnos como presidente de mesa en esta votación"
|
assignments: "Turnos como presidente de mesa en esta votación"
|
||||||
no_assignments: "No tiene turnos como presidente de mesa en esta votación."
|
no_assignments: "No tiene turnos como presidente de mesa en esta votación."
|
||||||
total_recounts: "Recuentos totales"
|
|
||||||
total_recount: "Recuento total (presidente de mesa)"
|
|
||||||
poll_shifts:
|
poll_shifts:
|
||||||
new:
|
new:
|
||||||
add_shift: "Añadir turno"
|
add_shift: "Añadir turno"
|
||||||
@@ -570,16 +566,10 @@ es:
|
|||||||
results_tab: Resultados
|
results_tab: Resultados
|
||||||
no_questions: "No hay preguntas asignadas a esta votación."
|
no_questions: "No hay preguntas asignadas a esta votación."
|
||||||
questions_title: "Listado de preguntas asignadas"
|
questions_title: "Listado de preguntas asignadas"
|
||||||
remove_question: "Desasignar pregunta"
|
|
||||||
add_question: "Incluir pregunta"
|
|
||||||
table_title: "Título"
|
table_title: "Título"
|
||||||
table_assignment: "Asignación"
|
|
||||||
table_name: "Nombre"
|
|
||||||
flash:
|
flash:
|
||||||
question_added: "Pregunta añadida a esta votación"
|
question_added: "Pregunta añadida a esta votación"
|
||||||
error_on_question_added: "No se pudo asignar la pregunta"
|
error_on_question_added: "No se pudo asignar la pregunta"
|
||||||
question_removed: "Pregunta eliminada de esta votación"
|
|
||||||
error_on_question_removed: "No se pudo quitar la pregunta"
|
|
||||||
questions:
|
questions:
|
||||||
index:
|
index:
|
||||||
title: "Preguntas ciudadanas"
|
title: "Preguntas ciudadanas"
|
||||||
@@ -606,7 +596,6 @@ es:
|
|||||||
description: Descripción
|
description: Descripción
|
||||||
video_url: Video externo
|
video_url: Video externo
|
||||||
documents: Documentos (1)
|
documents: Documentos (1)
|
||||||
preview: Ver en la web
|
|
||||||
recounts:
|
recounts:
|
||||||
index:
|
index:
|
||||||
title: "Recuentos"
|
title: "Recuentos"
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ es:
|
|||||||
note: "Puedes subir una imagen en los formatos: %{accepted_content_types}, y de hasta %{max_file_size} MB por archivo."
|
note: "Puedes subir una imagen en los formatos: %{accepted_content_types}, y de hasta %{max_file_size} MB por archivo."
|
||||||
add_new_image: Añadir imagen
|
add_new_image: Añadir imagen
|
||||||
title_placeholder: Añade un título descriptivo para la imagen
|
title_placeholder: Añade un título descriptivo para la imagen
|
||||||
|
admin_title: "Imagen principal de la votación"
|
||||||
|
admin_alt_text: "Texto alternativo para la imagen"
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
destroy:
|
destroy:
|
||||||
|
|||||||
@@ -273,9 +273,7 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
scope module: :poll do
|
scope module: :poll do
|
||||||
resources :polls do
|
resources :polls do
|
||||||
get :search_questions, on: :member
|
|
||||||
patch :add_question, on: :member
|
patch :add_question, on: :member
|
||||||
patch :remove_question, on: :member
|
|
||||||
|
|
||||||
resources :booth_assignments, only: [:index, :show, :create, :destroy] do
|
resources :booth_assignments, only: [:index, :show, :create, :destroy] do
|
||||||
get :search_booths, on: :collection
|
get :search_booths, on: :collection
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
class AddSummaryAndDescriptionToPolls < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :polls, :summary, :text
|
||||||
|
add_column :polls, :description, :text
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -782,6 +782,8 @@ ActiveRecord::Schema.define(version: 20171003170029) do
|
|||||||
t.datetime "ends_at"
|
t.datetime "ends_at"
|
||||||
t.boolean "published", default: false
|
t.boolean "published", default: false
|
||||||
t.boolean "geozone_restricted", default: false
|
t.boolean "geozone_restricted", default: false
|
||||||
|
t.text "summary"
|
||||||
|
t.text "description"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "polls", ["starts_at", "ends_at"], name: "index_polls_on_starts_at_and_ends_at", using: :btree
|
add_index "polls", ["starts_at", "ends_at"], name: "index_polls_on_starts_at_and_ends_at", using: :btree
|
||||||
|
|||||||
@@ -87,9 +87,11 @@ feature 'Admin booths' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Edit" do
|
scenario "Edit" do
|
||||||
|
poll = create(:poll, :current)
|
||||||
booth = create(:poll_booth)
|
booth = create(:poll_booth)
|
||||||
|
assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
||||||
|
|
||||||
visit admin_booths_path
|
visit available_admin_booths_path
|
||||||
|
|
||||||
within("#booth_#{booth.id}") do
|
within("#booth_#{booth.id}") do
|
||||||
click_link "Edit"
|
click_link "Edit"
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ feature 'Admin polls' do
|
|||||||
fill_in "poll_name", with: "Upcoming poll"
|
fill_in "poll_name", with: "Upcoming poll"
|
||||||
fill_in 'poll_starts_at', with: start_date.strftime("%d/%m/%Y")
|
fill_in 'poll_starts_at', with: start_date.strftime("%d/%m/%Y")
|
||||||
fill_in 'poll_ends_at', with: end_date.strftime("%d/%m/%Y")
|
fill_in 'poll_ends_at', with: end_date.strftime("%d/%m/%Y")
|
||||||
|
fill_in 'poll_summary', with: "Upcoming poll's summary. This poll..."
|
||||||
|
fill_in 'poll_description', with: "Upcomming poll's description. This poll..."
|
||||||
click_button "Create poll"
|
click_button "Create poll"
|
||||||
|
|
||||||
expect(page).to have_content "Poll created successfully"
|
expect(page).to have_content "Poll created successfully"
|
||||||
@@ -181,54 +183,6 @@ feature 'Admin polls' do
|
|||||||
expect(page).to_not have_content "There are no questions assigned to this poll"
|
expect(page).to_not have_content "There are no questions assigned to this poll"
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Add question to poll', :js do
|
|
||||||
poll = create(:poll)
|
|
||||||
question = create(:poll_question, title: 'Should we rebuild the city?')
|
|
||||||
|
|
||||||
visit admin_poll_path(poll)
|
|
||||||
|
|
||||||
expect(page).to have_content 'Questions (0)'
|
|
||||||
expect(page).to have_content 'There are no questions assigned to this poll'
|
|
||||||
|
|
||||||
fill_in 'search-questions', with: 'rebuild'
|
|
||||||
click_button 'Search'
|
|
||||||
|
|
||||||
within('#search-questions-results') do
|
|
||||||
click_link 'Include question'
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(page).to have_content 'Question added to this poll'
|
|
||||||
|
|
||||||
visit admin_poll_path(poll)
|
|
||||||
|
|
||||||
expect(page).to have_content 'Questions (1)'
|
|
||||||
expect(page).to_not have_content 'There are no questions assigned to this poll'
|
|
||||||
expect(page).to have_content question.title
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'Remove question from poll', :js do
|
|
||||||
poll = create(:poll)
|
|
||||||
question = create(:poll_question, poll: poll)
|
|
||||||
|
|
||||||
visit admin_poll_path(poll)
|
|
||||||
|
|
||||||
expect(page).to have_content 'Questions (1)'
|
|
||||||
expect(page).to_not have_content 'There are no questions assigned to this poll'
|
|
||||||
expect(page).to have_content question.title
|
|
||||||
|
|
||||||
within("#poll_question_#{question.id}") do
|
|
||||||
click_link 'Remove question from poll'
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(page).to have_content 'Question removed from this poll'
|
|
||||||
|
|
||||||
visit admin_poll_path(poll)
|
|
||||||
|
|
||||||
expect(page).to have_content 'Questions (0)'
|
|
||||||
expect(page).to have_content 'There are no questions assigned to this poll'
|
|
||||||
expect(page).to_not have_content question.title
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -31,13 +31,14 @@ feature 'Admin shifts' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Create Vote Collection Shift and Recount & Scrutiny Shift on same date", :js do
|
scenario "Create Vote Collection Shift and Recount & Scrutiny Shift on same date", :js do
|
||||||
poll = create(:poll)
|
poll = create(:poll, :current)
|
||||||
booth = create(:poll_booth)
|
booth = create(:poll_booth)
|
||||||
|
assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
||||||
officer = create(:poll_officer)
|
officer = create(:poll_officer)
|
||||||
vote_collection_dates = (poll.starts_at.to_date..poll.ends_at.to_date).to_a.map { |date| I18n.l(date, format: :long) }
|
vote_collection_dates = (poll.starts_at.to_date..poll.ends_at.to_date).to_a.map { |date| I18n.l(date, format: :long) }
|
||||||
recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).to_a.map { |date| I18n.l(date, format: :long) }
|
recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).to_a.map { |date| I18n.l(date, format: :long) }
|
||||||
|
|
||||||
visit admin_booths_path
|
visit available_admin_booths_path
|
||||||
|
|
||||||
within("#booth_#{booth.id}") do
|
within("#booth_#{booth.id}") do
|
||||||
click_link "Manage shifts"
|
click_link "Manage shifts"
|
||||||
@@ -61,7 +62,7 @@ feature 'Admin shifts' do
|
|||||||
expect(page).to have_content(officer.name)
|
expect(page).to have_content(officer.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
visit admin_booths_path
|
visit available_admin_booths_path
|
||||||
|
|
||||||
within("#booth_#{booth.id}") do
|
within("#booth_#{booth.id}") do
|
||||||
click_link "Manage shifts"
|
click_link "Manage shifts"
|
||||||
@@ -89,11 +90,12 @@ feature 'Admin shifts' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Error on create", :js do
|
scenario "Error on create", :js do
|
||||||
poll = create(:poll)
|
poll = create(:poll, :current)
|
||||||
booth = create(:poll_booth)
|
booth = create(:poll_booth)
|
||||||
|
assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
||||||
officer = create(:poll_officer)
|
officer = create(:poll_officer)
|
||||||
|
|
||||||
visit admin_booths_path
|
visit available_admin_booths_path
|
||||||
|
|
||||||
within("#booth_#{booth.id}") do
|
within("#booth_#{booth.id}") do
|
||||||
click_link "Manage shifts"
|
click_link "Manage shifts"
|
||||||
@@ -108,13 +110,14 @@ feature 'Admin shifts' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Destroy" do
|
scenario "Destroy" do
|
||||||
poll = create(:poll)
|
poll = create(:poll, :current)
|
||||||
booth = create(:poll_booth)
|
booth = create(:poll_booth)
|
||||||
|
assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
||||||
officer = create(:poll_officer)
|
officer = create(:poll_officer)
|
||||||
|
|
||||||
shift = create(:poll_shift, officer: officer, booth: booth)
|
shift = create(:poll_shift, officer: officer, booth: booth)
|
||||||
|
|
||||||
visit admin_booths_path
|
visit available_admin_booths_path
|
||||||
|
|
||||||
within("#booth_#{booth.id}") do
|
within("#booth_#{booth.id}") do
|
||||||
click_link "Manage shifts"
|
click_link "Manage shifts"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ feature "Voter" do
|
|||||||
login_as user
|
login_as user
|
||||||
visit question_path(question)
|
visit question_path(question)
|
||||||
|
|
||||||
click_link 'Answer this question'
|
click_link 'Go to voting page'
|
||||||
click_link 'Yes'
|
click_link 'Yes'
|
||||||
|
|
||||||
expect(page).to_not have_link('Yes')
|
expect(page).to_not have_link('Yes')
|
||||||
@@ -81,7 +81,7 @@ feature "Voter" do
|
|||||||
login_as user
|
login_as user
|
||||||
visit question_path(question)
|
visit question_path(question)
|
||||||
|
|
||||||
click_link 'Answer this question'
|
click_link 'Go to voting page'
|
||||||
|
|
||||||
expect(page).to_not have_link('Yes')
|
expect(page).to_not have_link('Yes')
|
||||||
expect(page).to have_content "You have already participated in a booth for this poll."
|
expect(page).to have_content "You have already participated in a booth for this poll."
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ module CommonActions
|
|||||||
def vote_for_poll_via_web
|
def vote_for_poll_via_web
|
||||||
visit question_path(question)
|
visit question_path(question)
|
||||||
|
|
||||||
click_link 'Answer this question'
|
click_link 'Go to voting page'
|
||||||
click_link 'Yes'
|
click_link 'Yes'
|
||||||
|
|
||||||
expect(page).to_not have_link('Yes')
|
expect(page).to_not have_link('Yes')
|
||||||
|
|||||||
Reference in New Issue
Block a user