diff --git a/app/assets/stylesheets/participacion.scss b/app/assets/stylesheets/participacion.scss index cbd2c3f23..cb7ff289f 100644 --- a/app/assets/stylesheets/participacion.scss +++ b/app/assets/stylesheets/participacion.scss @@ -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 { diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index b0bd18e5b..38bd4bfe5 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -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 diff --git a/app/models/comment_notifier.rb b/app/models/comment_notifier.rb index 8a82e9df0..3cceb5c15 100644 --- a/app/models/comment_notifier.rb +++ b/app/models/comment_notifier.rb @@ -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? diff --git a/app/models/proposal.rb b/app/models/proposal.rb index 6e0930955..6597b16e8 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -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 diff --git a/app/models/setting.rb b/app/models/setting.rb index f696ceefd..2d0926418 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -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 diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index e43c424de..1df3e408e 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -29,25 +29,25 @@

<%= t("account.show.personal")%>

-
- <% 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") %> +
+ <% 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 %>

<%= t("account.show.notifications")%>

- <%= f.label :email_on_debate_comment do %> - <%= f.check_box :email_on_debate_comment, label: false %> - <%= t("account.show.email_on_debate_comment_label") %> + <%= f.label :email_on_comment do %> + <%= f.check_box :email_on_comment, label: false %> + <%= t("account.show.email_on_comment_label") %> <% end %>
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 2a9716167..87d21e84b 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -54,8 +54,7 @@

<%= t("layouts.header.open_city_title") %>

<%= t("layouts.header.open_city_slogan_html") %>

- <%= 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" %>
diff --git a/app/views/pages/more_information.html.erb b/app/views/pages/more_information.html.erb index c43fdc8e9..4b64b2137 100644 --- a/app/views/pages/more_information.html.erb +++ b/app/views/pages/more_information.html.erb @@ -36,6 +36,7 @@
  • Hechos sobre participación ciudadana y democracia directa + Para perderle el miedo
  • diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index c4f6090c4..3c821c6ef 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -3,24 +3,25 @@
    <%= image_tag("icon_home_debates.png") %> -

    Debates

    -

    Encontrarnos, debatir y compartir lo que nos parece conveniente, importante o necesario para nuestra ciudad.

    +

    <%= t("welcome.debates.title") %>

    +

    <%= t("welcome.debates.description") %>

    +
    <%= image_tag("icon_home_propones.png") %> -

    Propones

    -

    Hay también un espacio abierto para propuestas ciudadanas sobre el tipo de ciudad en el que queremos vivir.

    +

    <%= t("welcome.proposal.title") %>

    +

    <%= t("welcome.proposal.description") %>

    <%= image_tag("icon_home_decides.png") %> -

    Decides

    -

    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.

    +

    <%= t("welcome.decide.title") %>

    +

    <%= t("welcome.decide.description") %>

    <%= image_tag("icon_home_sehace.png") %> -

    Se hace

    -

    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.

    +

    <%= t("welcome.do.title") %>

    +

    <%= t("welcome.do.description") %>

    diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 15e8796f2..7c67a3a09 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -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*' diff --git a/config/locales/en.yml b/config/locales/en.yml index fea3d74ac..527a2f495 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 debaten sobre temas que les preocupan, proponen ideas para mejorar + # sus vidas y deciden 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." diff --git a/config/locales/es.yml b/config/locales/es.yml index 12144cdb6..8823f8321 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -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" diff --git a/config/locales/settings.en.yml b/config/locales/settings.en.yml index 6ef8d4053..8cc261c1e 100644 --- a/config/locales/settings.en.yml +++ b/config/locales/settings.en.yml @@ -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" \ No newline at end of file + proposal_code_prefix: "Prefix for Proposals codes" + votes_for_proposal_success: "Number of votes needed for Proposal approval" \ No newline at end of file diff --git a/config/locales/settings.es.yml b/config/locales/settings.es.yml index 96e485069..fa80fbdad 100644 --- a/config/locales/settings.es.yml +++ b/config/locales/settings.es.yml @@ -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" \ No newline at end of file + proposal_code_prefix: "Prefijo para los códigos de Propuestas" + votes_for_proposal_success: "Número de votos necesarios para aprobar una Propuesta" \ No newline at end of file diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index d8062e44f..f979d9453 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -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" diff --git a/db/migrate/20150914114019_change_email_config_field_in_user.rb b/db/migrate/20150914114019_change_email_config_field_in_user.rb new file mode 100644 index 000000000..90c875d60 --- /dev/null +++ b/db/migrate/20150914114019_change_email_config_field_in_user.rb @@ -0,0 +1,5 @@ +class ChangeEmailConfigFieldInUser < ActiveRecord::Migration + def change + rename_column :users, :email_on_debate_comment, :email_on_comment + end +end diff --git a/db/schema.rb b/db/schema.rb index b8d4cc424..9add178d4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" diff --git a/db/seeds.rb b/db/seeds.rb index 181386c4c..27da98e1c 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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') diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index 93cfe3dd0..e0249072c 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -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 diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index b6a9d1db5..1ce4b529f 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -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) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 756810395..f7ef59121 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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