From 6bb4baa80972aa1817a9340bbdfac0c7688628f5 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Tue, 5 Jan 2016 17:07:27 +0100 Subject: [PATCH 01/12] Removes social icons from header --- app/assets/stylesheets/variables.scss | 4 ++-- app/views/layouts/_header.html.erb | 24 +++--------------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/app/assets/stylesheets/variables.scss b/app/assets/stylesheets/variables.scss index 72fb27788..d9da9c580 100644 --- a/app/assets/stylesheets/variables.scss +++ b/app/assets/stylesheets/variables.scss @@ -44,11 +44,11 @@ $line-height: rem-calc(24); // 02. Colors // - - - - - - - - - - - - - - - - - - - - - - - - - +$brand: #004A83; $body: #E9E9E9; $background: #EDEFF0; -$dark: #0B0C0C; $border: #DEE0E3; -$brand: #004A83; +$dark: darken($brand, 10%); $text: #222222; $text-medium: #999999; diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 98975bbaf..de706a66c 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -5,25 +5,7 @@ @@ -51,7 +33,7 @@ From 7eda0b2889c160ba587cf0bbf87f40b3fb5bced4 Mon Sep 17 00:00:00 2001 From: kikito Date: Tue, 5 Jan 2016 19:37:40 +0100 Subject: [PATCH 02/12] Uses order_links in proposals/index and debates/index --- app/views/debates/index.html.erb | 16 +--------------- app/views/proposals/index.html.erb | 16 +--------------- app/views/shared/_order_links.html.erb | 7 +++++++ 3 files changed, 9 insertions(+), 30 deletions(-) create mode 100644 app/views/shared/_order_links.html.erb diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb index b1a4b8007..16197f221 100644 --- a/app/views/debates/index.html.erb +++ b/app/views/debates/index.html.erb @@ -24,21 +24,7 @@ <% end %> - <% if @tag_filter || @search_terms %> -
-
- <%= t("debates.index.select_order") %> -
- <%= render 'shared/order_selector', i18n_namespace: "debates.index" %> -
- <% else %> -
-

- <%= t("debates.index.select_order_long") %> -

- <%= render 'shared/order_selector', i18n_namespace: "debates.index" %> -
- <% end %> + <%= render 'shared/order_links', i18n_namespace: "debates.index" %>
<%= link_to t("debates.index.start_debate"), new_debate_path, class: 'button radius expand' %> diff --git a/app/views/proposals/index.html.erb b/app/views/proposals/index.html.erb index 77a0a79a0..6db5e3fc1 100644 --- a/app/views/proposals/index.html.erb +++ b/app/views/proposals/index.html.erb @@ -24,21 +24,7 @@ <% end %>
- <% if @tag_filter || @search_terms %> -
-
- <%= t("proposals.index.select_order") %> -
- <%= render 'shared/order_selector', i18n_namespace: "proposals.index" %> -
- <% else %> -
-

- <%= t("proposals.index.select_order_long") %> -

- <%= render 'shared/order_selector', i18n_namespace: "proposals.index" %> -
- <% end %> + <%= render 'shared/order_links', i18n_namespace: "proposals.index" %>
<%= link_to t("proposals.index.start_proposal"), new_proposal_path, class: 'button radius expand' %> diff --git a/app/views/shared/_order_links.html.erb b/app/views/shared/_order_links.html.erb new file mode 100644 index 000000000..bea821859 --- /dev/null +++ b/app/views/shared/_order_links.html.erb @@ -0,0 +1,7 @@ + From b89f39bfef78e93ec906316a80748654a9d1f1eb Mon Sep 17 00:00:00 2001 From: kikito Date: Tue, 5 Jan 2016 19:37:56 +0100 Subject: [PATCH 03/12] Removes unused orders from debates controller --- app/controllers/debates_controller.rb | 2 +- app/controllers/proposals_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb index e28f053c7..824118c8d 100644 --- a/app/controllers/debates_controller.rb +++ b/app/controllers/debates_controller.rb @@ -7,7 +7,7 @@ class DebatesController < ApplicationController before_action :set_search_order, only: :index before_action :authenticate_user!, except: [:index, :show] - has_orders %w{hot_score confidence_score created_at most_commented random relevance}, only: :index + has_orders %w{hot_score confidence_score created_at relevance}, only: :index has_orders %w{most_voted newest oldest}, only: :show load_and_authorize_resource diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index cc8a286ec..4a5e17af3 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -7,7 +7,7 @@ class ProposalsController < ApplicationController before_action :set_search_order, only: :index before_action :authenticate_user!, except: [:index, :show] - has_orders %w{hot_score confidence_score created_at most_commented random relevance}, only: :index + has_orders %w{hot_score confidence_score created_at relevance}, only: :index has_orders %w{most_voted newest oldest}, only: :show load_and_authorize_resource From 9898353d998a3063e3aa57473e8a11f00ce4249f Mon Sep 17 00:00:00 2001 From: kikito Date: Tue, 5 Jan 2016 19:38:36 +0100 Subject: [PATCH 04/12] Fixes specs for debates and proposals --- spec/features/debates_spec.rb | 52 ++++------------------------- spec/features/proposals_spec.rb | 59 ++++----------------------------- 2 files changed, 14 insertions(+), 97 deletions(-) diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index 5c8f4f908..6ef03d06e 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -419,9 +419,9 @@ feature 'Debates' do create(:debate, title: 'Medium').update_column(:confidence_score, 5) visit debates_path - select 'highest rated', from: 'order-selector' + click_link 'highest rated' - expect(page).to have_selector('.js-order-selector[data-order="confidence_score"]') + expect(page).to have_selector('a.active', text: 'highest rated') within '#debates' do expect('Best').to appear_before('Medium') @@ -432,34 +432,15 @@ feature 'Debates' do expect(current_url).to include('page=1') end - scenario 'Debates are ordered by most commented', :js do - create(:debate, title: 'Best', comments_count: 10) - create(:debate, title: 'Medium', comments_count: 5) - create(:debate, title: 'Worst', comments_count: 2) - - visit debates_path - select 'most commented', from: 'order-selector' - - expect(page).to have_selector('.js-order-selector[data-order="most_commented"]') - - within '#debates' do - expect('Best').to appear_before('Medium') - expect('Medium').to appear_before('Worst') - end - - expect(current_url).to include('order=most_commented') - expect(current_url).to include('page=1') - end - scenario 'Debates are ordered by newest', :js do create(:debate, title: 'Best', created_at: Time.now) create(:debate, title: 'Medium', created_at: Time.now - 1.hour) create(:debate, title: 'Worst', created_at: Time.now - 1.day) visit debates_path - select 'newest', from: 'order-selector' + click_link 'newest' - expect(page).to have_selector('.js-order-selector[data-order="created_at"]') + expect(page).to have_selector('a.active', text: 'newest') within '#debates' do expect('Best').to appear_before('Medium') @@ -469,25 +450,6 @@ feature 'Debates' do expect(current_url).to include('order=created_at') expect(current_url).to include('page=1') end - - scenario 'Debates are ordered randomly', :js do - create_list(:debate, 12) - visit debates_path - - select 'random', from: 'order-selector' - expect(page).to have_selector('.js-order-selector[data-order="random"]') - debates_first_time = find("#debates").text - - select 'most commented', from: 'order-selector' - expect(page).to have_selector('.js-order-selector[data-order="most_commented"]') - - select 'random', from: 'order-selector' - expect(page).to have_selector('.js-order-selector[data-order="random"]') - debates_second_time = find("#debates").text - - expect(debates_first_time).to_not eq(debates_second_time) - expect(current_url).to include('page=1') - end end scenario 'Debate index search' do @@ -524,7 +486,7 @@ feature 'Debates' do fill_in "search", with: "Show what you got" click_button "Search" - expect(page).to have_selector('.js-order-selector[data-order="relevance"]') + expect(page).to have_selector('a.active', text: "relevance") within("#debates") do expect(all(".debate")[0].text).to match "Show what you got" @@ -543,8 +505,8 @@ feature 'Debates' do fill_in "search", with: "Show what you got" click_button "Search" - select 'newest', from: 'order-selector' - expect(page).to have_selector('.js-order-selector[data-order="created_at"]') + click_link "newest" + expect(page).to have_selector('a.active', text: "Newest") within("#debates") do expect(all(".debate")[0].text).to match "Show you got" diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index b8c2cce05..e6938a432 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -482,9 +482,8 @@ feature 'Proposals' do create(:proposal, title: 'Medium proposal').update_column(:confidence_score, 5) visit proposals_path - select 'highest rated', from: 'order-selector' - - expect(page).to have_selector('.js-order-selector[data-order="confidence_score"]') + click_link 'highest rated' + expect(page).to have_selector('a.active', text: 'highest rated') within '#proposals' do expect('Best proposal').to appear_before('Medium proposal') @@ -495,27 +494,6 @@ feature 'Proposals' do expect(current_url).to include('page=1') end - scenario 'Proposals are ordered by most commented', :js do - create_featured_proposals - - create(:proposal, title: 'Best proposal', comments_count: 10) - create(:proposal, title: 'Medium proposal', comments_count: 5) - create(:proposal, title: 'Worst proposal', comments_count: 2) - - visit proposals_path - select 'most commented', from: 'order-selector' - - expect(page).to have_selector('.js-order-selector[data-order="most_commented"]') - - within '#proposals' do - expect('Best proposal').to appear_before('Medium proposal') - expect('Medium proposal').to appear_before('Worst proposal') - end - - expect(current_url).to include('order=most_commented') - expect(current_url).to include('page=1') - end - scenario 'Proposals are ordered by newest', :js do create_featured_proposals @@ -524,9 +502,8 @@ feature 'Proposals' do create(:proposal, title: 'Worst proposal', created_at: Time.now - 1.day) visit proposals_path - select 'newest', from: 'order-selector' - - expect(page).to have_selector('.js-order-selector[data-order="created_at"]') + click_link 'newest' + expect(page).to have_selector('a.active', text: 'newest') within '#proposals' do expect('Best proposal').to appear_before('Medium proposal') @@ -536,27 +513,6 @@ feature 'Proposals' do expect(current_url).to include('order=created_at') expect(current_url).to include('page=1') end - - scenario 'Proposals are ordered randomly', :js do - create_featured_proposals - - create_list(:proposal, 12) - visit proposals_path - - select 'random', from: 'order-selector' - expect(page).to have_selector('.js-order-selector[data-order="random"]') - proposals_first_time = find("#proposals").text - - select 'most commented', from: 'order-selector' - expect(page).to have_selector('.js-order-selector[data-order="most_commented"]') - - select 'random', from: 'order-selector' - expect(page).to have_selector('.js-order-selector[data-order="random"]') - proposals_second_time = find("#proposals").text - - expect(proposals_first_time).to_not eq(proposals_second_time) - expect(current_url).to include('page=1') - end end scenario 'Proposal index search' do @@ -593,7 +549,7 @@ feature 'Proposals' do fill_in "search", with: "Show what you got" click_button "Search" - expect(page).to have_selector('.js-order-selector[data-order="relevance"]') + expect(page).to have_selector("a.active", text: "relevance") within("#proposals") do expect(all(".proposal")[0].text).to match "Show what you got" @@ -611,9 +567,8 @@ feature 'Proposals' do visit proposals_path fill_in "search", with: "Show what you got" click_button "Search" - - select 'newest', from: 'order-selector' - expect(page).to have_selector('.js-order-selector[data-order="created_at"]') + click_link 'newest' + expect(page).to have_selector("a.active", text: "newest") within("#proposals") do expect(all(".proposal")[0].text).to match "Show you got" From 8a594e673a89c872f810320d5f7d6f281a7d11a5 Mon Sep 17 00:00:00 2001 From: kikito Date: Tue, 5 Jan 2016 19:39:59 +0100 Subject: [PATCH 05/12] modifies i18n for the new orders --- config/locales/en.yml | 2 -- config/locales/es.yml | 22 ++++++++++------------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ee698c91..acde32014 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -88,7 +88,6 @@ en: hot_score: "most active" created_at: "newest" most_commented: "most commented" - random: "random" relevance: "relevance" filter_topic: one: " with topic '%{topic}'" @@ -165,7 +164,6 @@ en: hot_score: "most active" created_at: "newest" most_commented: "most commented" - random: "random" relevance: "relevance" filter_topic: one: " with topic '%{topic}'" diff --git a/config/locales/es.yml b/config/locales/es.yml index 46bb3b88b..ed88a4609 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -84,12 +84,11 @@ es: select_order: "Ordenar por" select_order_long: "Estás viendo los debates" orders: - confidence_score: "mejor valorados" - hot_score: "más activos" - created_at: "más nuevos" - most_commented: "más comentados" - random: "aleatorio" - relevance: "relevancia" + confidence_score: "Mejor valorados" + hot_score: "Más activos hoy" + created_at: "Nuevos" + most_commented: "Más comentados" + relevance: "Más relevantes" filter_topic: one: " con el tema '%{topic}'" other: " con el tema '%{topic}'" @@ -161,12 +160,11 @@ es: select_order: "Ordenar por" select_order_long: "Estás viendo las propuestas" orders: - confidence_score: "más apoyadas" - hot_score: "más activas hoy" - created_at: "más nuevas" - most_commented: "más comentadas" - random: "aleatorias" - relevance: "relevancia" + confidence_score: "Más apoyadas" + hot_score: "Más activas hoy" + created_at: "Nuevas" + most_commented: "Más comentadas" + relevance: "Más relevantes" filter_topic: one: " con el tema '%{topic}'" other: " con el tema '%{topic}'" From 2948a2ebe4dfe8383e79c137a4315e2ccc3ca066 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Thu, 7 Jan 2016 12:05:05 +0100 Subject: [PATCH 06/12] Improves search form of header --- app/assets/stylesheets/layout.scss | 48 +++++++++++------------------- app/assets/stylesheets/mixins.scss | 7 +++-- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 4 files changed, 23 insertions(+), 36 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index d47189d18..95dd958f6 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -232,14 +232,13 @@ header { } .selected { - border-bottom: 2px solid white; - padding-bottom: $line-height/12; + border-bottom: 1px solid white; position: relative; } .locale { float: none; - font-family: $font-sans; + height: $line-height*1.5; @media (min-width: $small-breakpoint) { float: left; @@ -264,7 +263,20 @@ header { } .postfix { + background: $border; + border: 1px solid #ccc; + border-left: 0; + color: $text; height: rem-calc(37); + + &:hover { + background: $brand; + color: white; + } + } + + input { + border-right: 0; } input, .button { @@ -456,11 +468,6 @@ header { @media (min-width: $small-breakpoint) { background: white; - padding-left: 0; - - & > .column { - padding-left: 0; - } } a { @@ -475,7 +482,6 @@ header { @media (min-width: $small-breakpoint) { color: $text; font-weight: bold; - margin-left: $line-height/2; margin-right: $line-height*1.5; margin-right: 12px\9; width: auto; @@ -1201,34 +1207,14 @@ table { } .social { - margin-top: $line-height; - padding-top: $line-height/4; - text-align: center; - vertical-align: middle; - - @media (min-width: $small-breakpoint) { - margin-top: 0; - text-align: right; - } a { - font-size: rem-calc(24); - line-height: $line-height; + font-size: $h3-font-size; margin: 0 $line-height/2; text-decoration: none; - vertical-align: middle; &:hover { - opacity: .5; - text-decoration: none; - } - - @media (min-width: $small-breakpoint) { - font-size: rem-calc(18); - } - - &:last-child { - margin-right: 0; + color: $brand; } } } diff --git a/app/assets/stylesheets/mixins.scss b/app/assets/stylesheets/mixins.scss index f913ed464..3b2bde372 100644 --- a/app/assets/stylesheets/mixins.scss +++ b/app/assets/stylesheets/mixins.scss @@ -18,8 +18,9 @@ font-weight: lighter; @media (min-width: $small-breakpoint) { - font-size: rem-calc(24); - line-height: rem-calc(48); + font-size: $h3-font-size; + line-height: $line-height*2; + margin-top: 0; } img { @@ -28,7 +29,7 @@ @media (min-width: $small-breakpoint) { height: 80px; - margin-right: rem-calc(12); + margin-right: $line-height/2; margin-top: 0; width: 80px; } diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ee698c91..7c17e5b46 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -173,7 +173,7 @@ en: search_form: title: "Search" button: "Search" - placeholder: "Search citizen proposals..." + placeholder: "Search proposals..." search_results: one: " containing the term '%{search_term}'" other: " containing the term '%{search_term}'" diff --git a/config/locales/es.yml b/config/locales/es.yml index 46bb3b88b..1778ebd46 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -173,7 +173,7 @@ es: search_form: title: "Buscar" button: "Buscar" - placeholder: "Buscar propuestas ciudadanas..." + placeholder: "Buscar propuestas..." search_results: one: " que contiene '%{search_term}'" other: " que contienen '%{search_term}'" From 2467ee4a54d8d1e2651818095206dff33530791c Mon Sep 17 00:00:00 2001 From: kikito Date: Thu, 7 Jan 2016 12:37:16 +0100 Subject: [PATCH 07/12] removes unused i18n keys --- app/views/shared/_order_selector.html.erb | 2 +- config/i18n-tasks.yml | 2 ++ config/locales/en.yml | 3 +-- config/locales/es.yml | 3 +-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/shared/_order_selector.html.erb b/app/views/shared/_order_selector.html.erb index e120e98e5..cd3e2cbd5 100644 --- a/app/views/shared/_order_selector.html.erb +++ b/app/views/shared/_order_selector.html.erb @@ -1,5 +1,5 @@
- +