<% if proposal.draft? %>
<%= link_to t('layouts.dashboard.proposal_totals.preview_proposal'), proposal_path(proposal), class: 'button success expanded', target: '_blank' %>
diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml
index ce6469246..417b435b7 100644
--- a/config/locales/en/general.yml
+++ b/config/locales/en/general.yml
@@ -210,9 +210,10 @@ en:
show_proposal: Show proposal
preview_proposal: Preview proposal
current_goal: Current goal
- support_count:
- one: "%{count} support"
- other: "%{count} supports"
+ supports:
+ zero: No supports
+ one: 1 Support
+ other: "Supports"
footer:
accessibility: Accessibility
conditions: Terms and conditions of use
@@ -575,12 +576,12 @@ en:
title: Poster preview
poster_title: "Do not keep looking,"
poster_subtitle: "back me up! ;)"
- intro_text:
- I am participating in %{org} with my own citizen proposal and only if you also add you can I achieve the
- necessary support to make Madrid the city we all want.
+ intro_text_html:
+ "I am participating in %{org} with my own citizen proposal and only if you also add you can I achieve the
+ necessary support to make the city we all want."
proposal_code: "Code of the proposal: %{code}"
support: Support my proposal
- footer: Visit %{link} and support this proposal. We need to be many. Decide your too. Thank you!
+ footer_html: "Visit %{link} and support this proposal. We need to be many. Decide your too. Thank you!"
new:
title: Poster feature
options:
@@ -598,7 +599,7 @@ en:
sent: The email has been sent
mailer:
forward:
- subtitle: If you support me,
we will achieve it.
+ subtitle_html: "If you support me,
we will achieve it."
support_button: Support this proposal
share_in: Share in
hi: "Hello!"
diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml
index 5d9dc6bb4..f7d21ee9b 100644
--- a/config/locales/es/general.yml
+++ b/config/locales/es/general.yml
@@ -210,9 +210,10 @@ es:
show_proposal: Ver propuesta
preview_proposal: Previsualizar propuesta
current_goal: Meta actual
- support_count:
- one: "%{count} Apoyo"
- other: "%{count} Apoyos"
+ supports:
+ zero: Sin apoyos
+ one: 1 Apoyo
+ other: "Apoyos"
footer:
accessibility: Accesibilidad
conditions: Condiciones de uso
@@ -575,12 +576,12 @@ es:
title: Previsualización del poster
poster_title: "No te quedes mirando,"
poster_subtitle: "¡apóyame! ;)"
- intro_text:
- Estoy participando en %{org} con mi propia propuesta ciudadana y sólo si tú también te sumas podré lograr el
- apoyo necesario para hacer de madrid la ciudad que todos queremos.
+ intro_text_html:
+ "Estoy participando en %{org} con mi propia propuesta ciudadana y sólo si tú también te sumas podré lograr el
+ apoyo necesario para hacer la ciudad que todos queremos."
proposal_code: "Código de la propuesta: %{code}"
support: Apoya mi propuesta
- footer: Entra en %{link} y apoya esta propuesta. Necesitamos ser muchos. Decide tu también. ¡Gracias!
+ footer_html: "Entra en %{link} y apoya esta propuesta. Necesitamos ser muchos. Decide tu también. ¡Gracias!"
new:
title: Funcionalidad de póster
options:
@@ -598,7 +599,7 @@ es:
sent: El e-mail ha sido enviado
mailer:
forward:
- subtitle: Si me apoyas,
lo conseguiremos.
+ subtitle_html: "Si me apoyas,
lo conseguiremos."
support_button: Apoyar esta propuesta
share_in: Compartir en
hi: "¡Hola!"
diff --git a/spec/features/dashboard/dashboard_spec.rb b/spec/features/dashboard/dashboard_spec.rb
index 0d6e4eedf..5eb1a0770 100644
--- a/spec/features/dashboard/dashboard_spec.rb
+++ b/spec/features/dashboard/dashboard_spec.rb
@@ -1,4 +1,4 @@
-require 'rails_helper'
+require "rails_helper"
feature "Proposal's dashboard" do
let!(:proposal) { create(:proposal, :draft) }
@@ -8,45 +8,47 @@ feature "Proposal's dashboard" do
visit proposal_dashboard_path(proposal)
end
- scenario 'Dashboard has a link to my proposal' do
- expect(page).to have_link('My proposal')
+ scenario "Dashboard has a link to my proposal" do
+ expect(page).to have_link("My proposal")
end
- scenario 'My proposal has a link to edit the proposal' do
- expect(page).to have_link('Edit proposal')
+ scenario "My proposal has a link to edit the proposal" do
+ expect(page).to have_link("Edit proposal")
end
- scenario 'My proposal has a link to retire the proposal' do
- expect(page).to have_link('Retire proposal')
+ scenario "My proposal has a link to retire the proposal" do
+ expect(page).to have_link("Retire proposal")
end
- scenario 'My proposal has a link to publish the proposal' do
- expect(page).to have_link('Publish proposal')
+ scenario "My proposal has a link to publish the proposal" do
+ expect(page).to have_link("Publish proposal")
end
scenario "Publish link dissapears after proposal's publication" do
- click_link 'Publish proposal'
- expect(page).not_to have_link('Publish proposal')
+ click_link "Publish proposal"
+ expect(page).not_to have_link("Publish proposal")
end
- scenario 'Dashboard progress shows current goal', js: true do
- goal = create(:dashboard_action, :resource, :active, required_supports: proposal.votes_for.size + 1_000)
- future_goal = create(:dashboard_action, :resource, :active, required_supports: proposal.votes_for.size + 2_000)
+ scenario "Dashboard progress shows current goal", js: true do
+ goal = create(:dashboard_action, :resource, :active,
+ required_supports: proposal.votes_for.size + 1_000)
+ future_goal = create(:dashboard_action, :resource, :active,
+ required_supports: proposal.votes_for.size + 2_000)
visit progress_proposal_dashboard_path(proposal)
- within 'div#goals-section' do
+ within "div#goals-section" do
expect(page).to have_content(goal.title)
expect(page).not_to have_content(future_goal.title)
- find(:css, '#see_complete_course_link').click
+ find(:css, "#see_complete_course_link").click
expect(page).to have_content(goal.title)
expect(page).to have_content(future_goal.title)
end
end
- scenario 'Dashboard progress show proposed actions' do
+ scenario "Dashboard progress show proposed actions" do
action = create(:dashboard_action, :proposed_action, :active)
visit progress_proposal_dashboard_path(proposal)
@@ -110,8 +112,7 @@ feature "Proposal's dashboard" do
end
end
- scenario "Dashboard progress display contains no results text when there are not
- proposed_actions pending" do
+ scenario "Display no results text when there are not proposed_actions done" do
visit progress_proposal_dashboard_path(proposal)
expect(page).to have_content("No recommended actions done")
@@ -241,36 +242,36 @@ feature "Proposal's dashboard" do
end
end
- scenario 'Dashboard has a link to polls feature' do
- expect(page).to have_link('Polls')
+ scenario "Dashboard has a link to polls feature" do
+ expect(page).to have_link("Polls")
end
- scenario 'Dashboard has a link to e-mail feature' do
- expect(page).to have_link('E-mail')
+ scenario "Dashboard has a link to e-mail feature" do
+ expect(page).to have_link("E-mail")
end
- scenario 'Dashboard has a link to poster feature' do
- expect(page).to have_link('Poster')
+ scenario "Dashboard has a link to poster feature" do
+ expect(page).to have_link("Poster")
end
- scenario 'Dashboard has a link to resources on main menu' do
+ scenario "Dashboard has a link to resources on main menu" do
feature = create(:dashboard_action, :resource, :active)
visit proposal_dashboard_path(proposal)
expect(page).to have_link(feature.title)
end
- scenario 'Request resource with admin request', js: true do
+ scenario "Request resource with admin request", js: true do
feature = create(:dashboard_action, :resource, :active, :admin_request)
visit proposal_dashboard_path(proposal)
click_link(feature.title)
- click_button 'Request'
- expect(page).to have_content('The request for the administrator has been successfully sent.')
+ click_button "Request"
+ expect(page).to have_content("The request for the administrator has been successfully sent.")
end
- scenario 'Request already requested resource with admin request', js: true do
+ scenario "Request already requested resource with admin request", js: true do
feature = create(:dashboard_action, :resource, :active, :admin_request)
visit proposal_dashboard_path(proposal)
@@ -278,27 +279,27 @@ feature "Proposal's dashboard" do
create(:dashboard_executed_action, action: feature, proposal: proposal)
- click_button 'Request'
- expect(page).to have_content('Proposal has already been taken')
+ click_button "Request"
+ expect(page).to have_content("Proposal has already been taken")
end
- scenario 'Resource without admin request do not have a request link', js: true do
+ scenario "Resource without admin request do not have a request link", js: true do
feature = create(:dashboard_action, :resource, :active)
visit proposal_dashboard_path(proposal)
click_link(feature.title)
- expect(page).not_to have_button('Request')
+ expect(page).not_to have_button("Request")
end
- scenario 'Dashboard has a link to dashboard community', js: true do
- expect(page).to have_link('Community')
- click_link 'Community'
+ scenario "Dashboard has a link to dashboard community", js: true do
+ expect(page).to have_link("Community")
+ click_link "Community"
- expect(page).to have_content('Participants')
- expect(page).to have_content('Debates')
- expect(page).to have_content('Comments')
- expect(page).to have_link('Access the community')
+ expect(page).to have_content("Participants")
+ expect(page).to have_content("Debates")
+ expect(page).to have_content("Comments")
+ expect(page).to have_link("Access the community")
end
scenario "Dashboard has a link to recommended_actions", js: true do
@@ -321,7 +322,7 @@ feature "Proposal's dashboard" do
expect(page).to have_content(action_5.title)
end
- scenario "On recommended actions section do not display from the fourth proposed actions", js: true do
+ scenario "On recommended actions section display four proposed actions", js: true do
create_list(:dashboard_action, 4, :proposed_action, :active)
action_5 = create(:dashboard_action, :proposed_action, :active)
@@ -359,7 +360,7 @@ feature "Proposal's dashboard" do
end
end
- scenario "On recommended actions section contains no_results_text when there are
+ scenario "On recommended actions section contains no results text when there are
not proposed_actions pending" do
visit recommended_actions_proposal_dashboard_path(proposal.to_param)
diff --git a/spec/models/dashboard/action_spec.rb b/spec/models/dashboard/action_spec.rb
index 3d92cae79..77214f710 100644
--- a/spec/models/dashboard/action_spec.rb
+++ b/spec/models/dashboard/action_spec.rb
@@ -16,88 +16,88 @@ describe Dashboard::Action do
let(:day_offset) { 0 }
let(:required_supports) { 0 }
let(:request_to_administrators) { true }
- let(:action_type) { 'resource' }
+ let(:action_type) { "resource" }
- it 'is invalid when title is blank' do
- action = build(:dashboard_action, title: '')
+ it "is invalid when title is blank" do
+ action = build(:dashboard_action, title: "")
expect(action).not_to be_valid
end
- it 'is invalid when title is too short' do
- action = build(:dashboard_action, title: 'abc')
+ it "is invalid when title is too short" do
+ action = build(:dashboard_action, title: "abc")
expect(action).not_to be_valid
end
- it 'is invalid when title is too long' do
- action = build(:dashboard_action, title: 'a' * 81)
+ it "is invalid when title is too long" do
+ action = build(:dashboard_action, title: "a" * 81)
expect(action).not_to be_valid
end
- it 'is invalid when day_offset is not defined' do
+ it "is invalid when day_offset is not defined" do
action = build(:dashboard_action, day_offset: nil)
expect(action).not_to be_valid
end
- it 'is invalid when day_offset is negative' do
+ it "is invalid when day_offset is negative" do
action = build(:dashboard_action, day_offset: -1)
expect(action).not_to be_valid
end
- it 'is invalid when day_offset not an integer' do
+ it "is invalid when day_offset not an integer" do
action = build(:dashboard_action, day_offset: 1.23)
expect(action).not_to be_valid
end
- it 'is invalid when required_supports is nil' do
+ it "is invalid when required_supports is nil" do
action = build(:dashboard_action, required_supports: nil)
expect(action).not_to be_valid
end
- it 'is invalid when required_supports is negative' do
+ it "is invalid when required_supports is negative" do
action = build(:dashboard_action, required_supports: -1)
expect(action).not_to be_valid
end
- it 'is invalid when required_supports is not an integer' do
+ it "is invalid when required_supports is not an integer" do
action = build(:dashboard_action, required_supports: 1.23)
expect(action).not_to be_valid
end
- it 'is invalid when action_type is nil' do
+ it "is invalid when action_type is nil" do
action = build(:dashboard_action, action_type: nil)
expect(action).not_to be_valid
end
- context '#active_for?' do
- it 'is active when required supports is 0 and day_offset is 0' do
+ context "#active_for?" do
+ it "is active when required supports is 0 and day_offset is 0" do
action = build(:dashboard_action, required_supports: 0, day_offset: 0)
proposal = build(:proposal)
expect(action).to be_active_for(proposal)
end
- it 'is active when published after day_offset' do
+ it "is active when published after day_offset" do
action = build(:dashboard_action, required_supports: 0, day_offset: 10)
proposal = build(:proposal, published_at: Time.current - 10.days)
expect(action).to be_active_for(proposal)
end
- it 'is active when have enough supports' do
+ it "is active when have enough supports" do
action = build(:dashboard_action, required_supports: 10, day_offset: 0)
proposal = build(:proposal, cached_votes_up: 10)
expect(action).to be_active_for(proposal)
end
- it 'is not active when not enough time published' do
+ it "is not active when not enough time published" do
action = build(:dashboard_action, required_supports: 0, day_offset: 10)
proposal = build(:proposal, published_at: Time.current - 9.days)
expect(action).not_to be_active_for(proposal)
end
- it 'is not active when not enough supports' do
+ it "is not active when not enough supports" do
action = build(:dashboard_action, required_supports: 10, day_offset: 0)
proposal = build(:proposal, cached_votes_up: 9)
@@ -105,15 +105,15 @@ describe Dashboard::Action do
end
end
- context '#requested_for?' do
- it 'is not requested when no administrator task' do
+ context "#requested_for?" do
+ it "is not requested when no administrator task" do
proposal = create(:proposal)
action = create(:dashboard_action, :active, :admin_request, :resource)
expect(action).not_to be_requested_for(proposal)
end
- it 'is requested when administrator task' do
+ it "is requested when administrator task" do
proposal = create(:proposal)
action = create(:dashboard_action, :active, :admin_request, :resource)
executed_action = create(:dashboard_executed_action, proposal: proposal, action: action)
@@ -123,15 +123,15 @@ describe Dashboard::Action do
end
end
- context '#executed_for?' do
- it 'is not executed when no administrator task' do
+ context "#executed_for?" do
+ it "is not executed when no administrator task" do
proposal = create(:proposal)
action = create(:dashboard_action, :active, :admin_request, :resource)
expect(action).not_to be_executed_for(proposal)
end
- it 'is not executed when pending administrator task' do
+ it "is not executed when pending administrator task" do
proposal = create(:proposal)
action = create(:dashboard_action, :active, :admin_request, :resource)
executed_action = create(:dashboard_executed_action, proposal: proposal, action: action)
@@ -140,7 +140,7 @@ describe Dashboard::Action do
expect(action).not_to be_executed_for(proposal)
end
- it 'is executed when done administrator task' do
+ it "is executed when done administrator task" do
proposal = create(:proposal)
action = create(:dashboard_action, :active, :admin_request, :resource)
executed_action = create(:dashboard_executed_action, proposal: proposal, action: action)
@@ -150,12 +150,14 @@ describe Dashboard::Action do
end
end
- context '#active_for' do
+ context "#active_for" do
let!(:active_action) { create :dashboard_action, :active, day_offset: 0, required_supports: 0 }
- let!(:not_enough_supports_action) { create :dashboard_action, :active, day_offset: 0, required_supports: 10_000 }
+ let!(:not_enough_supports_action) { create :dashboard_action, :active, day_offset: 0,
+ required_supports: 10_000 }
let!(:inactive_action) { create :dashboard_action, :inactive }
- let!(:future_action) { create :dashboard_action, :active, day_offset: 300, required_supports: 0 }
- let!(:action_for_published_proposal) { create :dashboard_action,
+ let!(:future_action) { create :dashboard_action, :active, day_offset: 300,
+ required_supports: 0 }
+ let!(:action_published_proposal) { create :dashboard_action,
:active,
day_offset: 0,
required_supports: 0,
@@ -185,11 +187,11 @@ describe Dashboard::Action do
end
it "actions with published_proposal: true, are not included on draft proposal" do
- expect(described_class.active_for(draft_proposal)).not_to include(action_for_published_proposal)
+ expect(described_class.active_for(draft_proposal)).not_to include(action_published_proposal)
end
it "actions with published_proposal: true, are included on published proposal" do
- expect(described_class.active_for(proposal)).to include(action_for_published_proposal)
+ expect(described_class.active_for(proposal)).to include(action_published_proposal)
end
it "actions with published_proposal: false, are included on draft proposal" do
@@ -201,9 +203,10 @@ describe Dashboard::Action do
end
end
- context '#course_for' do
+ context "#course_for" do
let!(:proposed_action) { create :dashboard_action, :active, required_supports: 0 }
- let!(:inactive_resource) { create :dashboard_action, :inactive, :resource, required_supports: 0 }
+ let!(:inactive_resource) { create :dashboard_action, :inactive, :resource,
+ required_supports: 0 }
let!(:resource) { create :dashboard_action, :active, :resource, required_supports: 10_000 }
let!(:achieved_resource) { create :dashboard_action, :active, :resource, required_supports: 0 }
let(:proposal) { create :proposal }