From f36b58f6059099851888838283be3f9884a33847 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Thu, 15 Feb 2018 11:49:58 -0400 Subject: [PATCH 01/71] I18n: cleanup for ActiveRecord English strings * Remove duplicated strings * Replace untranslated strings --- config/locales/en/activerecord.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/config/locales/en/activerecord.yml b/config/locales/en/activerecord.yml index 2d5163cb0..9b47de088 100644 --- a/config/locales/en/activerecord.yml +++ b/config/locales/en/activerecord.yml @@ -59,8 +59,8 @@ en: one: "Citizen proposal" other: "Citizen proposals" spending_proposal: - one: "Spending proposal" - other: "Spending proposals" + one: "Investment project" + other: "Investment projects" site_customization/page: one: Custom page other: Custom pages @@ -113,15 +113,11 @@ en: phase: "Phase" currency_symbol: "Currency" budget/investment: - heading_id: "Sección de presupuesto" - title: "Title" - description: "Description" - external_url: "External url" - administrator_id: "Administrator" - description: "Description" - external_url: "Link to additional documentation" heading_id: "Heading" title: "Title" + description: "Description" + external_url: "Link to additional documentation" + administrator_id: "Administrator" location: "Location (optional)" organization_name: "If you are proposing in the name of a collective/organization, or on behalf of more people, write its name" image: "Proposal descriptive image" @@ -163,7 +159,7 @@ en: name: "Name of organisation" responsible_name: "Person responsible for the group" spending_proposal: - administrator_id: "Administrador" + administrator_id: "Administrator" association_name: "Association name" description: "Description" external_url: "Link to additional documentation" From f9e8e2d86dc56d4e28d37e9ee0f679d2320e1af8 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Fri, 16 Feb 2018 10:29:47 -0400 Subject: [PATCH 02/71] I18n: cleanup for Admin English/Spanish strings * Add missing exclamation marks * Fix typos * Remove duplicated keys * Remove trailing whitespaces * Replace single quotes with double quotes * Replace untranslated strings * Fix incorrect 'Spending proposal' assertion --- config/locales/en/admin.yml | 10 +++++----- config/locales/es/admin.yml | 4 ++-- spec/models/signature_sheet_spec.rb | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index f85d6a8c8..9ea208054 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -27,8 +27,8 @@ en: preview: Preview banner: title: Title - description: Description - target_url: Link + description: Description + target_url: Link style: Style image: Image post_started_at: Post started at @@ -41,7 +41,7 @@ en: form: error: one: "error prevented this banner from being saved" - other: 'errors prevented this banner from being saved' + other: "errors prevented this banner from being saved" new: creating: Create banner activity: @@ -62,7 +62,7 @@ en: on_users: Users title: Moderator activity type: Type - no_activity: There ares no moderators activity. + no_activity: There are no moderators activity. budgets: index: title: Participatory budgets @@ -664,7 +664,7 @@ en: search_officer_placeholder: Search officer search_officer_text: Search for an officer to assign a new shift select_date: "Select day" - no_voting_days: "Los dias de votación terminaron" + no_voting_days: "Voting days ended" select_task: "Select task" table_shift: "Shift" table_email: "Email" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 64e7dafd0..76c38c91c 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -41,7 +41,7 @@ es: form: error: one: "error impidió guardar el banner" - other: 'errores impidieron guardar el banner.' + other: "errores impidieron guardar el banner" new: creating: Crear banner activity: @@ -257,7 +257,7 @@ es: edit: title: Editar hito create: - notice: Nuevo hito creado con éxito! + notice: ¡Nuevo hito creado con éxito! update: notice: Hito actualizado delete: diff --git a/spec/models/signature_sheet_spec.rb b/spec/models/signature_sheet_spec.rb index e573d8259..f64cac6e6 100644 --- a/spec/models/signature_sheet_spec.rb +++ b/spec/models/signature_sheet_spec.rb @@ -51,7 +51,7 @@ describe SignatureSheet do spending_proposal = create(:spending_proposal) signature_sheet.signable = spending_proposal - expect(signature_sheet.name).to eq("Spending proposal #{spending_proposal.id}") + expect(signature_sheet.name).to eq("Investment project #{spending_proposal.id}") end it "returns name for budget investment signature sheets" do @@ -92,4 +92,4 @@ describe SignatureSheet do end end -end \ No newline at end of file +end From f1e722ac5c86e7f811ff48d95d850a68f23fe0a8 Mon Sep 17 00:00:00 2001 From: decabeza Date: Wed, 9 May 2018 13:05:11 +0200 Subject: [PATCH 03/71] Adds message to selected budget investments --- app/helpers/budgets_helper.rb | 8 ++- app/models/budget.rb | 4 ++ spec/features/budgets/budgets_spec.rb | 71 +++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/app/helpers/budgets_helper.rb b/app/helpers/budgets_helper.rb index 8cff4b72b..44cb85c13 100644 --- a/app/helpers/budgets_helper.rb +++ b/app/helpers/budgets_helper.rb @@ -66,6 +66,12 @@ module BudgetsHelper def current_budget_map_locations return unless current_budget.present? - MapLocation.where(investment_id: current_budget.investments).map { |l| l.json_data } + if current_budget.valuating_or_later? + investments = current_budget.investments.selected + else + investments = current_budget.investments + end + + MapLocation.where(investment_id: investments).map { |l| l.json_data } end end diff --git a/app/models/budget.rb b/app/models/budget.rb index 6c80e7f1f..87f5579b0 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -105,6 +105,10 @@ class Budget < ActiveRecord::Base Budget::Phase::PUBLISHED_PRICES_PHASES.include?(phase) end + def valuating_or_later? + valuating? || publishing_prices? || balloting_or_later? + end + def balloting_process? balloting? || reviewing_ballots? end diff --git a/spec/features/budgets/budgets_spec.rb b/spec/features/budgets/budgets_spec.rb index cd1ee6cd5..614fa38e7 100644 --- a/spec/features/budgets/budgets_spec.rb +++ b/spec/features/budgets/budgets_spec.rb @@ -191,6 +191,77 @@ feature 'Budgets' do expect(page).to have_css(".phase.active", count: 1) end + xcontext "Index map" do + + let(:group) { create(:budget_group, budget: budget) } + let(:heading) { create(:budget_heading, group: group) } + + before do + Setting['feature.map'] = true + end + + scenario "Display investment's map location markers" , :js do + investment1 = create(:budget_investment, heading: heading) + investment2 = create(:budget_investment, heading: heading) + investment3 = create(:budget_investment, heading: heading) + + investment1.create_map_location(longitude: 40.1234, latitude: 3.1234, zoom: 10) + investment2.create_map_location(longitude: 40.1235, latitude: 3.1235, zoom: 10) + investment3.create_map_location(longitude: 40.1236, latitude: 3.1236, zoom: 10) + + visit budgets_path + + within ".map_location" do + expect(page).to have_css(".map-icon", count: 3) + end + end + + scenario "Display selected investment's map location markers" , :js do + + budget.update(phase: :valuating) + + investment1 = create(:budget_investment, :selected, heading: heading) + investment2 = create(:budget_investment, :selected, heading: heading) + investment3 = create(:budget_investment, heading: heading) + + investment1.create_map_location(longitude: 40.1234, latitude: 3.1234, zoom: 10) + investment2.create_map_location(longitude: 40.1235, latitude: 3.1235, zoom: 10) + investment3.create_map_location(longitude: 40.1236, latitude: 3.1236, zoom: 10) + + visit budgets_path + + within ".map_location" do + expect(page).to have_css(".map-icon", count: 2) + end + end + + scenario "Skip invalid map markers" , :js do + map_locations = [] + map_locations << { longitude: 40.123456789, latitude: 3.12345678 } + map_locations << { longitude: 40.123456789, latitude: "*******" } + map_locations << { longitude: "**********", latitude: 3.12345678 } + + budget_map_locations = map_locations.map do |map_location| + { + lat: map_location[:latitude], + long: map_location[:longitude], + investment_title: "#{rand(999)}", + investment_id: "#{rand(999)}", + budget_id: budget.id + } + end + + allow_any_instance_of(BudgetsHelper). + to receive(:current_budget_map_locations).and_return(budget_map_locations) + + visit budgets_path + + within ".map_location" do + expect(page).to have_css(".map-icon", count: 1) + end + end + end + context 'Show' do scenario "List all groups" do From 44b1eb929a490ed0c3e031ffb04b14a3c8efdc74 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Fri, 18 May 2018 09:19:20 -0400 Subject: [PATCH 04/71] Move 'Show stats and results' form to Admin::Poll#results tab --- app/views/admin/poll/polls/_form.html.erb | 11 ---- .../admin/poll/results/_show_results.html.erb | 17 ++++++ app/views/admin/poll/results/index.html.erb | 2 + spec/features/admin/poll/polls_spec.rb | 58 ++++++++++++++++--- 4 files changed, 69 insertions(+), 19 deletions(-) create mode 100644 app/views/admin/poll/results/_show_results.html.erb diff --git a/app/views/admin/poll/polls/_form.html.erb b/app/views/admin/poll/polls/_form.html.erb index e802d1217..1a45b8097 100644 --- a/app/views/admin/poll/polls/_form.html.erb +++ b/app/views/admin/poll/polls/_form.html.erb @@ -55,17 +55,6 @@ - <% if controller_name == "polls" && action_name == "edit" %> -
-
- <%= t('admin.polls.new.show_results_and_stats') %> - <%= f.check_box :results_enabled, checked: @poll.results_enabled?, label: t('admin.polls.new.show_results') %> - <%= f.check_box :stats_enabled, checked: @poll.stats_enabled?, label: t('admin.polls.new.show_stats') %> -

<%= t('admin.polls.new.results_and_stats_reminder') %>

-
-
- <% end %> -
<%= f.submit t("admin.polls.#{admin_submit_action(@poll)}.submit_button"), diff --git a/app/views/admin/poll/results/_show_results.html.erb b/app/views/admin/poll/results/_show_results.html.erb new file mode 100644 index 000000000..30222a2bf --- /dev/null +++ b/app/views/admin/poll/results/_show_results.html.erb @@ -0,0 +1,17 @@ +<%= form_for [:admin, @poll], action: "update" do |f| %> +
+
+ <%= t("admin.polls.new.show_results_and_stats") %> + <%= f.check_box :results_enabled, checked: @poll.results_enabled?, label: t("admin.polls.new.show_results") %> + <%= f.check_box :stats_enabled, checked: @poll.stats_enabled?, label: t("admin.polls.new.show_stats") %> +

<%= t("admin.polls.new.results_and_stats_reminder") %>

+
+
+ +
+
+ <%= f.submit t("admin.polls.#{admin_submit_action(@poll)}.submit_button"), + class: "button success expanded" %> +
+
+<% end %> diff --git a/app/views/admin/poll/results/index.html.erb b/app/views/admin/poll/results/index.html.erb index 7f21e5452..6f1fbbe74 100644 --- a/app/views/admin/poll/results/index.html.erb +++ b/app/views/admin/poll/results/index.html.erb @@ -1,4 +1,5 @@ <%= render "/admin/poll/polls/poll_header" %> +
<%= render "/admin/poll/polls/subnav" %> @@ -12,5 +13,6 @@ <%= render "recount", resource: @poll %> <%= render "result" %> <%= render "results_by_booth" %> + <%= render "show_results", resource: @poll %> <% end %>
diff --git a/spec/features/admin/poll/polls_spec.rb b/spec/features/admin/poll/polls_spec.rb index 482d461cc..e7e4d6bba 100644 --- a/spec/features/admin/poll/polls_spec.rb +++ b/spec/features/admin/poll/polls_spec.rb @@ -83,25 +83,67 @@ feature 'Admin polls' do expect(page).to have_css("img[alt='#{poll.image.title}']") - expect(page).to have_css("#poll_results_enabled") - expect(page).to have_css("#poll_stats_enabled") - fill_in "poll_name", with: "Next Poll" fill_in 'poll_ends_at', with: end_date.strftime("%d/%m/%Y") - check 'poll_results_enabled' - check 'poll_stats_enabled' click_button "Update poll" expect(page).to have_content "Poll updated successfully" expect(page).to have_content "Next Poll" expect(page).to have_content I18n.l(end_date.to_date) + end - click_link "Edit poll" + scenario 'Enable stats and results' do + poll = create(:poll) + + booth_assignment_1 = create(:poll_booth_assignment, poll: poll) + booth_assignment_2 = create(:poll_booth_assignment, poll: poll) + booth_assignment_3 = create(:poll_booth_assignment, poll: poll) + + question_1 = create(:poll_question, poll: poll) + create(:poll_question_answer, title: 'Oui', question: question_1) + create(:poll_question_answer, title: 'Non', question: question_1) + + question_2 = create(:poll_question, poll: poll) + create(:poll_question_answer, title: "Aujourd'hui", question: question_2) + create(:poll_question_answer, title: 'Demain', question: question_2) + + [booth_assignment_1, booth_assignment_2, booth_assignment_3].each do |ba| + create(:poll_partial_result, + booth_assignment: ba, + question: question_1, + answer: 'Oui', + amount: 11) + + create(:poll_partial_result, + booth_assignment: ba, + question: question_2, + answer: 'Demain', + amount: 5) + end + + create(:poll_recount, + booth_assignment: booth_assignment_1, + white_amount: 21, + null_amount: 44, + total_amount: 66) + + visit admin_poll_results_path(poll) + + expect(page).to have_field('poll_stats_enabled', checked: false) + expect(page).to have_field('poll_results_enabled', checked: false) + + check 'poll_stats_enabled' + check 'poll_results_enabled' + + click_button 'Update poll' + + expect(page).to have_content('Poll updated successfully') + + click_link 'Results' - expect(page).to have_field('poll_results_enabled', checked: true) expect(page).to have_field('poll_stats_enabled', checked: true) - + expect(page).to have_field('poll_results_enabled', checked: true) end scenario 'Edit from index' do From 4c0deb0eca89a95bc4cd79f07785b24d5ce962f9 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Fri, 18 May 2018 09:43:43 -0400 Subject: [PATCH 05/71] Remove `video_url` attr from Admin::Poll::Question form --- app/controllers/admin/poll/questions_controller.rb | 2 +- app/views/admin/poll/questions/_form.html.erb | 13 ------------- spec/features/admin/poll/questions_spec.rb | 3 --- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/app/controllers/admin/poll/questions_controller.rb b/app/controllers/admin/poll/questions_controller.rb index 64ecf4009..399c72788 100644 --- a/app/controllers/admin/poll/questions_controller.rb +++ b/app/controllers/admin/poll/questions_controller.rb @@ -55,7 +55,7 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController private def question_params - params.require(:poll_question).permit(:poll_id, :title, :question, :proposal_id, :video_url) + params.require(:poll_question).permit(:poll_id, :title, :question, :proposal_id) end def search_params diff --git a/app/views/admin/poll/questions/_form.html.erb b/app/views/admin/poll/questions/_form.html.erb index 17ebde59d..eeb38a405 100644 --- a/app/views/admin/poll/questions/_form.html.erb +++ b/app/views/admin/poll/questions/_form.html.erb @@ -14,19 +14,6 @@ <%= f.text_field :title %> -
- <%= f.label :video_url, t("proposals.form.proposal_video_url") %> - -

- <%= t("proposals.form.proposal_video_url_note") %> -

- - <%= f.text_field :video_url, - placeholder: t("proposals.form.proposal_video_url"), - label: false, - aria: {describedby: "video-url-help-text"} %> -
-
<%= f.submit(class: "button expanded", value: t("shared.save")) %>
diff --git a/spec/features/admin/poll/questions_spec.rb b/spec/features/admin/poll/questions_spec.rb index 4399e3e64..d499869b9 100644 --- a/spec/features/admin/poll/questions_spec.rb +++ b/spec/features/admin/poll/questions_spec.rb @@ -36,19 +36,16 @@ feature 'Admin poll questions' do Pursued by the Empire's sinister agents, Princess Leia races home aboard her starship, custodian of the stolen plans that can save her people and restore freedom to the galaxy.... } - video_url = "https://puppyvideos.com" visit admin_questions_path click_link "Create question" select 'Movies', from: 'poll_question_poll_id' fill_in 'poll_question_title', with: title - fill_in 'poll_question_video_url', with: video_url click_button 'Save' expect(page).to have_content(title) - expect(page).to have_content(video_url) end scenario 'Create from successful proposal index' do From 9a326d4987e68f804f8e5a4554233c5f21eee1b9 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Fri, 18 May 2018 11:02:06 -0400 Subject: [PATCH 06/71] Use 'drafting' as default value when creating a new budget --- app/views/admin/budgets/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/budgets/_form.html.erb b/app/views/admin/budgets/_form.html.erb index f5ce6b027..c2aaced9b 100644 --- a/app/views/admin/budgets/_form.html.erb +++ b/app/views/admin/budgets/_form.html.erb @@ -4,7 +4,7 @@
- <%= f.select :phase, budget_phases_select_options %> + <%= f.select :phase, budget_phases_select_options, selected: "drafting" %>
<%= f.select :currency_symbol, budget_currency_symbol_select_options %> From f220c477c17743381987d77a38785ae6311de555 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Fri, 18 May 2018 14:04:59 -0400 Subject: [PATCH 07/71] Remove `proposals_description` attr from Admin::Legislation::Processes module --- .../admin/legislation/processes_controller.rb | 1 - .../admin/legislation/proposals/_form.html.erb | 13 ------------- config/locales/en/admin.yml | 3 --- config/locales/es/admin.yml | 3 --- 4 files changed, 20 deletions(-) diff --git a/app/controllers/admin/legislation/processes_controller.rb b/app/controllers/admin/legislation/processes_controller.rb index 47c7c34c0..976318958 100644 --- a/app/controllers/admin/legislation/processes_controller.rb +++ b/app/controllers/admin/legislation/processes_controller.rb @@ -60,7 +60,6 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll :draft_publication_enabled, :result_publication_enabled, :published, - :proposals_description, :custom_list, documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy] ) diff --git a/app/views/admin/legislation/proposals/_form.html.erb b/app/views/admin/legislation/proposals/_form.html.erb index dd12f9492..cca190440 100644 --- a/app/views/admin/legislation/proposals/_form.html.erb +++ b/app/views/admin/legislation/proposals/_form.html.erb @@ -15,19 +15,6 @@ <% end %> -
-
- <%= label_tag t('admin.legislation.proposals.form.header_information') %> - <%= t('admin.legislation.proposals.form.header_information_description') %> -
-
- <%= f.text_area :proposals_description, - label: false, - rows: 5, - placeholder: t('admin.legislation.proposals.form.header_information_placeholder') %> -
-
-
<%= label_tag t('admin.legislation.proposals.form.custom_categories') %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 0292df944..3f7c22af5 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -369,9 +369,6 @@ en: title: Proposals back: Back form: - header_information: Information header - header_information_description: Provide information about the proposals. This text will be displayed as an alert in the Proposals section inside this Process. Use Markdown to format the text. - header_information_placeholder: Add information for the proposals' header custom_categories: Categories custom_categories_description: Categories that users can select creating the proposal. draft_versions: diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 5d44c9a17..441bb23e6 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -369,9 +369,6 @@ es: title: Propuestas back: Volver form: - header_information: Encabezado de información - header_information_description: Proporciona información sobre el recorrido de las propuestas. Este texto se mostrará como una alerta en el encabezado de la sección de Propuestas dentro de este proceso. Usa Markdown para formatear el texto. - header_information_placeholder: Añade información para el encabezado de las las propuestas custom_categories: Categorías custom_categories_description: Categorías que el usuario puede seleccionar al crear la propuesta. draft_versions: From 2c3770229852cf0b8c1ff7b0c64ffa68e2f268a2 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Fri, 18 May 2018 14:44:16 -0400 Subject: [PATCH 08/71] Sort booths by name and enable pagination --- app/controllers/admin/poll/booth_assignments_controller.rb | 2 +- app/views/admin/poll/booth_assignments/manage.html.erb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/poll/booth_assignments_controller.rb b/app/controllers/admin/poll/booth_assignments_controller.rb index c90eb9cac..ea1f2f28f 100644 --- a/app/controllers/admin/poll/booth_assignments_controller.rb +++ b/app/controllers/admin/poll/booth_assignments_controller.rb @@ -55,7 +55,7 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController end def manage - @booths = ::Poll::Booth.all + @booths = ::Poll::Booth.all.order(name: :asc).page(params[:page]).per(300) @poll = Poll.find(params[:poll_id]) end diff --git a/app/views/admin/poll/booth_assignments/manage.html.erb b/app/views/admin/poll/booth_assignments/manage.html.erb index a24fac478..b7d619c71 100644 --- a/app/views/admin/poll/booth_assignments/manage.html.erb +++ b/app/views/admin/poll/booth_assignments/manage.html.erb @@ -25,4 +25,6 @@ <% end %> + + <%= paginate @booths %> <% end %> From 608f1996ce9eaa397ee32592bc84967795985cf5 Mon Sep 17 00:00:00 2001 From: decabeza Date: Wed, 23 May 2018 12:00:07 +0200 Subject: [PATCH 09/71] Fixes admin layout --- app/assets/stylesheets/admin.scss | 9 -------- .../admin/poll/results/_show_results.html.erb | 23 ++++++++----------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 5538a2c59..00b05706d 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -698,15 +698,6 @@ table { } } -.legislation-process-index { - - .legislation-process-new { - @include breakpoint(medium) { - text-align: right; - } - } -} - // 08. CMS // -------------- .cms-page-list { diff --git a/app/views/admin/poll/results/_show_results.html.erb b/app/views/admin/poll/results/_show_results.html.erb index 30222a2bf..e607f4779 100644 --- a/app/views/admin/poll/results/_show_results.html.erb +++ b/app/views/admin/poll/results/_show_results.html.erb @@ -1,17 +1,14 @@ <%= form_for [:admin, @poll], action: "update" do |f| %> -
-
- <%= t("admin.polls.new.show_results_and_stats") %> - <%= f.check_box :results_enabled, checked: @poll.results_enabled?, label: t("admin.polls.new.show_results") %> - <%= f.check_box :stats_enabled, checked: @poll.stats_enabled?, label: t("admin.polls.new.show_stats") %> -

<%= t("admin.polls.new.results_and_stats_reminder") %>

-
-
+
+ <%= t("admin.polls.new.show_results_and_stats") %> + <%= f.check_box :results_enabled, checked: @poll.results_enabled?, label: t("admin.polls.new.show_results") %> + <%= f.check_box :stats_enabled, checked: @poll.stats_enabled?, label: t("admin.polls.new.show_stats") %> +

<%= t("admin.polls.new.results_and_stats_reminder") %>

+
-
-
- <%= f.submit t("admin.polls.#{admin_submit_action(@poll)}.submit_button"), - class: "button success expanded" %> -
+ +
+ <%= f.submit t("admin.polls.#{admin_submit_action(@poll)}.submit_button"), + class: "button success expanded" %>
<% end %> From 8161045009e91b84b4a99c7cba6ba2778d687a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Salvador=20P=C3=A9rez=20Garc=C3=ADa?= Date: Fri, 1 Jun 2018 15:51:06 +0200 Subject: [PATCH 10/71] Docker/docker-compose enhancements The following enhancements have been made to docker/docker-compose * Fixed bug when building the image. * docker-compose up starts the server * Scaffolding inside the container respect the ownership of the files outside it * Volumes are tagged as 'delegated' in order to improve performance for mac/windoze users. * bundler stores packages in a volume. This whay new packages can be added without rebuilding the image: ```bash docker-compose run app bundle install ``` --- .gitignore | 3 +++ Dockerfile | 15 +++++++++--- docker-compose.yml | 57 +++++++++++++++++++++++++------------------ scripts/entrypoint.sh | 17 +++++++++++++ 4 files changed, 65 insertions(+), 27 deletions(-) create mode 100755 scripts/entrypoint.sh diff --git a/.gitignore b/.gitignore index 7761dba2a..36e00c513 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ public/sitemap.xml public/system/ + +# Ignore vim swap files +*.swp diff --git a/Dockerfile b/Dockerfile index 40e32c768..880d17e43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,17 @@ -# # Select ubuntu as the base image -FROM coreapps/ruby2.3 +FROM ruby:2.3.6 # Install essential Linux packages -RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick +RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick sudo + +# Files created inside the container repect the ownership +RUN adduser --shell /bin/bash --disabled-password --gecos "" consul \ + && adduser consul sudo \ + && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +RUN echo 'Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bundle/bin"' > /etc/sudoers.d/secure_path +RUN chmod 0440 /etc/sudoers.d/secure_path + +COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh # Define where our application will live inside the image ENV RAILS_ROOT /var/www/consul diff --git a/docker-compose.yml b/docker-compose.yml index d5399089e..5c03e071b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,31 +1,40 @@ -# service configuration for our database -database: +version: '3' +services: + # service configuration for our database + database: - # use the preferred version of the official Postgres image - # see https://hub.docker.com/_/postgres/ - image: postgres:9.4.5 + # use the preferred version of the official Postgres image + # see https://hub.docker.com/_/postgres/ + image: postgres:9.4.5 - # persist the database between containers by storing it in a volume - volumes: - - docker-example-postgres:/var/lib/postgresql/data + # persist the database between containers by storing it in a volume + volumes: + - docker-example-postgres:/var/lib/postgresql/data -# service configuration for our dockerized Rails app -app: + # service configuration for our dockerized Rails app + app: - # use the Dockerfile next to this file - build: . + # use the Dockerfile next to this file + build: . + entrypoint: /usr/local/bin/entrypoint.sh + command: bundle exec rails s -p 3000 -b '0.0.0.0' + working_dir: /var/www/consul - # rely on the RAILS_ENV value of the host machine - # environment: - #RAILS_ENV: $RAILS_ENV + # rely on the RAILS_ENV value of the host machine + # environment: + #RAILS_ENV: $RAILS_ENV - # makes the app container aware of the DB container - links: - - database + # makes the app container aware of the DB container + depends_on: + - database - # expose the port we configured Unicorn to bind to - ports: - - "3000:3000" - # map our application source code, in full, to the application root of our container - volumes: - - .:/var/www/consul + # expose the port we configured Unicorn to bind to + ports: + - "3000:3000" + # map our application source code, in full, to the application root of our container + volumes: + - .:/var/www/consul:delegated + - bundle:/usr/local/bundle:delegated +volumes: + docker-example-postgres: {} + bundle: {} diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh new file mode 100755 index 000000000..e3a7bede6 --- /dev/null +++ b/scripts/entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/sh -x + +USER_UID=$(stat -c %u /var/www/consul/Gemfile) +USER_GID=$(stat -c %g /var/www/consul/Gemfile) + +export USER_UID +export USER_GID + +usermod -u "$USER_UID" consul 2> /dev/null +groupmod -g "$USER_GID" consul 2> /dev/null +usermod -g "$USER_GID" consul 2> /dev/null + +chown -R -h "$USER_UID" "$BUNDLE_PATH" +chgrp -R -h "$USER_GID" "$BUNDLE_PATH" + +/usr/bin/sudo -EH -u consul "$@" + From 0effea3c034a68a9ebdebd8a6758b3e28976e578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Salvador=20P=C3=A9rez=20Garc=C3=ADa?= Date: Sun, 3 Jun 2018 18:32:31 +0200 Subject: [PATCH 11/71] Ignores relative to the editor moved from gitignore to gitignore_global --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 36e00c513..7761dba2a 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,3 @@ public/sitemap.xml public/system/ - -# Ignore vim swap files -*.swp From c5506e48bbdb048c50a267d6911ff7da7d693867 Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 6 Apr 2018 18:25:45 +0200 Subject: [PATCH 12/71] Updates foundation gem --- Gemfile | 3 ++- Gemfile.lock | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index f7f9c46ad..5b352c700 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,8 @@ gem 'delayed_job_active_record', '~> 4.1.0' gem 'devise', '~> 3.5.7' gem 'devise-async', '~> 0.10.2' gem 'devise_security_extension', '~> 0.10.0' -gem 'foundation-rails', '~> 6.2.4.0' +gem 'foundation-rails' +gem 'autoprefixer-rails' gem 'foundation_rails_helper', '~> 2.0.0' gem 'graphiql-rails', '~> 1.4.1' gem 'graphql', '~> 1.7.8' diff --git a/Gemfile.lock b/Gemfile.lock index aa4a00eab..19f4daac2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -61,6 +61,8 @@ GEM activerecord (>= 3.2.0) arel (6.0.4) ast (2.4.0) + autoprefixer-rails (8.2.0) + execjs babel-source (5.8.35) babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) @@ -163,7 +165,7 @@ GEM faraday (0.12.1) multipart-post (>= 1.2, < 3) ffi (1.9.23) - foundation-rails (6.2.4.0) + foundation-rails (6.4.3.0) railties (>= 3.1.0) sass (>= 3.3.0, < 3.5) sprockets-es6 (>= 0.9.0) @@ -194,7 +196,7 @@ GEM httpi (2.4.2) rack socksify - i18n (0.9.1) + i18n (0.9.5) concurrent-ruby (~> 1.0) i18n-tasks (0.9.20) activesupport (>= 4.0.2) @@ -261,7 +263,7 @@ GEM mimemagic (0.3.2) mini_mime (1.0.0) mini_portile2 (2.3.0) - minitest (5.11.1) + minitest (5.11.3) mixlib-cli (1.7.0) mixlib-config (2.2.4) multi_json (1.12.2) @@ -321,7 +323,7 @@ GEM public_suffix (3.0.1) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) - rack (1.6.8) + rack (1.6.9) rack-accept (0.4.5) rack (>= 0.4) rack-attack (5.0.1) @@ -465,7 +467,7 @@ GEM rack (>= 1.3, < 3) rack-accept (~> 0.4) tilt (>= 1.4, < 3) - tzinfo (1.2.4) + tzinfo (1.2.5) thread_safe (~> 0.1) uglifier (4.1.3) execjs (>= 0.3.0, < 3) @@ -498,6 +500,7 @@ DEPENDENCIES acts_as_votable (~> 0.11.1) ahoy_matey (~> 1.6.0) ancestry (~> 3.0.1) + autoprefixer-rails browser (~> 2.5.2) bullet (~> 5.7.0) byebug (~> 10.0.0) @@ -521,7 +524,7 @@ DEPENDENCIES email_spec (~> 2.1.0) factory_bot_rails (~> 4.8.2) faker (~> 1.8.7) - foundation-rails (~> 6.2.4.0) + foundation-rails foundation_rails_helper (~> 2.0.0) globalize (~> 5.0.0) globalize-accessors (~> 0.2.1) From e3b92f1c0c56051924f6a1d4cae344c8dd7d0ebd Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 6 Apr 2018 18:27:03 +0200 Subject: [PATCH 13/71] Adds foundation assets --- app/assets/javascripts/application.js | 2 + app/assets/stylesheets/_settings.scss | 506 ++++++++++++++---- app/assets/stylesheets/browserslist | 4 + .../stylesheets/foundation_and_overrides.scss | 23 +- 4 files changed, 425 insertions(+), 110 deletions(-) create mode 100644 app/assets/stylesheets/browserslist diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 1c97069b0..b809585dc 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -132,3 +132,5 @@ $(function(){ $(document).on('page:load', initialize_modules); $(document).on('ajax:complete', initialize_modules); }); + +$(function(){ $(document).foundation(); }); diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index 33800fed5..b8c6fcedd 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -16,30 +16,49 @@ // 11. Button // 12. Button Group // 13. Callout -// 14. Close Button -// 15. Drilldown -// 16. Dropdown -// 17. Dropdown Menu -// 18. Flex Video -// 19. Forms -// 20. Label -// 21. Media Object -// 22. Menu -// 23. Meter -// 24. Off-canvas -// 25. Orbit -// 26. Pagination -// 27. Progress Bar -// 28. Reveal -// 29. Slider -// 30. Switch -// 31. Table -// 32. Tabs -// 33. Thumbnail -// 34. Title Bar -// 35. Tooltip -// 36. Top Bar -// 37. Custom variables +// 14. Card +// 15. Close Button +// 16. Drilldown +// 17. Dropdown +// 18. Dropdown Menu +// 19. Flexbox Utilities +// 20. Forms +// 21. Label +// 22. Media Object +// 23. Menu +// 24. Meter +// 25. Off-canvas +// 26. Orbit +// 27. Pagination +// 28. Progress Bar +// 29. Prototype Arrow +// 30. Prototype Border-Box +// 31. Prototype Border-None +// 32. Prototype Bordered +// 33. Prototype Display +// 34. Prototype Font-Styling +// 35. Prototype List-Style-Type +// 36. Prototype Overflow +// 37. Prototype Position +// 38. Prototype Rounded +// 39. Prototype Separator +// 40. Prototype Shadow +// 41. Prototype Sizing +// 42. Prototype Spacing +// 43. Prototype Text-Decoration +// 44. Prototype Text-Transformation +// 45. Prototype Text-Utilities +// 46. Responsive Embed +// 47. Reveal +// 48. Slider +// 49. Switch +// 50. Table +// 51. Tabs +// 52. Thumbnail +// 53. Title Bar +// 54. Tooltip +// 55. Top Bar +// 56. Xy Grid @import 'util/util'; @@ -50,28 +69,34 @@ $global-font-size: 100%; $global-width: rem-calc(1200); $global-lineheight: 1.5; $foundation-palette: ( - primary: #2199e8, - secondary: #777, + primary: #1779ba, + secondary: #767676, success: #3adb76, warning: #ffae00, - alert: #ec5840, + alert: #cc4b37, ); $light-gray: #e6e6e6; $medium-gray: #cacaca; $dark-gray: #8a8a8a; -$black: #222; -$white: #fff; +$black: #0a0a0a; +$white: #fefefe; $body-background: $white; $body-font-color: $black; -$body-font-family: 'Source Sans Pro', 'Helvetica', 'Arial', sans-serif !important; +$body-font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; $body-antialiased: true; $global-margin: 1rem; $global-padding: 1rem; +$global-position: 1rem; $global-weight-normal: normal; $global-weight-bold: bold; -$global-radius: rem-calc(3); +$global-radius: 0; +$global-menu-padding: 0.7rem 1rem; +$global-menu-nested-margin: 1rem; $global-text-direction: ltr; -$global-flexbox: false; +$global-flexbox: true; +$global-prototype-breakpoints: false; +$global-button-cursor: auto; +$global-color-pick-contrast-tolerance: 0; $print-transparent-backgrounds: true; @include add-foundation-colors; @@ -83,7 +108,10 @@ $breakpoints: ( small: 0, medium: 640px, large: 1024px, + xlarge: 1200px, + xxlarge: 1440px, ); +$print-breakpoint: large; $breakpoint-classes: (small medium large); // 3. The Grid @@ -96,6 +124,7 @@ $grid-column-gutter: ( medium: 30px, ); $grid-column-align-edge: true; +$grid-column-alias: 'columns'; $block-grid-max: 8; // 4. Base Typography @@ -105,30 +134,29 @@ $header-font-family: $body-font-family; $header-font-weight: $global-weight-normal; $header-font-style: normal; $font-family-monospace: Consolas, 'Liberation Mono', Courier, monospace; -$font-family-serif: Georgia, 'Times New Roman', Times, serif; -$header-sizes: ( - small: ( - 'h1': 34, - 'h2': 24, - 'h3': 20, - 'h4': 18, - 'h5': 16, - 'h6': 14, - ), - medium: ( - 'h1': 44, - 'h2': 34, - 'h3': 24, - 'h4': 19, - 'h5': 16, - 'h6': 13, - ), -); $header-color: inherit; $header-lineheight: 1.4; $header-margin-bottom: 0.5rem; +$header-styles: ( + small: ( + 'h1': ('font-size': 24), + 'h2': ('font-size': 20), + 'h3': ('font-size': 19), + 'h4': ('font-size': 18), + 'h5': ('font-size': 17), + 'h6': ('font-size': 16), + ), + medium: ( + 'h1': ('font-size': 48), + 'h2': ('font-size': 40), + 'h3': ('font-size': 31), + 'h4': ('font-size': 25), + 'h5': ('font-size': 20), + 'h6': ('font-size': 16), + ), +); $header-text-rendering: optimizeLegibility; -$small-font-size: rem-calc(14); +$small-font-size: 80%; $header-small-font-color: $medium-gray; $paragraph-lineheight: 1.6; $paragraph-margin-bottom: 1rem; @@ -160,12 +188,13 @@ $blockquote-padding: rem-calc(9 20 0 19); $blockquote-border: 1px solid $medium-gray; $cite-font-size: rem-calc(13); $cite-color: $dark-gray; +$cite-pseudo-content: '\2014 \0020'; $keystroke-font: $font-family-monospace; $keystroke-color: $black; $keystroke-background: $light-gray; $keystroke-padding: rem-calc(2 4 0); $keystroke-radius: $global-radius; -$abbr-underline: none; +$abbr-underline: 1px dotted $black; // 5. Typography Helpers // --------------------- @@ -184,9 +213,9 @@ $stat-font-size: 2.5rem; $abide-inputs: true; $abide-labels: true; -$input-background-invalid: map-get($foundation-palette, alert); -$form-label-color-invalid: map-get($foundation-palette, alert); -$input-error-color: map-get($foundation-palette, alert); +$input-background-invalid: get-color(alert); +$form-label-color-invalid: get-color(alert); +$input-error-color: get-color(alert); $input-error-font-size: rem-calc(12); $input-error-font-weight: $global-weight-bold; @@ -195,25 +224,38 @@ $input-error-font-weight: $global-weight-bold; $accordion-background: $white; $accordion-plusminus: true; -$accordion-item-color: foreground($accordion-background, $primary-color); +$accordion-title-font-size: rem-calc(12); +$accordion-item-color: $primary-color; $accordion-item-background-hover: $light-gray; $accordion-item-padding: 1.25rem 1rem; $accordion-content-background: $white; $accordion-content-border: 1px solid $light-gray; -$accordion-content-color: foreground($accordion-background, $primary-color); +$accordion-content-color: $body-font-color; $accordion-content-padding: 1rem; // 8. Accordion Menu // ----------------- +$accordionmenu-padding: $global-menu-padding; +$accordionmenu-nested-margin: $global-menu-nested-margin; +$accordionmenu-submenu-padding: $accordionmenu-padding; $accordionmenu-arrows: true; $accordionmenu-arrow-color: $primary-color; +$accordionmenu-item-background: null; +$accordionmenu-border: null; +$accordionmenu-submenu-toggle-background: null; +$accordion-submenu-toggle-border: $accordionmenu-border; +$accordionmenu-submenu-toggle-width: 40px; +$accordionmenu-submenu-toggle-height: $accordionmenu-submenu-toggle-width; +$accordionmenu-arrow-size: 6px; // 9. Badge // -------- $badge-background: $primary-color; -$badge-color: foreground($badge-background); +$badge-color: $white; +$badge-color-alt: $black; +$badge-palette: $foundation-palette; $badge-padding: 0.3em; $badge-minwidth: 2.1em; $badge-font-size: 0.6rem; @@ -228,11 +270,15 @@ $breadcrumbs-item-color-current: $black; $breadcrumbs-item-color-disabled: $medium-gray; $breadcrumbs-item-margin: 0.75rem; $breadcrumbs-item-uppercase: true; -$breadcrumbs-item-slash: true; +$breadcrumbs-item-separator: true; +$breadcrumbs-item-separator-item: '/'; +$breadcrumbs-item-separator-item-rtl: '\\'; +$breadcrumbs-item-separator-color: $medium-gray; // 11. Button // ---------- +$button-font-family: inherit; $button-padding: 0.85em 1em; $button-margin: 0 0 $global-margin 0; $button-fill: solid; @@ -241,13 +287,18 @@ $button-background-hover: scale-color($button-background, $lightness: -15%); $button-color: $white; $button-color-alt: $black; $button-radius: $global-radius; +$button-hollow-border-width: 1px; $button-sizes: ( tiny: 0.6rem, small: 0.75rem, default: 0.9rem, large: 1.25rem, ); +$button-palette: $foundation-palette; $button-opacity-disabled: 0.25; +$button-background-hover-lightness: -20%; +$button-hollow-hover-lightness: -50%; +$button-transition: background-color 0.25s ease-out, color 0.25s ease-out; // 12. Button Group // ---------------- @@ -256,6 +307,7 @@ $buttongroup-margin: 1rem; $buttongroup-spacing: 1px; $buttongroup-child-selector: '.button'; $buttongroup-expand-max: 6; +$buttongroup-radius-on-each: true; // 13. Callout // ----------- @@ -270,29 +322,56 @@ $callout-font-color-alt: $body-background; $callout-radius: $global-radius; $callout-link-tint: 30%; -// 14. Close Button +// 14. Card +// -------- + +$card-background: $white; +$card-font-color: $body-font-color; +$card-divider-background: $light-gray; +$card-border: 1px solid $light-gray; +$card-shadow: none; +$card-border-radius: $global-radius; +$card-padding: $global-padding; +$card-margin-bottom: $global-margin; + +// 15. Close Button // ---------------- $closebutton-position: right top; -$closebutton-offset-horizontal: 1rem; -$closebutton-offset-vertical: 0.5rem; -$closebutton-size: 2em; +$closebutton-offset-horizontal: ( + small: 0.66rem, + medium: 1rem, +); +$closebutton-offset-vertical: ( + small: 0.33em, + medium: 0.5rem, +); +$closebutton-size: ( + small: 1.5em, + medium: 2em, +); $closebutton-lineheight: 1; $closebutton-color: $dark-gray; $closebutton-color-hover: $black; -// 15. Drilldown +// 16. Drilldown // ------------- $drilldown-transition: transform 0.15s linear; $drilldown-arrows: true; -$drilldown-arrow-color: $primary-color; +$drilldown-padding: $global-menu-padding; +$drilldown-nested-margin: 0; $drilldown-background: $white; +$drilldown-submenu-padding: $drilldown-padding; +$drilldown-submenu-background: $white; +$drilldown-arrow-color: $primary-color; +$drilldown-arrow-size: 6px; -// 16. Dropdown +// 17. Dropdown // ------------ $dropdown-padding: 1rem; +$dropdown-background: $body-background; $dropdown-border: 1px solid $medium-gray; $dropdown-font-size: 1rem; $dropdown-width: 300px; @@ -303,23 +382,30 @@ $dropdown-sizes: ( large: 400px, ); -// 17. Dropdown Menu +// 18. Dropdown Menu // ----------------- $dropdownmenu-arrows: true; $dropdownmenu-arrow-color: $anchor-color; +$dropdownmenu-arrow-size: 6px; +$dropdownmenu-arrow-padding: 1.5rem; $dropdownmenu-min-width: 200px; $dropdownmenu-background: $white; +$dropdownmenu-submenu-background: $dropdownmenu-background; +$dropdownmenu-padding: $global-menu-padding; +$dropdownmenu-nested-margin: 0; +$dropdownmenu-submenu-padding: $dropdownmenu-padding; $dropdownmenu-border: 1px solid $medium-gray; +$dropdown-menu-item-color-active: get-color(primary); +$dropdown-menu-item-background-active: transparent; -// 18. Flex Video -// -------------- +// 19. Flexbox Utilities +// --------------------- -$flexvideo-margin-bottom: rem-calc(16); -$flexvideo-ratio: 4 by 3; -$flexvideo-ratio-widescreen: 16 by 9; +$flex-source-ordering-count: 6; +$flexbox-responsive-breakpoints: true; -// 19. Forms +// 20. Forms // --------- $fieldset-border: 1px solid $medium-gray; @@ -345,45 +431,56 @@ $input-color: $black; $input-placeholder-color: $medium-gray; $input-font-family: inherit; $input-font-size: rem-calc(16); +$input-font-weight: $global-weight-normal; +$input-line-height: $global-lineheight; $input-background: $white; $input-background-focus: $white; $input-background-disabled: $light-gray; $input-border: 1px solid $medium-gray; $input-border-focus: 1px solid $dark-gray; +$input-padding: $form-spacing / 2; $input-shadow: inset 0 1px 2px rgba($black, 0.1); $input-shadow-focus: 0 0 5px $medium-gray; $input-cursor-disabled: not-allowed; $input-transition: box-shadow 0.5s, border-color 0.25s ease-in-out; $input-number-spinners: true; $input-radius: $global-radius; +$form-button-radius: $global-radius; -// 20. Label +// 21. Label // --------- $label-background: $primary-color; -$label-color: foreground($label-background); +$label-color: $white; +$label-color-alt: $black; +$label-palette: $foundation-palette; $label-font-size: 0.8rem; $label-padding: 0.33333rem 0.5rem; $label-radius: $global-radius; -// 21. Media Object +// 22. Media Object // ---------------- $mediaobject-margin-bottom: $global-margin; $mediaobject-section-padding: $global-padding; $mediaobject-image-width-stacked: 100%; -// 22. Menu +// 23. Menu // -------- $menu-margin: 0; -$menu-margin-nested: 1rem; -$menu-item-padding: 0.7rem 1rem; +$menu-nested-margin: $global-menu-nested-margin; +$menu-items-padding: $global-menu-padding; +$menu-simple-margin: 1rem; $menu-item-color-active: $white; -$menu-item-background-active: map-get($foundation-palette, primary); +$menu-item-background-active: get-color(primary); $menu-icon-spacing: 0.25rem; +$menu-item-background-hover: $light-gray; +$menu-state-back-compat: true; +$menu-centered-back-compat: true; +$menu-icons-back-compat: true; -// 23. Meter +// 24. Meter // --------- $meter-height: 1rem; @@ -393,20 +490,30 @@ $meter-fill-good: $success-color; $meter-fill-medium: $warning-color; $meter-fill-bad: $alert-color; -// 24. Off-canvas +// 25. Off-canvas // -------------- -$offcanvas-size: 250px; +$offcanvas-sizes: ( + small: 250px, +); +$offcanvas-vertical-sizes: ( + small: 250px, +); $offcanvas-background: $light-gray; -$offcanvas-zindex: -1; +$offcanvas-shadow: 0 0 10px rgba($black, 0.7); +$offcanvas-inner-shadow-size: 20px; +$offcanvas-inner-shadow-color: rgba($black, 0.25); +$offcanvas-overlay-zindex: 11; +$offcanvas-push-zindex: 12; +$offcanvas-overlap-zindex: 13; +$offcanvas-reveal-zindex: 12; $offcanvas-transition-length: 0.5s; $offcanvas-transition-timing: ease; $offcanvas-fixed-reveal: true; $offcanvas-exit-background: rgba($white, 0.25); $maincontent-class: 'off-canvas-content'; -$maincontent-shadow: 0 0 10px rgba($black, 0.5); -// 25. Orbit +// 26. Orbit // --------- $orbit-bullet-background: $medium-gray; @@ -421,7 +528,7 @@ $orbit-control-background-hover: rgba($black, 0.5); $orbit-control-padding: 1rem; $orbit-control-zindex: 10; -// 26. Pagination +// 27. Pagination // -------------- $pagination-font-size: rem-calc(14); @@ -432,13 +539,14 @@ $pagination-item-spacing: rem-calc(1); $pagination-radius: $global-radius; $pagination-item-background-hover: $light-gray; $pagination-item-background-current: $primary-color; -$pagination-item-color-current: foreground($pagination-item-background-current); +$pagination-item-color-current: $white; $pagination-item-color-disabled: $medium-gray; $pagination-ellipsis-color: $black; $pagination-mobile-items: false; +$pagination-mobile-current-item: false; $pagination-arrows: true; -// 27. Progress Bar +// 28. Progress Bar // ---------------- $progress-height: 1rem; @@ -447,7 +555,177 @@ $progress-margin-bottom: $global-margin; $progress-meter-background: $primary-color; $progress-radius: $global-radius; -// 28. Reveal +// 29. Prototype Arrow +// ------------------- + +$prototype-arrow-directions: ( + down, + up, + right, + left +); +$prototype-arrow-size: 0.4375rem; +$prototype-arrow-color: $black; + +// 30. Prototype Border-Box +// ------------------------ + +$prototype-border-box-breakpoints: $global-prototype-breakpoints; + +// 31. Prototype Border-None +// ------------------------- + +$prototype-border-none-breakpoints: $global-prototype-breakpoints; + +// 32. Prototype Bordered +// ---------------------- + +$prototype-bordered-breakpoints: $global-prototype-breakpoints; +$prototype-border-width: rem-calc(1); +$prototype-border-type: solid; +$prototype-border-color: $medium-gray; + +// 33. Prototype Display +// --------------------- + +$prototype-display-breakpoints: $global-prototype-breakpoints; +$prototype-display: ( + inline, + inline-block, + block, + table, + table-cell +); + +// 34. Prototype Font-Styling +// -------------------------- + +$prototype-font-breakpoints: $global-prototype-breakpoints; +$prototype-wide-letter-spacing: rem-calc(4); +$prototype-font-normal: $global-weight-normal; +$prototype-font-bold: $global-weight-bold; + +// 35. Prototype List-Style-Type +// ----------------------------- + +$prototype-list-breakpoints: $global-prototype-breakpoints; +$prototype-style-type-unordered: ( + disc, + circle, + square +); +$prototype-style-type-ordered: ( + decimal, + lower-alpha, + lower-latin, + lower-roman, + upper-alpha, + upper-latin, + upper-roman +); + +// 36. Prototype Overflow +// ---------------------- + +$prototype-overflow-breakpoints: $global-prototype-breakpoints; +$prototype-overflow: ( + visible, + hidden, + scroll +); + +// 37. Prototype Position +// ---------------------- + +$prototype-position-breakpoints: $global-prototype-breakpoints; +$prototype-position: ( + static, + relative, + absolute, + fixed +); +$prototype-position-z-index: 975; + +// 38. Prototype Rounded +// --------------------- + +$prototype-rounded-breakpoints: $global-prototype-breakpoints; +$prototype-border-radius: rem-calc(3); + +// 39. Prototype Separator +// ----------------------- + +$prototype-separator-breakpoints: $global-prototype-breakpoints; +$prototype-separator-align: center; +$prototype-separator-height: rem-calc(2); +$prototype-separator-width: 3rem; +$prototype-separator-background: $primary-color; +$prototype-separator-margin-top: $global-margin; + +// 40. Prototype Shadow +// -------------------- + +$prototype-shadow-breakpoints: $global-prototype-breakpoints; +$prototype-box-shadow: 0 2px 5px 0 rgba(0,0,0,.16), + 0 2px 10px 0 rgba(0,0,0,.12); + +// 41. Prototype Sizing +// -------------------- + +$prototype-sizing-breakpoints: $global-prototype-breakpoints; +$prototype-sizing: ( + width, + height +); +$prototype-sizes: ( + 25: 25%, + 50: 50%, + 75: 75%, + 100: 100% +); + +// 42. Prototype Spacing +// --------------------- + +$prototype-spacing-breakpoints: $global-prototype-breakpoints; +$prototype-spacers-count: 3; + +// 43. Prototype Text-Decoration +// ----------------------------- + +$prototype-decoration-breakpoints: $global-prototype-breakpoints; +$prototype-text-decoration: ( + overline, + underline, + line-through, +); + +// 44. Prototype Text-Transformation +// --------------------------------- + +$prototype-transformation-breakpoints: $global-prototype-breakpoints; +$prototype-text-transformation: ( + lowercase, + uppercase, + capitalize +); + +// 45. Prototype Text-Utilities +// ---------------------------- + +$prototype-utilities-breakpoints: $global-prototype-breakpoints; +$prototype-text-overflow: ellipsis; + +// 46. Responsive Embed +// -------------------- + +$responsive-embed-margin-bottom: rem-calc(16); +$responsive-embed-ratios: ( + default: 4 by 3, + widescreen: 16 by 9, +); + +// 47. Reveal // ---------- $reveal-background: $white; @@ -459,7 +737,7 @@ $reveal-radius: $global-radius; $reveal-zindex: 1005; $reveal-overlay-background: rgba($black, 0.45); -// 29. Slider +// 48. Slider // ---------- $slider-width-vertical: 0.5rem; @@ -473,7 +751,7 @@ $slider-handle-background: $primary-color; $slider-opacity-disabled: 0.25; $slider-radius: $global-radius; -// 30. Switch +// 49. Switch // ---------- $switch-background: $medium-gray; @@ -489,7 +767,7 @@ $switch-paddle-offset: 0.25rem; $switch-paddle-radius: $global-radius; $switch-paddle-transition: all 0.25s ease-out; -// 31. Table +// 50. Table // --------- $table-background: $white; @@ -499,29 +777,36 @@ $table-padding: rem-calc(8 10 10); $table-hover-scale: 2%; $table-row-hover: darken($table-background, $table-hover-scale); $table-row-stripe-hover: darken($table-background, $table-color-scale + $table-hover-scale); +$table-is-striped: true; $table-striped-background: smart-scale($table-background, $table-color-scale); $table-stripe: even; $table-head-background: smart-scale($table-background, $table-color-scale / 2); +$table-head-row-hover: darken($table-head-background, $table-hover-scale); $table-foot-background: smart-scale($table-background, $table-color-scale); +$table-foot-row-hover: darken($table-foot-background, $table-hover-scale); $table-head-font-color: $body-font-color; +$table-foot-font-color: $body-font-color; $show-header-for-stacked: false; +$table-stack-breakpoint: medium; -// 32. Tabs +// 51. Tabs // -------- $tab-margin: 0; $tab-background: $white; -$tab-background-active: $white; +$tab-color: $primary-color; +$tab-background-active: $light-gray; +$tab-active-color: $primary-color; $tab-item-font-size: rem-calc(12); $tab-item-background-hover: $white; $tab-item-padding: 1.25rem 1.5rem; $tab-expand-max: 6; $tab-content-background: $white; $tab-content-border: $light-gray; -$tab-content-color: foreground($tab-background, $primary-color); +$tab-content-color: $body-font-color; $tab-content-padding: 1rem; -// 33. Thumbnail +// 52. Thumbnail // ------------- $thumbnail-border: solid 4px $white; @@ -531,7 +816,7 @@ $thumbnail-shadow-hover: 0 0 6px 1px rgba($primary-color, 0.5); $thumbnail-transition: box-shadow 200ms ease-out; $thumbnail-radius: $global-radius; -// 34. Title Bar +// 53. Title Bar // ------------- $titlebar-background: $black; @@ -542,25 +827,42 @@ $titlebar-icon-color: $white; $titlebar-icon-color-hover: $medium-gray; $titlebar-icon-spacing: 0.25rem; -// 35. Tooltip +// 54. Tooltip // ----------- +$has-tip-cursor: help; $has-tip-font-weight: $global-weight-bold; $has-tip-border-bottom: dotted 1px $dark-gray; $tooltip-background-color: $black; $tooltip-color: $white; $tooltip-padding: 0.75rem; +$tooltip-max-width: 10rem; $tooltip-font-size: $small-font-size; $tooltip-pip-width: 0.75rem; $tooltip-pip-height: $tooltip-pip-width * 0.866; $tooltip-radius: $global-radius; -// 36. Top Bar +// 55. Top Bar // ----------- $topbar-padding: 0.5rem; $topbar-background: $light-gray; $topbar-submenu-background: $topbar-background; -$topbar-title-spacing: 1rem; +$topbar-title-spacing: 0.5rem 1rem 0.5rem 0; $topbar-input-width: 200px; $topbar-unstack-breakpoint: medium; + +// 56. Xy Grid +// ----------- + +$xy-grid: true; +$grid-container: $global-width; +$grid-columns: 12; +$grid-margin-gutters: ( + small: 20px, + medium: 30px +); +$grid-padding-gutters: $grid-margin-gutters; +$grid-container-padding: $grid-padding-gutters; +$grid-container-max: $global-width; +$xy-block-grid-max: 8; diff --git a/app/assets/stylesheets/browserslist b/app/assets/stylesheets/browserslist new file mode 100644 index 000000000..6019618a9 --- /dev/null +++ b/app/assets/stylesheets/browserslist @@ -0,0 +1,4 @@ +last 2 versions +ie >= 9 +Android >= 2.3 +ios >= 7 diff --git a/app/assets/stylesheets/foundation_and_overrides.scss b/app/assets/stylesheets/foundation_and_overrides.scss index 66640f3f2..99e77f57d 100644 --- a/app/assets/stylesheets/foundation_and_overrides.scss +++ b/app/assets/stylesheets/foundation_and_overrides.scss @@ -4,31 +4,38 @@ @import 'consul_settings'; @import 'custom_settings'; @import 'foundation'; + @import 'motion-ui/motion-ui'; @include foundation-global-styles; +// @include foundation-xy-grid-classes; @include foundation-grid; +// @include foundation-flex-grid; +// @include foundation-flex-classes; @include foundation-typography; -@include foundation-button; @include foundation-forms; -@include foundation-visibility-classes; -@include foundation-float-classes; +@include foundation-button; @include foundation-accordion; @include foundation-accordion-menu; +@include foundation-badge; @include foundation-breadcrumbs; @include foundation-button-group; @include foundation-callout; +@include foundation-card; @include foundation-close-button; +@include foundation-menu; +@include foundation-menu-icon; @include foundation-drilldown-menu; @include foundation-dropdown; @include foundation-dropdown-menu; -@include foundation-flex-video; +@include foundation-responsive-embed; @include foundation-label; @include foundation-media-object; -@include foundation-menu; @include foundation-off-canvas; +@include foundation-orbit; @include foundation-pagination; @include foundation-progress-bar; +@include foundation-slider; @include foundation-sticky; @include foundation-reveal; @include foundation-switch; @@ -36,9 +43,9 @@ @include foundation-tabs; @include foundation-thumbnail; @include foundation-title-bar; +@include foundation-tooltip; @include foundation-top-bar; -@include foundation-menu-icon; -@include foundation-orbit; - +@include foundation-visibility-classes; +@include foundation-float-classes; @include motion-ui-transitions; @include motion-ui-animations; From 771ef3d9e1bc6bf6317ef0ab29b5774820aa2fc1 Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 9 Apr 2018 18:02:37 +0200 Subject: [PATCH 14/71] Adds custom consul settings --- app/assets/javascripts/application.js | 2 - app/assets/stylesheets/_consul_settings.scss | 41 +++++++++++++++++++- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index b809585dc..1c97069b0 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -132,5 +132,3 @@ $(function(){ $(document).on('page:load', initialize_modules); $(document).on('ajax:complete', initialize_modules); }); - -$(function(){ $(document).foundation(); }); diff --git a/app/assets/stylesheets/_consul_settings.scss b/app/assets/stylesheets/_consul_settings.scss index 1f03c9be7..537cdbbf9 100644 --- a/app/assets/stylesheets/_consul_settings.scss +++ b/app/assets/stylesheets/_consul_settings.scss @@ -10,7 +10,7 @@ // 1. CONSUL variables // -------------------- -$base-font-size: rem-calc(17); +$base-font-size: 17px; $base-line: rem-calc(26); $small-font-size: rem-calc(14); $line-height: rem-calc(24); @@ -65,10 +65,47 @@ $alert-bg: #f2dede; $alert-border: #ebccd1; $color-alert: #a94442; - // 2. Foundation settings overrides // --------------------------------- +$black: #222; +$white: #fff; + +$body-font-family: 'Source Sans Pro', 'Helvetica', 'Arial', sans-serif !important; + +$header-font-family: $body-font-family; + +$global-radius: rem-calc(3); + +$button-radius: $global-radius; + +$font-family-serif: Georgia, 'Times New Roman', Times, serif; + +$header-sizes: ( + small: ( + 'h1': 34, + 'h2': 24, + 'h3': 20, + 'h4': 18, + 'h5': 16, + 'h6': 14, + ), + medium: ( + 'h1': 44, + 'h2': 34, + 'h3': 24, + 'h4': 19, + 'h5': 16, + 'h6': 13, + ), +); + +$small-font-size: rem-calc(14); + +$abbr-underline: none; + +$tab-background-active: $white; + $accordion-item-color: foreground($accordion-background, $text); $accordion-content-color: foreground($accordion-background, $text); From fcae2c0ac23b4e808f48e90e16d02739855a092d Mon Sep 17 00:00:00 2001 From: decabeza Date: Mon, 9 Apr 2018 18:03:11 +0200 Subject: [PATCH 15/71] Updates top bar html and styles --- app/assets/stylesheets/layout.scss | 63 +++++++++++------- app/views/layouts/_header.html.erb | 70 ++++++++++++-------- app/views/shared/_admin_login_items.html.erb | 4 +- 3 files changed, 84 insertions(+), 53 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 3a0b73864..5b78fa374 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -436,8 +436,6 @@ header { .top-bar { background: $brand !important; color: #fff; - height: $line-height * 2; - line-height: $line-height * 2; padding-bottom: 0; padding-top: 0; @@ -445,30 +443,44 @@ header { padding: 0; } - .top-bar-title a { - @include logo; - line-height: rem-calc(80); - - @include breakpoint(medium) { - line-height: rem-calc(80); - } - - &:hover { - text-decoration: none; - } - } - ul { background: none; padding-right: rem-calc(15); } + .menu .menu-text { + padding: 0; + + a { + color: #fff; + display: inline-block; + font-family: 'Lato' !important; + font-size: rem-calc(24); + font-weight: lighter; + line-height: $line-height * 2; + padding: 0; + + @include breakpoint(medium) { + line-height: rem-calc(80); + margin-top: 0; + } + + img { + + @include breakpoint(medium) { + margin-right: $line-height / 2; + margin-top: 0; + } + } + } + } + .menu > li { display: block; + width: 100%; @include breakpoint(medium) { - display: table-cell; - height: $line-height * 3.5; + width: auto; } a { @@ -492,13 +504,11 @@ header { } } - .menu-icon.dark { - height: 20px; + .has-submenu { - &::after, - &:hover::after { - background: #fff; - box-shadow: 0 7px 0 #fff, 0 14px 0 #fff; + &.is-active a { + color: #fff; + font-weight: bold; } } @@ -507,7 +517,7 @@ header { &.is-dropdown-submenu { background: #fff; margin: 0; - margin-top: rem-calc(-24); + margin-top: rem-calc(-12); padding: 0; z-index: 9; } @@ -524,6 +534,11 @@ header { } } +.title-bar { + background: none; + float: right; +} + .dropdown.menu > li { &.is-dropdown-submenu-parent > a::after { diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index a73a99509..8b4c0a171 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -10,37 +10,53 @@
+
+ +
<%= t("application.menu")%>
+
+
- - <%= link_to setting['org_name'], root_path, class: "logo show-for-small-only" %> - - - - <%= t("application.menu")%> - - -
-
- <%= link_to root_path, class: "hide-for-small-only", accesskey: "0" do %> - <%= image_tag(image_path_for('logo_header.png'), class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %> - <%= setting['org_name'] %> +
+ + +
-
- +
+
+ +
-
- +
+ +
+ +
+
diff --git a/app/views/shared/_admin_login_items.html.erb b/app/views/shared/_admin_login_items.html.erb index a9e6fa4b9..3fbb34fcc 100644 --- a/app/views/shared/_admin_login_items.html.erb +++ b/app/views/shared/_admin_login_items.html.erb @@ -1,7 +1,7 @@ <% if show_admin_menu? %> -
  • +
  • <%= link_to t("layouts.header.administration_menu"), "#", rel: "nofollow", class: "hide-for-small-only" %> -