Merge branch 'master' into notifications
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -24,6 +24,7 @@
|
||||
/coverage
|
||||
|
||||
/config/beta-testers.txt
|
||||
.byebug_history
|
||||
|
||||
# Mac finder artifacts
|
||||
.DS_Store
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -824,7 +824,7 @@
|
||||
}
|
||||
|
||||
.featured-debates-container, .featured-proposals-container {
|
||||
margin: 0 !important;
|
||||
margin: $line-height 0 !important;
|
||||
|
||||
h2 {
|
||||
font-size: rem-calc(24);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -24,30 +24,16 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if @tag_filter || @search_terms %>
|
||||
<div class="small-12 medium-5 margin-top inline-block debates-order">
|
||||
<h6 class="inline-block">
|
||||
<%= t("debates.index.select_order") %>
|
||||
</h6>
|
||||
<%= render 'shared/order_selector', i18n_namespace: "debates.index" %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="small-12 inline-block">
|
||||
<h2 class="inline-block">
|
||||
<%= t("debates.index.select_order_long") %>
|
||||
</h2>
|
||||
<%= render 'shared/order_selector', i18n_namespace: "debates.index" %>
|
||||
</div>
|
||||
<% unless @tag_filter || @search_terms %>
|
||||
<%= render "featured_debates_static" %>
|
||||
<% end %>
|
||||
|
||||
<%= render 'shared/order_links', i18n_namespace: "debates.index" %>
|
||||
|
||||
<div class="show-for-small-only">
|
||||
<%= link_to t("debates.index.start_debate"), new_debate_path, class: 'button radius expand' %>
|
||||
</div>
|
||||
|
||||
<% unless @tag_filter || @search_terms %>
|
||||
<%= render "featured_debates_static" %>
|
||||
<% end %>
|
||||
|
||||
<%= render @debates %>
|
||||
<%= paginate @debates %>
|
||||
</div>
|
||||
|
||||
@@ -5,25 +5,7 @@
|
||||
<div class="external-links">
|
||||
<%= 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")) %> |
|
||||
<div class="social inline-block">
|
||||
<%= link_to "https://twitter.com/abriendomadrid", target: "_blank", title: t("social.twitter") do %>
|
||||
<span class="sr-only"><%= t("social.twitter") %></span>
|
||||
<i class="icon-twitter"></i>
|
||||
<% end %>
|
||||
<%= link_to "https://www.facebook.com/Abriendo-Madrid-1475577616080350/", target: "_blank", title: t("social.facebook") do %>
|
||||
<span class="sr-only"><%= t("social.facebook") %></span>
|
||||
<i class="icon-facebook"></i>
|
||||
<% end %>
|
||||
<%= link_to "/blog", target: "_blank", title: t("social.blog") do %>
|
||||
<span class="sr-only"><%= t("social.blog") %></span>
|
||||
<i class="icon-blog"></i>
|
||||
<% end %>
|
||||
<%= link_to "https://www.youtube.com/channel/UCFmaChI9quIY7lwHplnacfg", target: "_blank", title: t("social.youtube") do %>
|
||||
<span class="sr-only"><%= t("social.youtube") %></span>
|
||||
<i class="icon-youtube"></i>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= link_to t("layouts.header.external_link_opendata"), "/opendata", class: ("selected" if current_page?("/opendata")) %>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -51,7 +33,7 @@
|
||||
</section>
|
||||
|
||||
<section class="subnavigation row">
|
||||
<div class="small-12 medium-8 column">
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= 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 @@
|
||||
<small><i class="icon-external"></i></small>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="small-12 medium-4 column right">
|
||||
<div class="small-12 medium-3 column">
|
||||
<%= yield :header_addon %>
|
||||
</div>
|
||||
</section>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="row-full subnavigation-container"></div>
|
||||
<div class="row-full subnavigation-background"></div>
|
||||
|
||||
<% if home_page? %>
|
||||
<div class="row home-page">
|
||||
|
||||
@@ -24,26 +24,6 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if @tag_filter || @search_terms %>
|
||||
<div class="small-12 medium-5 margin-top margin-top inline-block proposals-order">
|
||||
<h6 class="inline-block">
|
||||
<%= t("proposals.index.select_order") %>
|
||||
</h6>
|
||||
<%= render 'shared/order_selector', i18n_namespace: "proposals.index" %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="small-12 inline-block">
|
||||
<h2 class="inline-block">
|
||||
<%= t("proposals.index.select_order_long") %>
|
||||
</h2>
|
||||
<%= render 'shared/order_selector', i18n_namespace: "proposals.index" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="show-for-small-only">
|
||||
<%= link_to t("proposals.index.start_proposal"), new_proposal_path, class: 'button radius expand' %>
|
||||
</div>
|
||||
|
||||
<% if @featured_proposals.present? %>
|
||||
<div id="featured-proposals" class="row featured-proposals-container">
|
||||
<div class="small-12 medium-3 column">
|
||||
@@ -62,6 +42,12 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render 'shared/order_links', i18n_namespace: "proposals.index" %>
|
||||
|
||||
<div class="show-for-small-only">
|
||||
<%= link_to t("proposals.index.start_proposal"), new_proposal_path, class: 'button radius expand' %>
|
||||
</div>
|
||||
|
||||
<%= render partial: 'proposals/proposal', collection: @proposals %>
|
||||
<%= paginate @proposals %>
|
||||
</div>
|
||||
|
||||
7
app/views/shared/_order_links.html.erb
Normal file
7
app/views/shared/_order_links.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<section class="submenu">
|
||||
<% valid_orders.each do |order| %>
|
||||
<%= link_to t("#{i18n_namespace}.orders.#{order}"),
|
||||
current_path_with_query_params(order: order, page: 1),
|
||||
class: order == @current_order ? 'active' : '' %>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -1,5 +1,5 @@
|
||||
<form class="inline-block">
|
||||
<label for="order-selector-participation" class="sr-only"><%= t("debates.index.select_order") %></label>
|
||||
<label for="order-selector-participation" class="sr-only"><%= t("#{i18n_namespace}.select_order") %></label>
|
||||
<select class="js-location-changer js-order-selector select-order"
|
||||
data-order="<%= @current_order %>"
|
||||
name="order-selector"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<% tag_cloud @tag_cloud, %w[s m l] do |tag, css_class| %>
|
||||
<%= link_to taggable_path(taggable, tag.name), class: css_class do %>
|
||||
<%= tag.name %>
|
||||
<span class='label round info'><%= tag.send(taggable_counter_field(taggable)) %></span>
|
||||
(<%= tag.send(taggable_counter_field(taggable)) %>)
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -84,13 +84,11 @@ en:
|
||||
featured_debates_html: "Featured<br>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<br>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}'"
|
||||
|
||||
@@ -84,14 +84,12 @@ es:
|
||||
featured_debates_html: "Debates<br>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<br>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}'"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user