Skip to content

Commit

Permalink
change texts
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed Jul 9, 2024
1 parent d0ce3fa commit 57911de
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 73 deletions.
4 changes: 2 additions & 2 deletions app/controllers/decidim/vocdoni/admin/questions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def create
@form = form(QuestionForm).from_params(params, election:)

CreateQuestion.call(@form) do
on(:ok) do
on(:ok) do |question|
flash[:notice] = I18n.t("questions.create.success", scope: "decidim.vocdoni.admin")
redirect_to election_questions_path(election)
redirect_to election_question_answers_path(election, question)
end

on(:invalid) do
Expand Down
75 changes: 39 additions & 36 deletions app/views/decidim/vocdoni/admin/answers/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,51 @@
<h2 class="item_show__header-title">
<%= t(".title") %>
<%= question_with_link(question, election) %>
<%= link_to t("actions.new", scope: "decidim.vocdoni", name: t("models.answer.name", scope: "decidim.vocdoni.admin")), new_election_question_answer_path(election, question), class: "button button__sm button__secondary" if allowed_to? :create, :answer, election: election, question: question %>
<div>
<%= link_to t("actions.new", scope: "decidim.vocdoni", name: t("models.answer.name", scope: "decidim.vocdoni.admin")), new_election_question_answer_path(election, question), class: "button button__sm button__secondary" if allowed_to? :create, :answer, election: election, question: question %>
<%= link_to t(".back"), election_questions_path(election), class: "button button__sm button__transparent-secondary" %>
</div>
</h2>
</div>

<div class="card-section">
<div class="table-scroll">
<table class="table-list">
<thead>
<tr>
<th class="text-left"><%= t("models.answer.fields.title", scope: "decidim.vocdoni") %></th>
<th class="actions text-right"><%= t("actions.title", scope: "decidim.vocdoni") %></th>
</tr>
</thead>
<tbody>
<% answers.each do |answer| %>
<tr data-id="<%= question.id %>">
<td>
<%= translated_attribute(answer.title) %>
</td>
<td class="table-list__actions text-right">
<% if allowed_to? :update, :answer, election: election, question: question, answer: answer %>
<%= icon_link_to "pencil-line", edit_election_question_answer_path(election, question, answer), t("actions.edit", scope: "decidim.vocdoni"), class: "action-icon--edit" %>
<% else %>
<%= icon "pencil-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.edit", scope: "decidim.vocdoni") %>
<% end %>
<div class="table-scroll">
<table class="table-list">
<thead>
<tr>
<th class="text-left"><%= t("models.answer.fields.title", scope: "decidim.vocdoni") %></th>
<th class="actions text-right"><%= t("actions.title", scope: "decidim.vocdoni") %></th>
</tr>
</thead>
<tbody>
<% answers.each do |answer| %>
<tr data-id="<%= question.id %>">
<td>
<%= translated_attribute(answer.title) %>
</td>
<td class="table-list__actions text-right">
<% if allowed_to? :update, :answer, election: election, question: question, answer: answer %>
<%= icon_link_to "pencil-line", edit_election_question_answer_path(election, question, answer), t("actions.edit", scope: "decidim.vocdoni"), class: "action-icon--edit" %>
<% else %>
<%= icon "pencil-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.edit", scope: "decidim.vocdoni") %>
<% end %>

<% if allowed_to? :delete, :answer, election: election, question: question, answer: answer %>
<%= icon_link_to "close-circle-line", election_question_answer_path(election, question, answer), t("actions.destroy", scope: "decidim.vocdoni"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.vocdoni") } %>
<% else %>
<%= icon "close-circle-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.destroy", scope: "decidim.vocdoni") %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% if allowed_to? :delete, :answer, election: election, question: question, answer: answer %>
<%= icon_link_to "close-circle-line", election_question_answer_path(election, question, answer), t("actions.destroy", scope: "decidim.vocdoni"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.vocdoni") } %>
<% else %>
<%= icon "close-circle-line", class: "action-icon action-icon--disabled", role: "img", aria_label: t("actions.destroy", scope: "decidim.vocdoni") %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>

<div class="flex">
<%= link_to t(".back"), election_questions_path(election), class: "button button__sm button__secondary" %>
<%= render "decidim/vocdoni/admin/shared/minimum_answers_callout" %>
</div>

<% if allowed_to?(:index, :census, election: election) && election.ready_for_census_form? %>
<%= render "decidim/vocdoni/admin/shared/next_wizard_step", path: election_census_path(election) %>
<% end %>

<%= append_javascript_pack_tag "decidim_vocdoni_admin" %>
12 changes: 3 additions & 9 deletions app/views/decidim/vocdoni/admin/census/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,9 @@
<!--closing tag moved to the form-->
</div>
<% else %>
<div class="flex">
<% if allowed_to?(:edit, :election_calendar, election: election) && election.ready_for_calendar_form? %>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= link_to t("next_button", scope: "decidim.vocdoni.admin.elections.new"), edit_election_calendar_path(election), class: "button button__sm button__secondary" %>
</div>
</div>
<% end %>
</div>
<% if allowed_to?(:edit, :election_calendar, election: election) && election.ready_for_calendar_form? %>
<%= render "decidim/vocdoni/admin/shared/next_wizard_step", path: edit_election_calendar_path(election) %>
<% end %>
<% end %>
<% unless status.name == "ready" ||
(election.internal_census? && election.verification_types.empty?) ||
Expand Down
7 changes: 6 additions & 1 deletion app/views/decidim/vocdoni/admin/elections/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
<h2 class="item_show__header-title">
<%= t(".title") %>

<%= link_to t("actions.new", scope: "decidim.vocdoni", name: t("models.election.name", scope: "decidim.vocdoni.admin")), new_election_path, class: "button button__sm button__secondary" if allowed_to? :create, :election %>
<% if allowed_to? :create, :election %>
<%= link_to new_election_path, class: "button button__sm button__secondary" do %>
<%= icon "add-line", role: "img", "aria-hidden": true %>
<%= t("actions.new", scope: "decidim.vocdoni", name: t("models.election.name", scope: "decidim.vocdoni.admin")) %>
<% end %>
<% end %>
</h2>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
<div class="item__edit-sticky-container">
<% if election.published? %>
<% if allowed_to?(:unpublish, :election, election: election) %>
<%= link_to t("actions.unpublish", scope: "decidim.vocdoni"), url_for(action: :unpublish, id: election, controller: "elections"), class: "button button__sm button__secondary muted", method: :put %>
<%= link_to t("actions.unpublish", scope: "decidim.vocdoni"), url_for(action: :unpublish, id: election, controller: "elections"), class: "button button__sm button__secondary", method: :put %>
<% else %>
<%= link_to t("actions.unpublish", scope: "decidim.vocdoni"), "#", class: "button button__sm button__secondary muted disabled" %>
<%= link_to t("actions.unpublish", scope: "decidim.vocdoni"), "#", class: "button button__sm button__secondary disabled" %>
<% end %>
<% else %>
<% if allowed_to?(:publish, :election, election: election) %>
<%= link_to t("actions.publish", scope: "decidim.vocdoni"), url_for(action: :publish, id: election, controller: "elections"), class: "button button__sm button__secondary hollow", method: :put %>
<%= link_to t("actions.publish", scope: "decidim.vocdoni"), url_for(action: :publish, id: election, controller: "elections"), class: "button button__sm button__secondary", method: :put %>
<% else %>
<%= link_to t("actions.publish", scope: "decidim.vocdoni"), "#", class: "button button__sm button__secondary disabled" %>
<% end %>
Expand Down
19 changes: 7 additions & 12 deletions app/views/decidim/vocdoni/admin/questions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,12 @@
</tbody>
</table>
</div>
<% unless election.minimum_answers? %>
<div class="callout alert">
<%= t("minimum_answers_warning", scope: "decidim.vocdoni.admin.questions.index").html_safe %>
</div>
<% end %>
</div>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<% if allowed_to?(:index, :census, election: election) && election.ready_for_census_form? %>
<%= link_to t("next_button", scope: "decidim.vocdoni.admin.elections.new"), election_census_path(election), class: "button button__sm button__secondary" %>
<% end %>
</div>

<%= render "decidim/vocdoni/admin/shared/minimum_answers_callout" %>
</div>

<% if allowed_to?(:index, :census, election: election) && election.ready_for_census_form? %>
<%= render "decidim/vocdoni/admin/shared/next_wizard_step", path: election_census_path(election) %>
<% end %>

<%= append_javascript_pack_tag "decidim_vocdoni_admin" %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% unless election.minimum_answers? %>
<div class="callout alert mt-4">
<%= t("minimum_answers_warning", scope: "decidim.vocdoni.admin.questions.index").html_safe %>
</div>
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= link_to path, class: "button button__sm button__secondary" do %>
<%= icon "check-double-line", role: "img", "aria-hidden": true %>
<%= t("next_button", scope: "decidim.vocdoni.admin.elections.new") %>
<% end %>
</div>
</div>
1 change: 1 addition & 0 deletions app/views/decidim/vocdoni/admin/steps/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<% if @form.main_button? %>
<div class="flex justify-center mt-8 form-general-submit<%= " hide" if election.misconfigured? %>">
<%= f.button type: :submit, class: "button button__lg button__secondary", disabled: @form.invalid? do %>
<%= icon "broadcast-line", role: "img", "aria-hidden": true %>
<%= t("steps.#{current_step}.submit", scope: "decidim.vocdoni.admin") %>
<% end %>
</div>
Expand Down
10 changes: 4 additions & 6 deletions app/views/decidim/vocdoni/elections/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ edit_link(
<%= render partial: "decidim/shared/component_announcement" %>

<%= cell "decidim/vocdoni/remaining_time_callout", election %>
<% unless election.manual_start? %>
<%= cell("decidim/announcement", t("voting_period_status.#{election.voting_period_status}",
scope: "decidim.vocdoni.elections.show",
start_time: "<strong>#{l election.start_time, format: :long}</strong>",
end_time: "<strong>#{l election.end_time, format: :long}</strong>").html_safe) %>
<% end %>
<%= cell("decidim/announcement", t("#{election.manual_start? ? "manual_start_status" : "voting_period_status"}.#{election.voting_period_status}",
scope: "decidim.vocdoni.elections.show",
start_time: "<strong>#{l election.start_time, format: :long}</strong>",
end_time: "<strong>#{l election.end_time, format: :long}</strong>").html_safe) %>

<h1 class="h2 decorator"><%== present(election).title %></h1>
</section>
Expand Down
16 changes: 12 additions & 4 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ en:
ended:
title: Ended
index:
title: Steps dashboard
title: Voting control dashboard
invalid_status: The election was out of sync with the Vocdoni API. The status
has been updated to "%{status}". Please refresh the page.
paused:
Expand Down Expand Up @@ -478,6 +478,13 @@ en:
back: Available elections
canceled: This election was canceled
description: Real-time voting results
manual_start_status:
canceled: The election was canceled. It was meant to end on %{end_time}
finished: Voting began on %{start_time} and ended on %{end_time}
ongoing: 'Voting began on %{start_time}. Active voting until: %{end_time}'
paused: Voting began on %{start_time}. Voting is currently paused. It
ends on %{end_time}
upcoming: Voting will start soon and will end on %{end_time}
paused: This election is curently paused. Try again later.
preview: Preview
verify:
Expand All @@ -489,9 +496,10 @@ en:
canceled: Voting was canceled. It was ment to begin on %{start_time} and
end on %{end_time}
finished: Voting began on %{start_time} and ended on %{end_time}
ongoing: 'Active voting until: %{end_time}'
paused: Voting is paused. It ends on %{end_time}
upcoming: Voting begins on %{start_time}
ongoing: 'Voting began on %{start_time}. Active voting until: %{end_time}'
paused: Voting began on %{start_time}. Voting is currently paused. It
ends on %{end_time}
upcoming: Voting begins on %{start_time} and ends on %{end_time}
models:
answer:
fields:
Expand Down

0 comments on commit 57911de

Please sign in to comment.