Merge branch 'master' into signature-sheets

This commit is contained in:
Juanjo Bazán
2016-12-23 20:23:56 +01:00
committed by GitHub
27 changed files with 154 additions and 110 deletions

View File

@@ -34,3 +34,4 @@
@include foundation-thumbnail;
@include foundation-title-bar;
@include foundation-top-bar;
@include foundation-menu-icon;

View File

@@ -246,7 +246,7 @@ a {
}
}
h2 {
h2, h3 {
font-size: $base-font-size;
}
}

View File

@@ -2,7 +2,6 @@ class Admin::BannersController < Admin::BaseController
has_filters %w{all with_active with_inactive}, only: :index
before_action :find_banner, only: [:edit, :update, :destroy]
before_action :banner_styles, only: [:edit, :new, :create, :update]
before_action :banner_imgs, only: [:edit, :new, :create, :update]
@@ -24,7 +23,6 @@ class Admin::BannersController < Admin::BaseController
end
def update
@banner.assign_attributes(banner_params)
if @banner.update(banner_params)
redirect_to admin_banners_path
else
@@ -43,10 +41,6 @@ class Admin::BannersController < Admin::BaseController
params.require(:banner).permit(:title, :description, :target_url, :style, :image, :post_started_at, :post_ended_at)
end
def find_banner
@banner = Banner.find(params[:id])
end
def banner_styles
@banner_styles = Setting.all.banner_style.map { |banner_style| [banner_style.value, banner_style.key.split('.')[1]] }
end

View File

@@ -0,0 +1,12 @@
module LayoutsHelper
def layout_menu_link_to(text, path, is_active, options)
if is_active
content_tag(:span, t('shared.you_are_in'), class: 'sr-only') + ' ' +
link_to(text, path, options.merge(class: "active"))
else
link_to(text, path, options)
end
end
end

View File

@@ -1,5 +1,5 @@
class ApplicationMailer < ActionMailer::Base
helper :settings
default from: "Consul <no-reply@consul.es>"
default from: "#{Setting['mailer_from_name']} <#{Setting['mailer_from_address']}>"
layout 'mailer'
end

View File

@@ -1,6 +1,6 @@
<% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author, (@comment_flags[comment.id] if @comment_flags)] do %>
<div class="row">
<div id="<%= dom_id(comment) %>" class="comment small-12 column">
<ul id="<%= dom_id(comment) %>" class="comment no-bullet small-12 column">
<% if comment.hidden? || comment.user.hidden? %>
<% if comment.children.size > 0 %>
@@ -23,7 +23,7 @@
<% end %>
<% end %>
<div class="comment-body">
<li class="comment-body">
<div class="comment-info">
<% if comment.as_administrator? %>
@@ -92,14 +92,13 @@
<%= render 'comments/form', {commentable: comment.commentable, parent_id: comment.id, toggeable: true} %>
<% end %>
</div>
</div>
</li>
<% end %>
<div id="<%= dom_id(comment) %>_children" class="comment-children">
<ul id="<%= dom_id(comment) %>_children" class="no-bullet comment-children">
<% child_comments_of(comment).each do |child| %>
<%= render 'comments/comment', comment: child %>
<% end %>
</div>
</div>
</ul>
</ul>
</div>
<% end %>

View File

@@ -1,11 +1,10 @@
<% cache [locale_and_user_status, @current_order, commentable_cache_key(@debate), @comment_tree.comments, @comment_tree.comment_authors, @debate.comments_count, @comment_flags] do %>
<section class="row-full comments">
<div class="row">
<div class="row comments">
<div id="comments" class="small-12 column">
<h2>
<h3>
<%= t("debates.show.comments_title") %>
<span class="js-comments-count">(<%= @debate.comments_count %>)</span>
</h2>
</h3>
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
@@ -27,5 +26,4 @@
<%= paginate @comment_tree.root_comments %>
</div>
</div>
</section>
<% end %>

View File

@@ -1,6 +1,6 @@
<% provide :title do %><%= @debate.title %><% end %>
<% cache [locale_and_user_status(@debate), @debate, @debate.author, Flag.flagged?(current_user, @debate), @debate_votes] do %>
<section class="debate-show">
<div class="debate-show">
<div id="<%= dom_id(@debate) %>" class="row">
<div class="small-12 medium-9 column">
<%= render "shared/back_link" %>
@@ -59,7 +59,7 @@
<% end %>
</div>
</div>
</section>
</div>
<% end %>
<%= render "comments" %>

View File

@@ -16,13 +16,8 @@
<div class="top-bar-title">
<%= link_to root_path, class: "hide-for-small-only", accesskey: "/" do %>
<%= image_tag('logo_header.png', class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %>
<% if opendata_page? %>
<%= t("layouts.header.open_gov", open: "#{t('layouts.header.open')}") %> <span>|</span>
<span class="logo-site"><%= t("layouts.header.open_data") %></span>
<% else %>
<%= setting['org_name'] %>
<% end %>
<% end %>
</div>
<div class="top-bar-right">
@@ -34,9 +29,6 @@
<div class="show-for-small-only">
<div class="subnavigation row">
<%= render "shared/subnavigation" %>
<div class="small-12 medium-3 column">
<%= yield :header_addon %>
</div>
</div>
</div>
</div>
@@ -48,11 +40,11 @@
<div class="row">
<div class="hide-for-small-only">
<%= render "shared/subnavigation" %>
</div>
<div class="small-12 medium-3 column">
<%= yield :header_addon %>
</div>
</div>
</div>
</div>
</header>

View File

@@ -14,7 +14,7 @@
<%= csrf_meta_tags %>
<%= favicon_link_tag "favicon.ico" %>
<%= favicon_link_tag "apple-touch-icon-200.png",
rel: "apple-touch-icon",
rel: "icon apple-touch-icon",
sizes: "200x200",
type: "image/png" %>
<%= content_for :social_media_meta_tags %>

View File

@@ -1,6 +1,5 @@
<% cache [locale_and_user_status, @current_order, commentable_cache_key(@proposal), @comment_tree.comments, @comment_tree.comment_authors, @proposal.comments_count, @comment_flags] do %>
<section class="comments">
<div class="row">
<div class="row comments">
<div id="comments" class="small-12 column">
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
@@ -22,5 +21,4 @@
<%= paginate @comment_tree.root_comments %>
</div>
</div>
</section>
<% end %>

View File

@@ -3,18 +3,18 @@
<ul class="tabs" data-tabs id="example-tabs">
<li class="tabs-title is-active">
<%= link_to "#tab-comments" do %>
<h2>
<h3>
<%= t("proposals.show.comments_tab") %>
<span class="js-comments-count">(<%= @proposal.comments_count %>)</span>
</h2>
</h3>
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-notifications" do %>
<h2>
<h3>
<%= t("proposals.show.notifications_tab") %>
(<%= @notifications.count %>)
</h2>
</h3>
<% end %>
</li>
</ul>

View File

@@ -6,8 +6,7 @@
social_description: @proposal.summary %>
<% end %>
<% cache [locale_and_user_status(@proposal), @proposal, @proposal.author, Flag.flagged?(current_user, @proposal), @proposal_votes] do %>
<section class="proposal-show">
<div class="proposal-show">
<div id="<%= dom_id(@proposal) %>" class="row">
<div class="small-12 medium-9 column">
<%= render "shared/back_link" %>
@@ -134,7 +133,7 @@
</div>
</aside>
</div>
</section>
</div>
<% end %>
<div class="tabs-content" data-tabs-content="example-tabs">

View File

@@ -15,14 +15,14 @@
</div>
<div class="small-12 large-3 column">
<label><%= t("shared.advanced_search.author_type") %></label>
<label for="advanced_search_official_level"><%= t("shared.advanced_search.author_type") %></label>
<%= select_tag('advanced_search[official_level]', official_level_search_options,
include_blank: t("shared.advanced_search.author_type_blank")) %>
</div>
<div class="small-12 large-9">
<div class="small-12 large-4 column">
<label><%= t("shared.advanced_search.date") %></label>
<label for="js-advanced-search-date-min"><%= t("shared.advanced_search.date") %></label>
<%= select_tag('advanced_search[date_min]', date_range_options,
include_blank: t("shared.advanced_search.date_range_blank"),
id: 'js-advanced-search-date-min') %>
@@ -31,14 +31,18 @@
<div id='js-custom-date' class='small-12 large-8 column' style="display: none">
<div class="row">
<div class='small-12 large-6 column'>
<label><%= t("shared.advanced_search.from") %> (<%= t("shared.advanced_search.date_placeholder") %>)</label>
<label for="advanced_search_date_min">
<%= t("shared.advanced_search.from") %> (<%= t("shared.advanced_search.date_placeholder") %>)
</label>
<%= text_field_tag 'advanced_search[date_min]',
params[:advanced_search].try(:[], :date_min),
placeholder: t("shared.advanced_search.date_placeholder"),
class: 'js-calendar' %>
</div>
<div class='small-12 large-6 column'>
<label><%= t("shared.advanced_search.to") %> (<%= t("shared.advanced_search.date_placeholder") %>)</label>
<label for="advanced_search_date_max">
<%= t("shared.advanced_search.to") %> (<%= t("shared.advanced_search.date_placeholder") %>)
</label>
<%= text_field_tag 'advanced_search[date_max]',
params[:advanced_search].try(:[], :date_max),
placeholder: t("shared.advanced_search.date_placeholder"),

View File

@@ -1,9 +1,11 @@
<div class="submenu">
<ul class="no-bullet submenu">
<% valid_orders.each do |order| %>
<li class="inline-block">
<%= link_to current_path_with_query_params(order: order, page: 1), class: order == @current_order ? 'active' : '' do %>
<%= content_tag(order == @current_order ? :h2 : :span) do %>
<%= t("#{i18n_namespace}.orders.#{order}") %>
<% end %>
<% end %>
</li>
<% end %>
</div>
</ul>

View File

@@ -2,22 +2,31 @@
<ul>
<% if feature?(:debates) %>
<li>
<%= link_to t("layouts.header.debates"), debates_path, class: ("active" if controller_name == "debates"), accesskey: "d" %>
<%= layout_menu_link_to t("layouts.header.debates"),
debates_path,
controller_name == 'debates',
accesskey: "d" %>
</li>
<% end %>
<li>
<%= link_to t("layouts.header.proposals"), proposals_path, class: ("active" if controller_name == "proposals"), accesskey: "p" %>
<%= layout_menu_link_to t("layouts.header.proposals"),
proposals_path,
controller_name == 'proposals',
accesskey: "p" %>
</li>
<li>
<%= link_to t("layouts.header.proposal_ballot"), proposal_ballots_path, class: ("active" if controller_name == "proposal_ballots"), accesskey: "v" %>
<%= layout_menu_link_to t("layouts.header.proposal_ballot"),
proposal_ballots_path,
controller_name == 'proposal_ballots',
accesskey: "v" %>
</li>
<% if feature?(:spending_proposals) %>
<li>
<%= link_to t("layouts.header.spending_proposals"), spending_proposals_path, class: ("active" if controller_name == "spending_proposals"), accesskey: "s" %>
<%= layout_menu_link_to t("layouts.header.spending_proposals"),
spending_proposals_path,
controller_name == 'spending_proposals',
accesskey: "s" %>
</li>
<% end %>
<li>
<%= link_to t("layouts.header.more_information"), page_path('more_information'), class: ("active" if current_page?("/more_information")), accesskey: "i" %>
</li>
</ul>
</div>

View File

@@ -1,7 +1,7 @@
<%- limit ||= nil %>
<% if taggable.tags.any? %>
<ul id="tags" class="no-bullet tags">
<ul id="tags_<%= dom_id(taggable) %>" class="no-bullet tags">
<% taggable.tag_list_with_limit(limit).each do |tag| %>
<li class="inline-block"><%= link_to sanitize(tag.name), send("#{taggable.class.name.underscore.pluralize}_path", search: tag.name) %></li>
<% end %>

View File

@@ -2,8 +2,26 @@
<div class="row">
<%= render "shared/locale_switcher" %>
<ul class="no-bullet external-links">
<li class="inline-block"><%= link_to t("layouts.header.external_link_transparency"), t("layouts.header.external_link_transparency_url") %>&nbsp;|</li>
<li class="inline-block"><%= link_to t("layouts.header.external_link_opendata"), "/opendata", class: ("selected" if current_page?("/opendata")) %></li>
<li class="inline-block">
<%= link_to t("layouts.header.more_information"),
page_path('more_information'),
class: ("selected" if current_page?("/more_information")),
accesskey: "i" %>
&nbsp;|
</li>
<li class="inline-block">
<%= link_to t("layouts.header.external_link_transparency"),
t("layouts.header.external_link_transparency_url"),
target: "_blank",
title: t('shared.target_blank_html') %>
&nbsp;|
</li>
<li class="inline-block">
<%= link_to t("layouts.header.external_link_opendata"),
t("layouts.header.external_link_opendata_url"),
target: "_blank",
title: t('shared.target_blank_html') %>
</li>
<% if setting['blog_url'] %>
<li class="inline-block">|&nbsp;
<%= link_to setting['blog_url'], title: t('shared.target_blank_html'), target: "_blank" do %>

View File

@@ -12,7 +12,11 @@ Devise.setup do |config|
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = 'noreply@consul.es'
if Rails.env.test?
config.mailer_sender = "noreply@example.org"
else
config.mailer_sender = "#{Setting['mailer_from_name']} <#{Setting['mailer_from_address']}>"
end
# Configure the class responsible to send e-mails.
config.mailer = 'DeviseMailer'

View File

@@ -190,6 +190,7 @@ en:
debates: Debates
external_link_blog: Blog
external_link_opendata: Open data
external_link_opendata_url: "/opendata"
external_link_transparency: Transparency
external_link_transparency_url: https://transparency.consul
locale: 'Language:'
@@ -208,7 +209,6 @@ en:
open: open
open_city_slogan_html: There are cities that are governed directly by their inhabitants, who <b>discuss</b> the topics they are concerned about, <b>propose</b> ideas to improve their lives and <b>decide</b> among themselves which ones will be carried out.
open_city_title: Love the city, and it will become a city you love.
open_data: Open data
open_gov: Open government
proposals: Proposals
proposal_ballot: Voting
@@ -451,6 +451,7 @@ en:
districts_list: "Districts list"
categories: "Categories"
target_blank_html: " (link opens in new window)"
you_are_in: "You are in"
unflag: Unflag
outline:
debates: Debates

View File

@@ -190,6 +190,7 @@ es:
debates: Debates
external_link_blog: Blog
external_link_opendata: Datos abiertos
external_link_opendata_url: "/opendata"
external_link_transparency: Transparencia
external_link_transparency_url: https://transparency.consul
locale: 'Idioma:'
@@ -208,7 +209,6 @@ es:
open: abierto
open_city_slogan_html: Existen ciudades gobernadas directamente por sus habitantes, que <strong>debaten</strong> sobre temas que les preocupan, <strong>proponen</strong> ideas para mejorar sus vidas y <strong>deciden</strong> entre todas y todos las que se llevan a cabo.
open_city_title: La ciudad que quieres será la ciudad que quieras.
open_data: Datos abiertos
open_gov: Gobierno %{open}
proposals: Propuestas
proposal_ballot: Votaciones
@@ -451,6 +451,7 @@ es:
districts_list: "Listado de distritos"
categories: "Categorías"
target_blank_html: " (se abre en ventana nueva)"
you_are_in: "Estás en"
unflag: Deshacer denuncia
outline:
debates: Debates

View File

@@ -31,3 +31,5 @@ en:
spending_proposals: Investment projects
spending_proposal_features:
voting_allowed: Voting on investment projects
mailer_from_name: Origin email name
mailer_from_address: Origin email address

View File

@@ -31,3 +31,5 @@ es:
spending_proposals: Propuestas de inversión
spending_proposal_features:
voting_allowed: Votaciones sobre propuestas de inversión.
mailer_from_name: Nombre email remitente
mailer_from_address: Dirección email remitente

View File

@@ -30,9 +30,12 @@ Setting.create(key: 'feature.spending_proposal_features.voting_allowed', value:
Setting.create(key: 'feature.twitter_login', value: "true")
Setting.create(key: 'feature.facebook_login', value: "true")
Setting.create(key: 'feature.google_login', value: "true")
Setting.create(key: 'feature.signature_sheets', value: "true")
Setting.create(key: 'per_page_code', value: "")
Setting.create(key: 'comments_body_max_length', value: '1000')
Setting.create(key: 'feature.signature_sheets', value: "true")
Setting.create(key: 'mailer_from_name', value: 'Consul')
Setting.create(key: 'mailer_from_address', value: 'noreply@consul.dev')
puts "Creating Geozones"
('A'..'Z').each { |i| Geozone.create(name: "District #{i}", external_code: i.ord, census_code: i.ord) }

View File

@@ -82,3 +82,7 @@ Setting['banner-img.banner-img-three'] = "Banner image 3"
# Proposal notifications
Setting['proposal_notification_minimum_interval_in_days'] = 3
Setting['direct_message_max_per_day'] = 3
# Email settings
Setting['mailer_from_name'] = 'Consul'
Setting['mailer_from_address'] = 'noreply@consul.dev'

View File

@@ -232,7 +232,7 @@ feature 'Debates' do
expect(page).to have_content 'Debate created successfully.'
within "#tags" do
within "#tags_debate_#{Debate.last.id}" do
expect(page).to have_content 'Education'
expect(page).to_not have_content 'Health'
end
@@ -249,7 +249,8 @@ feature 'Debates' do
click_button 'Start a debate'
expect(page).to have_content 'Debate created successfully.'
within "#tags" do
within "#tags_debate_#{Debate.last.id}" do
expect(page).to have_content 'Refugees'
expect(page).to have_content 'Solidarity'
end

View File

@@ -333,7 +333,7 @@ feature 'Proposals' do
expect(page).to have_content 'Proposal created successfully.'
within "#tags" do
within "#tags_proposal_#{Proposal.last.id}" do
expect(page).to have_content 'Education'
expect(page).to_not have_content 'Health'
end
@@ -355,7 +355,7 @@ feature 'Proposals' do
click_button 'Create proposal'
expect(page).to have_content 'Proposal created successfully.'
within "#tags" do
within "#tags_proposal_#{Proposal.last.id}" do
expect(page).to have_content 'Refugees'
expect(page).to have_content 'Solidarity'
end