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);
margin-top: 0;
&.see-more-debates {
&.see-more {
width: 100%;
@media (min-width: $small-breakpoint) {
width: auto;
}
}
&.see-more-proposals {
@extend .see-more-debates;
@media (min-width: $small-breakpoint) {
margin-left: rem-calc(12);
}
}
}
.home-page {

View File

@@ -23,9 +23,9 @@ class AccountController < ApplicationController
def account_params
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
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

View File

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

View File

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

View File

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

View File

@@ -29,25 +29,25 @@
<h2><%= t("account.show.personal")%></h2>
<div class="small-12 medium-4">
<% if @account.organization? %>
<%= f.fields_for :organization do |fo| %>
<%= fo.text_field :name, autofocus: true, maxlength: Organization.name_max_length, placeholder: t("account.show.organization_name_label") %>
<%= fo.text_field :responsible_name, autofocus: true, maxlength: Organization.responsible_name_max_length, placeholder: t("account.show.organization_responsible_name_placeholder") %>
<% end %>
<%= f.text_field :phone_number, placeholder: t("account.show.phone_number_label") %>
<div class="small-12 medium-4">
<% if @account.organization? %>
<%= f.fields_for :organization do |fo| %>
<%= fo.text_field :name, autofocus: true, maxlength: Organization.name_max_length, placeholder: t("account.show.organization_name_label") %>
<%= fo.text_field :responsible_name, autofocus: true, maxlength: Organization.responsible_name_max_length, placeholder: t("account.show.organization_responsible_name_placeholder") %>
<% end %>
<%= f.text_field :phone_number, placeholder: t("account.show.phone_number_label") %>
<% else %>
<%= f.text_field :username, maxlength: User.username_max_length, placeholder: t("account.show.username_label") %>
<% end %>
<%= f.text_field :username, maxlength: User.username_max_length, placeholder: t("account.show.username_label") %>
<% end %>
</div>
<h2><%= t("account.show.notifications")%></h2>
<div>
<%= f.label :email_on_debate_comment do %>
<%= f.check_box :email_on_debate_comment, label: false %>
<span class="checkbox"><%= t("account.show.email_on_debate_comment_label") %></span>
<%= f.label :email_on_comment do %>
<%= f.check_box :email_on_comment, label: false %>
<span class="checkbox"><%= t("account.show.email_on_comment_label") %></span>
<% end %>
</div>

View File

@@ -54,8 +54,7 @@
<div class="small-12 medium-7 column">
<h1><%= t("layouts.header.open_city_title") %></h1>
<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_proposals"), proposals_path, class: "button radius see-more-proposals" %>
<%= link_to t("layouts.header.see_all"), root_path, class: "button radius see-more warning" %>
<%= link_to t("layouts.header.more_information"), "/more_information", class: "more-info" %>
</div>

View File

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

View File

@@ -3,24 +3,25 @@
<div class="row text-center">
<div class="small-12 medium-3 column">
<%= image_tag("icon_home_debates.png") %>
<h2>Debates</h2>
<p>Encontrarnos, debatir y compartir lo que nos parece conveniente, importante o necesario para nuestra ciudad.</p>
<h2><%= t("welcome.debates.title") %></h2>
<p><%= t("welcome.debates.description") %></p>
</div>
<div class="small-12 medium-3 column">
<%= image_tag("icon_home_propones.png") %>
<h2>Propones</h2>
<p>Hay también un espacio abierto para propuestas ciudadanas sobre el tipo de ciudad en el que queremos vivir.</p>
<h2><%= t("welcome.proposal.title") %></h2>
<p><%= t("welcome.proposal.description") %></p>
</div>
<div class="small-12 medium-3 column">
<%= image_tag("icon_home_decides.png") %>
<h2>Decides</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>
<h2><%= t("welcome.decide.title") %></h2>
<p><%= t("welcome.decide.description") %></p>
</div>
<div class="small-12 medium-3 column">
<%= image_tag("icon_home_sehace.png") %>
<h2>Se hace</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>
<h2><%= t("welcome.do.title") %></h2>
<p><%= t("welcome.do.description") %></p>
</div>
</div>
<div class="filters row">

View File

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

View File

@@ -15,13 +15,14 @@ en:
open_city_slogan_html:
"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."
# "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:
# "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,
# 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."
see_all_debates: See all debates
see_all_proposals: See all proposals
see_all: See debates and proposals
my_account_link: My account
locale: "Language:"
administration: Administration
@@ -254,8 +255,7 @@ en:
show:
title: "My account"
save_changes_submit: "Save changes"
email_on_debate_comment_label: "Receive email when someone comments on my debates"
email_on_proposal_comment_label: "Receive email when someone comments on my proposals"
email_on_comment_label: "Receive email when someone comments on my debates or proposals"
email_on_comment_reply_label: "Receive email when someone replies to my comments"
change_credentials_link: "Change my credentials"
avatar: "Avatar"
@@ -298,6 +298,19 @@ en:
last_debates: Last debates
last_proposals: Last proposals
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:
title: Account verification
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
# 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."
see_all_debates: Ver todos los debates
see_all_proposals: Ver todas las propuestas
see_all: Ver debates y propuestas
my_account_link: Mi cuenta
locale: "Idioma:"
administration: Administrar
@@ -257,8 +256,7 @@ es:
title: "Mi cuenta"
save_changes_submit: "Guardar cambios"
change_credentials_link: "Cambiar mis datos de acceso"
email_on_debate_comment_label: "Recibir un email cuando alguien comenta en mis debates"
email_on_proposal_comment_label: "Recibir un email cuando alguien comenta en mis propuestas"
email_on_comment_label: "Recibir un email cuando alguien comenta en mis propuestas o debates"
email_on_comment_reply_label: "Recibir un email cuando alguien contesta a mis comentarios"
avatar: "Avatar"
personal: "Datos personales"
@@ -300,6 +298,18 @@ es:
last_debates: Últimos debates
last_proposals: Últimas propuestas
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:
title: Verificación de cuenta
instructions_1_html: "Bienvenido a la página de participación ciudadana"

View File

@@ -7,4 +7,5 @@ en:
official_level_5_name: "Level 5 official positions"
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"
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

@@ -7,4 +7,5 @@ es:
official_level_5_name: "Cargos públicos de nivel 5"
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"
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_votes_for_proposal_edit', value: '1000')
Setting.create(key: 'proposal_code_prefix', value: 'MAD')
Setting.create(key: 'votes_for_proposal_success', value: '100')
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.
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
enable_extension "plpgsql"
@@ -260,7 +260,7 @@ ActiveRecord::Schema.define(version: 20150914113251) do
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
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.string "phone_number", limit: 30
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
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
fill_in 'account_username', with: 'Larry Bird'
check 'account_email_on_debate_comment'
check 'account_email_on_comment'
check 'account_email_on_comment_reply'
click_button 'Save changes'
@@ -42,7 +42,7 @@ feature 'Account' do
visit account_path
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']")
end
@@ -51,7 +51,7 @@ feature 'Account' do
visit account_path
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'
click_button 'Save changes'
@@ -60,7 +60,7 @@ feature 'Account' do
visit account_path
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']")
end

View File

@@ -26,7 +26,7 @@ feature 'Emails' do
context 'Debate comments' 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)
comment_on(debate)
@@ -37,7 +37,7 @@ feature 'Emails' do
end
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)
comment_on(debate, user)
@@ -45,7 +45,7 @@ feature 'Emails' do
end
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)
comment_on(debate)

View File

@@ -66,9 +66,9 @@ describe User do
end
describe 'preferences' do
describe 'email_on_debate_comment' do
describe 'email_on_comment' 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