From bf7112f090ebae8facd6bf9574e577423ed8e543 Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Wed, 26 Dec 2018 12:58:43 +0100 Subject: [PATCH 01/27] make parameter 'skip_map' accessible on creating an investment --- .../budgets/investments_controller.rb | 3 +- .../management/budget_investments_spec.rb | 9 ++++ spec/shared/features/mappable.rb | 53 +++++++++++++------ 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/app/controllers/management/budgets/investments_controller.rb b/app/controllers/management/budgets/investments_controller.rb index d4ecac8d40e..da22677b611 100644 --- a/app/controllers/management/budgets/investments_controller.rb +++ b/app/controllers/management/budgets/investments_controller.rb @@ -52,7 +52,8 @@ def load_investment_votes(investments) end def investment_params - params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id, :tag_list, :organization_name, :location) + params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id, + :tag_list, :organization_name, :location, :skip_map) end def only_verified_users diff --git a/spec/features/management/budget_investments_spec.rb b/spec/features/management/budget_investments_spec.rb index 9f0ca79382d..10b80ff1dcd 100644 --- a/spec/features/management/budget_investments_spec.rb +++ b/spec/features/management/budget_investments_spec.rb @@ -9,6 +9,15 @@ @heading = create(:budget_heading, group: @group, name: "Health") end + it_behaves_like "mappable", + "budget_investment", + "investment", + "new_management_budget_investment_path", + "", + "management_budget_investment_path", + { "budget_id": "budget_id" }, + management = true + context "Create" do before { @budget.update(phase: 'accepting') } diff --git a/spec/shared/features/mappable.rb b/spec/shared/features/mappable.rb index 4f01ac5bb73..1ae371e8da3 100644 --- a/spec/shared/features/mappable.rb +++ b/spec/shared/features/mappable.rb @@ -1,4 +1,10 @@ -shared_examples "mappable" do |mappable_factory_name, mappable_association_name, mappable_new_path, mappable_edit_path, mappable_show_path, mappable_path_arguments| +shared_examples "mappable" do |mappable_factory_name, + mappable_association_name, + mappable_new_path, + mappable_edit_path, + mappable_show_path, + mappable_path_arguments, + management = false| include ActionView::Helpers @@ -6,6 +12,7 @@ let!(:arguments) { {} } let!(:mappable) { create(mappable_factory_name.to_s.to_sym) } let!(:map_location) { create(:map_location, "#{mappable_factory_name}_map_location".to_sym, "#{mappable_association_name}": mappable) } + let(:management) { management } before do Setting['feature.map'] = true @@ -16,7 +23,7 @@ before { set_arguments(arguments, mappable, mappable_path_arguments) } scenario "Should not show marker by default on create #{mappable_factory_name}", :js do - login_as user + do_login_for user visit send(mappable_new_path, arguments) send("fill_in_#{mappable_factory_name}_form") @@ -27,7 +34,7 @@ end scenario "Should show marker on create #{mappable_factory_name} when click on map", :js do - login_as user + do_login_for user visit send(mappable_new_path, arguments) send("fill_in_#{mappable_factory_name}_form") @@ -39,7 +46,7 @@ end scenario "Should create #{mappable_factory_name} with map", :js do - login_as user + do_login_for user visit send(mappable_new_path, arguments) send("fill_in_#{mappable_factory_name}_form") @@ -50,7 +57,7 @@ end scenario "Can not display map on #{mappable_factory_name} when not fill marker on map", :js do - login_as user + do_login_for user visit send(mappable_new_path, arguments) send("fill_in_#{mappable_factory_name}_form") @@ -63,7 +70,7 @@ scenario "Can not display map on #{mappable_factory_name} when feature.map is disabled", :js do Setting['feature.map'] = false - login_as user + do_login_for user visit send(mappable_new_path, arguments) send("fill_in_#{mappable_factory_name}_form") @@ -74,7 +81,7 @@ end scenario 'Errors on create' do - login_as user + do_login_for user visit send(mappable_new_path, arguments) send("submit_#{mappable_factory_name}_form") @@ -83,7 +90,7 @@ end scenario 'Skip map', :js do - login_as user + do_login_for user visit send(mappable_new_path, arguments) send("fill_in_#{mappable_factory_name}_form") @@ -94,7 +101,7 @@ end scenario 'Toggle map', :js do - login_as user + do_login_for user visit send(mappable_new_path, arguments) check "#{mappable_factory_name}_skip_map" @@ -115,7 +122,7 @@ before { skip } if mappable_edit_path.blank? scenario "Should edit map on #{mappable_factory_name} and contain default values", :js do - login_as mappable.author + do_login_for mappable.author visit send(mappable_edit_path, id: mappable.id) @@ -124,7 +131,7 @@ end scenario "Should edit default values from map on #{mappable_factory_name} edit page", :js do - login_as mappable.author + do_login_for mappable.author visit send(mappable_edit_path, id: mappable.id) find(".map_location").click @@ -137,7 +144,7 @@ end scenario "Should edit mappable on #{mappable_factory_name} without change map", :js do - login_as mappable.author + do_login_for mappable.author visit send(mappable_edit_path, id: mappable.id) fill_in "#{mappable_factory_name}_title", with: "New title" @@ -150,7 +157,7 @@ end scenario "Can not display map on #{mappable_factory_name} edit when remove map marker", :js do - login_as mappable.author + do_login_for mappable.author visit send(mappable_edit_path, id: mappable.id) click_link "Remove map marker" @@ -162,7 +169,7 @@ scenario "Can not display map on #{mappable_factory_name} edit when feature.map is disabled", :js do Setting['feature.map'] = false - login_as mappable.author + do_login_for mappable.author visit send(mappable_edit_path, id: mappable.id) fill_in "#{mappable_factory_name}_title", with: "New title" @@ -173,7 +180,7 @@ scenario 'No errors on update', :js do skip "" - login_as mappable.author + do_login_for mappable.author visit send(mappable_edit_path, id: mappable.id) click_link "Remove map marker" @@ -183,7 +190,7 @@ end scenario 'No need to skip map on update' do - login_as mappable.author + do_login_for mappable.author visit send(mappable_edit_path, id: mappable.id) click_link "Remove map marker" @@ -196,7 +203,10 @@ describe "At #{mappable_show_path}" do - before { set_arguments(arguments, mappable, mappable_path_arguments) } + before do + set_arguments(arguments, mappable, mappable_path_arguments) + do_login_for(user) if management + end scenario "Should display map on #{mappable_factory_name} show page", :js do arguments[:id] = mappable.id @@ -229,6 +239,15 @@ end +def do_login_for(user) + if management + login_as_manager + login_managed_user(user) + else + login_as(user) + end +end + def fill_in_proposal_form fill_in 'proposal_title', with: 'Help refugees' fill_in 'proposal_question', with: '¿Would you like to give assistance to war refugees?' From 82a2dd622badb43791c55f030925abd013ecc1f0 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 8 Mar 2017 22:34:34 +0100 Subject: [PATCH 02/27] hotfix to load categories on error --- app/controllers/management/budgets/investments_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/management/budgets/investments_controller.rb b/app/controllers/management/budgets/investments_controller.rb index da22677b611..2e879b6e16f 100644 --- a/app/controllers/management/budgets/investments_controller.rb +++ b/app/controllers/management/budgets/investments_controller.rb @@ -23,6 +23,7 @@ def create notice = t('flash.actions.create.notice', resource_name: Budget::Investment.model_name.human, count: 1) redirect_to management_budget_investment_path(@budget, @investment), notice: notice else + load_categories render :new end end From d3671491e885384b8337042769fb70d1959c1ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 28 Dec 2018 12:50:45 +0100 Subject: [PATCH 03/27] Enable indentation width cop This cop is necessary so the `Layout/IndentationConsistency` cop works properly when its `EnforcedStyle` is set to `Rails`, and so incorrect indentation for `private` methods is properly detected. --- .rubocop_basic.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index 7d7074e9f09..7711c48b63e 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -18,6 +18,9 @@ AllCops: Layout/IndentationConsistency: EnforcedStyle: rails +Layout/IndentationWidth: + Enabled: true + Layout/EndOfLine: EnforcedStyle: lf From a982f97cbdf47610d8c3b31cc17298934d0ff17c Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 27 Dec 2018 13:02:44 +0100 Subject: [PATCH 04/27] Adds documents list on legislation process proposals phase --- app/views/legislation/processes/proposals.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/legislation/processes/proposals.html.erb b/app/views/legislation/processes/proposals.html.erb index eb8caa153ba..53e11485c4f 100644 --- a/app/views/legislation/processes/proposals.html.erb +++ b/app/views/legislation/processes/proposals.html.erb @@ -2,6 +2,8 @@ <%= render 'legislation/processes/header', process: @process, header: :full %> +<%= render 'documents/additional_documents', documents: @process.documents %> + <%= render 'key_dates', process: @process, phase: :proposals %> <%= render 'proposals_content', process: @process, proposals: @proposals %> From a8fb479be59d4d7ea97db6be4380f0fe9c224566 Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 28 Dec 2018 13:01:34 +0100 Subject: [PATCH 05/27] Adds specs for show view has document present on all phases --- spec/features/legislation/processes_spec.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/spec/features/legislation/processes_spec.rb b/spec/features/legislation/processes_spec.rb index 4b71a0ccd36..7d286c85d40 100644 --- a/spec/features/legislation/processes_spec.rb +++ b/spec/features/legislation/processes_spec.rb @@ -134,12 +134,21 @@ context "show" do include_examples "not published permissions", :legislation_process_path - scenario '#show view has document present' do + scenario 'show view has document present on all phases' do process = create(:legislation_process) document = create(:document, documentable: process) + phases = ["Debate", "Proposals", "Draft publication", + "Comments", "Final result publication"] + visit legislation_process_path(process) - expect(page).to have_content(document.title) + phases.each do |phase| + within(".legislation-process-list") do + find('li', :text => "#{phase}").click_link + end + + expect(page).to have_content(document.title) + end end scenario 'show additional info button' do From db86f0e7ab6f18f019c7c9d6235614d3c1fd3a78 Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 27 Dec 2018 20:16:39 +0100 Subject: [PATCH 06/27] Changes styles to tabs on processes key dates --- .../stylesheets/legislation_process.scss | 112 +++++++++++------- 1 file changed, 71 insertions(+), 41 deletions(-) diff --git a/app/assets/stylesheets/legislation_process.scss b/app/assets/stylesheets/legislation_process.scss index 0bfff8b239f..c870b0e32ec 100644 --- a/app/assets/stylesheets/legislation_process.scss +++ b/app/assets/stylesheets/legislation_process.scss @@ -44,69 +44,99 @@ // 02. Legislation process navigation // ---------------------------------- -.legislation-process-categories { - position: relative; +.legislation-process-list { + border-bottom: 1px solid $border; +} - .legislation-process-list { - border-bottom: 1px solid $medium-gray; - margin: 0 rem-calc(16) rem-calc(16); +.key-dates { + list-style-type: none; + margin: 0 rem-calc(-10); - ul { - list-style: none; - margin: 0 auto; - margin-bottom: 0; - padding-left: 0; - } + @include breakpoint(medium) { + margin: 0; + } - li { - border-bottom: 2px solid transparent; - cursor: pointer; + li { + border: 1px solid $border; + display: block; + margin: rem-calc(-1) 0; + position: relative; + + @include breakpoint(medium) { + background: #fafafa; display: inline-block; - margin-bottom: $line-height; - margin-right: $line-height; - transition: all 0.4s; + border-bottom: 0; + border-top-left-radius: rem-calc(6); + border-top-right-radius: rem-calc(6); + margin-bottom: 0; + margin-right: $line-height / 4; + margin-top: 0; - @include breakpoint(medium) { - margin-bottom: 0; + &:hover:not(.is-active) { + background: $highlight; } - &:hover, - &:active, - &:focus { - border-bottom: 2px solid $brand; + &::after { + content: '' !important; } + } - a, - h4 { - display: block; - color: #6d6d6d; - margin-bottom: 0; - } + &::after { + content: '\63'; + font-family: "icons" !important; + font-size: rem-calc(24); + pointer-events: none; + position: absolute; + right: 12px; + top: 12px; } a { - &:hover, - &:active { + display: block; + padding: $line-height / 4 $line-height / 2; + + @include breakpoint(medium) { + display: inline-block; + } + + &:hover { text-decoration: none; } - p { + h4 { margin-bottom: 0; - - @include breakpoint(medium) { - margin-bottom: rem-calc(16); - } } } + } - .is-active { - border-bottom: 2px solid $brand; + span { + color: $text-medium; + font-size: $small-font-size; + } - a, - h4 { - color: $brand; + .is-active { + background: $highlight; + position: relative; + + @include breakpoint(medium) { + background: none; + border: 1px solid $border; + border-bottom: 0; + + &::after { + border-bottom: 1px solid #fefefe; + bottom: -1px; + content: '' !important; + left: 0; + position: absolute; + width: 100%; } } + + &::after { + content: '\61'; + color: $link; + } } } From 2ac3406a989855dd52b358d850073aab24034741 Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 27 Dec 2018 20:17:38 +0100 Subject: [PATCH 07/27] Updates key dates i18n --- config/locales/en/legislation.yml | 2 +- config/locales/es-AR/legislation.yml | 2 +- config/locales/es-BO/legislation.yml | 2 +- config/locales/es-CL/legislation.yml | 2 +- config/locales/es-CO/legislation.yml | 2 +- config/locales/es-CR/legislation.yml | 2 +- config/locales/es-DO/legislation.yml | 2 +- config/locales/es-EC/legislation.yml | 2 +- config/locales/es-GT/legislation.yml | 2 +- config/locales/es-HN/legislation.yml | 2 +- config/locales/es-MX/legislation.yml | 2 +- config/locales/es-NI/legislation.yml | 2 +- config/locales/es-PA/legislation.yml | 2 +- config/locales/es-PE/legislation.yml | 2 +- config/locales/es-PR/legislation.yml | 2 +- config/locales/es-PY/legislation.yml | 2 +- config/locales/es-SV/legislation.yml | 2 +- config/locales/es-UY/legislation.yml | 2 +- config/locales/es-VE/legislation.yml | 2 +- config/locales/es/legislation.yml | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/config/locales/en/legislation.yml b/config/locales/en/legislation.yml index ed142fd493c..e1c71f6c6b7 100644 --- a/config/locales/en/legislation.yml +++ b/config/locales/en/legislation.yml @@ -82,7 +82,7 @@ en: see_latest_comments: See latest comments see_latest_comments_title: Comment on this process shared: - key_dates: Key dates + key_dates: Participation phases debate_dates: Debate draft_publication_date: Draft publication allegations_dates: Comments diff --git a/config/locales/es-AR/legislation.yml b/config/locales/es-AR/legislation.yml index 846e74d5a13..92714dc197d 100644 --- a/config/locales/es-AR/legislation.yml +++ b/config/locales/es-AR/legislation.yml @@ -73,7 +73,7 @@ es-AR: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-BO/legislation.yml b/config/locales/es-BO/legislation.yml index 1b5d5ed55c0..85247082674 100644 --- a/config/locales/es-BO/legislation.yml +++ b/config/locales/es-BO/legislation.yml @@ -73,7 +73,7 @@ es-BO: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-CL/legislation.yml b/config/locales/es-CL/legislation.yml index ab17069eee6..2a254f7f795 100644 --- a/config/locales/es-CL/legislation.yml +++ b/config/locales/es-CL/legislation.yml @@ -73,7 +73,7 @@ es-CL: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-CO/legislation.yml b/config/locales/es-CO/legislation.yml index aaae703d3c5..1b8a1763710 100644 --- a/config/locales/es-CO/legislation.yml +++ b/config/locales/es-CO/legislation.yml @@ -73,7 +73,7 @@ es-CO: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-CR/legislation.yml b/config/locales/es-CR/legislation.yml index db9d5cda44e..c262a9e5306 100644 --- a/config/locales/es-CR/legislation.yml +++ b/config/locales/es-CR/legislation.yml @@ -73,7 +73,7 @@ es-CR: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-DO/legislation.yml b/config/locales/es-DO/legislation.yml index 5492300ec40..9d737a8dd2d 100644 --- a/config/locales/es-DO/legislation.yml +++ b/config/locales/es-DO/legislation.yml @@ -73,7 +73,7 @@ es-DO: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-EC/legislation.yml b/config/locales/es-EC/legislation.yml index ec08d9ed0dd..cad9eb51df2 100644 --- a/config/locales/es-EC/legislation.yml +++ b/config/locales/es-EC/legislation.yml @@ -73,7 +73,7 @@ es-EC: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-GT/legislation.yml b/config/locales/es-GT/legislation.yml index 03328bcfb00..2a672648f3f 100644 --- a/config/locales/es-GT/legislation.yml +++ b/config/locales/es-GT/legislation.yml @@ -73,7 +73,7 @@ es-GT: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-HN/legislation.yml b/config/locales/es-HN/legislation.yml index 1184bda4ba8..8b10aa0e46f 100644 --- a/config/locales/es-HN/legislation.yml +++ b/config/locales/es-HN/legislation.yml @@ -73,7 +73,7 @@ es-HN: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-MX/legislation.yml b/config/locales/es-MX/legislation.yml index cd64b635353..81697e4931b 100644 --- a/config/locales/es-MX/legislation.yml +++ b/config/locales/es-MX/legislation.yml @@ -73,7 +73,7 @@ es-MX: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-NI/legislation.yml b/config/locales/es-NI/legislation.yml index d364ccb0065..c112c516ca9 100644 --- a/config/locales/es-NI/legislation.yml +++ b/config/locales/es-NI/legislation.yml @@ -73,7 +73,7 @@ es-NI: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-PA/legislation.yml b/config/locales/es-PA/legislation.yml index bfade748781..59fc865ce3b 100644 --- a/config/locales/es-PA/legislation.yml +++ b/config/locales/es-PA/legislation.yml @@ -73,7 +73,7 @@ es-PA: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-PE/legislation.yml b/config/locales/es-PE/legislation.yml index 8732d96ebb5..1a6088a984d 100644 --- a/config/locales/es-PE/legislation.yml +++ b/config/locales/es-PE/legislation.yml @@ -73,7 +73,7 @@ es-PE: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-PR/legislation.yml b/config/locales/es-PR/legislation.yml index 7aa3e0aa0f5..a8a8daad186 100644 --- a/config/locales/es-PR/legislation.yml +++ b/config/locales/es-PR/legislation.yml @@ -73,7 +73,7 @@ es-PR: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-PY/legislation.yml b/config/locales/es-PY/legislation.yml index 60b9864fad9..6d18bb5899f 100644 --- a/config/locales/es-PY/legislation.yml +++ b/config/locales/es-PY/legislation.yml @@ -73,7 +73,7 @@ es-PY: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-SV/legislation.yml b/config/locales/es-SV/legislation.yml index 528d2ce5e16..dae905caa58 100644 --- a/config/locales/es-SV/legislation.yml +++ b/config/locales/es-SV/legislation.yml @@ -73,7 +73,7 @@ es-SV: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-UY/legislation.yml b/config/locales/es-UY/legislation.yml index 548cf6f5e8c..1917fb92e6b 100644 --- a/config/locales/es-UY/legislation.yml +++ b/config/locales/es-UY/legislation.yml @@ -73,7 +73,7 @@ es-UY: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es-VE/legislation.yml b/config/locales/es-VE/legislation.yml index 38d51b1f7d5..79528f0938e 100644 --- a/config/locales/es-VE/legislation.yml +++ b/config/locales/es-VE/legislation.yml @@ -73,7 +73,7 @@ es-VE: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador result_publication_date: Publicación resultados diff --git a/config/locales/es/legislation.yml b/config/locales/es/legislation.yml index 766089a43f9..18bd8d5ef2a 100644 --- a/config/locales/es/legislation.yml +++ b/config/locales/es/legislation.yml @@ -82,7 +82,7 @@ es: see_latest_comments: Ver últimas aportaciones see_latest_comments_title: Aportar a este proceso shared: - key_dates: Fechas clave + key_dates: Fases de participación debate_dates: Debate previo draft_publication_date: Publicación borrador allegations_dates: Comentarios From dd8e2d63114b8c7ca12b8b481afc626e2eb700b6 Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 27 Dec 2018 20:18:34 +0100 Subject: [PATCH 08/27] Shows participation phases only if there is a phase enabled --- app/models/legislation/process.rb | 4 + .../legislation/processes/_key_dates.html.erb | 110 +++++++++--------- spec/factories/legislations.rb | 19 +++ spec/features/legislation/processes_spec.rb | 17 ++- 4 files changed, 94 insertions(+), 56 deletions(-) diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index e9bfe02a469..be8cc74c308 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -80,6 +80,10 @@ def result_publication Legislation::Process::Publication.new(result_publication_date, result_publication_enabled) end + def enabled_phases? + PHASES_AND_PUBLICATIONS.any? { |process| send(process).enabled? } + end + def enabled_phases_and_publications_count PHASES_AND_PUBLICATIONS.count { |process| send(process).enabled? } end diff --git a/app/views/legislation/processes/_key_dates.html.erb b/app/views/legislation/processes/_key_dates.html.erb index 6fbea50537f..7181e68cf56 100644 --- a/app/views/legislation/processes/_key_dates.html.erb +++ b/app/views/legislation/processes/_key_dates.html.erb @@ -1,65 +1,65 @@ - diff --git a/spec/factories/legislations.rb b/spec/factories/legislations.rb index 79a617d677c..e911f574ebf 100644 --- a/spec/factories/legislations.rb +++ b/spec/factories/legislations.rb @@ -100,6 +100,25 @@ end_date { 1.week.from_now } end + trait :empty do + start_date { Date.current - 5.days } + end_date { Date.current + 5.days } + debate_start_date nil + debate_end_date nil + draft_publication_date nil + allegations_start_date nil + allegations_end_date nil + proposals_phase_start_date nil + proposals_phase_end_date nil + result_publication_date nil + debate_phase_enabled false + allegations_phase_enabled false + proposals_phase_enabled false + draft_publication_enabled false + result_publication_enabled false + published true + end + end factory :legislation_draft_version, class: 'Legislation::DraftVersion' do diff --git a/spec/features/legislation/processes_spec.rb b/spec/features/legislation/processes_spec.rb index 4b71a0ccd36..6d732bfd14b 100644 --- a/spec/features/legislation/processes_spec.rb +++ b/spec/features/legislation/processes_spec.rb @@ -47,17 +47,32 @@ end end - scenario 'Key dates are displayed on current locale' do + scenario 'Participation phases are displayed only if there is a phase enabled' do + process = create(:legislation_process, :empty) + process_debate = create(:legislation_process) + + visit legislation_process_path(process) + + expect(page).not_to have_content("Participation phases") + + visit legislation_process_path(process_debate) + + expect(page).to have_content("Participation phases") + end + + scenario 'Participation phases are displayed on current locale' do process = create(:legislation_process, proposals_phase_start_date: Date.new(2018, 01, 01), proposals_phase_end_date: Date.new(2018, 12, 01)) visit legislation_process_path(process) + expect(page).to have_content("Participation phases") expect(page).to have_content("Proposals") expect(page).to have_content("01 Jan 2018 - 01 Dec 2018") visit legislation_process_path(process, locale: "es") + expect(page).to have_content("Fases de participación") expect(page).to have_content("Propuestas") expect(page).to have_content("01 ene 2018 - 01 dic 2018") end From 6a580ede5b68f11c4980172ee0e6c202bf8dbac8 Mon Sep 17 00:00:00 2001 From: decabeza Date: Thu, 27 Dec 2018 20:19:08 +0100 Subject: [PATCH 09/27] Improves layout of admin legislation homepage form --- app/views/admin/legislation/homepages/_form.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/legislation/homepages/_form.html.erb b/app/views/admin/legislation/homepages/_form.html.erb index e6b7cf2f442..aa3ee4151db 100644 --- a/app/views/admin/legislation/homepages/_form.html.erb +++ b/app/views/admin/legislation/homepages/_form.html.erb @@ -11,7 +11,7 @@ <%= f.translatable_fields do |translations_form| %> -
+
<%= translations_form.cktext_area :homepage, language: I18n.locale, @@ -22,7 +22,7 @@
<% end %> -
+
<%= f.submit(class: "button success expanded", value: t("admin.legislation.processes.#{admin_submit_action(@process)}.submit_button")) %>
<% end %> From 6b58a71f3fbab597df91bf0d2dca431d3d7fbfcf Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 28 Dec 2018 16:18:11 +0100 Subject: [PATCH 10/27] Shows tabs only on large screens Also moves ::after styles inside breakpoint(large down) to avoid use !important --- .../stylesheets/legislation_process.scss | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/app/assets/stylesheets/legislation_process.scss b/app/assets/stylesheets/legislation_process.scss index c870b0e32ec..fd75187f883 100644 --- a/app/assets/stylesheets/legislation_process.scss +++ b/app/assets/stylesheets/legislation_process.scss @@ -52,7 +52,7 @@ list-style-type: none; margin: 0 rem-calc(-10); - @include breakpoint(medium) { + @include breakpoint(large) { margin: 0; } @@ -62,7 +62,20 @@ margin: rem-calc(-1) 0; position: relative; - @include breakpoint(medium) { + @include breakpoint(large down) { + + &::after { + content: '\63'; + font-family: "icons" !important; + font-size: rem-calc(24); + pointer-events: none; + position: absolute; + right: 12px; + top: 12px; + } + } + + @include breakpoint(large) { background: #fafafa; display: inline-block; border-bottom: 0; @@ -77,25 +90,15 @@ } &::after { - content: '' !important; + content: ''; } } - &::after { - content: '\63'; - font-family: "icons" !important; - font-size: rem-calc(24); - pointer-events: none; - position: absolute; - right: 12px; - top: 12px; - } - a { display: block; padding: $line-height / 4 $line-height / 2; - @include breakpoint(medium) { + @include breakpoint(large) { display: inline-block; } @@ -118,7 +121,15 @@ background: $highlight; position: relative; - @include breakpoint(medium) { + @include breakpoint(large down) { + + &::after { + content: '\61'; + color: $link; + } + } + + @include breakpoint(large) { background: none; border: 1px solid $border; border-bottom: 0; @@ -126,17 +137,12 @@ &::after { border-bottom: 1px solid #fefefe; bottom: -1px; - content: '' !important; + content: ''; left: 0; position: absolute; width: 100%; } } - - &::after { - content: '\61'; - color: $link; - } } } From 5924a7038559c649ff8d006c34e8626714dd66a9 Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 28 Dec 2018 19:36:18 +0100 Subject: [PATCH 11/27] Removes arrow icon on active process phase --- app/assets/stylesheets/legislation_process.scss | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/assets/stylesheets/legislation_process.scss b/app/assets/stylesheets/legislation_process.scss index fd75187f883..990581236c3 100644 --- a/app/assets/stylesheets/legislation_process.scss +++ b/app/assets/stylesheets/legislation_process.scss @@ -121,14 +121,6 @@ background: $highlight; position: relative; - @include breakpoint(large down) { - - &::after { - content: '\61'; - color: $link; - } - } - @include breakpoint(large) { background: none; border: 1px solid $border; @@ -137,12 +129,15 @@ &::after { border-bottom: 1px solid #fefefe; bottom: -1px; - content: ''; left: 0; position: absolute; width: 100%; } } + + &::after { + content: ''; + } } } From d2b394396858fc80186c6f3ac23ca82613264069 Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Wed, 19 Dec 2018 13:22:43 +0100 Subject: [PATCH 12/27] improve rendering of map in the sidebar --- app/assets/stylesheets/layout.scss | 1 - app/views/budgets/investments/_map.html.erb | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 14ec9e35450..a2e3ed6bffe 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -851,7 +851,6 @@ footer { .categories a, .geozone a, .sidebar-links a, -.sidebar-map a, .tags span { background: #ececec; border-radius: rem-calc(6); diff --git a/app/views/budgets/investments/_map.html.erb b/app/views/budgets/investments/_map.html.erb index 37aa50f6721..f22a5d7ee18 100644 --- a/app/views/budgets/investments/_map.html.erb +++ b/app/views/budgets/investments/_map.html.erb @@ -1,7 +1,4 @@ - -
- -