fixes conflicts

This commit is contained in:
rgarcia
2015-09-14 16:46:00 +02:00
21 changed files with 87 additions and 59 deletions

View File

@@ -302,21 +302,13 @@ header {
font-size: rem-calc(16); font-size: rem-calc(16);
margin-top: 0; margin-top: 0;
&.see-more-debates { &.see-more {
width: 100%; width: 100%;
@media (min-width: $small-breakpoint) { @media (min-width: $small-breakpoint) {
width: auto; width: auto;
} }
} }
&.see-more-proposals {
@extend .see-more-debates;
@media (min-width: $small-breakpoint) {
margin-left: rem-calc(12);
}
}
} }
.home-page { .home-page {

View File

@@ -23,9 +23,9 @@ class AccountController < ApplicationController
def account_params def account_params
if @account.organization? if @account.organization?
params.require(:account).permit(:phone_number, :email_on_debate_comment, :email_on_comment_reply, organization_attributes: [:name, :responsible_name]) params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, organization_attributes: [:name, :responsible_name])
else else
params.require(:account).permit(:username, :email_on_debate_comment, :email_on_comment_reply) params.require(:account).permit(:username, :email_on_comment, :email_on_comment_reply)
end end
end end

View File

@@ -12,16 +12,16 @@ class CommentNotifier
private private
def send_comment_email def send_comment_email
Mailer.comment(@comment).deliver_later if email_on_debate_comment? Mailer.comment(@comment).deliver_later if email_on_comment?
end end
def send_reply_email def send_reply_email
Mailer.reply(@comment).deliver_later if email_on_comment_reply? Mailer.reply(@comment).deliver_later if email_on_comment_reply?
end end
def email_on_debate_comment? def email_on_comment?
commentable_author = @comment.commentable.author commentable_author = @comment.commentable.author
commentable_author != @author && commentable_author.email_on_debate_comment? commentable_author != @author && commentable_author.email_on_comment?
end end
def email_on_comment_reply? def email_on_comment_reply?

View File

@@ -108,7 +108,7 @@ class Proposal < ActiveRecord::Base
end end
def self.votes_needed_for_success def self.votes_needed_for_success
53726 Setting.value_for('votes_for_proposal_success').to_i
end end
protected protected

View File

@@ -1,7 +1,7 @@
class Setting < ActiveRecord::Base class Setting < ActiveRecord::Base
validates :key, presence: true, uniqueness: true validates :key, presence: true, uniqueness: true
default_scope { order(key: :desc) } default_scope { order(id: :asc) }
def self.value_for(key) def self.value_for(key)
where(key: key).pluck(:value).first where(key: key).pluck(:value).first

View File

@@ -45,9 +45,9 @@
<h2><%= t("account.show.notifications")%></h2> <h2><%= t("account.show.notifications")%></h2>
<div> <div>
<%= f.label :email_on_debate_comment do %> <%= f.label :email_on_comment do %>
<%= f.check_box :email_on_debate_comment, label: false %> <%= f.check_box :email_on_comment, label: false %>
<span class="checkbox"><%= t("account.show.email_on_debate_comment_label") %></span> <span class="checkbox"><%= t("account.show.email_on_comment_label") %></span>
<% end %> <% end %>
</div> </div>

View File

@@ -54,8 +54,7 @@
<div class="small-12 medium-7 column"> <div class="small-12 medium-7 column">
<h1><%= t("layouts.header.open_city_title") %></h1> <h1><%= t("layouts.header.open_city_title") %></h1>
<p><%= t("layouts.header.open_city_slogan_html") %></p> <p><%= t("layouts.header.open_city_slogan_html") %></p>
<%= link_to t("layouts.header.see_all_debates"), debates_path, class: "button radius see-more-debates" %> <%= link_to t("layouts.header.see_all"), root_path, class: "button radius see-more warning" %>
<%= link_to t("layouts.header.see_all_proposals"), proposals_path, class: "button radius see-more-proposals" %>
<%= link_to t("layouts.header.more_information"), "/more_information", class: "more-info" %> <%= link_to t("layouts.header.more_information"), "/more_information", class: "more-info" %>
</div> </div>

View File

@@ -36,6 +36,7 @@
<a href="/participation_facts"> <a href="/participation_facts">
<li> <li>
Hechos sobre participación ciudadana y democracia directa Hechos sobre participación ciudadana y democracia directa
<span>Para perderle el miedo</span>
</li> </li>
</a> </a>
</ul> </ul>

View File

@@ -3,24 +3,25 @@
<div class="row text-center"> <div class="row text-center">
<div class="small-12 medium-3 column"> <div class="small-12 medium-3 column">
<%= image_tag("icon_home_debates.png") %> <%= image_tag("icon_home_debates.png") %>
<h2>Debates</h2> <h2><%= t("welcome.debates.title") %></h2>
<p>Encontrarnos, debatir y compartir lo que nos parece conveniente, importante o necesario para nuestra ciudad.</p> <p><%= t("welcome.debates.description") %></p>
</div> </div>
<div class="small-12 medium-3 column"> <div class="small-12 medium-3 column">
<%= image_tag("icon_home_propones.png") %> <%= image_tag("icon_home_propones.png") %>
<h2>Propones</h2> <h2><%= t("welcome.proposal.title") %></h2>
<p>Hay también un espacio abierto para propuestas ciudadanas sobre el tipo de ciudad en el que queremos vivir.</p> <p><%= t("welcome.proposal.description") %></p>
</div> </div>
<div class="small-12 medium-3 column"> <div class="small-12 medium-3 column">
<%= image_tag("icon_home_decides.png") %> <%= image_tag("icon_home_decides.png") %>
<h2>Decides</h2> <h2><%= t("welcome.decide.title") %></h2>
<p>Cuando una propuesta es apoyada pasa a un espacio de votación en el que se invita a toda la ciudadanía a apoyarla o rechazarla como propuesta colectiva.</p> <p><%= t("welcome.decide.description") %></p>
</div> </div>
<div class="small-12 medium-3 column"> <div class="small-12 medium-3 column">
<%= image_tag("icon_home_sehace.png") %> <%= image_tag("icon_home_sehace.png") %>
<h2>Se hace</h2> <h2><%= t("welcome.do.title") %></h2>
<p>Si la propuesta es aceptada en mayoría, se emitirán los informes adecuados para llevarla a cabo dentro de los cauces legales, presupuestarios y de viabilidad.</p> <p><%= t("welcome.do.description") %></p>
</div> </div>
</div> </div>
<div class="filters row"> <div class="filters row">

View File

@@ -104,6 +104,7 @@ ignore_unused:
- 'admin.officials.level_*' - 'admin.officials.level_*'
- 'admin.comments.index.filter*' - 'admin.comments.index.filter*'
- 'admin.debates.index.filter*' - 'admin.debates.index.filter*'
- 'admin.proposals.index.filter*'
- 'admin.organizations.index.filter*' - 'admin.organizations.index.filter*'
- 'admin.users.index.filter*' - 'admin.users.index.filter*'
- 'moderation.comments.index.filter*' - 'moderation.comments.index.filter*'

View File

@@ -15,13 +15,14 @@ en:
open_city_slogan_html: open_city_slogan_html:
"Start listening to Madrid. "Start listening to Madrid.
For that we open this digital Puerta del Sol, where all the locals can meet to discuss and share everything we want." For that we open this digital Puerta del Sol, where all the locals can meet to discuss and share everything we want."
# "Existen ciudades gobernadas directamente por sus habitantes, que <b>debaten</b> sobre temas que les preocupan, <b>proponen</b> ideas para mejorar
# sus vidas y <b>deciden</b> entre todas y todos las que se llevan a cabo. Madrid ya es una de ellas."
# open_city_text: # open_city_text:
# "Here every voice has its place and are citizens, and no one in their name, they decide to vote debates what issues are # "Here every voice has its place and are citizens, and no one in their name, they decide to vote debates what issues are
# most important of every time. Government officials have individual users with whom you may participate in the debates, and evaluated, # most important of every time. Government officials have individual users with whom you may participate in the debates, and evaluated,
# the same level as everyone else. Because the Madrid City Council works for its citizens, and must respond to them." # the same level as everyone else. Because the Madrid City Council works for its citizens, and must respond to them."
# open_city_soon: "And soon... we'll open the section for citizen proposals." # open_city_soon: "And soon... we'll open the section for citizen proposals."
see_all_debates: See all debates see_all: See debates and proposals
see_all_proposals: See all proposals
my_account_link: My account my_account_link: My account
locale: "Language:" locale: "Language:"
administration: Administration administration: Administration
@@ -254,8 +255,7 @@ en:
show: show:
title: "My account" title: "My account"
save_changes_submit: "Save changes" save_changes_submit: "Save changes"
email_on_debate_comment_label: "Receive email when someone comments on my debates" email_on_comment_label: "Receive email when someone comments on my debates or proposals"
email_on_proposal_comment_label: "Receive email when someone comments on my proposals"
email_on_comment_reply_label: "Receive email when someone replies to my comments" email_on_comment_reply_label: "Receive email when someone replies to my comments"
change_credentials_link: "Change my credentials" change_credentials_link: "Change my credentials"
avatar: "Avatar" avatar: "Avatar"
@@ -298,6 +298,19 @@ en:
last_debates: Last debates last_debates: Last debates
last_proposals: Last proposals last_proposals: Last proposals
signed_in_home_title: Recent activity signed_in_home_title: Recent activity
signed_in_home_title: Actividad reciente
debates:
title: "Debate"
description: "Meet, discuss and share what we think is important in our city."
proposal:
title: "You propose"
description: "Open to citizens proposals on the kind of city we want to live."
decide:
title: "You decide"
description: "Citizenship decide whether to accept or reject the most supported proposals."
do:
title: "It does"
description: "If the proposal is accepted mostly, the City Council makes his own and done."
welcome: welcome:
title: Account verification title: Account verification
instructions_1_html: "Welcome to the public participation website." instructions_1_html: "Welcome to the public participation website."

View File

@@ -22,8 +22,7 @@ es:
# más importantes de cada momento. Los responsables del gobierno tienen cuentas de usuario propias con las que podrán participar en los debates, y ser evaluados # más importantes de cada momento. Los responsables del gobierno tienen cuentas de usuario propias con las que podrán participar en los debates, y ser evaluados
# al mismo nivel que todos los demás." # al mismo nivel que todos los demás."
# open_city_soon: "Muy pronto abriremos la sección de propuestas ciudadanas, donde cualquiera podrá presentar propuestas y, si reciben apoyo, serán puestas en marcha por el Ayuntamiento." # open_city_soon: "Muy pronto abriremos la sección de propuestas ciudadanas, donde cualquiera podrá presentar propuestas y, si reciben apoyo, serán puestas en marcha por el Ayuntamiento."
see_all_debates: Ver todos los debates see_all: Ver debates y propuestas
see_all_proposals: Ver todas las propuestas
my_account_link: Mi cuenta my_account_link: Mi cuenta
locale: "Idioma:" locale: "Idioma:"
administration: Administrar administration: Administrar
@@ -257,8 +256,7 @@ es:
title: "Mi cuenta" title: "Mi cuenta"
save_changes_submit: "Guardar cambios" save_changes_submit: "Guardar cambios"
change_credentials_link: "Cambiar mis datos de acceso" change_credentials_link: "Cambiar mis datos de acceso"
email_on_debate_comment_label: "Recibir un email cuando alguien comenta en mis debates" email_on_comment_label: "Recibir un email cuando alguien comenta en mis propuestas o debates"
email_on_proposal_comment_label: "Recibir un email cuando alguien comenta en mis propuestas"
email_on_comment_reply_label: "Recibir un email cuando alguien contesta a mis comentarios" email_on_comment_reply_label: "Recibir un email cuando alguien contesta a mis comentarios"
avatar: "Avatar" avatar: "Avatar"
personal: "Datos personales" personal: "Datos personales"
@@ -300,6 +298,18 @@ es:
last_debates: Últimos debates last_debates: Últimos debates
last_proposals: Últimas propuestas last_proposals: Últimas propuestas
signed_in_home_title: Actividad reciente signed_in_home_title: Actividad reciente
debates:
title: "Debates"
description: "Encontrarnos, debatir y compartir lo que nos parece importante en nuestra ciudad."
proposal:
title: "Propones"
description: "Espacio abierto para propuestas ciudadanas sobre el tipo de ciudad en el que queremos vivir."
decide:
title: "Decides"
description: "La ciudadanía decide si acepta o rechaza las propuestas más apoyadas."
do:
title: "Se hace"
description: "Si la propuesta es aceptada mayoritariamente, el Ayuntamiento la asume como propia y se hace."
welcome: welcome:
title: Verificación de cuenta title: Verificación de cuenta
instructions_1_html: "Bienvenido a la página de participación ciudadana" instructions_1_html: "Bienvenido a la página de participación ciudadana"

View File

@@ -8,3 +8,4 @@ en:
max_ratio_anon_votes_on_debates: "Max allowed percentage of anonymous votes per Debate" max_ratio_anon_votes_on_debates: "Max allowed percentage of anonymous votes per Debate"
max_votes_for_proposal_edit: "Number of votes where a Proposal is not editable anymore" max_votes_for_proposal_edit: "Number of votes where a Proposal is not editable anymore"
proposal_code_prefix: "Prefix for Proposals codes" proposal_code_prefix: "Prefix for Proposals codes"
votes_for_proposal_success: "Number of votes needed for Proposal approval"

View File

@@ -8,3 +8,4 @@ es:
max_ratio_anon_votes_on_debates: "Porcentaje máximo de votos anónimos por Debate" max_ratio_anon_votes_on_debates: "Porcentaje máximo de votos anónimos por Debate"
max_votes_for_proposal_edit: "Número de votos en que una Propuesta deja de poderse editar" max_votes_for_proposal_edit: "Número de votos en que una Propuesta deja de poderse editar"
proposal_code_prefix: "Prefijo para los códigos de Propuestas" proposal_code_prefix: "Prefijo para los códigos de Propuestas"
votes_for_proposal_success: "Número de votos necesarios para aprobar una Propuesta"

View File

@@ -11,6 +11,7 @@ Setting.create(key: 'official_level_5_name', value: 'Alcaldesa')
Setting.create(key: 'max_ratio_anon_votes_on_debates', value: '50') Setting.create(key: 'max_ratio_anon_votes_on_debates', value: '50')
Setting.create(key: 'max_votes_for_proposal_edit', value: '1000') Setting.create(key: 'max_votes_for_proposal_edit', value: '1000')
Setting.create(key: 'proposal_code_prefix', value: 'MAD') Setting.create(key: 'proposal_code_prefix', value: 'MAD')
Setting.create(key: 'votes_for_proposal_success', value: '100')
puts "Creating Users" puts "Creating Users"

View File

@@ -0,0 +1,5 @@
class ChangeEmailConfigFieldInUser < ActiveRecord::Migration
def change
rename_column :users, :email_on_debate_comment, :email_on_comment
end
end

View File

@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150914113251) do ActiveRecord::Schema.define(version: 20150914114019) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@@ -260,7 +260,7 @@ ActiveRecord::Schema.define(version: 20150914113251) do
t.datetime "confirmed_at" t.datetime "confirmed_at"
t.datetime "confirmation_sent_at" t.datetime "confirmation_sent_at"
t.string "unconfirmed_email" t.string "unconfirmed_email"
t.boolean "email_on_debate_comment", default: false t.boolean "email_on_comment", default: false
t.boolean "email_on_comment_reply", default: false t.boolean "email_on_comment_reply", default: false
t.string "phone_number", limit: 30 t.string "phone_number", limit: 30
t.string "official_position" t.string "official_position"

View File

@@ -20,3 +20,6 @@ Setting.create(key: 'max_votes_for_proposal_edit', value: '1000')
# Prefix for the Proposal codes # Prefix for the Proposal codes
Setting.create(key: 'proposal_code_prefix', value: 'MAD') Setting.create(key: 'proposal_code_prefix', value: 'MAD')
# Number of votes needed for proposal success
Setting.create(key: 'votes_for_proposal_success', value: '53726')

View File

@@ -33,7 +33,7 @@ feature 'Account' do
visit account_path visit account_path
fill_in 'account_username', with: 'Larry Bird' fill_in 'account_username', with: 'Larry Bird'
check 'account_email_on_debate_comment' check 'account_email_on_comment'
check 'account_email_on_comment_reply' check 'account_email_on_comment_reply'
click_button 'Save changes' click_button 'Save changes'
@@ -42,7 +42,7 @@ feature 'Account' do
visit account_path visit account_path
expect(page).to have_selector("input[value='Larry Bird']") expect(page).to have_selector("input[value='Larry Bird']")
expect(page).to have_selector("input[id='account_email_on_debate_comment'][value='1']") expect(page).to have_selector("input[id='account_email_on_comment'][value='1']")
expect(page).to have_selector("input[id='account_email_on_comment_reply'][value='1']") expect(page).to have_selector("input[id='account_email_on_comment_reply'][value='1']")
end end
@@ -51,7 +51,7 @@ feature 'Account' do
visit account_path visit account_path
fill_in 'account_organization_attributes_name', with: 'Google' fill_in 'account_organization_attributes_name', with: 'Google'
check 'account_email_on_debate_comment' check 'account_email_on_comment'
check 'account_email_on_comment_reply' check 'account_email_on_comment_reply'
click_button 'Save changes' click_button 'Save changes'
@@ -60,7 +60,7 @@ feature 'Account' do
visit account_path visit account_path
expect(page).to have_selector("input[value='Google']") expect(page).to have_selector("input[value='Google']")
expect(page).to have_selector("input[id='account_email_on_debate_comment'][value='1']") expect(page).to have_selector("input[id='account_email_on_comment'][value='1']")
expect(page).to have_selector("input[id='account_email_on_comment_reply'][value='1']") expect(page).to have_selector("input[id='account_email_on_comment_reply'][value='1']")
end end

View File

@@ -26,7 +26,7 @@ feature 'Emails' do
context 'Debate comments' do context 'Debate comments' do
scenario "Send email on debate comment", :js do scenario "Send email on debate comment", :js do
user = create(:user, email_on_debate_comment: true) user = create(:user, email_on_comment: true)
debate = create(:debate, author: user) debate = create(:debate, author: user)
comment_on(debate) comment_on(debate)
@@ -37,7 +37,7 @@ feature 'Emails' do
end end
scenario 'Do not send email about own debate comments', :js do scenario 'Do not send email about own debate comments', :js do
user = create(:user, email_on_debate_comment: true) user = create(:user, email_on_comment: true)
debate = create(:debate, author: user) debate = create(:debate, author: user)
comment_on(debate, user) comment_on(debate, user)
@@ -45,7 +45,7 @@ feature 'Emails' do
end end
scenario 'Do not send email about debate comment unless set in preferences', :js do scenario 'Do not send email about debate comment unless set in preferences', :js do
user = create(:user, email_on_debate_comment: false) user = create(:user, email_on_comment: false)
debate = create(:debate, author: user) debate = create(:debate, author: user)
comment_on(debate) comment_on(debate)

View File

@@ -66,9 +66,9 @@ describe User do
end end
describe 'preferences' do describe 'preferences' do
describe 'email_on_debate_comment' do describe 'email_on_comment' do
it 'should be false by default' do it 'should be false by default' do
expect(subject.email_on_debate_comment).to eq(false) expect(subject.email_on_comment).to eq(false)
end end
end end