diff --git a/.gitignore b/.gitignore
index d04dbfeb8..f4b9c99fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@
/coverage
/config/beta-testers.txt
+.byebug_history
# Mac finder artifacts
.DS_Store
diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss
index 329ab5a0e..0698ee129 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 {
@@ -445,7 +457,7 @@ header {
}
}
-.subnavigation-container {
+.subnavigation-background {
background: white;
height: rem-calc(50);
margin-top: rem-calc(-50);
@@ -456,17 +468,11 @@ header {
@media (min-width: $small-breakpoint) {
background: white;
- padding-left: 0;
-
- & > .column {
- padding-left: 0;
- }
}
a {
color: white;
display: inline-block;
- font-family: $font-sans;
line-height: $line-height*2;
position: relative;
text-align: left;
@@ -475,7 +481,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;
@@ -496,6 +501,35 @@ header {
}
}
+.submenu {
+ background: white;
+ border-bottom: 1px solid $border;
+ clear: both;
+ margin: $line-height 0 $line-height/2;
+
+ a {
+ color: $text;
+ display: inline-block;
+ font-weight: bold;
+ margin-right: $line-height/2;
+ position: relative;
+ text-align: left;
+
+ @media (min-width: $small-breakpoint) {
+ margin-right: $line-height*1.5;
+ }
+
+ &:hover {
+ color: $link;
+ }
+
+ &.active {
+ border-bottom: 2px solid $brand;
+ color: $brand;
+ }
+ }
+}
+
// 03. Footer
// - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -559,18 +593,17 @@ footer {
.tags, .tag-cloud {
a {
- background: $border;
+ background: #ececec;
border-radius: rem-calc(6);
- color: #4d4d4d;
+ color: $text;
display: inline-block;
font-size: $small-font-size;
margin-bottom: $line-height/3;
- padding: 0 $line-height/3;
+ padding: $line-height/4 $line-height/3;
+ text-decoration: none;
&:hover {
- color: $link;
- cursor: pointer;
- background: #E5F1F8;
+ background: #e0e0e0;
}
}
}
@@ -586,27 +619,6 @@ footer {
padding-top: $line-height/4;
text-transform: uppercase;
}
-
- a {
- background: white;
- border: 2px solid $border;
- padding: $line-height/4 $line-height/3;
-
- .label {
- color: white;
-
- &.info {
- background: rgba(0,0,0,.5);
- }
- }
-
- &:hover {
-
- .label {
- background: $brand;
- }
- }
- }
}
// 05. Auth pages
@@ -1272,34 +1284,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/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss
index 57110299c..c7d296744 100644
--- a/app/assets/stylesheets/participation.scss
+++ b/app/assets/stylesheets/participation.scss
@@ -824,7 +824,7 @@
}
.featured-debates-container, .featured-proposals-container {
- margin: 0 !important;
+ margin: $line-height 0 !important;
h2 {
font-size: rem-calc(24);
diff --git a/app/assets/stylesheets/variables.scss b/app/assets/stylesheets/variables.scss
index 336b09919..6a61ec72c 100644
--- a/app/assets/stylesheets/variables.scss
+++ b/app/assets/stylesheets/variables.scss
@@ -45,11 +45,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/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
diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb
index b1a4b8007..3312fa0e7 100644
--- a/app/views/debates/index.html.erb
+++ b/app/views/debates/index.html.erb
@@ -24,30 +24,16 @@
<% 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" %>
-
+ <% unless @tag_filter || @search_terms %>
+ <%= render "featured_debates_static" %>
<% end %>
+ <%= render 'shared/order_links', i18n_namespace: "debates.index" %>
+
<%= link_to t("debates.index.start_debate"), new_debate_path, class: 'button radius expand' %>
- <% unless @tag_filter || @search_terms %>
- <%= render "featured_debates_static" %>
- <% end %>
-
<%= render @debates %>
<%= paginate @debates %>
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index 98975bbaf..78899aba5 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -5,25 +5,7 @@
<%= link_to t("layouts.header.participation_html"), root_path, class: ("selected" unless current_page?("/opendata")) %> |
<%= link_to t("layouts.header.external_link_transparency"), t("layouts.header.external_link_transparency_url") %> |
- <%= link_to t("layouts.header.external_link_opendata"), "/opendata", class: ("selected" if current_page?("/opendata")) %> |
-
- <%= link_to "https://twitter.com/abriendomadrid", target: "_blank", title: t("social.twitter") do %>
- <%= t("social.twitter") %>
-
- <% end %>
- <%= link_to "https://www.facebook.com/Abriendo-Madrid-1475577616080350/", target: "_blank", title: t("social.facebook") do %>
- <%= t("social.facebook") %>
-
- <% end %>
- <%= link_to "/blog", target: "_blank", title: t("social.blog") do %>
- <%= t("social.blog") %>
-
- <% end %>
- <%= link_to "https://www.youtube.com/channel/UCFmaChI9quIY7lwHplnacfg", target: "_blank", title: t("social.youtube") do %>
- <%= t("social.youtube") %>
-
- <% end %>
-
+ <%= link_to t("layouts.header.external_link_opendata"), "/opendata", class: ("selected" if current_page?("/opendata")) %>
@@ -51,7 +33,7 @@
-
+
<%= link_to t("layouts.header.debates"), debates_path, class: ("active" if current_page?(controller: "/debates")) %>
<%= link_to t("layouts.header.proposals"), proposals_path, class: ("active" if current_page?(controller: "/proposals")) %>
<%= link_to t("layouts.header.more_information"), page_path('more_information'), class: ("active" if current_page?("/more_information")) %>
@@ -60,14 +42,14 @@
<% end %>
-
+
<%= yield :header_addon %>
-
+
<% if home_page? %>
diff --git a/app/views/proposals/index.html.erb b/app/views/proposals/index.html.erb
index 77a0a79a0..d7fdadee9 100644
--- a/app/views/proposals/index.html.erb
+++ b/app/views/proposals/index.html.erb
@@ -24,26 +24,6 @@
<% 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 %>
-
-
- <%= link_to t("proposals.index.start_proposal"), new_proposal_path, class: 'button radius expand' %>
-
-
<% if @featured_proposals.present? %>
@@ -62,6 +42,12 @@
<% end %>
+ <%= render 'shared/order_links', i18n_namespace: "proposals.index" %>
+
+
+ <%= link_to t("proposals.index.start_proposal"), new_proposal_path, class: 'button radius expand' %>
+
+
<%= render partial: 'proposals/proposal', collection: @proposals %>
<%= paginate @proposals %>
diff --git a/app/views/shared/_order_links.html.erb b/app/views/shared/_order_links.html.erb
new file mode 100644
index 000000000..1e8554916
--- /dev/null
+++ b/app/views/shared/_order_links.html.erb
@@ -0,0 +1,7 @@
+
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 @@
diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml
index 5668ee2ce..081619394 100644
--- a/config/i18n-tasks.yml
+++ b/config/i18n-tasks.yml
@@ -121,8 +121,10 @@ ignore_unused:
- 'moderation.debates.index.filter*'
- 'moderation.debates.index.order*'
- 'users.show.filters.*'
+ - 'debates.index.select_order'
- 'debates.index.orders.*'
- 'debates.index.search_form.*'
+ - 'proposals.index.select_order'
- 'proposals.index.orders.*'
- 'proposals.index.search_form.*'
- 'notifications.index.commented_on_your_debate'
diff --git a/config/locales/en.yml b/config/locales/en.yml
index d46c6f5ab..e8d82bcf8 100755
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -84,13 +84,11 @@ en:
featured_debates_html: "Featured
debates"
start_debate: "Start a debate"
select_order: "Order by"
- select_order_long: "You are viewing debates according to:"
orders:
confidence_score: "highest rated"
hot_score: "most active"
created_at: "newest"
most_commented: "most commented"
- random: "random"
relevance: "relevance"
filter_topic:
one: " with topic '%{topic}'"
@@ -160,14 +158,13 @@ en:
title: "Proposals"
featured_proposals_html: "Featured
proposals"
start_proposal: "Create a proposal"
- select_order: "Order by"
select_order_long: "You are viewing proposals according to:"
+ select_order: "Order by"
orders:
confidence_score: "highest rated"
hot_score: "most active"
created_at: "newest"
most_commented: "most commented"
- random: "random"
relevance: "relevance"
filter_topic:
one: " with topic '%{topic}'"
@@ -175,7 +172,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 531456d8f..6d6f9a72b 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -84,14 +84,12 @@ es:
featured_debates_html: "Debates
destacados"
start_debate: "Empieza un debate"
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}'"
@@ -160,22 +158,21 @@ es:
title: "Propuestas ciudadanas"
featured_proposals_html: "Propuestas
destacadas"
start_proposal: "Crea una propuesta"
+ select_order_long: "Estas viendo las propuestas"
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}'"
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}'"
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"
diff --git a/spec/features/tags_spec.rb b/spec/features/tags_spec.rb
index 2bd729448..3f57c6b91 100644
--- a/spec/features/tags_spec.rb
+++ b/spec/features/tags_spec.rb
@@ -63,10 +63,10 @@ feature 'Tags' do
visit debates_path
within(:css, "#tag-cloud") do
- expect(page.find("a:eq(1)")).to have_content("Economía 10")
- expect(page.find("a:eq(2)")).to have_content("Corrupción 5")
- expect(page.find("a:eq(3)")).to have_content("Educación 5")
- expect(page.find("a:eq(4)")).to have_content("Medio Ambiente 1")
+ expect(page.find("a:eq(1)")).to have_content("Economía (10)")
+ expect(page.find("a:eq(2)")).to have_content("Corrupción (5)")
+ expect(page.find("a:eq(3)")).to have_content("Educación (5)")
+ expect(page.find("a:eq(4)")).to have_content("Medio Ambiente (1)")
end
end