From f5375e813d16d2dbabac6bfbc6dd0760c0891169 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 1 Jun 2016 13:30:44 +0200 Subject: [PATCH 001/126] stores a proposal notification --- .../proposal_notifications_controller.rb | 29 +++++++++++++++++ app/models/proposal_notification.rb | 8 +++++ app/views/proposal_notifications/new.html.erb | 13 ++++++++ .../proposal_notifications/show.html.erb | 2 ++ config/locales/en.yml | 6 ++++ config/locales/es.yml | 6 ++++ config/locales/responders.en.yml | 2 ++ config/locales/responders.es.yml | 1 + config/routes.rb | 2 ++ ...601103338_create_proposal_notifications.rb | 12 +++++++ db/schema.rb | 11 ++++++- spec/factories.rb | 11 +++++-- spec/features/proposal_notifications_spec.rb | 31 +++++++++++++++++++ spec/models/proposal_notification_spec.rb | 25 +++++++++++++++ 14 files changed, 155 insertions(+), 4 deletions(-) create mode 100644 app/controllers/proposal_notifications_controller.rb create mode 100644 app/models/proposal_notification.rb create mode 100644 app/views/proposal_notifications/new.html.erb create mode 100644 app/views/proposal_notifications/show.html.erb create mode 100644 db/migrate/20160601103338_create_proposal_notifications.rb create mode 100644 spec/features/proposal_notifications_spec.rb create mode 100644 spec/models/proposal_notification_spec.rb diff --git a/app/controllers/proposal_notifications_controller.rb b/app/controllers/proposal_notifications_controller.rb new file mode 100644 index 000000000..bd83c941c --- /dev/null +++ b/app/controllers/proposal_notifications_controller.rb @@ -0,0 +1,29 @@ +class ProposalNotificationsController < ApplicationController + skip_authorization_check + + def new + @notification = ProposalNotification.new + @proposal = Proposal.find(params[:proposal_id]) + end + + def create + @notification = ProposalNotification.new(notification_params) + @proposal = Proposal.find(notification_params[:proposal_id]) + if @notification.save + redirect_to @notification, notice: I18n.t("flash.actions.create.proposal_notification") + else + render :new + end + end + + def show + @notification = ProposalNotification.find(params[:id]) + end + + private + + def notification_params + params.require(:proposal_notification).permit(:title, :body, :proposal_id) + end + +end \ No newline at end of file diff --git a/app/models/proposal_notification.rb b/app/models/proposal_notification.rb new file mode 100644 index 000000000..d31b2e1a5 --- /dev/null +++ b/app/models/proposal_notification.rb @@ -0,0 +1,8 @@ +class ProposalNotification < ActiveRecord::Base + belongs_to :author, class_name: 'User', foreign_key: 'author_id' + belongs_to :proposal + + validates :title, presence: true + validates :body, presence: true + validates :proposal, presence: true +end \ No newline at end of file diff --git a/app/views/proposal_notifications/new.html.erb b/app/views/proposal_notifications/new.html.erb new file mode 100644 index 000000000..728b022a1 --- /dev/null +++ b/app/views/proposal_notifications/new.html.erb @@ -0,0 +1,13 @@ +<%= form_for @notification do |f| %> + <%= render "shared/errors", resource: @notification %> + + <%= f.label :title, t("proposal_notifications.new.title_label") %> + <%= f.text_field :title, label: false %> + + <%= f.label :body, t("proposal_notifications.new.body_label") %> + <%= f.text_area :body, label: false %> + + <%= f.hidden_field :proposal_id, value: @proposal.id %> + + <%= f.submit t("proposal_notifications.new.submit_button") %> +<% end %> \ No newline at end of file diff --git a/app/views/proposal_notifications/show.html.erb b/app/views/proposal_notifications/show.html.erb new file mode 100644 index 000000000..e3c50e8cc --- /dev/null +++ b/app/views/proposal_notifications/show.html.erb @@ -0,0 +1,2 @@ +
<%= @notification.title %>
+
<%= @notification.body %>
\ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 62fc521c5..725e8d08b 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -146,6 +146,7 @@ en: not_saved: 'prevented this %{resource} from being saved:' policy: Privacy Policy proposal: Proposal + proposal_notification: "Notification" spending_proposal: Spending proposal user: Account verification/sms: phone @@ -360,6 +361,11 @@ en: update: form: submit_button: Save changes + proposal_notifications: + new: + title_label: "Title" + body_label: "Message" + submit_button: "Send" shared: advanced_search: author_type: 'By author category' diff --git a/config/locales/es.yml b/config/locales/es.yml index 05e53fc2b..840dcf705 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -146,6 +146,7 @@ es: not_saved: 'impidieron guardar %{resource}:' policy: Política de privacidad proposal: la propuesta + proposal_notification: "la notificación" spending_proposal: la propuesta de gasto user: la cuenta verification/sms: el teléfono @@ -360,6 +361,11 @@ es: update: form: submit_button: Guardar cambios + proposal_notifications: + new: + title_label: "Título" + body_label: "Mensaje" + submit_button: "Enviar" shared: advanced_search: author_type: 'Por categoría de autor' diff --git a/config/locales/responders.en.yml b/config/locales/responders.en.yml index 3f83f746a..1155ff34a 100755 --- a/config/locales/responders.en.yml +++ b/config/locales/responders.en.yml @@ -6,7 +6,9 @@ en: notice: "%{resource_name} created successfully." debate: "Debate created successfully." proposal: "Proposal created successfully." + proposal_notification: "Your message has been sent correctly." spending_proposal: "Spending proposal created successfully. You can access it from %{activity}" + save_changes: notice: Changes saved update: diff --git a/config/locales/responders.es.yml b/config/locales/responders.es.yml index e57dacd31..948b6650f 100644 --- a/config/locales/responders.es.yml +++ b/config/locales/responders.es.yml @@ -6,6 +6,7 @@ es: notice: "%{resource_name} creado correctamente." debate: "Debate creado correctamente." proposal: "Propuesta creada correctamente." + proposal_notification: "Tu message ha sido enviado correctamente." spending_proposal: "Propuesta de inversión creada correctamente. Puedes acceder a ella desde %{activity}" save_changes: notice: Cambios guardados diff --git a/config/routes.rb b/config/routes.rb index 7d0a3a996..6cba48e42 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -93,6 +93,8 @@ Rails.application.routes.draw do put :mark_all_as_read, on: :collection end + resources :proposal_notifications, only: [:new, :create, :show] + resource :verification, controller: "verification", only: [:show] scope module: :verification do diff --git a/db/migrate/20160601103338_create_proposal_notifications.rb b/db/migrate/20160601103338_create_proposal_notifications.rb new file mode 100644 index 000000000..97760da6b --- /dev/null +++ b/db/migrate/20160601103338_create_proposal_notifications.rb @@ -0,0 +1,12 @@ +class CreateProposalNotifications < ActiveRecord::Migration + def change + create_table :proposal_notifications do |t| + t.string :title + t.text :body + t.integer :author_id + t.integer :proposal_id + + t.timestamps null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 10f10c7a8..91628725a 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: 20160518141543) do +ActiveRecord::Schema.define(version: 20160601103338) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -260,6 +260,15 @@ ActiveRecord::Schema.define(version: 20160518141543) do add_index "organizations", ["user_id"], name: "index_organizations_on_user_id", using: :btree + create_table "proposal_notifications", force: :cascade do |t| + t.string "title" + t.text "body" + t.integer "author_id" + t.integer "proposal_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "proposals", force: :cascade do |t| t.string "title", limit: 80 t.text "description" diff --git a/spec/factories.rb b/spec/factories.rb index 62bea738f..0a9645dcb 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -1,5 +1,4 @@ FactoryGirl.define do - sequence(:document_number) { |n| "#{n.to_s.rjust(8, '0')}X" } factory :user do @@ -323,7 +322,13 @@ FactoryGirl.define do style {["banner-style-one", "banner-style-two", "banner-style-three"].sample} image {["banner.banner-img-one", "banner.banner-img-two", "banner.banner-img-three"].sample} target_url {["/proposals", "/debates" ].sample} - post_started_at Time.now - 7.days - post_ended_at Time.now + 7.days + post_started_at Time.now - 7.days + post_ended_at Time.now + 7.days + end + + factory :proposal_notification do + title "Thank you for supporting my proposal" + body "Please let others know so we can make it happen" + proposal end end diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb new file mode 100644 index 000000000..756fc3fdd --- /dev/null +++ b/spec/features/proposal_notifications_spec.rb @@ -0,0 +1,31 @@ +require 'rails_helper' + +feature 'Proposal Notifications' do + + scenario "Send a notification" do + noelia = create(:user) + vega = create(:user) + + proposal = create(:proposal) + #use correct path from my activity + visit new_proposal_notification_path(proposal_id: proposal.id) + + fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal" + fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen!" + click_button "Send" + + expect(page).to have_content "Your message has been sent correctly." + expect(page).to have_content "Thank you for supporting my proposal" + expect(page).to have_content "Please share it with others so we can make it happen!" + end + + scenario "Error messages" do + proposal = create(:proposal) + + visit new_proposal_notification_path(proposal_id: proposal.id) + click_button "Send" + + expect(page).to have_content error_message + end + +end \ No newline at end of file diff --git a/spec/models/proposal_notification_spec.rb b/spec/models/proposal_notification_spec.rb new file mode 100644 index 000000000..5a7575219 --- /dev/null +++ b/spec/models/proposal_notification_spec.rb @@ -0,0 +1,25 @@ +require 'rails_helper' + +describe ProposalNotification do + let(:notification) { build(:proposal_notification) } + + it "should be valid" do + expect(notification).to be_valid + end + + it "should not be valid without a title" do + notification.title = nil + expect(notification).to_not be_valid + end + + it "should not be valid without a body" do + notification.body = nil + expect(notification).to_not be_valid + end + + it "should not be valid without an associated proposal" do + notification.proposal = nil + expect(notification).to_not be_valid + end + +end From 6e4ed0b8951e50a9d05f360a846f922a35c5c48a Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 1 Jun 2016 21:01:24 +0200 Subject: [PATCH 002/126] adds link to send message from my activity --- app/controllers/users_controller.rb | 7 +++- app/views/users/_proposals.html.erb | 11 ++++-- config/locales/en.yml | 6 ++-- config/locales/es.yml | 6 ++-- spec/features/proposal_notifications_spec.rb | 38 ++++++++++++++++++-- 5 files changed, 58 insertions(+), 10 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index af4005e06..fbd77f184 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3,6 +3,7 @@ class UsersController < ApplicationController load_and_authorize_resource helper_method :authorized_for_filter? + helper_method :author? helper_method :author_or_admin? def show @@ -65,8 +66,12 @@ class UsersController < ApplicationController @user.public_activity || authorized_current_user? end + def author? + @author ||= current_user && (current_user == @user) + end + def author_or_admin? - @author_or_admin ||= current_user && (current_user == @user || current_user.administrator?) + @author_or_admin ||= current_user && (author? || current_user.administrator?) end def authorized_current_user? diff --git a/app/views/users/_proposals.html.erb b/app/views/users/_proposals.html.erb index e0b54dcc4..d23e865ca 100644 --- a/app/views/users/_proposals.html.erb +++ b/app/views/users/_proposals.html.erb @@ -7,17 +7,24 @@ <%= proposal.summary %> + <% if author? %> + + <%= link_to t("users.proposals.send_message"), new_proposal_notification_path(proposal_id: proposal.id) %> + + <% end %> + <% if author_or_admin? %> <% if proposal.retired? %> - <%= t('users.show.retired') %> + <%= t('users.proposals.retired') %> <% else %> - <%= link_to t('users.show.retire'), + <%= link_to t('users.proposals.retire'), retire_form_proposal_path(proposal), class: 'delete' %> <% end %> <% end %> + <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 725e8d08b..40407f3fc 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -510,8 +510,10 @@ en: other: "%{count} Spending proposals" no_activity: User has no public activity private_activity: This user decided to keep the activity list private - retire: Retire - retired: Retired + proposals: + send_message: "Send message" + retire: "Retire" + retired: "Retired" votes: agree: I agree anonymous: Too many anonymous votes to admit vote %{verify_account}. diff --git a/config/locales/es.yml b/config/locales/es.yml index 840dcf705..4c26d7561 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -510,8 +510,10 @@ es: other: "%{count} Propuestas de inversión" no_activity: Usuario sin actividad pública private_activity: Este usuario ha decidido mantener en privado su lista de actividades - retire: Retirar - retired: Retirada + proposals: + send_message: "Enviar mensaje" + retire: "Retirar" + retired: "Retirada" votes: agree: Estoy de acuerdo anonymous: Demasiados votos anónimos, para poder votar %{verify_account}. diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index 756fc3fdd..d10beb6f4 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -6,9 +6,17 @@ feature 'Proposal Notifications' do noelia = create(:user) vega = create(:user) - proposal = create(:proposal) - #use correct path from my activity - visit new_proposal_notification_path(proposal_id: proposal.id) + author = create(:user) + proposal = create(:proposal, author: author) + + login_as(author) + visit root_path + + click_link "My activity" + + within("#proposal_#{proposal.id}") do + click_link "Send message" + end fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal" fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen!" @@ -19,6 +27,30 @@ feature 'Proposal Notifications' do expect(page).to have_content "Please share it with others so we can make it happen!" end + context "Permissions" do + + scenario "Link to send the message" do + user = create(:user) + author = create(:user) + proposal = create(:proposal, author: author) + + login_as(author) + visit user_path(author) + + within("#proposal_#{proposal.id}") do + expect(page).to have_link "Send message" + end + + login_as(user) + visit user_path(author) + + within("#proposal_#{proposal.id}") do + expect(page).to_not have_link "Send message" + end + end + + end + scenario "Error messages" do proposal = create(:proposal) From ca26b3423b01a1889cee75ad66a676e0054f1c13 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 1 Jun 2016 21:40:23 +0200 Subject: [PATCH 003/126] sends notification email to each voter --- .../proposal_notifications_controller.rb | 3 ++ app/mailers/mailer.rb | 8 +++++ app/models/proposal.rb | 4 +++ .../mailer/proposal_notification.html.erb | 2 ++ spec/features/emails_spec.rb | 36 +++++++++++++++++++ spec/features/proposal_notifications_spec.rb | 3 -- 6 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 app/views/mailer/proposal_notification.html.erb diff --git a/app/controllers/proposal_notifications_controller.rb b/app/controllers/proposal_notifications_controller.rb index bd83c941c..fe6add7e2 100644 --- a/app/controllers/proposal_notifications_controller.rb +++ b/app/controllers/proposal_notifications_controller.rb @@ -10,6 +10,9 @@ class ProposalNotificationsController < ApplicationController @notification = ProposalNotification.new(notification_params) @proposal = Proposal.find(notification_params[:proposal_id]) if @notification.save + @proposal.voters.each do |voter| + Mailer.proposal_notification(@notification, voter).deliver_later + end redirect_to @notification, notice: I18n.t("flash.actions.create.proposal_notification") else render :new diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 82abbb205..b8ca433ce 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -42,6 +42,14 @@ class Mailer < ApplicationMailer end end + def proposal_notification(notification, voter) + @notification = notification + + with_user(voter) do + mail(to: voter.email, subject: @notification.title) + end + end + private def with_user(user, &block) diff --git a/app/models/proposal.rb b/app/models/proposal.rb index d2b97f1c5..f9ef60303 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -97,6 +97,10 @@ class Proposal < ActiveRecord::Base cached_votes_up + physical_votes end + def voters + votes_for.voters + end + def editable? total_votes <= Setting["max_votes_for_proposal_edit"].to_i end diff --git a/app/views/mailer/proposal_notification.html.erb b/app/views/mailer/proposal_notification.html.erb new file mode 100644 index 000000000..30e8d8bc6 --- /dev/null +++ b/app/views/mailer/proposal_notification.html.erb @@ -0,0 +1,2 @@ +
<%= @notification.proposal.title %>
+
<%= @notification.body %>
diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index c6f0d3708..81e6560ff 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -148,4 +148,40 @@ feature 'Emails' do expect(email).to have_body_text(spending_proposal.feasible_explanation) end + scenario "Proposal notification" do + author = create(:user) + + noelia = create(:user) + vega = create(:user) + cristina = create(:user) + + proposal = create(:proposal, author: author) + + create(:vote, voter: noelia, votable: proposal, vote_flag: true) + create(:vote, voter: vega, votable: proposal, vote_flag: true) + + reset_mailer + + login_as(author) + visit root_path + + visit new_proposal_notification_path(proposal_id: proposal.id) + + fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal" + fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen!" + click_button "Send" + + expect(page).to have_content "Your message has been sent correctly." + + expect(unread_emails_for(noelia.email).size).to eql parse_email_count(1) + expect(unread_emails_for(vega.email).size).to eql parse_email_count(1) + expect(unread_emails_for(cristina.email).size).to eql parse_email_count(0) + expect(unread_emails_for(author.email).size).to eql parse_email_count(0) + + email = open_last_email + expect(email).to have_subject("Thank you for supporting my proposal") + expect(email).to have_body_text("Please share it with others so we can make it happen!") + expect(email).to have_body_text(proposal.title) + end + end diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index d10beb6f4..b014aa162 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -3,9 +3,6 @@ require 'rails_helper' feature 'Proposal Notifications' do scenario "Send a notification" do - noelia = create(:user) - vega = create(:user) - author = create(:user) proposal = create(:proposal, author: author) From 0ef316de911252aa9c6df2c5b07cd3f205071601 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Thu, 2 Jun 2016 13:36:41 +0200 Subject: [PATCH 004/126] Improves styles for proposal notifications --- .../mailer/proposal_notification.html.erb | 11 ++++++-- app/views/proposal_notifications/new.html.erb | 28 +++++++++++++------ .../proposal_notifications/show.html.erb | 13 +++++++-- config/locales/en.yml | 5 +++- config/locales/es.yml | 5 +++- 5 files changed, 47 insertions(+), 15 deletions(-) diff --git a/app/views/mailer/proposal_notification.html.erb b/app/views/mailer/proposal_notification.html.erb index 30e8d8bc6..59489840c 100644 --- a/app/views/mailer/proposal_notification.html.erb +++ b/app/views/mailer/proposal_notification.html.erb @@ -1,2 +1,9 @@ -
<%= @notification.proposal.title %>
-
<%= @notification.body %>
+ +

+ <%= @notification.proposal.title %> +

+ +

+ <%= @notification.body %> +

+ diff --git a/app/views/proposal_notifications/new.html.erb b/app/views/proposal_notifications/new.html.erb index 728b022a1..60f7e64e4 100644 --- a/app/views/proposal_notifications/new.html.erb +++ b/app/views/proposal_notifications/new.html.erb @@ -1,13 +1,23 @@ -<%= form_for @notification do |f| %> - <%= render "shared/errors", resource: @notification %> +
+
+ <%= render 'shared/back_link' %> - <%= f.label :title, t("proposal_notifications.new.title_label") %> - <%= f.text_field :title, label: false %> +

<%= t("proposal_notifications.new.title") %>

- <%= f.label :body, t("proposal_notifications.new.body_label") %> - <%= f.text_area :body, label: false %> + <%= form_for @notification do |f| %> + <%= render "shared/errors", resource: @notification %> - <%= f.hidden_field :proposal_id, value: @proposal.id %> + <%= f.label :title, t("proposal_notifications.new.title_label") %> + <%= f.text_field :title, label: false %> - <%= f.submit t("proposal_notifications.new.submit_button") %> -<% end %> \ No newline at end of file + <%= f.label :body, t("proposal_notifications.new.body_label") %> + <%= f.text_area :body, label: false, rows: "3" %> + + <%= f.hidden_field :proposal_id, value: @proposal.id %> + +
+ <%= f.submit t("proposal_notifications.new.submit_button"), class: "button expanded" %> +
+ <% end %> +
+
diff --git a/app/views/proposal_notifications/show.html.erb b/app/views/proposal_notifications/show.html.erb index e3c50e8cc..379b361fb 100644 --- a/app/views/proposal_notifications/show.html.erb +++ b/app/views/proposal_notifications/show.html.erb @@ -1,2 +1,11 @@ -
<%= @notification.title %>
-
<%= @notification.body %>
\ No newline at end of file +
+
+ <%= link_to user_path(current_user), class: "back" do %> + + <%= t("proposal_notifications.show.back") %> + <% end %> + +

<%= @notification.title %>

+

<%= @notification.body %>

+
+
diff --git a/config/locales/en.yml b/config/locales/en.yml index 40407f3fc..40b32f712 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -363,9 +363,12 @@ en: submit_button: Save changes proposal_notifications: new: + title: "Send message" title_label: "Title" body_label: "Message" - submit_button: "Send" + submit_button: "Send message" + show: + back: "Go back to my activity" shared: advanced_search: author_type: 'By author category' diff --git a/config/locales/es.yml b/config/locales/es.yml index 4c26d7561..5dc388853 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -363,9 +363,12 @@ es: submit_button: Guardar cambios proposal_notifications: new: + title: "Enviar mensaje" title_label: "Título" body_label: "Mensaje" - submit_button: "Enviar" + submit_button: "Enviar mensaje" + show: + back: "Volver a mi actividad" shared: advanced_search: author_type: 'Por categoría de autor' From fc6cc090f8ab9dbb0d18484f06a818f4e31e6dab Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 6 Jun 2016 12:21:48 +0200 Subject: [PATCH 005/126] displays notifications in proposal view --- app/controllers/proposals_controller.rb | 2 +- app/models/proposal.rb | 5 +++++ app/views/proposals/_notifications.html.erb | 6 ++++++ app/views/proposals/show.html.erb | 1 + spec/features/proposal_notifications_spec.rb | 14 ++++++++++++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 app/views/proposals/_notifications.html.erb diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index 0b350f687..578395ab3 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -2,7 +2,6 @@ class ProposalsController < ApplicationController include CommentableActions include FlagActions - before_action :parse_search_terms, only: [:index, :suggest] before_action :parse_advanced_search_terms, only: :index before_action :parse_tag_filter, only: :index @@ -22,6 +21,7 @@ class ProposalsController < ApplicationController def show super + @notifications = @proposal.notifications redirect_to proposal_path(@proposal), status: :moved_permanently if request.path != proposal_path(@proposal) end diff --git a/app/models/proposal.rb b/app/models/proposal.rb index f9ef60303..7d2bddb30 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -16,6 +16,7 @@ class Proposal < ActiveRecord::Base belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id' belongs_to :geozone has_many :comments, as: :commentable + has_many :proposal_notifications validates :title, presence: true validates :question, presence: true @@ -154,6 +155,10 @@ class Proposal < ActiveRecord::Base Setting['votes_for_proposal_success'].to_i end + def notifications + proposal_notifications + end + protected def set_responsible_name diff --git a/app/views/proposals/_notifications.html.erb b/app/views/proposals/_notifications.html.erb new file mode 100644 index 000000000..576ed8cc6 --- /dev/null +++ b/app/views/proposals/_notifications.html.erb @@ -0,0 +1,6 @@ +
+ <% @notifications.each do |notification| %> +
<%= notification.title %>
+
<%= notification.body %>
+ <% end %> +
\ No newline at end of file diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index cb2773c65..9d8c3b739 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -118,4 +118,5 @@ <% end %> +<%= render "proposals/notifications" %> <%= render "proposals/comments" %> diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index b014aa162..1662475b1 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -24,6 +24,20 @@ feature 'Proposal Notifications' do expect(page).to have_content "Please share it with others so we can make it happen!" end + scenario "Show notifications" do + proposal = create(:proposal) + notification1 = create(:proposal_notification, proposal: proposal, title: "Hey guys", body: "Just wanted to let you know that...") + notification2 = create(:proposal_notification, proposal: proposal, title: "Another update", body: "We are almost there please share with your peoples!") + + visit proposal_path(proposal) + + expect(page).to have_content "Hey guys" + expect(page).to have_content "Just wanted to let you know that..." + + expect(page).to have_content "Another update" + expect(page).to have_content "We are almost there please share with your peoples!" + end + context "Permissions" do scenario "Link to send the message" do From ad697cd2c190b2079b77f769783ac7c1bb75cb8d Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 6 Jun 2016 12:55:33 +0200 Subject: [PATCH 006/126] adds preference to receive proposal notifications --- app/controllers/account_controller.rb | 2 +- .../proposal_notifications_controller.rb | 4 +- app/views/account/show.html.erb | 25 +++++-- config/locales/en.yml | 1 + config/locales/es.yml | 1 + ...email_on_proposal_notification_to_users.rb | 5 ++ db/schema.rb | 35 +++++----- spec/features/account_spec.rb | 11 +-- spec/features/emails_spec.rb | 68 ++++++++++++------- spec/models/user_spec.rb | 6 ++ 10 files changed, 107 insertions(+), 51 deletions(-) create mode 100644 db/migrate/20160606102427_add_email_on_proposal_notification_to_users.rb diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 9a0f89bae..d1ac9c9c4 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -25,7 +25,7 @@ class AccountController < ApplicationController if @account.organization? params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, :newsletter, organization_attributes: [:name, :responsible_name]) else - params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :newsletter) + params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_proposal_notification, :newsletter) end end diff --git a/app/controllers/proposal_notifications_controller.rb b/app/controllers/proposal_notifications_controller.rb index fe6add7e2..f1249c707 100644 --- a/app/controllers/proposal_notifications_controller.rb +++ b/app/controllers/proposal_notifications_controller.rb @@ -11,7 +11,9 @@ class ProposalNotificationsController < ApplicationController @proposal = Proposal.find(notification_params[:proposal_id]) if @notification.save @proposal.voters.each do |voter| - Mailer.proposal_notification(@notification, voter).deliver_later + if voter.email_on_proposal_notification? + Mailer.proposal_notification(@notification, voter).deliver_later + end end redirect_to @notification, notice: I18n.t("flash.actions.create.proposal_notification") else diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index f0d2b6abc..b3a84dede 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -34,7 +34,9 @@
<%= f.label :public_activity do %> <%= f.check_box :public_activity, title: t('account.show.public_activity_label'), label: false %> - <%= t("account.show.public_activity_label") %> + + <%= t("account.show.public_activity_label") %> + <% end %>
@@ -43,21 +45,36 @@
<%= f.label :email_on_comment do %> <%= f.check_box :email_on_comment, title: t('account.show.email_on_comment_label'), label: false %> - <%= t("account.show.email_on_comment_label") %> + + <%= t("account.show.email_on_comment_label") %> + <% end %>
<%= f.label :email_on_comment_reply do %> <%= f.check_box :email_on_comment_reply, title: t('account.show.email_on_comment_reply_label'), label: false %> - <%= t("account.show.email_on_comment_reply_label") %> + + <%= t("account.show.email_on_comment_reply_label") %> + <% end %>
<%= f.label :email_newsletter_subscribed do %> <%= f.check_box :newsletter, title: t('account.show.subscription_to_website_newsletter_label'), label: false %> - <%= t("account.show.subscription_to_website_newsletter_label") %> + + <%= t("account.show.subscription_to_website_newsletter_label") %> + + <% end %> +
+ +
+ <%= f.label :email_on_proposal_notification do %> + <%= f.check_box :email_on_proposal_notification, title: t('account.show.email_on_proposal_notification_label'), label: false %> + + <%= t("account.show.email_on_proposal_notification_label") %> + <% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 40b32f712..5a0dec0c6 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -15,6 +15,7 @@ en: public_activity_label: Keep my list of activities public save_changes_submit: Save changes subscription_to_website_newsletter_label: Receive by email website relevant information + email_on_proposal_notification_label: Receive by email notifications about proposals title: My account user_permission_debates: Participate on debates user_permission_info: With your account you can... diff --git a/config/locales/es.yml b/config/locales/es.yml index 5dc388853..909e20bbc 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -15,6 +15,7 @@ es: public_activity_label: Mostrar públicamente mi lista de actividades save_changes_submit: Guardar cambios subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web + email_on_proposal_notification_label: Recibir emails con notificaciones sobre propuestas title: Mi cuenta user_permission_debates: Participar en debates user_permission_info: Con tu cuenta ya puedes... diff --git a/db/migrate/20160606102427_add_email_on_proposal_notification_to_users.rb b/db/migrate/20160606102427_add_email_on_proposal_notification_to_users.rb new file mode 100644 index 000000000..84753eb50 --- /dev/null +++ b/db/migrate/20160606102427_add_email_on_proposal_notification_to_users.rb @@ -0,0 +1,5 @@ +class AddEmailOnProposalNotificationToUsers < ActiveRecord::Migration + def change + add_column :users, :email_on_proposal_notification, :boolean, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 91628725a..a8e09434e 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: 20160601103338) do +ActiveRecord::Schema.define(version: 20160606102427) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -402,30 +402,30 @@ ActiveRecord::Schema.define(version: 20160601103338) do add_index "tolk_translations", ["phrase_id", "locale_id"], name: "index_tolk_translations_on_phrase_id_and_locale_id", unique: true, using: :btree create_table "users", force: :cascade do |t| - t.string "email", default: "" - t.string "encrypted_password", default: "", null: false + t.string "email", default: "" + t.string "encrypted_password", default: "", null: false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" t.string "unconfirmed_email" - t.boolean "email_on_comment", default: false - t.boolean "email_on_comment_reply", default: false - t.string "phone_number", limit: 30 + 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" - t.integer "official_level", default: 0 + t.integer "official_level", default: 0 t.datetime "hidden_at" t.string "sms_confirmation_code" - t.string "username", limit: 60 + t.string "username", limit: 60 t.string "document_number" t.string "document_type" t.datetime "residence_verified_at" @@ -436,20 +436,21 @@ ActiveRecord::Schema.define(version: 20160601103338) do t.datetime "letter_requested_at" t.datetime "confirmed_hide_at" t.string "letter_verification_code" - t.integer "failed_census_calls_count", default: 0 + t.integer "failed_census_calls_count", default: 0 t.datetime "level_two_verified_at" t.string "erase_reason" t.datetime "erased_at" - t.boolean "public_activity", default: true - t.boolean "newsletter", default: true - t.integer "notifications_count", default: 0 - t.boolean "registering_with_oauth", default: false + t.boolean "public_activity", default: true + t.boolean "newsletter", default: true + t.integer "notifications_count", default: 0 + t.boolean "registering_with_oauth", default: false t.string "locale" t.string "oauth_email" t.integer "geozone_id" t.string "redeemable_code" - t.string "gender", limit: 10 + t.string "gender", limit: 10 t.datetime "date_of_birth" + t.boolean "email_on_proposal_notification", default: true end add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index bc9c38dae..f5ba747fb 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -35,6 +35,7 @@ feature 'Account' do fill_in 'account_username', with: 'Larry Bird' check 'account_email_on_comment' check 'account_email_on_comment_reply' + uncheck 'account_email_on_proposal_notification' click_button 'Save changes' expect(page).to have_content "Changes saved" @@ -42,8 +43,9 @@ 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_comment'][value='1']") - expect(page).to have_selector("input[id='account_email_on_comment_reply'][value='1']") + expect(find("#account_email_on_comment")).to be_checked + expect(find("#account_email_on_comment_reply")).to be_checked + expect(find("#account_email_on_proposal_notification")).to_not be_checked end scenario 'Edit Organization' do @@ -53,6 +55,7 @@ feature 'Account' do fill_in 'account_organization_attributes_name', with: 'Google' check 'account_email_on_comment' check 'account_email_on_comment_reply' + click_button 'Save changes' expect(page).to have_content "Changes saved" @@ -60,8 +63,8 @@ feature 'Account' do visit account_path expect(page).to have_selector("input[value='Google']") - 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(find("#account_email_on_comment")).to be_checked + expect(find("#account_email_on_comment_reply")).to be_checked end scenario "Errors on edit" do diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index 81e6560ff..e61403635 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -148,40 +148,60 @@ feature 'Emails' do expect(email).to have_body_text(spending_proposal.feasible_explanation) end - scenario "Proposal notification" do - author = create(:user) + context "Proposal notifications" do - noelia = create(:user) - vega = create(:user) - cristina = create(:user) + scenario "Proposal notification" do + author = create(:user) - proposal = create(:proposal, author: author) + noelia = create(:user) + vega = create(:user) + cristina = create(:user) - create(:vote, voter: noelia, votable: proposal, vote_flag: true) - create(:vote, voter: vega, votable: proposal, vote_flag: true) + proposal = create(:proposal, author: author) - reset_mailer + create(:vote, voter: noelia, votable: proposal, vote_flag: true) + create(:vote, voter: vega, votable: proposal, vote_flag: true) - login_as(author) - visit root_path + reset_mailer - visit new_proposal_notification_path(proposal_id: proposal.id) + login_as(author) + visit root_path - fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal" - fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen!" - click_button "Send" + visit new_proposal_notification_path(proposal_id: proposal.id) - expect(page).to have_content "Your message has been sent correctly." + fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal" + fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen!" + click_button "Send message" - expect(unread_emails_for(noelia.email).size).to eql parse_email_count(1) - expect(unread_emails_for(vega.email).size).to eql parse_email_count(1) - expect(unread_emails_for(cristina.email).size).to eql parse_email_count(0) - expect(unread_emails_for(author.email).size).to eql parse_email_count(0) + expect(page).to have_content "Your message has been sent correctly." - email = open_last_email - expect(email).to have_subject("Thank you for supporting my proposal") - expect(email).to have_body_text("Please share it with others so we can make it happen!") - expect(email).to have_body_text(proposal.title) + expect(unread_emails_for(noelia.email).size).to eql parse_email_count(1) + expect(unread_emails_for(vega.email).size).to eql parse_email_count(1) + expect(unread_emails_for(cristina.email).size).to eql parse_email_count(0) + expect(unread_emails_for(author.email).size).to eql parse_email_count(0) + + email = open_last_email + expect(email).to have_subject("Thank you for supporting my proposal") + expect(email).to have_body_text("Please share it with others so we can make it happen!") + expect(email).to have_body_text(proposal.title) + end + + scenario "Do not send email about proposal notifications unless set in preferences", :js do + author = create(:user) + voter = create(:user, email_on_proposal_notification: false) + + proposal = create(:proposal) + create(:vote, voter: voter, votable: proposal, vote_flag: true) + + login_as(author) + visit new_proposal_notification_path(proposal_id: proposal.id) + + fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal" + fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen!" + click_button "Send message" + + expect { open_last_email }.to raise_error "No email has been sent!" + end end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 054e043f9..ca46ff68f 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -83,6 +83,12 @@ describe User do expect(subject.newsletter).to eq(true) end end + + describe 'email_on_proposal_notification' do + it 'should be true by default' do + expect(subject.email_on_proposal_notification).to eq(true) + end + end end describe "administrator?" do From 86f0cae7bbdd78141f0cd8d3bb7f34b60c9d7c41 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 6 Jun 2016 13:52:40 +0200 Subject: [PATCH 007/126] fixes specs --- app/views/proposals/_notifications.html.erb | 14 ++++++++------ spec/features/proposal_notifications_spec.rb | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/proposals/_notifications.html.erb b/app/views/proposals/_notifications.html.erb index 576ed8cc6..9e3af3e9e 100644 --- a/app/views/proposals/_notifications.html.erb +++ b/app/views/proposals/_notifications.html.erb @@ -1,6 +1,8 @@ -
- <% @notifications.each do |notification| %> -
<%= notification.title %>
-
<%= notification.body %>
- <% end %> -
\ No newline at end of file +<% if @notifications.present? %> +
+ <% @notifications.each do |notification| %> +
<%= notification.title %>
+
<%= notification.body %>
+ <% end %> +
+<% end %> \ No newline at end of file diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index 1662475b1..3046c6ab5 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -17,7 +17,7 @@ feature 'Proposal Notifications' do fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal" fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen!" - click_button "Send" + click_button "Send message" expect(page).to have_content "Your message has been sent correctly." expect(page).to have_content "Thank you for supporting my proposal" @@ -66,7 +66,7 @@ feature 'Proposal Notifications' do proposal = create(:proposal) visit new_proposal_notification_path(proposal_id: proposal.id) - click_button "Send" + click_button "Send message" expect(page).to have_content error_message end From a2c9756c1873fe09ac02e09f58f62a140dcd890a Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 6 Jun 2016 16:50:00 +0200 Subject: [PATCH 008/126] displays message about receivers --- app/views/proposal_notifications/new.html.erb | 8 ++++++++ config/locales/en.yml | 2 ++ config/locales/es.yml | 2 ++ spec/features/proposal_notifications_spec.rb | 13 +++++++++++++ 4 files changed, 25 insertions(+) diff --git a/app/views/proposal_notifications/new.html.erb b/app/views/proposal_notifications/new.html.erb index 60f7e64e4..f8be10c2e 100644 --- a/app/views/proposal_notifications/new.html.erb +++ b/app/views/proposal_notifications/new.html.erb @@ -4,6 +4,14 @@

<%= t("proposal_notifications.new.title") %>

+

+ <%= t("proposal_notifications.new.info_about_receivers", + count: @proposal.voters.count) %> + + <%= link_to t("proposal_notifications.new.proposal_page"), + proposal_path(@proposal) %> +

+ <%= form_for @notification do |f| %> <%= render "shared/errors", resource: @notification %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 5a0dec0c6..a830de2d8 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -368,6 +368,8 @@ en: title_label: "Title" body_label: "Message" submit_button: "Send message" + info_about_receivers: "This message will be send to %{count} people and it will be visible in " + proposal_page: "the proposal's page" show: back: "Go back to my activity" shared: diff --git a/config/locales/es.yml b/config/locales/es.yml index 909e20bbc..670aaa2d6 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -368,6 +368,8 @@ es: title_label: "Título" body_label: "Mensaje" submit_button: "Enviar mensaje" + info_about_receivers: "Este mensaje se enviará a %{count} usuarios y se publicará en " + proposal_page: "la página de la propuesta" show: back: "Volver a mi actividad" shared: diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index 3046c6ab5..f40e0b81e 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -38,6 +38,19 @@ feature 'Proposal Notifications' do expect(page).to have_content "We are almost there please share with your peoples!" end + scenario "Message about receivers" do + author = create(:user) + proposal = create(:proposal, author: author) + + 7.times { create(:vote, votable: proposal, vote_flag: true) } + + login_as(author) + visit new_proposal_notification_path(proposal_id: proposal.id) + + expect(page).to have_content "This message will be send to 7 people and it will be visible in the proposal's page" + expect(page).to have_link("the proposal's page", href: proposal_path(proposal)) + end + context "Permissions" do scenario "Link to send the message" do From 84f9dcaa7650855b0dafb1ccc82a6548515646a6 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Jun 2016 17:26:48 +0200 Subject: [PATCH 009/126] Adds tabs for notifications on proposal show --- app/assets/stylesheets/_settings.scss | 136 ++++++++++---------- app/assets/stylesheets/layout.scss | 32 ++++- app/assets/stylesheets/participation.scss | 10 ++ app/views/proposals/_comments.html.erb | 12 +- app/views/proposals/_filter_subnav.html.erb | 22 ++++ app/views/proposals/_notifications.html.erb | 17 ++- app/views/proposals/show.html.erb | 13 +- app/views/users/_proposals.html.erb | 5 +- config/locales/en.yml | 2 + config/locales/es.yml | 2 + 10 files changed, 166 insertions(+), 85 deletions(-) create mode 100644 app/views/proposals/_filter_subnav.html.erb diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index 22e7ac8de..1e181e1c1 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -3,6 +3,7 @@ // // Table of Contents: // +// 0. Custom variables // 1. Global // 2. Breakpoints // 3. The Grid @@ -43,6 +44,70 @@ @import 'util/util'; +// 0. Custom variables +// -------------------- + +$base-font-size: rem-calc(17); +$base-line-height: rem-calc(26); +$small-font-size: rem-calc(14); +$line-height: rem-calc(24); + +$brand: #004A83; +$body: #E9E9E9; +$background: #EDEFF0; +$border: #DEE0E3; +$dark: darken($brand, 10%); + +$text: #222222; +$text-medium: #999999; +$text-light: #CCCCCC; + +$link: #2895F1; +$link-hover: #2178BF; + +$debates: #008CCF; +$votes-bg: #26AEEE; +$votes-border: #1F94CB; + +$votes-like: #7BD2A8; +$votes-like-act: #5D9E7F; +$votes-unlike: #EF8585; +$votes-unlike-act: #BD6A6A; + +$delete: #F04124; +$check: #46DB91; + +$proposals: #FFA42D; +$proposals-border: #CC8425; + +$budget: #454372; +$budget-hover: #7571BF; + +$highlight: #E7F2FC; +$featured: #FED900; + +$footer-bg: #DEE0E2; +$footer-color: #171819; +$footer-link: #454A4C; +$footer-border: #BFC1C3; + +$success-bg: #DFF0D8; +$success-border: #D6E9C6; +$color-success: #3C763D; + +$info-bg: #D9EDF7; +$info-border: #BCE8F1; +$color-info: #31708F; + +$warning-bg: #FCF8E3; +$warning-border: #FAEBCC; +$color-warning: #8A6D3B; + +$alert-bg: #F2DEDE; +$alert-border: #EBCCD1; +$color-alert: #A94442; + + // 1. Global // --------- @@ -510,13 +575,13 @@ $show-header-for-stacked: false; $tab-margin: 0; $tab-background: $white; -$tab-background-active: $light-gray; -$tab-item-font-size: rem-calc(12); +$tab-background-active: $white; +$tab-item-font-size: $base-font-size; $tab-item-background-hover: $white; -$tab-item-padding: 1.25rem 1.5rem; +$tab-item-padding: $line-height/2 0; $tab-expand-max: 6; $tab-content-background: $white; -$tab-content-border: $light-gray; +$tab-content-border: $border; $tab-content-color: foreground($tab-background, $primary-color); $tab-content-padding: 1rem; @@ -563,66 +628,3 @@ $topbar-submenu-background: $topbar-background; $topbar-title-spacing: 1rem; $topbar-input-width: 200px; $topbar-unstack-breakpoint: medium; - -// 37. Custom variables -// -------------------- - -$base-font-size: rem-calc(17); -$base-line-height: rem-calc(26); -$small-font-size: rem-calc(14); -$line-height: rem-calc(24); - -$brand: #004A83; -$body: #E9E9E9; -$background: #EDEFF0; -$border: #DEE0E3; -$dark: darken($brand, 10%); - -$text: #222222; -$text-medium: #999999; -$text-light: #CCCCCC; - -$link: #2895F1; -$link-hover: #2178BF; - -$debates: #008CCF; -$votes-bg: #26AEEE; -$votes-border: #1F94CB; - -$votes-like: #7BD2A8; -$votes-like-act: #5D9E7F; -$votes-unlike: #EF8585; -$votes-unlike-act: #BD6A6A; - -$delete: #F04124; -$check: #46DB91; - -$proposals: #FFA42D; -$proposals-border: #CC8425; - -$budget: #454372; -$budget-hover: #7571BF; - -$highlight: #E7F2FC; -$featured: #FED900; - -$footer-bg: #DEE0E2; -$footer-color: #171819; -$footer-link: #454A4C; -$footer-border: #BFC1C3; - -$success-bg: #DFF0D8; -$success-border: #D6E9C6; -$color-success: #3C763D; - -$info-bg: #D9EDF7; -$info-border: #BCE8F1; -$color-info: #31708F; - -$warning-bg: #FCF8E3; -$warning-border: #FAEBCC; -$color-warning: #8A6D3B; - -$alert-bg: #F2DEDE; -$alert-border: #EBCCD1; -$color-alert: #A94442; diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 42f6f177d..ea426cf45 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -219,6 +219,35 @@ a { float: left; } +.tabs-content { + border: 0; +} + +.tabs { + border: { + left: 0; + right: 0; + top: 0; + }; + + .tabs-title > a { + color: $text-medium; + margin-bottom: rem-calc(-1); + margin-right: $line-height; + + &[aria-selected='true'], + &.is-active { + color: $brand; + border-bottom: 2px solid $brand; + font-weight: bold; + } + } + + h2 { + font-size: $base-font-size; + } +} + // 02. Header // ---------- @@ -1460,7 +1489,6 @@ table { .comments { background: $white; background-repeat: repeat-x; - padding-top: $line-height; padding-bottom: $line-height*4; h2 { @@ -1647,7 +1675,7 @@ table { &:first-child { padding-left: $line-height*1.5; - width: 80%; + width: 75%; } &:before { diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 502fe62aa..6e5b4273a 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -715,6 +715,16 @@ } } +.more-info { + clear: both; + color: $text-medium; + font-size: $small-font-size; + + a { + color: $text-medium; + } +} + .debate { .votes { diff --git a/app/views/proposals/_comments.html.erb b/app/views/proposals/_comments.html.erb index 31f1cb8ba..094814cf1 100644 --- a/app/views/proposals/_comments.html.erb +++ b/app/views/proposals/_comments.html.erb @@ -1,11 +1,13 @@ <% cache [locale_and_user_status, @current_order, commentable_cache_key(@proposal), @comment_tree.comments, @comment_tree.comment_authors, @proposal.comments_count, @comment_flags] do %> -
+
-

- <%= t("proposals.show.comments_title") %> - (<%= @proposal.comments_count %>) -

+ <% if @notifications.blank? %> +

+ <%= t("proposals.show.comments_title") %> + (<%= @proposal.comments_count %>) +

+ <% end %> <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> diff --git a/app/views/proposals/_filter_subnav.html.erb b/app/views/proposals/_filter_subnav.html.erb new file mode 100644 index 000000000..b7bc85dd6 --- /dev/null +++ b/app/views/proposals/_filter_subnav.html.erb @@ -0,0 +1,22 @@ +
+
+
    +
  • + <%= link_to "#tab-comments" do %> +

    + <%= t("proposals.show.comments_tab") %> + (<%= @proposal.comments_count %>) +

    + <% end %> +
  • +
  • + <%= link_to "#tab-notifications" do %> +

    + <%= t("proposals.show.notifications_tab") %> + (<%= @notifications.count %>) +

    + <% end %> +
  • +
+
+
diff --git a/app/views/proposals/_notifications.html.erb b/app/views/proposals/_notifications.html.erb index 9e3af3e9e..44bb9f4a2 100644 --- a/app/views/proposals/_notifications.html.erb +++ b/app/views/proposals/_notifications.html.erb @@ -1,8 +1,11 @@ -<% if @notifications.present? %> -
- <% @notifications.each do |notification| %> -
<%= notification.title %>
-
<%= notification.body %>
- <% end %> +
+
+
+ <% @notifications.each do |notification| %> +

<%= notification.title %>

+

<%= notification.created_at.to_date %>

+

<%= notification.body %>

+ <% end %> +
-<% end %> \ No newline at end of file +
diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index 9d8c3b739..2a6ae7185 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -118,5 +118,14 @@
<% end %> -<%= render "proposals/notifications" %> -<%= render "proposals/comments" %> + +
+ <% if @notifications.present? %> + <%= render "proposals/filter_subnav" %> + <%= render "proposals/notifications" %> + <% end %> + +
+ <%= render "proposals/comments" %> +
+
diff --git a/app/views/users/_proposals.html.erb b/app/views/users/_proposals.html.erb index d23e865ca..a56b096f6 100644 --- a/app/views/users/_proposals.html.erb +++ b/app/views/users/_proposals.html.erb @@ -9,7 +9,8 @@ <% if author? %> - <%= link_to t("users.proposals.send_message"), new_proposal_notification_path(proposal_id: proposal.id) %> + <%= link_to t("users.proposals.send_message"), new_proposal_notification_path(proposal_id: proposal.id), + class: 'button hollow' %> <% end %> @@ -20,7 +21,7 @@ <% else %> <%= link_to t('users.proposals.retire'), retire_form_proposal_path(proposal), - class: 'delete' %> + class: 'button hollow alert' %> <% end %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 5a0dec0c6..4d5816f4c 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -351,10 +351,12 @@ en: one: 1 comment other: "%{count} comments" zero: No comments + comments_tab: Comments comments_title: Comments edit_proposal_link: Edit flag: This proposal has been flagged as inappropriate by several users. login_to_comment: You must %{signin} or %{signup} to leave a comment. + notifications_tab: Notifications retired_warning: "The author considers this proposal should not receive more supports." retired_warning_link_to_explanation: Read the explanation before voting for it. retired: Proposal retired by the author diff --git a/config/locales/es.yml b/config/locales/es.yml index 909e20bbc..36b318cc7 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -351,10 +351,12 @@ es: one: 1 Comentario other: "%{count} Comentarios" zero: Sin comentarios + comments_tab: Comentarios comments_title: Comentarios edit_proposal_link: Editar propuesta flag: Esta propuesta ha sido marcada como inapropiada por varios usuarios. login_to_comment: Necesitas %{signin} o %{signup} para comentar. + notifications_tab: Notificaciones retired_warning: "El autor de esta propuesta considera que ya no debe seguir recogiendo apoyos." retired_warning_link_to_explanation: Revisa su explicación antes de apoyarla. retired: Propuesta retirada por el autor From 14f17983f4363efb2b0976d88f1da7ac57863018 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Jun 2016 17:30:31 +0200 Subject: [PATCH 010/126] Improves styles for about receivers message --- app/views/proposal_notifications/new.html.erb | 14 ++++++++------ config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/proposal_notifications/new.html.erb b/app/views/proposal_notifications/new.html.erb index f8be10c2e..a5f829ecc 100644 --- a/app/views/proposal_notifications/new.html.erb +++ b/app/views/proposal_notifications/new.html.erb @@ -4,13 +4,15 @@

<%= t("proposal_notifications.new.title") %>

-

- <%= t("proposal_notifications.new.info_about_receivers", - count: @proposal.voters.count) %> +

+

+ <%= t("proposal_notifications.new.info_about_receivers_html", + count: @proposal.voters.count) %> - <%= link_to t("proposal_notifications.new.proposal_page"), - proposal_path(@proposal) %> -

+ <%= link_to t("proposal_notifications.new.proposal_page"), + proposal_path(@proposal) %> +

+
<%= form_for @notification do |f| %> <%= render "shared/errors", resource: @notification %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 059cf5cd6..8905e0f00 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -370,7 +370,7 @@ en: title_label: "Title" body_label: "Message" submit_button: "Send message" - info_about_receivers: "This message will be send to %{count} people and it will be visible in " + info_about_receivers_html: "This message will be send to %{count} people and it will be visible in " proposal_page: "the proposal's page" show: back: "Go back to my activity" diff --git a/config/locales/es.yml b/config/locales/es.yml index 150c42583..24da77968 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -370,7 +370,7 @@ es: title_label: "Título" body_label: "Mensaje" submit_button: "Enviar mensaje" - info_about_receivers: "Este mensaje se enviará a %{count} usuarios y se publicará en " + info_about_receivers_html: "Este mensaje se enviará a %{count} usuarios y se publicará en " proposal_page: "la página de la propuesta" show: back: "Volver a mi actividad" From 224c9d42c49418401cfc92ea5b4a9eb7de0b36c3 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Jun 2016 17:47:17 +0200 Subject: [PATCH 011/126] Fixes layout for order comments --- app/assets/stylesheets/layout.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index ea426cf45..fdf7ff6c1 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -229,6 +229,7 @@ a { right: 0; top: 0; }; + margin-bottom: $line-height; .tabs-title > a { color: $text-medium; From bfc9c6c0dff9507ad686bc52ee94485350039db6 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Jun 2016 17:51:16 +0200 Subject: [PATCH 012/126] Improves styles for proposal show --- app/assets/stylesheets/layout.scss | 2 +- app/views/proposals/show.html.erb | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index fdf7ff6c1..209bcc3c6 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -1513,7 +1513,7 @@ table { .comment-votes { color: $text-medium; - font-size: $small-font-size; + font-size: rem-calc(14); line-height: $line-height; a { diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index 2a6ae7185..8a391a031 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -13,8 +13,7 @@ <%= render "shared/back_link" %> <% if current_user && @proposal.editable_by?(current_user) %> - <%= link_to edit_proposal_path(@proposal), class: 'edit-proposal button success small float-right' do %> - + <%= link_to edit_proposal_path(@proposal), class: 'edit-proposal button hollow float-right' do %> <%= t("proposals.show.edit_proposal_link") %> <% end %> <% end %> From 0a5369c7b4d57dc3c54a8025b7405f911b538c9c Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Jun 2016 18:04:58 +0200 Subject: [PATCH 013/126] Shows anonymous messages on focus whit tab --- app/assets/javascripts/votes.js.coffee | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/votes.js.coffee b/app/assets/javascripts/votes.js.coffee index e4223c644..030b9cf46 100644 --- a/app/assets/javascripts/votes.js.coffee +++ b/app/assets/javascripts/votes.js.coffee @@ -1,20 +1,22 @@ App.Votes = hoverize: (votes) -> - $(votes).hover -> - $("div.anonymous-votes", votes).show(); - $("div.organizations-votes", votes).show(); - $("div.not-logged", votes).show(); - $("div.no-supports-allowed", votes).show(); - $("div.logged", votes).hide(); - , -> - $("div.anonymous-votes", votes).hide(); - $("div.organizations-votes", votes).hide(); - $("div.not-logged", votes).hide(); - $("div.no-supports-allowed", votes).hide(); - $("div.logged", votes).show(); + $(document).on { + 'mouseenter focus': -> + $("div.anonymous-votes", this).show(); + $("div.organizations-votes", this).show(); + $("div.not-logged", this).show(); + $("div.no-supports-allowed", this).show(); + $("div.logged", this).hide(); + mouseleave: -> + $("div.anonymous-votes", this).hide(); + $("div.organizations-votes", this).hide(); + $("div.not-logged", this).hide(); + $("div.no-supports-allowed", this).hide(); + $("div.logged", this).show(); + }, votes initialize: -> - App.Votes.hoverize votes for votes in $("div.votes") - App.Votes.hoverize votes for votes in $("div.supports") + App.Votes.hoverize "div.votes" + App.Votes.hoverize "div.supports" false From 8e12fbdd557eaf1c1aa43943a13f61aa1fe9ad2f Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 7 Jun 2016 13:48:09 +0200 Subject: [PATCH 014/126] adds time limit between notifications --- app/models/proposal_notification.rb | 9 ++++++ config/locales/activerecord.en.yml | 3 ++ config/locales/activerecord.es.yml | 3 ++ db/seeds.rb | 3 ++ spec/features/proposal_notifications_spec.rb | 10 ++++++ spec/models/proposal_notification_spec.rb | 34 ++++++++++++++++++++ 6 files changed, 62 insertions(+) diff --git a/app/models/proposal_notification.rb b/app/models/proposal_notification.rb index d31b2e1a5..11bfea8ae 100644 --- a/app/models/proposal_notification.rb +++ b/app/models/proposal_notification.rb @@ -5,4 +5,13 @@ class ProposalNotification < ActiveRecord::Base validates :title, presence: true validates :body, presence: true validates :proposal, presence: true + validate :minimum_interval + + def minimum_interval + return true if proposal.notifications.blank? + if proposal.notifications.last.created_at > (Time.now - Setting[:proposal_notification_minimum_interval_in_days].to_i.days).to_datetime + errors.add(:minimum_interval, I18n.t('activerecord.errors.models.proposal_notification.minimum_interval', interval: Setting[:proposal_notification_minimum_interval])) + end + end + end \ No newline at end of file diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml index 91c035dfb..1d46596c2 100644 --- a/config/locales/activerecord.en.yml +++ b/config/locales/activerecord.en.yml @@ -84,3 +84,6 @@ en: attributes: tag_list: less_than_or_equal_to: "tags must be less than or equal to %{count}" + proposal_notification: + attributes: + minimum_interval: "You have to wait a minium of %{interval} days between notifications" \ No newline at end of file diff --git a/config/locales/activerecord.es.yml b/config/locales/activerecord.es.yml index a7644f02e..001be7228 100644 --- a/config/locales/activerecord.es.yml +++ b/config/locales/activerecord.es.yml @@ -84,3 +84,6 @@ es: attributes: tag_list: less_than_or_equal_to: "los temas deben ser menor o igual que %{count}" + proposal_notification: + attributes: + minimum_interval: "Debes esperar un mínimo de %{interval} días entre notificaciones" \ No newline at end of file diff --git a/db/seeds.rb b/db/seeds.rb index 7555f6999..5a6db1574 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -74,3 +74,6 @@ Setting['banner-style.banner-style-three'] = "Banner style 3" Setting['banner-img.banner-img-one'] = "Banner image 1" Setting['banner-img.banner-img-two'] = "Banner image 2" Setting['banner-img.banner-img-three'] = "Banner image 3" + +# Proposal notifications +Setting['proposal_notification_minimum_interval_in_days '] = 3 diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index f40e0b81e..87a717ba2 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -84,4 +84,14 @@ feature 'Proposal Notifications' do expect(page).to have_content error_message end + context "Limits" do + + pending "Cannot send more than one notification within established interval" do + end + + pending "use timecop to make sure notifications can be sent after time interval" do + end + + end + end \ No newline at end of file diff --git a/spec/models/proposal_notification_spec.rb b/spec/models/proposal_notification_spec.rb index 5a7575219..f66b254b6 100644 --- a/spec/models/proposal_notification_spec.rb +++ b/spec/models/proposal_notification_spec.rb @@ -22,4 +22,38 @@ describe ProposalNotification do expect(notification).to_not be_valid end + describe "minimum interval between notifications" do + + before(:each) do + Setting[:proposal_notification_minimum_interval_in_days] = 3 + end + + it "should not be valid if below minium interval" do + proposal = create(:proposal) + + notification1 = create(:proposal_notification, proposal: proposal) + notification2 = build(:proposal_notification, proposal: proposal) + + proposal.reload + expect(notification2).to_not be_valid + end + + it "should be valid if notifications above minium interval" do + proposal = create(:proposal) + + notification1 = create(:proposal_notification, proposal: proposal, created_at: 4.days.ago) + notification2 = build(:proposal_notification, proposal: proposal) + + proposal.reload + expect(notification2).to be_valid + end + + it "should be valid if no notifications sent" do + notification1 = build(:proposal_notification) + + expect(notification1).to be_valid + end + + end + end From 43251585b99398ca38fe962f7a64e3271b23e591 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 7 Jun 2016 13:56:40 +0200 Subject: [PATCH 015/126] pending permissions spec --- spec/models/abilities/everyone_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/models/abilities/everyone_spec.rb b/spec/models/abilities/everyone_spec.rb index 3f1e57278..30ce5c3a6 100644 --- a/spec/models/abilities/everyone_spec.rb +++ b/spec/models/abilities/everyone_spec.rb @@ -26,4 +26,6 @@ describe "Abilities::Everyone" do it { should be_able_to(:index, SpendingProposal) } it { should_not be_able_to(:create, SpendingProposal) } -end + + pending "only authors can access new and create for ProposalNotifications" +end \ No newline at end of file From e550a40f90ad4a1d774a3d06e67ca5300f36e7d4 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Tue, 7 Jun 2016 16:12:16 +0200 Subject: [PATCH 016/126] Adds share and comment button on email --- app/assets/images/icon_mailer_comment.png | Bin 0 -> 251 bytes app/assets/images/icon_mailer_share.png | Bin 0 -> 379 bytes app/mailers/mailer.rb | 2 +- .../mailer/proposal_notification.html.erb | 22 +++++++++++++++++- app/views/proposals/show.html.erb | 2 +- config/locales/mailers.en.yml | 5 +++- config/locales/mailers.es.yml | 3 +++ 7 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 app/assets/images/icon_mailer_comment.png create mode 100644 app/assets/images/icon_mailer_share.png diff --git a/app/assets/images/icon_mailer_comment.png b/app/assets/images/icon_mailer_comment.png new file mode 100644 index 0000000000000000000000000000000000000000..d3c9bff738825499e7c06f8a2adce4b5d17b586c GIT binary patch literal 251 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ za0`PlBg3pY5@fx({`eF=FuU@JE6u`H t^}0y%m%?NFP723uJSgy8?a}=M%yHKgpUwZrxEbhB22WQ%mvv4FO#oa~T$ca< literal 0 HcmV?d00001 diff --git a/app/assets/images/icon_mailer_share.png b/app/assets/images/icon_mailer_share.png new file mode 100644 index 0000000000000000000000000000000000000000..f95d44141b621be582501edd89e8cbdf98321ba1 GIT binary patch literal 379 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ za0`PlBg3pY5)2HCvYsxEAr`$yCv5a$P84WK|9|9!JjegHc^wIgON8HiRn572%&hl^ z%(f&|j%i9^N)gdrD^>Uv#FWhL9c6yVHF-@d%U7HJIlaN>jPAel;}um^ntrc(e(FtK zhAXR>q}E>RHMahCkAJg{bO=+4)m+vdx6^K4TwH#CKKm@Twk^ijW!u@Daud1ovpEcl zL>h|IUW=^!Cc9x4x2;Oy9ucP(lZw+>_6S{!o1_xX5VNGpt3mqMM=_VHUDu30dmZ^B zvGQHbSJx*UGxZtH)Jm{62rzZOvNg_smaepkZNbM(5eAnh6GHh8iTgg{%I_2h3;qYyYi)m*Ktk X)PU#K>!xG?Lyy7J)z4*}Q$iB}&@_=P literal 0 HcmV?d00001 diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index b8ca433ce..447daabc4 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -46,7 +46,7 @@ class Mailer < ApplicationMailer @notification = notification with_user(voter) do - mail(to: voter.email, subject: @notification.title) + mail(to: voter.email, subject: @notification.title + ": " + @notification.proposal.title) end end diff --git a/app/views/mailer/proposal_notification.html.erb b/app/views/mailer/proposal_notification.html.erb index 59489840c..3bcfccc1b 100644 --- a/app/views/mailer/proposal_notification.html.erb +++ b/app/views/mailer/proposal_notification.html.erb @@ -4,6 +4,26 @@

- <%= @notification.body %> + <%= @notification.body %>

+ + + + + + + + + +
+ <%= link_to "#comments", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 200px; display: inline-block;" do %> + <%= image_tag('icon_mailer_share.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> + <%= t('mailers.proposal_notification.share') %> + <% end %> + + <%= link_to "#social-share", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 200px; display: inline-block;" do %> + <%= image_tag('icon_mailer_comment.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px; vertical-align: middle;", alt: "") %> + <%= t('mailers.proposal_notification.comment') %> + <% end %> +
diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index 8a391a031..2153b23e5 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -103,7 +103,7 @@ { proposal: @proposal, vote_url: vote_proposal_path(@proposal, value: 'yes') } %> - +

<%= t("proposals.show.share") %>

From 29f869046a22598bfb0a03fc158bd61a28d21628 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Fri, 10 Jun 2016 18:01:59 +0200 Subject: [PATCH 030/126] Adds message for no accepting private messages --- app/views/users/show.html.erb | 6 +++++- config/locales/en.yml | 1 + config/locales/es.yml | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 6adb97b37..31c62d13c 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -2,10 +2,14 @@
- <% if @user != current_user %> + <% if @user != current_user %> <%= link_to t("users.show.send_private_message"), new_user_direct_message_path(@user), class: "button hollow float-right" %> + +
+ <%= t("users.show.no_private_messages") %> +
<% end %>

diff --git a/config/locales/en.yml b/config/locales/en.yml index 40403561e..c0a68815b 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -530,6 +530,7 @@ en: one: 1 Spending proposal other: "%{count} Spending proposals" no_activity: User has no public activity + no_private_messages: "This user doesn't accept private messages." private_activity: This user decided to keep the activity list private send_private_message: "Send private message" proposals: diff --git a/config/locales/es.yml b/config/locales/es.yml index 397eca876..2354e4742 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -530,6 +530,7 @@ es: one: 1 Propuesta de inversión other: "%{count} Propuestas de inversión" no_activity: Usuario sin actividad pública + no_private_messages: "Este usuario no acepta mensajes privados." private_activity: Este usuario ha decidido mantener en privado su lista de actividades send_private_message: "Enviar un mensaje privado" proposals: From 988f1f645a27eb0939351c2e9ee48d161c1e03fa Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Fri, 10 Jun 2016 18:02:37 +0200 Subject: [PATCH 031/126] Improves proposal notification mailer and fixes settings.scss --- app/assets/stylesheets/_settings.scss | 2 +- app/views/mailer/proposal_notification.html.erb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index 1e181e1c1..57a1afb7c 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -192,7 +192,7 @@ $header-color: inherit; $header-lineheight: 1.4; $header-margin-bottom: 0.5rem; $header-text-rendering: optimizeLegibility; -$small-font-size: 80%; +$small-font-size: rem-calc(14); $header-small-font-color: $medium-gray; $paragraph-lineheight: 1.6; $paragraph-margin-bottom: 1rem; diff --git a/app/views/mailer/proposal_notification.html.erb b/app/views/mailer/proposal_notification.html.erb index 3bcfccc1b..04ca39d86 100644 --- a/app/views/mailer/proposal_notification.html.erb +++ b/app/views/mailer/proposal_notification.html.erb @@ -7,18 +7,18 @@ <%= @notification.body %>

- +
diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index c90ca12c9..66c1c75ea 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -33,5 +33,9 @@ en: proposal_notification: share: Share comment: Comment proposal + proposal_notification_digest: + title: You received the following notifications + share: Share + comment: Comment proposal direct_message: reply: Reply to %{sender} \ No newline at end of file diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 75ff487d1..36343267d 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -33,5 +33,9 @@ es: proposal_notification: share: Compartir comment: Comentar propuesta + proposal_notification_digest: + title: Has recibido las siguientes notificaciones + share: Compartir + comment: Comentar propuesta direct_message: reply: Responder a %{sender} \ No newline at end of file From 143089603cb26250a57be78850fb45880f639d81 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 13 Jun 2016 12:33:46 +0200 Subject: [PATCH 033/126] fixes specs --- app/views/mailer/direct_message.html.erb | 2 +- spec/factories.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/mailer/direct_message.html.erb b/app/views/mailer/direct_message.html.erb index c974a7644..28235089b 100644 --- a/app/views/mailer/direct_message.html.erb +++ b/app/views/mailer/direct_message.html.erb @@ -11,7 +11,7 @@
- <%= link_to "#comments", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 200px; display: inline-block;" do %> + <%= link_to "#comments", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> <%= image_tag('icon_mailer_share.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> <%= t('mailers.proposal_notification.share') %> <% end %> - <%= link_to "#social-share", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 200px; display: inline-block;" do %> + <%= link_to "#social-share", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> <%= image_tag('icon_mailer_comment.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px; vertical-align: middle;", alt: "") %> <%= t('mailers.proposal_notification.comment') %> <% end %> From a417d88f9113219fd491121ea06d56a059613db3 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Fri, 10 Jun 2016 18:03:03 +0200 Subject: [PATCH 032/126] Adds proposal notification digest mailer --- .../proposal_notification_digest.html.erb | 51 +++++++++++++++++++ config/locales/mailers.en.yml | 4 ++ config/locales/mailers.es.yml | 4 ++ 3 files changed, 59 insertions(+) create mode 100644 app/views/mailer/proposal_notification_digest.html.erb diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb new file mode 100644 index 000000000..4733d900e --- /dev/null +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -0,0 +1,51 @@ + + + + + + + +
+

+ <%= t('mailers.proposal_notification_digest.title') %> +

+
+ + + + + + + + +
+

+ <%= @notification.title %> +

+

+ <%= @notification.proposal.title %> • <%= @notification.proposal.created_at.to_date %> • <%= @notification.proposal.author.name %> +

+

+ <%= @notification.body %> +

+ + + + + + + +
+ <%= link_to "#comments", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> + <%= image_tag('icon_mailer_share.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> + <%= t('mailers.proposal_notification_digest.share') %> + <% end %> + + <%= link_to "#social-share", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block; margin-left: 12px;" do %> + <%= image_tag('icon_mailer_comment.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px; vertical-align: middle;", alt: "") %> + <%= t('mailers.proposal_notification_digest.comment') %> + <% end %> +
+
+ +
- <%= link_to user_path(@direct_message.sender_id), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 200px; display: inline-block;", target: "_blank" do %> + <%= link_to user_url(@direct_message.sender_id), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 200px; display: inline-block;", target: "_blank" do %> <%= image_tag('icon_mailer_reply.png', style: "border: 0; display: inline-block; width: 100%; max-width: 12px; vertical-align: sub;", alt: "") %> <%= t('mailers.direct_message.reply', sender: @direct_message.sender.name) %> diff --git a/spec/factories.rb b/spec/factories.rb index f642abaf1..ef9c56c47 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -333,7 +333,7 @@ FactoryGirl.define do end factory :direct_message do - title "Hey!" + title "Hey" body "How are You doing?" association :sender, factory: :user association :receiver, factory: :user From 9b1be8da19f3978d376b39098204e6d9a7a2607b Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 13 Jun 2016 12:33:59 +0200 Subject: [PATCH 034/126] adds direct message specs --- spec/features/direct_messages_spec.rb | 71 +++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 spec/features/direct_messages_spec.rb diff --git a/spec/features/direct_messages_spec.rb b/spec/features/direct_messages_spec.rb new file mode 100644 index 000000000..d9301a29e --- /dev/null +++ b/spec/features/direct_messages_spec.rb @@ -0,0 +1,71 @@ +require 'rails_helper' + +feature 'Direct messages' do + + scenario "Create", :focus do + sender = create(:user, :level_two) + receiver = create(:user, :level_two) + + login_as(sender) + visit user_path(receiver) + + click_link "Send private message" + + expect(page).to have_content "Send private message to #{receiver.name}" + + fill_in 'direct_message_title', with: "Hey!" + fill_in 'direct_message_body', with: "How are you doing?" + click_button "Send message" + + expect(page).to have_content "You message has been sent successfully." + expect(page).to have_content "Hey!" + expect(page).to have_content "How are you doing?" + end + + context "Permissions" do + + scenario "Link to send the message" do + sender = create(:user, :level_two) + + login_as(sender) + visit user_path(sender) + + expect(page).to_not have_link "Send private message" + end + + scenario "Accessing form directly" do + user = create(:user) + author = create(:user) + proposal = create(:proposal, author: author) + + login_as(user) + visit new_proposal_notification_path(proposal_id: proposal.id) + + expect(current_path).to eq(proposals_path) + expect(page).to have_content("You do not have permission to carry out the action") + end + + pending "unverified user" + + end + + scenario "Error messages" do + author = create(:user) + proposal = create(:proposal, author: author) + + login_as(author) + + visit new_proposal_notification_path(proposal_id: proposal.id) + click_button "Send message" + + expect(page).to have_content error_message + end + + context "Limits" do + + pending "Cannot send more than one notification within established interval" + pending "use timecop to make sure notifications can be sent after time interval" + + end + +end \ No newline at end of file From 6e800c512050c6eb576bec65aca96abf39ff3c64 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 14 Jun 2016 17:53:36 +0200 Subject: [PATCH 035/126] adds email digest for proposal notifications --- app/mailers/mailer.rb | 8 +++ app/models/user.rb | 1 + .../proposal_notification_digest.html.erb | 72 ++++++++++--------- ...0160613150659_add_email_digest_to_users.rb | 5 ++ db/schema.rb | 3 +- lib/email_digest.rb | 14 ++++ lib/tasks/emails.rake | 9 +++ spec/factories.rb | 2 +- spec/features/direct_messages_spec.rb | 2 +- spec/features/emails_spec.rb | 47 ++++++++++++ spec/features/proposal_notifications_spec.rb | 47 ++++++++++++ spec/lib/email_digests_spec.rb | 9 +++ spec/support/common_actions.rb | 18 +++++ 13 files changed, 199 insertions(+), 38 deletions(-) create mode 100644 db/migrate/20160613150659_add_email_digest_to_users.rb create mode 100644 lib/email_digest.rb create mode 100644 lib/tasks/emails.rake create mode 100644 spec/lib/email_digests_spec.rb diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 2a81c4bfe..d900fd17d 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -59,6 +59,14 @@ class Mailer < ApplicationMailer end end + def proposal_notification_digest(user) + @notifications = user.notifications.where(notifiable_type: "ProposalNotification") + + with_user(user) do + mail(to: user.email, subject: "Email digest") + end + end + private def with_user(user, &block) diff --git a/app/models/user.rb b/app/models/user.rb index 243781cb3..a3b719859 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -51,6 +51,7 @@ class User < ActiveRecord::Base scope :officials, -> { where("official_level > 0") } scope :for_render, -> { includes(:organization) } scope :by_document, -> (document_type, document_number) { where(document_type: document_type, document_number: document_number) } + scope :email_digest, -> { where(email_digest: true) } before_validation :clean_document_number diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index 4733d900e..16e96260c 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -11,41 +11,43 @@
- - - - - + + +
-

- <%= @notification.title %> -

-

- <%= @notification.proposal.title %> • <%= @notification.proposal.created_at.to_date %> • <%= @notification.proposal.author.name %> -

-

- <%= @notification.body %> -

+ <%= @notifications.each do |notification| %> + + + + + + +
+

+ <%= link_to notification.notifiable.title, notification_url(notification) %> +

+

+ <%= notification.notifiable.proposal.title %> •  + <%= notification.notifiable.proposal.created_at.to_date %> •  + <%= notification.notifiable.proposal.author.name %> +

+

+ <%= notification.notifiable.body %> +

- - - - - - -
- <%= link_to "#comments", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> - <%= image_tag('icon_mailer_share.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> - <%= t('mailers.proposal_notification_digest.share') %> - <% end %> + + + + - - -
+ <%= link_to proposal_url(notification.notifiable.proposal, anchor: "comments"), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> + <%= image_tag('icon_mailer_share.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> + <%= t('mailers.proposal_notification_digest.share') %> + <% end %> - <%= link_to "#social-share", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block; margin-left: 12px;" do %> - <%= image_tag('icon_mailer_comment.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px; vertical-align: middle;", alt: "") %> - <%= t('mailers.proposal_notification_digest.comment') %> - <% end %> -
-
- + <%= link_to proposal_url(notification.notifiable.proposal, anchor: "social-share"), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block; margin-left: 12px;" do %> + <%= image_tag('icon_mailer_comment.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px; vertical-align: middle;", alt: "") %> + <%= t('mailers.proposal_notification_digest.comment') %> + <% end %> +
+
+ <% end %> diff --git a/db/migrate/20160613150659_add_email_digest_to_users.rb b/db/migrate/20160613150659_add_email_digest_to_users.rb new file mode 100644 index 000000000..d127af78e --- /dev/null +++ b/db/migrate/20160613150659_add_email_digest_to_users.rb @@ -0,0 +1,5 @@ +class AddEmailDigestToUsers < ActiveRecord::Migration + def change + add_column :users, :email_digest, :boolean, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index bbd6dda8f..c4fddf324 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: 20160608174104) do +ActiveRecord::Schema.define(version: 20160613150659) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -460,6 +460,7 @@ ActiveRecord::Schema.define(version: 20160608174104) do t.string "gender", limit: 10 t.datetime "date_of_birth" t.boolean "email_on_proposal_notification", default: true + t.boolean "email_digest", default: true end add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree diff --git a/lib/email_digest.rb b/lib/email_digest.rb new file mode 100644 index 000000000..90838f78f --- /dev/null +++ b/lib/email_digest.rb @@ -0,0 +1,14 @@ +class EmailDigest + + def initialize + end + + def create + User.email_digest.each do |user| + if user.notifications.where(notifiable_type: "ProposalNotification").any? + Mailer.proposal_notification_digest(user).deliver_later + end + end + end + +end \ No newline at end of file diff --git a/lib/tasks/emails.rake b/lib/tasks/emails.rake new file mode 100644 index 000000000..6670264a5 --- /dev/null +++ b/lib/tasks/emails.rake @@ -0,0 +1,9 @@ +namespace :emails do + + desc "Sends email digest of proposal notifications to each user" + task digest: :environment do + email_digest = EmailDigest.new + email_digest.create + end + +end diff --git a/spec/factories.rb b/spec/factories.rb index ef9c56c47..4ead8ecac 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -136,7 +136,7 @@ FactoryGirl.define do factory :proposal do sequence(:title) { |n| "Proposal #{n} title" } - summary 'In summary, what we want is...' + sequence(:summary) { |n| "In summary, what we want is... #{n}" } description 'Proposal description' question 'Proposal question' external_url 'http://external_documention.es' diff --git a/spec/features/direct_messages_spec.rb b/spec/features/direct_messages_spec.rb index d9301a29e..142be8cbb 100644 --- a/spec/features/direct_messages_spec.rb +++ b/spec/features/direct_messages_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' feature 'Direct messages' do - scenario "Create", :focus do + scenario "Create" do sender = create(:user, :level_two) receiver = create(:user, :level_two) diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index ec8ff7b5f..5894d40ed 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -204,4 +204,51 @@ feature 'Emails' do end end + context "Proposal notification digest" do + + scenario "notifications for proposals that I have supported" do + user = create(:user, email_digest: true) + + proposal1 = create(:proposal) + proposal2 = create(:proposal) + proposal3 = create(:proposal) + + create(:vote, votable: proposal1, voter: user) + create(:vote, votable: proposal2, voter: user) + + reset_mailer + + notification1 = create_proposal_notification(proposal1) + notification2 = create_proposal_notification(proposal2) + notification3 = create_proposal_notification(proposal3) + + email_digest = EmailDigest.new + email_digest.create + + email = open_last_email + expect(email).to have_subject("Email digest") + expect(email).to deliver_to(user.email) + + expect(email).to have_body_text(proposal1.title) + expect(email).to have_body_text(notification1.notifiable.title) + expect(email).to have_body_text(notification1.notifiable.body) + expect(email).to have_body_text(proposal1.author.name) + + expect(email).to have_body_text(/#{notification_path(notification1)}/) + expect(email).to have_body_text(/#{proposal_path(proposal1, anchor: 'comments')}/) + expect(email).to have_body_text(/#{proposal_path(proposal1, anchor: 'social-share')}/) + + expect(email).to have_body_text(proposal2.title) + expect(email).to have_body_text(notification2.notifiable.title) + expect(email).to have_body_text(notification2.notifiable.body) + expect(email).to have_body_text(/#{notification_path(notification2)}/) + expect(email).to have_body_text(/#{proposal_path(proposal2, anchor: 'comments')}/) + expect(email).to have_body_text(/#{proposal_path(proposal2, anchor: 'social-share')}/) + expect(email).to have_body_text(proposal2.author.name) + + expect(email).to_not have_body_text(proposal3.title) + end + + end + end diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index be8b146fd..7785a1236 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -51,6 +51,53 @@ feature 'Proposal Notifications' do expect(page).to have_link("the proposal's page", href: proposal_path(proposal)) end + context "Receivers" do + + scenario "Only send a digest to users that have the option set in their profile" do + user1 = create(:user, email_digest: true) + user2 = create(:user, email_digest: true) + user3 = create(:user, email_digest: false) + + proposal = create(:proposal) + + [user1, user2, user3].each do |user| + create(:vote, votable: proposal, voter: user) + end + + create_proposal_notification(proposal) + + reset_mailer + email_digest = EmailDigest.new + email_digest.create + + expect(unread_emails_for(user1.email).size).to eql parse_email_count(1) + expect(unread_emails_for(user2.email).size).to eql parse_email_count(1) + expect(unread_emails_for(user3.email).size).to eql parse_email_count(0) + end + + scenario "Only send a digest to users that have voted for a proposal" do + user1 = create(:user, email_digest: true) + user2 = create(:user, email_digest: true) + user3 = create(:user, email_digest: true) + + proposal = create(:proposal) + + [user1, user2].each do |user| + create(:vote, votable: proposal, voter: user) + end + + create_proposal_notification(proposal) + + reset_mailer + email_digest = EmailDigest.new + email_digest.create + + expect(unread_emails_for(user1.email).size).to eql parse_email_count(1) + expect(unread_emails_for(user2.email).size).to eql parse_email_count(1) + expect(unread_emails_for(user3.email).size).to eql parse_email_count(0) + end + + end context "Permissions" do scenario "Link to send the message" do diff --git a/spec/lib/email_digests_spec.rb b/spec/lib/email_digests_spec.rb new file mode 100644 index 000000000..6fc6eef53 --- /dev/null +++ b/spec/lib/email_digests_spec.rb @@ -0,0 +1,9 @@ +require 'rails_helper' + +describe EmailDigest do + + describe "create" do + pending "only send unread notifications" + end + +end \ No newline at end of file diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 18a3f9499..39faf03f5 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -196,4 +196,22 @@ module CommonActions tag_cloud.tags.map(&:name) end + def create_proposal_notification(proposal) + login_as(proposal.author) + visit root_path + + click_link "My activity" + + within("#proposal_#{proposal.id}") do + click_link "Send message" + end + + fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal #{proposal.title}" + fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen! #{proposal.summary}" + click_button "Send message" + + expect(page).to have_content "Your message has been sent correctly." + Notification.last + end + end From 9f19a5d1439085af9b2ab8cff64bb8d75d0130ca Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 14 Jun 2016 18:08:27 +0200 Subject: [PATCH 036/126] adds option to receive email digest --- app/controllers/account_controller.rb | 2 +- app/views/account/show.html.erb | 9 +++++++++ config/locales/en.yml | 1 + config/locales/es.yml | 1 + spec/features/account_spec.rb | 3 ++- spec/models/user_spec.rb | 6 ++++++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index d1ac9c9c4..8bcb5f4d0 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -25,7 +25,7 @@ class AccountController < ApplicationController if @account.organization? params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, :newsletter, organization_attributes: [:name, :responsible_name]) else - params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_proposal_notification, :newsletter) + params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_proposal_notification, :email_digest, :newsletter) end end diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index b3a84dede..2180ce5f9 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -78,6 +78,15 @@ <% end %>

+
+ <%= f.label :email_digest do %> + <%= f.check_box :email_digest, title: t('account.show.email_digest_label'), label: false %> + + <%= t("account.show.email_digest_label") %> + + <% end %> +
+ <%= f.submit t("account.show.save_changes_submit"), class: "button" %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index c0a68815b..0051fef5c 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,6 +16,7 @@ en: save_changes_submit: Save changes subscription_to_website_newsletter_label: Receive by email website relevant information email_on_proposal_notification_label: Receive by email notifications about proposals + email_digest_label: Receive a summary of proposal notifications title: My account user_permission_debates: Participate on debates user_permission_info: With your account you can... diff --git a/config/locales/es.yml b/config/locales/es.yml index 2354e4742..7898cbd65 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -16,6 +16,7 @@ es: save_changes_submit: Guardar cambios subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web email_on_proposal_notification_label: Recibir emails con notificaciones sobre propuestas + email_digest_label: Recibir resumen de notificaciones sobre propuestas title: Mi cuenta user_permission_debates: Participar en debates user_permission_info: Con tu cuenta ya puedes... diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index f5ba747fb..f8ebf4e3a 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -36,6 +36,7 @@ feature 'Account' do check 'account_email_on_comment' check 'account_email_on_comment_reply' uncheck 'account_email_on_proposal_notification' + uncheck 'account_email_digest' click_button 'Save changes' expect(page).to have_content "Changes saved" @@ -45,7 +46,7 @@ feature 'Account' do expect(page).to have_selector("input[value='Larry Bird']") expect(find("#account_email_on_comment")).to be_checked expect(find("#account_email_on_comment_reply")).to be_checked - expect(find("#account_email_on_proposal_notification")).to_not be_checked + expect(find("#account_email_digest")).to_not be_checked end scenario 'Edit Organization' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index ca46ff68f..e9c05eeb3 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -89,6 +89,12 @@ describe User do expect(subject.email_on_proposal_notification).to eq(true) end end + + describe 'email_digest' do + it 'should be true by default' do + expect(subject.email_digest).to eq(true) + end + end end describe "administrator?" do From fd672940758e02774bec7c460afbc8ef56f823a3 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 14 Jun 2016 18:20:36 +0200 Subject: [PATCH 037/126] adds option to receive direct messages --- app/controllers/account_controller.rb | 2 +- app/views/account/show.html.erb | 9 +++++++++ config/locales/en.yml | 1 + config/locales/es.yml | 1 + ...160614160949_add_email_on_direct_messages_to_users.rb | 5 +++++ db/schema.rb | 3 ++- spec/features/account_spec.rb | 2 ++ spec/models/user_spec.rb | 6 ++++++ 8 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20160614160949_add_email_on_direct_messages_to_users.rb diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 8bcb5f4d0..496778e5f 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -25,7 +25,7 @@ class AccountController < ApplicationController if @account.organization? params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, :newsletter, organization_attributes: [:name, :responsible_name]) else - params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_proposal_notification, :email_digest, :newsletter) + params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_proposal_notification, :email_on_direct_message, :email_digest, :newsletter) end end diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index 2180ce5f9..3d93bc705 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -87,6 +87,15 @@ <% end %> +
+ <%= f.label :email_on_direct_message do %> + <%= f.check_box :email_on_direct_message, title: t('account.show.email_on_direct_message_label'), label: false %> + + <%= t("account.show.email_on_direct_message_label") %> + + <% end %> +
+ <%= f.submit t("account.show.save_changes_submit"), class: "button" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 0051fef5c..de1f1a485 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,6 +16,7 @@ en: save_changes_submit: Save changes subscription_to_website_newsletter_label: Receive by email website relevant information email_on_proposal_notification_label: Receive by email notifications about proposals + email_on_direct_message_label: Receive emails about direct messages email_digest_label: Receive a summary of proposal notifications title: My account user_permission_debates: Participate on debates diff --git a/config/locales/es.yml b/config/locales/es.yml index 7898cbd65..c5fa39c91 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -16,6 +16,7 @@ es: save_changes_submit: Guardar cambios subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web email_on_proposal_notification_label: Recibir emails con notificaciones sobre propuestas + email_on_direct_message_label: Recibir emails con mensajes directos email_digest_label: Recibir resumen de notificaciones sobre propuestas title: Mi cuenta user_permission_debates: Participar en debates diff --git a/db/migrate/20160614160949_add_email_on_direct_messages_to_users.rb b/db/migrate/20160614160949_add_email_on_direct_messages_to_users.rb new file mode 100644 index 000000000..db18e3f27 --- /dev/null +++ b/db/migrate/20160614160949_add_email_on_direct_messages_to_users.rb @@ -0,0 +1,5 @@ +class AddEmailOnDirectMessagesToUsers < ActiveRecord::Migration + def change + add_column :users, :email_on_direct_message, :boolean, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index c4fddf324..f5671b3a3 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: 20160613150659) do +ActiveRecord::Schema.define(version: 20160614160949) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -461,6 +461,7 @@ ActiveRecord::Schema.define(version: 20160613150659) do t.datetime "date_of_birth" t.boolean "email_on_proposal_notification", default: true t.boolean "email_digest", default: true + t.boolean "email_on_direct_message", default: true end add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index f8ebf4e3a..b41d676d4 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -37,6 +37,7 @@ feature 'Account' do check 'account_email_on_comment_reply' uncheck 'account_email_on_proposal_notification' uncheck 'account_email_digest' + uncheck 'account_email_on_direct_message' click_button 'Save changes' expect(page).to have_content "Changes saved" @@ -47,6 +48,7 @@ feature 'Account' do expect(find("#account_email_on_comment")).to be_checked expect(find("#account_email_on_comment_reply")).to be_checked expect(find("#account_email_digest")).to_not be_checked + expect(find("#account_email_on_direct_message")).to_not be_checked end scenario 'Edit Organization' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e9c05eeb3..698c4884c 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -95,6 +95,12 @@ describe User do expect(subject.email_digest).to eq(true) end end + + describe 'email_on_direct_message' do + it 'should be true by default' do + expect(subject.email_on_direct_message).to eq(true) + end + end end describe "administrator?" do From ce6072d17bbd46bc54163fbb5443cf90a2ea85db Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 14 Jun 2016 18:55:28 +0200 Subject: [PATCH 038/126] sends a copy of the direct message to the sender --- app/controllers/direct_messages_controller.rb | 3 +- app/mailers/mailer.rb | 13 +++++-- ...b => direct_message_for_receiver.html.erb} | 2 +- .../mailer/direct_message_for_sender.html.erb | 11 ++++++ config/locales/mailers.en.yml | 7 ++-- config/locales/mailers.es.yml | 7 ++-- spec/features/direct_messages_spec.rb | 7 ---- spec/features/emails_spec.rb | 35 +++++++++++++++++++ spec/support/common_actions.rb | 16 +++++++++ 9 files changed, 86 insertions(+), 15 deletions(-) rename app/views/mailer/{direct_message.html.erb => direct_message_for_receiver.html.erb} (70%) create mode 100644 app/views/mailer/direct_message_for_sender.html.erb diff --git a/app/controllers/direct_messages_controller.rb b/app/controllers/direct_messages_controller.rb index 912f186a3..07f39d941 100644 --- a/app/controllers/direct_messages_controller.rb +++ b/app/controllers/direct_messages_controller.rb @@ -12,7 +12,8 @@ class DirectMessagesController < ApplicationController @direct_message = DirectMessage.new(parsed_params) if @direct_message.save - Mailer.direct_message(@direct_message).deliver_later + Mailer.direct_message_for_receiver(@direct_message).deliver_later + Mailer.direct_message_for_sender(@direct_message).deliver_later redirect_to [@receiver, @direct_message], notice: I18n.t("flash.actions.create.direct_message") else render :new diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index d900fd17d..6916253f2 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -50,12 +50,21 @@ class Mailer < ApplicationMailer end end - def direct_message(direct_message) + def direct_message_for_receiver(direct_message) @direct_message = direct_message @receiver = @direct_message.receiver with_user(@receiver) do - mail(to: @receiver.email, subject: "Has recibido un nuevo mensaje privado") + mail(to: @receiver.email, subject: t('mailers.direct_message_for_receiver.subject')) + end + end + + def direct_message_for_sender(direct_message) + @direct_message = direct_message + @sender = @direct_message.sender + + with_user(@sender) do + mail(to: @sender.email, subject: t('mailers.direct_message_for_sender.subject')) end end diff --git a/app/views/mailer/direct_message.html.erb b/app/views/mailer/direct_message_for_receiver.html.erb similarity index 70% rename from app/views/mailer/direct_message.html.erb rename to app/views/mailer/direct_message_for_receiver.html.erb index 28235089b..d70c78a28 100644 --- a/app/views/mailer/direct_message.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -11,7 +11,7 @@ - <%= link_to user_url(@direct_message.sender_id), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 200px; display: inline-block;", target: "_blank" do %> + <%= link_to user_url(@direct_message.sender), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 200px; display: inline-block;", target: "_blank" do %> <%= image_tag('icon_mailer_reply.png', style: "border: 0; display: inline-block; width: 100%; max-width: 12px; vertical-align: sub;", alt: "") %> <%= t('mailers.direct_message.reply', sender: @direct_message.sender.name) %> diff --git a/app/views/mailer/direct_message_for_sender.html.erb b/app/views/mailer/direct_message_for_sender.html.erb new file mode 100644 index 000000000..219337705 --- /dev/null +++ b/app/views/mailer/direct_message_for_sender.html.erb @@ -0,0 +1,11 @@ + +

<%= @direct_message.receiver.name %>

+ +

+ <%= @direct_message.title %> +

+ +

+ <%= @direct_message.body %> +

+ diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 66c1c75ea..ec6e7f45c 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -37,5 +37,8 @@ en: title: You received the following notifications share: Share comment: Comment proposal - direct_message: - reply: Reply to %{sender} \ No newline at end of file + direct_message_for_receiver: + subject: "You have received a new private message" + reply: Reply to %{sender} + direct_message_for_sender: + subject: "You have send a new private message" \ No newline at end of file diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 36343267d..4defbd1ed 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -37,5 +37,8 @@ es: title: Has recibido las siguientes notificaciones share: Compartir comment: Comentar propuesta - direct_message: - reply: Responder a %{sender} \ No newline at end of file + direct_message_for_receiver: + subject: "Has recibido un nuevo mensaje privado" + reply: Responder a %{sender} + direct_message_for_sender: + subject: "Has enviado un nuevo mensaje privado" \ No newline at end of file diff --git a/spec/features/direct_messages_spec.rb b/spec/features/direct_messages_spec.rb index 142be8cbb..2ee1f4365 100644 --- a/spec/features/direct_messages_spec.rb +++ b/spec/features/direct_messages_spec.rb @@ -61,11 +61,4 @@ feature 'Direct messages' do expect(page).to have_content error_message end - context "Limits" do - - pending "Cannot send more than one notification within established interval" - pending "use timecop to make sure notifications can be sent after time interval" - - end - end \ No newline at end of file diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index 5894d40ed..237444f85 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -148,6 +148,41 @@ feature 'Emails' do expect(email).to have_body_text(spending_proposal.feasible_explanation) end + context "Direct Message" do + + scenario "Receiver email" do + sender = create(:user, :level_two) + receiver = create(:user, :level_two) + + direct_message = create_direct_message(sender, receiver) + + email = unread_emails_for(receiver.email).first + + expect(email).to have_subject("You have received a new private message") + expect(email).to have_body_text(direct_message.title) + expect(email).to have_body_text(direct_message.body) + expect(email).to have_body_text(direct_message.sender.name) + expect(email).to have_body_text(/#{user_path(direct_message.sender_id)}/) + end + + scenario "Sender email" do + sender = create(:user, :level_two) + receiver = create(:user, :level_two) + + direct_message = create_direct_message(sender, receiver) + + email = unread_emails_for(sender.email).first + + expect(email).to have_subject("You have send a new private message") + expect(email).to have_body_text(direct_message.title) + expect(email).to have_body_text(direct_message.body) + expect(email).to have_body_text(direct_message.receiver.name) + end + + pending "In the copy sent to the sender, display the receiver's name" + + end + context "Proposal notifications" do scenario "Proposal notification" do diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 39faf03f5..8eba8b13d 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -214,4 +214,20 @@ module CommonActions Notification.last end + def create_direct_message(sender, receiver) + login_as(sender) + visit user_path(receiver) + + click_link "Send private message" + + expect(page).to have_content "Send private message to #{receiver.name}" + + fill_in 'direct_message_title', with: "Hey #{receiver.name}!" + fill_in 'direct_message_body', with: "How are you doing? This is #{sender.name}" + click_button "Send message" + + expect(page).to have_content "You message has been sent successfully." + DirectMessage.last + end + end From 28d12fe55bcb7bbf73fb7edc803022a1d419f738 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 15 Jun 2016 10:43:02 +0200 Subject: [PATCH 039/126] removes sending individual proposal notifications via email --- app/controllers/account_controller.rb | 2 +- .../proposal_notifications_controller.rb | 3 - app/mailers/mailer.rb | 8 --- app/views/account/show.html.erb | 9 --- .../mailer/proposal_notification.html.erb | 29 ---------- config/locales/en.yml | 1 - config/locales/es.yml | 1 - config/locales/mailers.en.yml | 3 - config/locales/mailers.es.yml | 3 - spec/features/account_spec.rb | 1 - spec/features/emails_spec.rb | 56 ------------------- spec/features/proposal_notifications_spec.rb | 47 ---------------- spec/models/user_spec.rb | 6 -- 13 files changed, 1 insertion(+), 168 deletions(-) delete mode 100644 app/views/mailer/proposal_notification.html.erb diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 496778e5f..9212eb4fa 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -25,7 +25,7 @@ class AccountController < ApplicationController if @account.organization? params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, :newsletter, organization_attributes: [:name, :responsible_name]) else - params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_proposal_notification, :email_on_direct_message, :email_digest, :newsletter) + params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_direct_message, :email_digest, :newsletter) end end diff --git a/app/controllers/proposal_notifications_controller.rb b/app/controllers/proposal_notifications_controller.rb index 1fcd9322a..fc9cdf3d8 100644 --- a/app/controllers/proposal_notifications_controller.rb +++ b/app/controllers/proposal_notifications_controller.rb @@ -13,9 +13,6 @@ class ProposalNotificationsController < ApplicationController if @notification.save @proposal.voters.each do |voter| Notification.add(voter.id, @notification) - if voter.email_on_proposal_notification? - Mailer.proposal_notification(@notification, voter).deliver_later - end end redirect_to @notification, notice: I18n.t("flash.actions.create.proposal_notification") else diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 6916253f2..5f7dc5391 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -42,14 +42,6 @@ class Mailer < ApplicationMailer end end - def proposal_notification(notification, voter) - @notification = notification - - with_user(voter) do - mail(to: voter.email, subject: @notification.title + ": " + @notification.proposal.title) - end - end - def direct_message_for_receiver(direct_message) @direct_message = direct_message @receiver = @direct_message.receiver diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index 3d93bc705..98987626d 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -69,15 +69,6 @@ <% end %> -
- <%= f.label :email_on_proposal_notification do %> - <%= f.check_box :email_on_proposal_notification, title: t('account.show.email_on_proposal_notification_label'), label: false %> - - <%= t("account.show.email_on_proposal_notification_label") %> - - <% end %> -
-
<%= f.label :email_digest do %> <%= f.check_box :email_digest, title: t('account.show.email_digest_label'), label: false %> diff --git a/app/views/mailer/proposal_notification.html.erb b/app/views/mailer/proposal_notification.html.erb deleted file mode 100644 index 04ca39d86..000000000 --- a/app/views/mailer/proposal_notification.html.erb +++ /dev/null @@ -1,29 +0,0 @@ - -

- <%= @notification.proposal.title %> -

- -

- <%= @notification.body %> -

- - - - - - - - - -
- <%= link_to "#comments", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> - <%= image_tag('icon_mailer_share.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> - <%= t('mailers.proposal_notification.share') %> - <% end %> - - <%= link_to "#social-share", style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> - <%= image_tag('icon_mailer_comment.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px; vertical-align: middle;", alt: "") %> - <%= t('mailers.proposal_notification.comment') %> - <% end %> -
- diff --git a/config/locales/en.yml b/config/locales/en.yml index de1f1a485..e78f9c4d0 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -15,7 +15,6 @@ en: public_activity_label: Keep my list of activities public save_changes_submit: Save changes subscription_to_website_newsletter_label: Receive by email website relevant information - email_on_proposal_notification_label: Receive by email notifications about proposals email_on_direct_message_label: Receive emails about direct messages email_digest_label: Receive a summary of proposal notifications title: My account diff --git a/config/locales/es.yml b/config/locales/es.yml index c5fa39c91..592bc9213 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -15,7 +15,6 @@ es: public_activity_label: Mostrar públicamente mi lista de actividades save_changes_submit: Guardar cambios subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web - email_on_proposal_notification_label: Recibir emails con notificaciones sobre propuestas email_on_direct_message_label: Recibir emails con mensajes directos email_digest_label: Recibir resumen de notificaciones sobre propuestas title: Mi cuenta diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index ec6e7f45c..7270f81ae 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -30,9 +30,6 @@ en: sorry: "Sorry for the inconvenience and we again thank you for your invaluable participation." subject: "Your investment project '%{code}' has been marked as unfeasible" unfeasible_html: "From the Madrid City Council we want to thank you for your participation in the participatory budgets of the city of Madrid. We regret to inform you that your proposal '%{title}' will be excluded from this participatory process for the following reason:" - proposal_notification: - share: Share - comment: Comment proposal proposal_notification_digest: title: You received the following notifications share: Share diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 4defbd1ed..288fa189e 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -30,9 +30,6 @@ es: sorry: "Sentimos las molestias ocasionadas y volvemos a darte las gracias por tu inestimable participación." subject: "Tu propuesta de inversión '%{code}' ha sido marcada como inviable" unfeasible_html: "Desde el Ayuntamiento de Madrid queremos agradecer tu participación en los Presupuestos Participativos de la ciudad de Madrid. Lamentamos informarte de que tu propuesta '%{title}' quedará excluida de este proceso participativo por el siguiente motivo:" - proposal_notification: - share: Compartir - comment: Comentar propuesta proposal_notification_digest: title: Has recibido las siguientes notificaciones share: Compartir diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index b41d676d4..0d5da38b2 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -35,7 +35,6 @@ feature 'Account' do fill_in 'account_username', with: 'Larry Bird' check 'account_email_on_comment' check 'account_email_on_comment_reply' - uncheck 'account_email_on_proposal_notification' uncheck 'account_email_digest' uncheck 'account_email_on_direct_message' click_button 'Save changes' diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index 237444f85..3ea8f16b9 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -183,62 +183,6 @@ feature 'Emails' do end - context "Proposal notifications" do - - scenario "Proposal notification" do - author = create(:user) - - noelia = create(:user) - vega = create(:user) - cristina = create(:user) - - proposal = create(:proposal, author: author) - - create(:vote, voter: noelia, votable: proposal, vote_flag: true) - create(:vote, voter: vega, votable: proposal, vote_flag: true) - - reset_mailer - - login_as(author) - visit root_path - - visit new_proposal_notification_path(proposal_id: proposal.id) - - fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal" - fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen!" - click_button "Send message" - - expect(page).to have_content "Your message has been sent correctly." - - expect(unread_emails_for(noelia.email).size).to eql parse_email_count(1) - expect(unread_emails_for(vega.email).size).to eql parse_email_count(1) - expect(unread_emails_for(cristina.email).size).to eql parse_email_count(0) - expect(unread_emails_for(author.email).size).to eql parse_email_count(0) - - email = open_last_email - expect(email).to have_subject("Thank you for supporting my proposal: #{proposal.title}") - expect(email).to have_body_text("Please share it with others so we can make it happen!") - expect(email).to have_body_text(proposal.title) - end - - scenario "Do not send email about proposal notifications unless set in preferences", :js do - author = create(:user) - voter = create(:user, email_on_proposal_notification: false) - - proposal = create(:proposal, author: author) - create(:vote, voter: voter, votable: proposal, vote_flag: true) - - login_as(author) - visit new_proposal_notification_path(proposal_id: proposal.id) - - fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal" - fill_in 'proposal_notification_body', with: "Please share it with others so we can make it happen!" - click_button "Send message" - - expect { open_last_email }.to raise_error "No email has been sent!" - end - end - context "Proposal notification digest" do scenario "notifications for proposals that I have supported" do diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index 7785a1236..be8b146fd 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -51,53 +51,6 @@ feature 'Proposal Notifications' do expect(page).to have_link("the proposal's page", href: proposal_path(proposal)) end - context "Receivers" do - - scenario "Only send a digest to users that have the option set in their profile" do - user1 = create(:user, email_digest: true) - user2 = create(:user, email_digest: true) - user3 = create(:user, email_digest: false) - - proposal = create(:proposal) - - [user1, user2, user3].each do |user| - create(:vote, votable: proposal, voter: user) - end - - create_proposal_notification(proposal) - - reset_mailer - email_digest = EmailDigest.new - email_digest.create - - expect(unread_emails_for(user1.email).size).to eql parse_email_count(1) - expect(unread_emails_for(user2.email).size).to eql parse_email_count(1) - expect(unread_emails_for(user3.email).size).to eql parse_email_count(0) - end - - scenario "Only send a digest to users that have voted for a proposal" do - user1 = create(:user, email_digest: true) - user2 = create(:user, email_digest: true) - user3 = create(:user, email_digest: true) - - proposal = create(:proposal) - - [user1, user2].each do |user| - create(:vote, votable: proposal, voter: user) - end - - create_proposal_notification(proposal) - - reset_mailer - email_digest = EmailDigest.new - email_digest.create - - expect(unread_emails_for(user1.email).size).to eql parse_email_count(1) - expect(unread_emails_for(user2.email).size).to eql parse_email_count(1) - expect(unread_emails_for(user3.email).size).to eql parse_email_count(0) - end - - end context "Permissions" do scenario "Link to send the message" do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 698c4884c..143053c77 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -84,12 +84,6 @@ describe User do end end - describe 'email_on_proposal_notification' do - it 'should be true by default' do - expect(subject.email_on_proposal_notification).to eq(true) - end - end - describe 'email_digest' do it 'should be true by default' do expect(subject.email_digest).to eq(true) From cdc2bd67a4e99dfb8c0b597e5f4c2b0bfc4291c1 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 15 Jun 2016 10:51:58 +0200 Subject: [PATCH 040/126] adds correct order for email action links --- app/views/mailer/proposal_notification_digest.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index 16e96260c..500a0fade 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -11,7 +11,7 @@ - <%= @notifications.each do |notification| %> + <% @notifications.each do |notification| %> @@ -32,12 +32,12 @@ From 95d244003e8b2731faeef2b14afccefac847d154 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 15 Jun 2016 12:03:38 +0200 Subject: [PATCH 042/126] do not display link to send direct message --- app/views/users/show.html.erb | 4 ++-- spec/features/direct_messages_spec.rb | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 31c62d13c..8b4428a09 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -2,11 +2,11 @@
- <% if @user != current_user %> + <% if @user != current_user && @user.email_on_direct_message? %> <%= link_to t("users.show.send_private_message"), new_user_direct_message_path(@user), class: "button hollow float-right" %> - + <% else %>
<%= t("users.show.no_private_messages") %>
diff --git a/spec/features/direct_messages_spec.rb b/spec/features/direct_messages_spec.rb index 2ee1f4365..119cbe6de 100644 --- a/spec/features/direct_messages_spec.rb +++ b/spec/features/direct_messages_spec.rb @@ -24,8 +24,8 @@ feature 'Direct messages' do context "Permissions" do - scenario "Link to send the message" do - sender = create(:user, :level_two) + scenario "Do not display link to send message to myself" do + sender = create(:user, :level_two) login_as(sender) visit user_path(sender) @@ -33,6 +33,17 @@ feature 'Direct messages' do expect(page).to_not have_link "Send private message" end + scenario "Do not display link if direct message for user not allowed" do + sender = create(:user, :level_two) + receiver = create(:user, :level_two, email_on_direct_message: false) + + login_as(sender) + visit user_path(receiver) + + expect(page).to have_content "This user doesn't accept private messages." + expect(page).to_not have_link "Send private message" + end + scenario "Accessing form directly" do user = create(:user) author = create(:user) From e2689d640c3c26b6d672eb707c421b924f1cc8c9 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 15 Jun 2016 12:12:56 +0200 Subject: [PATCH 043/126] refactors notification helpers --- app/helpers/notifications_helper.rb | 11 +------ app/models/notification.rb | 11 +++++++ .../notifications/_notification.html.erb | 2 +- spec/helpers/notifications_helper_spec.rb | 25 --------------- spec/models/notification_spec.rb | 31 +++++++++++++++++++ 5 files changed, 44 insertions(+), 36 deletions(-) delete mode 100644 spec/helpers/notifications_helper_spec.rb diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 6ec5f1b9e..2b907535f 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -1,13 +1,4 @@ module NotificationsHelper - def notification_action(notification) - case notification.notifiable_type - when "ProposalNotification" - "proposal_notification" - when "Comment" - "replies_to" - else - "comments_on" - end - end + end diff --git a/app/models/notification.rb b/app/models/notification.rb index 2e2bedc38..9695c1b01 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -33,6 +33,17 @@ class Notification < ActiveRecord::Base end end + def notifiable_action + case notifiable_type + when "ProposalNotification" + "proposal_notification" + when "Comment" + "replies_to" + else + "comments_on" + end + end + def linkable_resource notifiable.is_a?(ProposalNotification) ? notifiable.proposal : notifiable end diff --git a/app/views/notifications/_notification.html.erb b/app/views/notifications/_notification.html.erb index 237912a10..99b4b7def 100644 --- a/app/views/notifications/_notification.html.erb +++ b/app/views/notifications/_notification.html.erb @@ -2,7 +2,7 @@ <%= link_to notification do %>

- <%= t("notifications.index.#{notification_action(notification)}", + <%= t("notifications.index.#{notification.notifiable_action}", count: notification.counter) %> <%= notification.notifiable_title %> diff --git a/spec/helpers/notifications_helper_spec.rb b/spec/helpers/notifications_helper_spec.rb deleted file mode 100644 index ccb3b3a9d..000000000 --- a/spec/helpers/notifications_helper_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'rails_helper' - -describe NotificationsHelper do - - describe "#notification_action" do - let(:debate) { create :debate } - let(:debate_comment) { create :comment, commentable: debate } - - context "when action was comment on a debate" do - it "returns correct text when someone comments on your debate" do - notification = create :notification, notifiable: debate - expect(notification_action(notification)).to eq "comments_on" - end - end - - context "when action was comment on a debate" do - it "returns correct text when someone replies to your comment" do - notification = create :notification, notifiable: debate_comment - expect(notification_action(notification)).to eq "replies_to" - end - end - end - - -end diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index 361211a51..fcf7cab4b 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -47,4 +47,35 @@ describe Notification do end end + describe "#notification_action" do + + context "when action was comment on a debate" do + it "returns correct text when someone comments on your debate" do + debate = create(:debate) + notification = create :notification, notifiable: debate + + expect(notification.notifiable_action).to eq "comments_on" + end + end + + context "when action was comment on a debate" do + it "returns correct text when someone replies to your comment" do + debate = create(:debate) + debate_comment = create :comment, commentable: debate + notification = create :notification, notifiable: debate_comment + + expect(notification.notifiable_action).to eq "replies_to" + end + end + + context "when action was proposal notification" do + it "returns correct text when the author created a proposal notification" do + proposal_notification = create(:proposal_notification) + notification = create :notification, notifiable: proposal_notification + + expect(notification.notifiable_action).to eq "proposal_notification" + end + end + end + end From 0c469bc362a073946dc3c3460ead5d7d37d5326f Mon Sep 17 00:00:00 2001 From: kikito Date: Wed, 15 Jun 2016 14:02:13 +0200 Subject: [PATCH 044/126] fixes the way permissions work for proposalnotifications --- app/models/abilities/common.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/models/abilities/common.rb b/app/models/abilities/common.rb index 994bf90c0..f82e78b58 100644 --- a/app/models/abilities/common.rb +++ b/app/models/abilities/common.rb @@ -50,9 +50,7 @@ module Abilities can :show, DirectMessage, sender_id: user.id end - can [:new, :create, :show], ProposalNotification do |notification| - notification.proposal.author_id == user.id - end + can [:create, :show], ProposalNotification, proposal: { author_id: user.id } can :create, Annotation can [:update, :destroy], Annotation, user_id: user.id From 19b6740d370c732461668b9e9a4c9fdf05ad666a Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 15 Jun 2016 16:46:54 +0200 Subject: [PATCH 045/126] updates email from field --- app/mailers/application_mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index c1f3e4bb6..8838f522f 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,5 +1,5 @@ class ApplicationMailer < ActionMailer::Base helper :settings - default from: "participacion@madrid.es" + default from: "Decide Madrid " layout 'mailer' end From 60c1fdcb271fe00a581b2fcebeb11bbc9654bd50 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 15 Jun 2016 16:54:13 +0200 Subject: [PATCH 046/126] Changes text to 'share proposal' --- config/locales/mailers.en.yml | 2 +- config/locales/mailers.es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 7270f81ae..6d91c52a1 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -32,7 +32,7 @@ en: unfeasible_html: "From the Madrid City Council we want to thank you for your participation in the participatory budgets of the city of Madrid. We regret to inform you that your proposal '%{title}' will be excluded from this participatory process for the following reason:" proposal_notification_digest: title: You received the following notifications - share: Share + share: Share proposal comment: Comment proposal direct_message_for_receiver: subject: "You have received a new private message" diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 288fa189e..7593aac43 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -32,7 +32,7 @@ es: unfeasible_html: "Desde el Ayuntamiento de Madrid queremos agradecer tu participación en los Presupuestos Participativos de la ciudad de Madrid. Lamentamos informarte de que tu propuesta '%{title}' quedará excluida de este proceso participativo por el siguiente motivo:" proposal_notification_digest: title: Has recibido las siguientes notificaciones - share: Compartir + share: Compartir propuesta comment: Comentar propuesta direct_message_for_receiver: subject: "Has recibido un nuevo mensaje privado" From 06596ac4d80a0e56a1e9cbbbb7245ef2b29dd9ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Wed, 15 Jun 2016 17:01:50 +0200 Subject: [PATCH 047/126] adds author_of? helper method --- app/helpers/application_helper.rb | 5 +++++ spec/helpers/application_helper_spec.rb | 27 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 spec/helpers/application_helper_spec.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c5f2e6aca..1f52f0eea 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -35,4 +35,9 @@ module ApplicationHelper } Redcarpet::Markdown.new(renderer, extensions).render(text).html_safe end + + def author_of?(authorable, user) + return false if authorable.blank? || user.blank? + authorable.author_id == user.id + end end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb new file mode 100644 index 000000000..61137912d --- /dev/null +++ b/spec/helpers/application_helper_spec.rb @@ -0,0 +1,27 @@ +require 'rails_helper' + +describe ApplicationHelper do + + describe "#author_of?" do + it "should be true if user is the author" do + user = create(:user) + proposal = create(:proposal, author: user) + expect(author_of?(proposal, user)).to eq true + end + + it "should be false if user is not the author" do + user = create(:user) + proposal = create(:proposal) + expect(author_of?(proposal, user)).to eq false + end + + it "should be false if user or authorable is nil" do + user = create(:user) + proposal = create(:proposal) + + expect(author_of?(nil, user)).to eq false + expect(author_of?(proposal, nil)).to eq false + end + end + +end \ No newline at end of file From e87fda2c8d030c8c8612d8b81a6cda24946fba5f Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 15 Jun 2016 17:03:33 +0200 Subject: [PATCH 048/126] Adds comments anchor on form link --- app/views/proposal_notifications/new.html.erb | 7 +++---- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/views/proposal_notifications/new.html.erb b/app/views/proposal_notifications/new.html.erb index a5f829ecc..b76f218fe 100644 --- a/app/views/proposal_notifications/new.html.erb +++ b/app/views/proposal_notifications/new.html.erb @@ -7,10 +7,9 @@

<%= t("proposal_notifications.new.info_about_receivers_html", - count: @proposal.voters.count) %> - - <%= link_to t("proposal_notifications.new.proposal_page"), - proposal_path(@proposal) %> + count: @proposal.voters.count, + proposal_page: link_to(t("proposal_notifications.new.proposal_page"), + proposal_path(@proposal, anchor: "comments"))).html_safe %>

diff --git a/config/locales/en.yml b/config/locales/en.yml index e78f9c4d0..1002042d7 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -374,7 +374,7 @@ en: title_label: "Title" body_label: "Message" submit_button: "Send message" - info_about_receivers_html: "This message will be send to %{count} people and it will be visible in " + info_about_receivers_html: "This message will be send to %{count} people and it will be visible in %{proposal_page}." proposal_page: "the proposal's page" show: back: "Go back to my activity" diff --git a/config/locales/es.yml b/config/locales/es.yml index 592bc9213..30d573c37 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -374,7 +374,7 @@ es: title_label: "Título" body_label: "Mensaje" submit_button: "Enviar mensaje" - info_about_receivers_html: "Este mensaje se enviará a %{count} usuarios y se publicará en " + info_about_receivers_html: "Este mensaje se enviará a %{count} usuarios y se publicará en %{proposal_page}." proposal_page: "la página de la propuesta" show: back: "Volver a mi actividad" From 2dc39192b800886a65f0c5b1dfd59c691c2e72f4 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 15 Jun 2016 17:13:44 +0200 Subject: [PATCH 049/126] Adds button to proposal's show to 'Send notification' --- app/assets/stylesheets/layout.scss | 4 ++++ app/views/proposals/show.html.erb | 5 +++++ app/views/users/_proposals.html.erb | 2 +- config/locales/en.yml | 3 ++- config/locales/es.yml | 3 ++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index e9a9f1057..9152955dc 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -253,6 +253,10 @@ a { max-width: none; } +.button.float-right ~ .button.float-right { + margin: 0 $line-height/2; +} + // 02. Header // ---------- diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index 2153b23e5..7bb2a92a6 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -12,6 +12,11 @@
<%= render "shared/back_link" %> + <% if author_of?(@proposal, current_user) %> + <%= link_to t("proposals.show.send_notification"), new_proposal_notification_path(proposal_id: @proposal.id), + class: 'button hollow float-right' %> + <% end %> + <% if current_user && @proposal.editable_by?(current_user) %> <%= link_to edit_proposal_path(@proposal), class: 'edit-proposal button hollow float-right' do %> <%= t("proposals.show.edit_proposal_link") %> diff --git a/app/views/users/_proposals.html.erb b/app/views/users/_proposals.html.erb index a56b096f6..f50045635 100644 --- a/app/views/users/_proposals.html.erb +++ b/app/views/users/_proposals.html.erb @@ -9,7 +9,7 @@ <% if author? %>
<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 1002042d7..78ac956a7 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -365,6 +365,7 @@ en: retired_warning_link_to_explanation: Read the explanation before voting for it. retired: Proposal retired by the author share: Share + send_notification: Send notification update: form: submit_button: Save changes @@ -535,7 +536,7 @@ en: private_activity: This user decided to keep the activity list private send_private_message: "Send private message" proposals: - send_message: "Send message" + send_notification: "Send notification" retire: "Retire" retired: "Retired" votes: diff --git a/config/locales/es.yml b/config/locales/es.yml index 30d573c37..219a07dee 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -364,6 +364,7 @@ es: retired_warning: "El autor de esta propuesta considera que ya no debe seguir recogiendo apoyos." retired_warning_link_to_explanation: Revisa su explicación antes de apoyarla. retired: Propuesta retirada por el autor + send_notification: Enviar notificación share: Compartir update: form: @@ -535,7 +536,7 @@ es: private_activity: Este usuario ha decidido mantener en privado su lista de actividades send_private_message: "Enviar un mensaje privado" proposals: - send_message: "Enviar mensaje" + send_notification: "Enviar notificación" retire: "Retirar" retired: "Retirada" votes: From f606a3bcbef34931568412945df329bf865d3293 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 15 Jun 2016 17:33:25 +0200 Subject: [PATCH 050/126] Adds link to unsubscribe in digest email --- .../mailer/proposal_notification_digest.html.erb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index 500a0fade..eda614040 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -50,4 +50,16 @@
- <%= link_to proposal_url(notification.notifiable.proposal, anchor: "comments"), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> + <%= link_to proposal_url(notification.notifiable.proposal, anchor: "social-share"), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block;" do %> <%= image_tag('icon_mailer_share.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px", alt: "") %> <%= t('mailers.proposal_notification_digest.share') %> <% end %> - <%= link_to proposal_url(notification.notifiable.proposal, anchor: "social-share"), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block; margin-left: 12px;" do %> + <%= link_to proposal_url(notification.notifiable.proposal, anchor: "comments"), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block; margin-left: 12px;" do %> <%= image_tag('icon_mailer_comment.png', style: "border: 0; display: inline-block; width: 100%; max-width: 16px; vertical-align: middle;", alt: "") %> <%= t('mailers.proposal_notification_digest.comment') %> <% end %> From 90148ffdca758dd4e7d3d7c18770b20f31c8dcff Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 15 Jun 2016 11:34:33 +0200 Subject: [PATCH 041/126] adds missing translation --- app/views/mailer/direct_message_for_receiver.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/mailer/direct_message_for_receiver.html.erb b/app/views/mailer/direct_message_for_receiver.html.erb index d70c78a28..a6b366ce9 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -13,7 +13,7 @@ <%= link_to user_url(@direct_message.sender), style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #f7f5f2; border-radius: 6px; color: #3d3d66!important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 200px; display: inline-block;", target: "_blank" do %> <%= image_tag('icon_mailer_reply.png', style: "border: 0; display: inline-block; width: 100%; max-width: 12px; vertical-align: sub;", alt: "") %> - <%= t('mailers.direct_message.reply', + <%= t('mailers.direct_message_for_receiver.reply', sender: @direct_message.sender.name) %> <% end %> - <%= link_to t("users.proposals.send_message"), new_proposal_notification_path(proposal_id: proposal.id), + <%= link_to t("users.proposals.send_notification"), new_proposal_notification_path(proposal_id: proposal.id), class: 'button hollow' %>
<% end %> + + + + + + + + From 0366d7efb25f7a8d5ace7d1ef6e5c2ab7a483571 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 15 Jun 2016 17:55:42 +0200 Subject: [PATCH 051/126] Adds translations on mailer message --- app/views/mailer/proposal_notification_digest.html.erb | 4 +++- config/locales/mailers.en.yml | 2 ++ config/locales/mailers.es.yml | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index eda614040..cd194de7f 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -56,7 +56,9 @@ diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 6d91c52a1..099b3c182 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -34,6 +34,8 @@ en: title: You received the following notifications share: Share proposal comment: Comment proposal + unsubscribe: "If you don't want receive proposal's notification, visit %{account} and unckeck 'Receive a summary of proposal notifications'." + unsubscribe_account: My account direct_message_for_receiver: subject: "You have received a new private message" reply: Reply to %{sender} diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 7593aac43..e510ec2d8 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -34,6 +34,8 @@ es: title: Has recibido las siguientes notificaciones share: Compartir propuesta comment: Comentar propuesta + unsubscribe: "Si no quieres recibir notificaciones de propuestas, puedes entrar en %{account} y desmarcar la opción 'Recibir resumen de notificaciones sobre propuestas'." + unsubscribe_account: Mi cuenta direct_message_for_receiver: subject: "Has recibido un nuevo mensaje privado" reply: Responder a %{sender} From 0f1d6c1f191ad3b02eab6aa2ce7f1f9a07dbfbc2 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 15 Jun 2016 20:44:32 +0200 Subject: [PATCH 052/126] Adds text in footer about not replying --- app/views/layouts/mailer.html.erb | 4 ++++ app/views/mailer/proposal_notification_digest.html.erb | 2 +- config/locales/mailers.en.yml | 1 + config/locales/mailers.es.yml | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index e0533ca50..f90b8e39d 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -32,6 +32,10 @@ diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index cd194de7f..97a309d81 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -17,7 +17,7 @@ diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 72c201dd7..81efbd30c 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -32,7 +32,7 @@ en: subject: "Your investment project '%{code}' has been marked as unfeasible" unfeasible_html: "From the Madrid City Council we want to thank you for your participation in the participatory budgets of the city of Madrid. We regret to inform you that your proposal '%{title}' will be excluded from this participatory process for the following reason:" proposal_notification_digest: - title: You received the following notifications + title: "Proposal notifications in %{org_name}" share: Share proposal comment: Comment proposal unsubscribe: "If you don't want receive proposal's notification, visit %{account} and unckeck 'Receive a summary of proposal notifications'." diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 41abb53d8..0c9d81ac0 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -32,7 +32,7 @@ es: subject: "Tu propuesta de inversión '%{code}' ha sido marcada como inviable" unfeasible_html: "Desde el Ayuntamiento de Madrid queremos agradecer tu participación en los Presupuestos Participativos de la ciudad de Madrid. Lamentamos informarte de que tu propuesta '%{title}' quedará excluida de este proceso participativo por el siguiente motivo:" proposal_notification_digest: - title: Has recibido las siguientes notificaciones + title: "Notificaciones de propuestas en %{org_name}" share: Compartir propuesta comment: Comentar propuesta unsubscribe: "Si no quieres recibir notificaciones de propuestas, puedes entrar en %{account} y desmarcar la opción 'Recibir resumen de notificaciones sobre propuestas'." From dd7629b5af5d769ff9b435bb30d850a99617d24c Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 15 Jun 2016 21:00:56 +0200 Subject: [PATCH 054/126] Adds notification menu and message for empty notifications --- app/views/proposals/_comments.html.erb | 7 ------- app/views/proposals/_notifications.html.erb | 6 ++++++ app/views/proposals/show.html.erb | 6 ++---- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/views/proposals/_comments.html.erb b/app/views/proposals/_comments.html.erb index 094814cf1..ed52b1b66 100644 --- a/app/views/proposals/_comments.html.erb +++ b/app/views/proposals/_comments.html.erb @@ -2,13 +2,6 @@
- <% if @notifications.blank? %> -

- <%= t("proposals.show.comments_title") %> - (<%= @proposal.comments_count %>) -

- <% end %> - <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> <% if user_signed_in? %> diff --git a/app/views/proposals/_notifications.html.erb b/app/views/proposals/_notifications.html.erb index 44bb9f4a2..69389b2c5 100644 --- a/app/views/proposals/_notifications.html.erb +++ b/app/views/proposals/_notifications.html.erb @@ -1,6 +1,12 @@
+ <% if @notifications.blank? %> +
+ <%= t('proposals.show.no_notifications') %> +
+ <% end %> + <% @notifications.each do |notification| %>

<%= notification.title %>

<%= notification.created_at.to_date %>

diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb index 7bb2a92a6..3a9869d83 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -124,10 +124,8 @@ <% end %>
- <% if @notifications.present? %> - <%= render "proposals/filter_subnav" %> - <%= render "proposals/notifications" %> - <% end %> + <%= render "proposals/filter_subnav" %> + <%= render "proposals/notifications" %>
<%= render "proposals/comments" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 78ac956a7..65d97f997 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -356,7 +356,6 @@ en: other: "%{count} comments" zero: No comments comments_tab: Comments - comments_title: Comments edit_proposal_link: Edit flag: This proposal has been flagged as inappropriate by several users. login_to_comment: You must %{signin} or %{signup} to leave a comment. @@ -366,6 +365,7 @@ en: retired: Proposal retired by the author share: Share send_notification: Send notification + no_notifications: "This proposal has any notifications." update: form: submit_button: Save changes diff --git a/config/locales/es.yml b/config/locales/es.yml index 219a07dee..9ac646584 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -356,7 +356,6 @@ es: other: "%{count} Comentarios" zero: Sin comentarios comments_tab: Comentarios - comments_title: Comentarios edit_proposal_link: Editar propuesta flag: Esta propuesta ha sido marcada como inapropiada por varios usuarios. login_to_comment: Necesitas %{signin} o %{signup} para comentar. @@ -366,6 +365,7 @@ es: retired: Propuesta retirada por el autor send_notification: Enviar notificación share: Compartir + no_notifications: "Esta propuesta no tiene notificaciones." update: form: submit_button: Guardar cambios From 419ced5a18394c5a91586e6b79dfc08b3bd16ace Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 15 Jun 2016 21:14:56 +0200 Subject: [PATCH 055/126] Adds text to form new --- app/views/proposal_notifications/new.html.erb | 6 +++++- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/proposal_notifications/new.html.erb b/app/views/proposal_notifications/new.html.erb index b76f218fe..678e00088 100644 --- a/app/views/proposal_notifications/new.html.erb +++ b/app/views/proposal_notifications/new.html.erb @@ -1,5 +1,5 @@
-
+
<%= render 'shared/back_link' %>

<%= t("proposal_notifications.new.title") %>

@@ -12,7 +12,11 @@ proposal_path(@proposal, anchor: "comments"))).html_safe %>

+
+
+
+
<%= form_for @notification do |f| %> <%= render "shared/errors", resource: @notification %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 65d97f997..7d59f0520 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -375,7 +375,7 @@ en: title_label: "Title" body_label: "Message" submit_button: "Send message" - info_about_receivers_html: "This message will be send to %{count} people and it will be visible in %{proposal_page}." + info_about_receivers_html: "This message will be send to %{count} people and it will be visible in %{proposal_page}.
Message are not sent immediately, users will receive periodically an email with all proposal notifications." proposal_page: "the proposal's page" show: back: "Go back to my activity" diff --git a/config/locales/es.yml b/config/locales/es.yml index 9ac646584..488d0d689 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -375,7 +375,7 @@ es: title_label: "Título" body_label: "Mensaje" submit_button: "Enviar mensaje" - info_about_receivers_html: "Este mensaje se enviará a %{count} usuarios y se publicará en %{proposal_page}." + info_about_receivers_html: "Este mensaje se enviará a %{count} usuarios y se publicará en %{proposal_page}.
El mensaje no se enviará inmediatamente, los usuarios recibirán periódicamente un email con todas las notificaciones de propuestas." proposal_page: "la página de la propuesta" show: back: "Volver a mi actividad" From c83e831cb7a11e19da873ebb0ad25475ce40b4f6 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 15 Jun 2016 21:28:17 +0200 Subject: [PATCH 056/126] Adds link to not receive direct messages --- .../direct_message_for_receiver.html.erb | 14 ++++++++++++++ .../proposal_notification_digest.html.erb | 18 +++++++++--------- config/locales/mailers.en.yml | 2 ++ config/locales/mailers.es.yml | 2 ++ 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/views/mailer/direct_message_for_receiver.html.erb b/app/views/mailer/direct_message_for_receiver.html.erb index a6b366ce9..eb1e56fe7 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -20,4 +20,18 @@
+

+ Si no quieres recibir notificaciones de propuestas, puedes entrar en Mi cuenta y desmarcar la opción "Recibir resumen de notificaciones sobre propuestas". +

+

- Si no quieres recibir notificaciones de propuestas, puedes entrar en Mi cuenta y desmarcar la opción "Recibir resumen de notificaciones sobre propuestas". + <%= t('mailers.proposal_notification_digest.unsubscribe', + account: link_to(t('mailers.proposal_notification_digest.unsubscribe_account'), + account_path)).html_safe %>

<%= setting['org_name'] %>

+ +

+ <%= t('mailers.no_reply') %>

+

- <%= link_to notification.notifiable.title, notification_url(notification) %> + <%= link_to notification.notifiable.title, notification_url(notification), style: "color: #2895F1; text-decoration: none;" %>

<%= notification.notifiable.proposal.title %> •  diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 099b3c182..72c201dd7 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -1,6 +1,7 @@ --- en: mailers: + no_reply: "This message was sent from an email address that does not accept replies." comment: hi: Hi new_comment_by_html: There is a new comment from %{commenter} diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index e510ec2d8..41abb53d8 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -1,6 +1,7 @@ --- es: mailers: + no_reply: "Este mensaje se ha enviado desde una dirección de correo electrónico que no admite respuestas." comment: hi: Hola new_comment_by_html: Hay un nuevo comentario de %{commenter} en From 017ccfb3786a9222e624a23d9ff72e7dfce0dac2 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 15 Jun 2016 20:49:29 +0200 Subject: [PATCH 053/126] Changes title and subject in email --- app/mailers/mailer.rb | 2 +- app/views/mailer/proposal_notification_digest.html.erb | 3 ++- config/locales/mailers.en.yml | 2 +- config/locales/mailers.es.yml | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 5f7dc5391..d987e34cc 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -64,7 +64,7 @@ class Mailer < ApplicationMailer @notifications = user.notifications.where(notifiable_type: "ProposalNotification") with_user(user) do - mail(to: user.email, subject: "Email digest") + mail(to: user.email, subject: t('mailers.proposal_notification_digest.title', org_name: Setting['org_name'])) end end diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index 97a309d81..b9592b21a 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -4,7 +4,8 @@

- <%= t('mailers.proposal_notification_digest.title') %> + <%= t('mailers.proposal_notification_digest.title', + org_name: Setting['org_name']) %>

+ + + + + + + +
+

+ <%= t('mailers.direct_message_for_receiver.unsubscribe', + account: link_to(t('mailers.proposal_notification_digest.unsubscribe_account'), + account_path, style: "color: #2895F1; text-decoration: none;")).html_safe %> +

+
diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index b9592b21a..626d46885 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -56,13 +56,13 @@ -

- <%= t('mailers.proposal_notification_digest.unsubscribe', - account: link_to(t('mailers.proposal_notification_digest.unsubscribe_account'), - account_path)).html_safe %> -

- - - - +

+ <%= t('mailers.proposal_notification_digest.unsubscribe', + account: link_to(t('mailers.proposal_notification_digest.unsubscribe_account'), + account_path, style: "color: #2895F1; text-decoration: none;")).html_safe %> +

+ + + + diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 81efbd30c..bcf622836 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -40,5 +40,7 @@ en: direct_message_for_receiver: subject: "You have received a new private message" reply: Reply to %{sender} + unsubscribe: "If you don't want receive direct messages, visit %{account} and unckeck 'Receive emails about direct messages'." + unsubscribe_account: My account direct_message_for_sender: subject: "You have send a new private message" \ No newline at end of file diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 0c9d81ac0..84b2a240e 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -40,5 +40,7 @@ es: direct_message_for_receiver: subject: "Has recibido un nuevo mensaje privado" reply: Responder a %{sender} + unsubscribe: "Si no quieres recibir mensajes directos, puedes entrar en %{account} y desmarcar la opción 'Recibir emails con mensajes directos'." + unsubscribe_account: Mi cuenta direct_message_for_sender: subject: "Has enviado un nuevo mensaje privado" \ No newline at end of file From 9f7b49838dc51fc1ff9ed8113ece6c8ca7a41b7f Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 15 Jun 2016 21:37:36 +0200 Subject: [PATCH 057/126] Improves texts for the sender's email --- app/views/mailer/direct_message_for_sender.html.erb | 10 +++++++--- config/locales/mailers.en.yml | 3 ++- config/locales/mailers.es.yml | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/views/mailer/direct_message_for_sender.html.erb b/app/views/mailer/direct_message_for_sender.html.erb index 219337705..4cf832414 100644 --- a/app/views/mailer/direct_message_for_sender.html.erb +++ b/app/views/mailer/direct_message_for_sender.html.erb @@ -1,9 +1,13 @@ -

<%= @direct_message.receiver.name %>

-

+

+ <%= t('mailers.direct_message_for_sender.title_html', + receiver: @direct_message.receiver.name ) %> +

+ +

<%= @direct_message.title %> -

+

<%= @direct_message.body %> diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index bcf622836..c2e2b5d85 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -43,4 +43,5 @@ en: unsubscribe: "If you don't want receive direct messages, visit %{account} and unckeck 'Receive emails about direct messages'." unsubscribe_account: My account direct_message_for_sender: - subject: "You have send a new private message" \ No newline at end of file + subject: "You have send a new private message" + title_html: "You have send a new private message to %{receiver} with the content:" \ No newline at end of file diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 84b2a240e..bde81ec86 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -40,7 +40,8 @@ es: direct_message_for_receiver: subject: "Has recibido un nuevo mensaje privado" reply: Responder a %{sender} - unsubscribe: "Si no quieres recibir mensajes directos, puedes entrar en %{account} y desmarcar la opción 'Recibir emails con mensajes directos'." + unsubscribe: "Si no quieres recibir mensajes privados, puedes entrar en %{account} y desmarcar la opción 'Recibir emails con mensajes directos'." unsubscribe_account: Mi cuenta direct_message_for_sender: - subject: "Has enviado un nuevo mensaje privado" \ No newline at end of file + subject: "Has enviado un nuevo mensaje privado" + title_html: "Has enviado un nuevo mensaje privado a %{receiver} con el siguiente contenido:" \ No newline at end of file From 25ebb325d12d99aa615874c4649f65bab04d62dd Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 16 Jun 2016 11:10:26 +0200 Subject: [PATCH 058/126] limits maximum number of messages able to send per day --- app/models/direct_message.rb | 18 ++++++ app/models/user.rb | 3 +- config/locales/activerecord.en.yml | 4 ++ config/locales/activerecord.es.yml | 4 ++ db/seeds.rb | 1 + spec/features/direct_messages_spec.rb | 29 +++++++++ spec/models/direct_message_spec.rb | 85 +++++++++++++++++++++++++++ 7 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 spec/models/direct_message_spec.rb diff --git a/app/models/direct_message.rb b/app/models/direct_message.rb index 32cf6ac58..14083f2c7 100644 --- a/app/models/direct_message.rb +++ b/app/models/direct_message.rb @@ -1,4 +1,22 @@ class DirectMessage < ActiveRecord::Base belongs_to :sender, class_name: 'User', foreign_key: 'sender_id' belongs_to :receiver, class_name: 'User', foreign_key: 'receiver_id' + + validates :title, presence: true + validates :body, presence: true + validates :sender, presence: true + validates :receiver, presence: true + validate :max_per_day + + scope :today, lambda { where('DATE(created_at) = ?', Date.today) } + + def max_per_day + return if errors.any? + max = Setting[:direct_message_max_per_day] + + if sender.direct_messages_sent.today.count >= max.to_i + errors.add(:title, I18n.t('activerecord.errors.models.direct_message.attributes.max_per_day.invalid', max: max)) + end + end + end diff --git a/app/models/user.rb b/app/models/user.rb index a3b719859..7240c8929 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -23,7 +23,8 @@ class User < ActiveRecord::Base has_many :spending_proposals, foreign_key: :author_id has_many :failed_census_calls has_many :notifications - has_many :direct_messages + has_many :direct_messages_sent, class_name: 'DirectMessage', foreign_key: :sender_id + has_many :direct_messages_received, class_name: 'DirectMessage', foreign_key: :receiver_id belongs_to :geozone validates :username, presence: true, if: :username_required? diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml index 524c8906c..9b48c1fc2 100644 --- a/config/locales/activerecord.en.yml +++ b/config/locales/activerecord.en.yml @@ -78,6 +78,10 @@ en: attributes: tag_list: less_than_or_equal_to: "tags must be less than or equal to %{count}" + direct_message: + attributes: + max_per_day: + invalid: "You can only send a maximum of %{max} direct messages per day" proposal: attributes: tag_list: diff --git a/config/locales/activerecord.es.yml b/config/locales/activerecord.es.yml index 1999631ab..f14022255 100644 --- a/config/locales/activerecord.es.yml +++ b/config/locales/activerecord.es.yml @@ -78,6 +78,10 @@ es: attributes: tag_list: less_than_or_equal_to: "los temas deben ser menor o igual que %{count}" + direct_message: + attributes: + max_per_day: + invalid: "Sólo puedes enviar %{max} mensajes directos por día" proposal: attributes: tag_list: diff --git a/db/seeds.rb b/db/seeds.rb index 5a6db1574..5644fe493 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -77,3 +77,4 @@ 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 \ No newline at end of file diff --git a/spec/features/direct_messages_spec.rb b/spec/features/direct_messages_spec.rb index 119cbe6de..76b7a150c 100644 --- a/spec/features/direct_messages_spec.rb +++ b/spec/features/direct_messages_spec.rb @@ -72,4 +72,33 @@ feature 'Direct messages' do expect(page).to have_content error_message end + context "Limits" do + + background do + Setting[:direct_message_max_per_day] = 3 + end + + scenario "Can only send a maximum number of direct messages per day" do + sender = create(:user, :level_two) + receiver = create(:user, :level_two) + + 3.times { create(:direct_message, sender: sender) } + + login_as(sender) + visit user_path(receiver) + + click_link "Send private message" + + expect(page).to have_content "Send private message to #{receiver.name}" + + fill_in 'direct_message_title', with: "Hey!" + fill_in 'direct_message_body', with: "How are you doing?" + click_button "Send message" + + expect(page).to have_content "You can only send a maximum of 3 direct messages per day" + expect(page).to_not have_content "You message has been sent successfully." + end + + end + end \ No newline at end of file diff --git a/spec/models/direct_message_spec.rb b/spec/models/direct_message_spec.rb new file mode 100644 index 000000000..e982f9e56 --- /dev/null +++ b/spec/models/direct_message_spec.rb @@ -0,0 +1,85 @@ +require 'rails_helper' + +describe DirectMessage do + + let(:direct_message) { build(:direct_message) } + + before(:each) do + Setting[:direct_message_max_per_day] = 3 + end + + it "should be valid" do + expect(direct_message).to be_valid + end + + it "should not be valid without a title" do + direct_message.title = nil + expect(direct_message).to_not be_valid + end + + it "should not be valid without a body" do + direct_message.body = nil + expect(direct_message).to_not be_valid + end + + it "should not be valid without an associated sender" do + direct_message.sender = nil + expect(direct_message).to_not be_valid + end + + it "should not be valid without an associated receiver" do + direct_message.receiver = nil + expect(direct_message).to_not be_valid + end + + describe "maximum number of direct messages per day" do + + it "should not be valid if above maximum" do + sender = create(:user) + direct_message1 = create(:direct_message, sender: sender) + direct_message2 = create(:direct_message, sender: sender) + direct_message3 = create(:direct_message, sender: sender) + + direct_message4 = build(:direct_message, sender: sender) + expect(direct_message4).to_not be_valid + end + + it "should be valid if below maximum" do + sender = create(:user) + direct_message1 = create(:direct_message, sender: sender) + direct_message2 = create(:direct_message, sender: sender) + + direct_message3 = build(:direct_message) + expect(direct_message).to be_valid + end + + it "should be valid if no direct_messages sent" do + direct_message = build(:direct_message) + + expect(direct_message).to be_valid + end + + end + + describe "scopes" do + + describe "today" do + it "should return direct messages created today" do + direct_message1 = create(:direct_message, created_at: Time.zone.now.beginning_of_day + 3.hours) + direct_message2 = create(:direct_message, created_at: Time.zone.now) + direct_message3 = create(:direct_message, created_at: Time.zone.now.end_of_day) + + expect(DirectMessage.today.count).to eq 3 + end + + it "should not return direct messages created another day" do + direct_message1 = create(:direct_message, created_at: 1.day.ago) + direct_message2 = create(:direct_message, created_at: 1.day.from_now) + + expect(DirectMessage.today.count).to eq 0 + end + end + + end + +end \ No newline at end of file From 91860cb4097908cd21b9cbccbd64001cec6a7bef Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 16 Jun 2016 11:23:03 +0200 Subject: [PATCH 059/126] validates that a user does not want to receive direct messages --- app/views/direct_messages/new.html.erb | 19 +++++++++-- config/locales/en.yml | 4 +++ config/locales/es.yml | 5 +++ spec/features/direct_messages_spec.rb | 44 ++++++++++++++++++-------- 4 files changed, 56 insertions(+), 16 deletions(-) diff --git a/app/views/direct_messages/new.html.erb b/app/views/direct_messages/new.html.erb index 4c888ccd0..3413f26f0 100644 --- a/app/views/direct_messages/new.html.erb +++ b/app/views/direct_messages/new.html.erb @@ -3,11 +3,24 @@ <%= render 'shared/back_link' %>

- <%= t("users.direct_messages.new.title", - receiver: @receiver.name) %> + <%= t("users.direct_messages.new.title", receiver: @receiver.name) %>

- <% if can? :create, @direct_message %> + <% if not current_user %> +
+

+ <%= t("users.direct_messages.new.authenticate", + signin: link_to(t("users.direct_messages.new.signin"), new_user_session_path), + signup: link_to(t("users.direct_messages.new.signup"), new_user_registration_path)).html_safe %> +

+
+ <% elsif not @receiver.email_on_direct_message? %> +
+

+ <%= t("users.direct_messages.new.direct_messages_bloqued") %> +

+
+ <% elsif can? :create, @direct_message %> <%= form_for [@receiver, @direct_message] do |f| %> <%= render "shared/errors", resource: @direct_message %> diff --git a/config/locales/en.yml b/config/locales/en.yml index e78f9c4d0..eb28cf18d 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -504,11 +504,15 @@ en: direct_messages: new: body_label: Message + direct_messages_bloqued: "This user has decided not to receive direct messages" submit_button: Send message title: Send private message to %{receiver} title_label: Title verified_only: To send a private message %{verify_account} verify_account: verify your account + authenticate: You must %{signin} or %{signup} to continue. + signin: sign in + signup: sign up show: receiver: Message sent to %{receiver} show: diff --git a/config/locales/es.yml b/config/locales/es.yml index 592bc9213..bf46a8258 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -143,6 +143,7 @@ es: accept_terms_title: Acepto la Política de privacidad y las Condiciones de uso conditions: Condiciones de uso debate: el debate + direct_message: el mensaje privado error: error errors: errores not_saved: 'impidieron guardar %{resource}:' @@ -504,11 +505,15 @@ es: direct_messages: new: body_label: "Mensaje" + direct_messages_bloqued: "Este usuarios ha decidido no recibir mensajes directos" submit_button: "Enviar mensaje" title: Enviar mensaje privado a %{receiver} title_label: "Título" verified_only: Para enviar un mensaje privado %{verify_account} verify_account: verifica tu cuenta + authenticate: Necesitas %{signin} o %{signup}. + signin: iniciar sesión + signup: registrarte show: receiver: Mensaje enviado a %{receiver} show: diff --git a/spec/features/direct_messages_spec.rb b/spec/features/direct_messages_spec.rb index 76b7a150c..8ec949e9a 100644 --- a/spec/features/direct_messages_spec.rb +++ b/spec/features/direct_messages_spec.rb @@ -2,6 +2,10 @@ require 'rails_helper' feature 'Direct messages' do + background do + Setting[:direct_message_max_per_day] = 3 + end + scenario "Create" do sender = create(:user, :level_two) receiver = create(:user, :level_two) @@ -44,19 +48,37 @@ feature 'Direct messages' do expect(page).to_not have_link "Send private message" end - scenario "Accessing form directly" do - user = create(:user) - author = create(:user) - proposal = create(:proposal, author: author) + scenario "Unverified user" do + sender = create(:user) + receiver = create(:user) - login_as(user) - visit new_proposal_notification_path(proposal_id: proposal.id) + login_as(sender) + visit new_user_direct_message_path(receiver) - expect(current_path).to eq(proposals_path) - expect(page).to have_content("You do not have permission to carry out the action") + expect(page).to have_content "To send a private message verify your account" + expect(page).to_not have_link "Send private message" end - pending "unverified user" + scenario "User not logged in" do + sender = create(:user) + receiver = create(:user) + + visit new_user_direct_message_path(receiver) + + expect(page).to have_content "You must sign in or sign up to continue." + expect(page).to_not have_link "Send private message" + end + + scenario "Accessing form directly" do + sender = create(:user, :level_two) + receiver = create(:user, :level_two, email_on_direct_message: false) + + login_as(sender) + visit new_user_direct_message_path(receiver) + + expect(page).to have_content("This user has decided not to receive direct messages") + expect(page).to_not have_css("#direct_message_title") + end end @@ -74,10 +96,6 @@ feature 'Direct messages' do context "Limits" do - background do - Setting[:direct_message_max_per_day] = 3 - end - scenario "Can only send a maximum number of direct messages per day" do sender = create(:user, :level_two) receiver = create(:user, :level_two) From 18dd9c95f35a7e9bf6b0fd5bda8b3c64e1bd22e9 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 16 Jun 2016 12:06:26 +0200 Subject: [PATCH 060/126] fixes specs --- app/controllers/management/proposals_controller.rb | 1 + app/views/mailer/direct_message_for_receiver.html.erb | 4 ++-- app/views/mailer/proposal_notification_digest.html.erb | 2 +- config/i18n-tasks.yml | 1 + config/locales/en.yml | 1 + db/seeds.rb | 2 +- spec/features/comments/proposals_spec.rb | 5 ++++- spec/features/emails_spec.rb | 3 ++- spec/features/proposal_notifications_spec.rb | 6 +++--- spec/support/common_actions.rb | 3 ++- 10 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/controllers/management/proposals_controller.rb b/app/controllers/management/proposals_controller.rb index 4f6ca18c4..2ce74d6d5 100644 --- a/app/controllers/management/proposals_controller.rb +++ b/app/controllers/management/proposals_controller.rb @@ -13,6 +13,7 @@ class Management::ProposalsController < Management::BaseController def show super + @notifications = @proposal.notifications redirect_to management_proposal_path(@proposal), status: :moved_permanently if request.path != management_proposal_path(@proposal) end diff --git a/app/views/mailer/direct_message_for_receiver.html.erb b/app/views/mailer/direct_message_for_receiver.html.erb index eb1e56fe7..2523f3502 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -27,8 +27,8 @@

<%= t('mailers.direct_message_for_receiver.unsubscribe', - account: link_to(t('mailers.proposal_notification_digest.unsubscribe_account'), - account_path, style: "color: #2895F1; text-decoration: none;")).html_safe %> + account: link_to(t('mailers.direct_message_for_receiver.unsubscribe_account'), + account_url, style: "color: #2895F1; text-decoration: none;")).html_safe %>

diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index 626d46885..0b839150f 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -59,7 +59,7 @@

<%= t('mailers.proposal_notification_digest.unsubscribe', account: link_to(t('mailers.proposal_notification_digest.unsubscribe_account'), - account_path, style: "color: #2895F1; text-decoration: none;")).html_safe %> + account_url, style: "color: #2895F1; text-decoration: none;")).html_safe %>

diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index d24cc6eab..250ed18f9 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -96,6 +96,7 @@ search: ignore_missing: - 'unauthorized.*' - 'activerecord.errors.models.proposal_notification.*' + - 'activerecord.errors.models.direct_message.*' - 'errors.messages.blank' - 'errors.messages.taken' - 'devise.failure.invalid' diff --git a/config/locales/en.yml b/config/locales/en.yml index 64ee8fb6f..b16f1092a 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -143,6 +143,7 @@ en: accept_terms_title: I agree to the Privacy Policy and the Terms and conditions of use conditions: Terms and conditions of use debate: Debate + direct_message: private message error: error errors: errors not_saved: 'prevented this %{resource} from being saved:' diff --git a/db/seeds.rb b/db/seeds.rb index 5644fe493..4a4741a07 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -77,4 +77,4 @@ 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 \ No newline at end of file +Setting['direct_message_max_per_day'] = 3 \ No newline at end of file diff --git a/spec/features/comments/proposals_spec.rb b/spec/features/comments/proposals_spec.rb index 53b1006c3..8312176cd 100644 --- a/spec/features/comments/proposals_spec.rb +++ b/spec/features/comments/proposals_spec.rb @@ -168,7 +168,10 @@ feature 'Commenting proposals' do within "#comments" do expect(page).to have_content 'Have you thought about...?' - expect(page).to have_content '(1)' + end + + within "#tab-comments-label" do + expect(page).to have_content 'Comments (1)' end end diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index 3ea8f16b9..f793b5bb7 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -205,7 +205,7 @@ feature 'Emails' do email_digest.create email = open_last_email - expect(email).to have_subject("Email digest") + expect(email).to have_subject("Proposal notifications in Consul") expect(email).to deliver_to(user.email) expect(email).to have_body_text(proposal1.title) @@ -226,6 +226,7 @@ feature 'Emails' do expect(email).to have_body_text(proposal2.author.name) expect(email).to_not have_body_text(proposal3.title) + expect(email).to have_body_text(/#{account_path}/) end end diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index be8b146fd..6092289f0 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -12,7 +12,7 @@ feature 'Proposal Notifications' do click_link "My activity" within("#proposal_#{proposal.id}") do - click_link "Send message" + click_link "Send notification" end fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal" @@ -48,7 +48,7 @@ feature 'Proposal Notifications' do visit new_proposal_notification_path(proposal_id: proposal.id) expect(page).to have_content "This message will be send to 7 people and it will be visible in the proposal's page" - expect(page).to have_link("the proposal's page", href: proposal_path(proposal)) + expect(page).to have_link("the proposal's page", href: proposal_path(proposal, anchor: 'comments')) end context "Permissions" do @@ -62,7 +62,7 @@ feature 'Proposal Notifications' do visit user_path(author) within("#proposal_#{proposal.id}") do - expect(page).to have_link "Send message" + expect(page).to have_link "Send notification" end login_as(user) diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 8eba8b13d..80bdde907 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -203,7 +203,7 @@ module CommonActions click_link "My activity" within("#proposal_#{proposal.id}") do - click_link "Send message" + click_link "Send notification" end fill_in 'proposal_notification_title', with: "Thank you for supporting my proposal #{proposal.title}" @@ -224,6 +224,7 @@ module CommonActions fill_in 'direct_message_title', with: "Hey #{receiver.name}!" fill_in 'direct_message_body', with: "How are you doing? This is #{sender.name}" + click_button "Send message" expect(page).to have_content "You message has been sent successfully." From 7f20d4eb23bf159786b4096e07b83adb12573a61 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Thu, 16 Jun 2016 13:44:06 +0200 Subject: [PATCH 061/126] Improves styles for admin pages --- app/assets/stylesheets/admin.scss | 17 +++++++++++++++++ app/views/admin/comments/index.html.erb | 4 ++-- app/views/admin/proposals/index.html.erb | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index f52045c7b..e99392fc1 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -111,6 +111,23 @@ body.admin { padding: $line-height !important; } +@include breakpoint(medium) { + + tr { + + .on-hover-block { + display: none; + } + + &:hover .on-hover-block { + display: block; + margin: 0; + margin-top: $line-height/2; + width: 100%; + } + } +} + @include breakpoint(medium) { tr { diff --git a/app/views/admin/comments/index.html.erb b/app/views/admin/comments/index.html.erb index 4166be938..75493857c 100644 --- a/app/views/admin/comments/index.html.erb +++ b/app/views/admin/comments/index.html.erb @@ -20,12 +20,12 @@ restore_admin_comment_path(comment, request.query_parameters), method: :put, data: { confirm: t("admin.actions.confirm") }, - class: "button hollow on-hover" %> + class: "button hollow on-hover-block" %> <% unless comment.confirmed_hide? %> <%= link_to t("admin.actions.confirm_hide"), confirm_hide_admin_comment_path(comment, request.query_parameters), method: :put, - class: "button hollow warning on-hover" %> + class: "button hollow warning on-hover-block" %> <% end %> diff --git a/app/views/admin/proposals/index.html.erb b/app/views/admin/proposals/index.html.erb index cbe1e6d74..d929843b1 100644 --- a/app/views/admin/proposals/index.html.erb +++ b/app/views/admin/proposals/index.html.erb @@ -27,12 +27,12 @@ restore_admin_proposal_path(proposal, request.query_parameters), method: :put, data: { confirm: t("admin.actions.confirm") }, - class: "button hollow on-hover" %> + class: "button hollow on-hover-block" %> <% unless proposal.confirmed_hide? %> <%= link_to t("admin.actions.confirm_hide"), confirm_hide_admin_proposal_path(proposal, request.query_parameters), method: :put, - class: "button hollow warning on-hover" %> + class: "button hollow warning on-hover-block" %> <% end %> From 86fcd4fa76e8702b8966d3e033376f74107401e7 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 16 Jun 2016 15:45:33 +0200 Subject: [PATCH 062/126] removes blank space in setting's key --- db/seeds.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/seeds.rb b/db/seeds.rb index 4a4741a07..86847a64e 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -76,5 +76,5 @@ Setting['banner-img.banner-img-two'] = "Banner image 2" Setting['banner-img.banner-img-three'] = "Banner image 3" # Proposal notifications -Setting['proposal_notification_minimum_interval_in_days '] = 3 +Setting['proposal_notification_minimum_interval_in_days'] = 3 Setting['direct_message_max_per_day'] = 3 \ No newline at end of file From 8ee7d535ba74d099f5f0e804495cb1f64cc0cfa1 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 16 Jun 2016 15:54:19 +0200 Subject: [PATCH 063/126] generic message for max_per_day setting --- app/models/direct_message.rb | 2 +- config/locales/activerecord.en.yml | 2 +- config/locales/activerecord.es.yml | 2 +- spec/features/direct_messages_spec.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/direct_message.rb b/app/models/direct_message.rb index 14083f2c7..476194aea 100644 --- a/app/models/direct_message.rb +++ b/app/models/direct_message.rb @@ -15,7 +15,7 @@ class DirectMessage < ActiveRecord::Base max = Setting[:direct_message_max_per_day] if sender.direct_messages_sent.today.count >= max.to_i - errors.add(:title, I18n.t('activerecord.errors.models.direct_message.attributes.max_per_day.invalid', max: max)) + errors.add(:title, I18n.t('activerecord.errors.models.direct_message.attributes.max_per_day.invalid')) end end diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml index 9b48c1fc2..07791e53c 100644 --- a/config/locales/activerecord.en.yml +++ b/config/locales/activerecord.en.yml @@ -81,7 +81,7 @@ en: direct_message: attributes: max_per_day: - invalid: "You can only send a maximum of %{max} direct messages per day" + invalid: "You have reached the maximum number of private messages per day" proposal: attributes: tag_list: diff --git a/config/locales/activerecord.es.yml b/config/locales/activerecord.es.yml index f14022255..d5b7f0005 100644 --- a/config/locales/activerecord.es.yml +++ b/config/locales/activerecord.es.yml @@ -81,7 +81,7 @@ es: direct_message: attributes: max_per_day: - invalid: "Sólo puedes enviar %{max} mensajes directos por día" + invalid: "Has llegado al número máximo de mensajes privados por día" proposal: attributes: tag_list: diff --git a/spec/features/direct_messages_spec.rb b/spec/features/direct_messages_spec.rb index 8ec949e9a..3c822de5c 100644 --- a/spec/features/direct_messages_spec.rb +++ b/spec/features/direct_messages_spec.rb @@ -113,7 +113,7 @@ feature 'Direct messages' do fill_in 'direct_message_body', with: "How are you doing?" click_button "Send message" - expect(page).to have_content "You can only send a maximum of 3 direct messages per day" + expect(page).to have_content "You have reached the maximum number of private messages per day" expect(page).to_not have_content "You message has been sent successfully." end From d40af1e94c8a2fb7498192166d7ee819f61d2ba3 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 16 Jun 2016 16:05:09 +0200 Subject: [PATCH 064/126] do not display button to send message to myself --- app/views/users/show.html.erb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 8b4428a09..c264d336f 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -2,14 +2,16 @@
- <% if @user != current_user && @user.email_on_direct_message? %> - <%= link_to t("users.show.send_private_message"), - new_user_direct_message_path(@user), - class: "button hollow float-right" %> - <% else %> -
- <%= t("users.show.no_private_messages") %> -
+ <% if @user != current_user %> + <% if @user.email_on_direct_message? %> + <%= link_to t("users.show.send_private_message"), + new_user_direct_message_path(@user), + class: "button hollow float-right" %> + <% else %> +
+ <%= t("users.show.no_private_messages") %> +
+ <% end %> <% end %>

From 38fded40d8d4c4ac84ef1e1f4151003b4df4dc41 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Thu, 16 Jun 2016 16:22:48 +0200 Subject: [PATCH 065/126] Changes translations --- config/locales/es.yml | 4 ++-- config/locales/mailers.es.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/locales/es.yml b/config/locales/es.yml index a3922ef5f..620499ace 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -15,7 +15,7 @@ es: public_activity_label: Mostrar públicamente mi lista de actividades save_changes_submit: Guardar cambios subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web - email_on_direct_message_label: Recibir emails con mensajes directos + email_on_direct_message_label: Recibir emails con mensajes privados email_digest_label: Recibir resumen de notificaciones sobre propuestas title: Mi cuenta user_permission_debates: Participar en debates @@ -506,7 +506,7 @@ es: direct_messages: new: body_label: "Mensaje" - direct_messages_bloqued: "Este usuarios ha decidido no recibir mensajes directos" + direct_messages_bloqued: "Este usuario ha decidido no recibir mensajes privados" submit_button: "Enviar mensaje" title: Enviar mensaje privado a %{receiver} title_label: "Título" diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index bde81ec86..d90636c32 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -40,7 +40,7 @@ es: direct_message_for_receiver: subject: "Has recibido un nuevo mensaje privado" reply: Responder a %{sender} - unsubscribe: "Si no quieres recibir mensajes privados, puedes entrar en %{account} y desmarcar la opción 'Recibir emails con mensajes directos'." + unsubscribe: "Si no quieres recibir mensajes privados, puedes entrar en %{account} y desmarcar la opción 'Recibir emails con mensajes privados'." unsubscribe_account: Mi cuenta direct_message_for_sender: subject: "Has enviado un nuevo mensaje privado" From 1c4a572993da91b7276a45b1e69c0df78a12d3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Thu, 16 Jun 2016 16:58:05 +0200 Subject: [PATCH 066/126] removes deprecated roadmap "If you have a roadmap, you are locked in an old version of the future" - David Heinemeier Hansson --- README.md | 4 ---- README_ES.md | 4 ---- ROADMAP_ES.md | 26 -------------------------- 3 files changed, 34 deletions(-) delete mode 100644 ROADMAP_ES.md diff --git a/README.md b/README.md index ba1c6cf21..025ebaaf7 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,6 @@ This is the opensource code repository of the eParticipation website originally Development started on [2015 July 15th](https://github.com/consul/consul/commit/8db36308379accd44b5de4f680a54c41a0cc6fc6). Code was deployed to production on 2015 september 7th to [decide.madrid.es](https://decide.madrid.es). Since then new features are added often. You can take a look at a roadmap and future features in the [open issues list](https://github.com/consul/consul/issues). -## Roadmap - -See [ROADMAP_ES.md](ROADMAP_ES.md) - ## Tech stack The application backend is written in the [Ruby language](https://www.ruby-lang.org/) using the [Ruby on Rails](http://rubyonrails.org/) framework. diff --git a/README_ES.md b/README_ES.md index 455215abe..a15763604 100644 --- a/README_ES.md +++ b/README_ES.md @@ -16,10 +16,6 @@ Este es el repositorio de código abierto de la Aplicación de Participación Ci El desarrollo de esta aplicación comenzó el [15 de Julio de 2015](https://github.com/consul/consul/commit/8db36308379accd44b5de4f680a54c41a0cc6fc6) y el código fue puesto en producción el día 7 de Septiembre de 2015 en [decide.madrid.es](https://decide.madrid.es). Desde entonces se le añaden mejoras y funcionalidades constantemente. La evolución y futura lista de funcionalidades a implementar se pueden consultar en la lista de [tareas por hacer](https://github.com/consul/consul/issues). -## Hoja de ruta - -Ver fichero [ROADMAP_ES.md](ROADMAP_ES.md) - ## Tecnología El backend de esta aplicación se desarrolla con el lenguaje de programación [Ruby](https://www.ruby-lang.org/) sobre el *framework* [Ruby on Rails](http://rubyonrails.org/). diff --git a/ROADMAP_ES.md b/ROADMAP_ES.md deleted file mode 100644 index 9e53b53c8..000000000 --- a/ROADMAP_ES.md +++ /dev/null @@ -1,26 +0,0 @@ -## Hoja de ruta - -Las necesidades y líneas de desarrollo de Consul a corto plazo se actualizan continuamente, y son añadidas como Issues https://github.com/consul/consul/issues La hoja de ruta de desarrollo a medio plazo comprende lo siguiente: - -## Debates y propuestas - -Entre las mejoras a desarrollar destacamos las siguientes: -- Búsquedas avanzadas -- Notificaciones de usuarios -- Listas de correo informativas para los usuarios -- Clasificaciones temáticas y locales -- Mejora del sistema de etiquetado -- Sistema de identificación de propuestas similares -- Mejora de algoritmos de ordenación -- Ampliación de licencias de contenidos -- Añadido de idiomas disponibles -- Universalización del código, y facilitación de adaptación a diferentes sistemas locales -- Creación de sección de procesos participativos ad-hoc - -## Presupuestos participativos - -Este espacio permitirá que una cierta cantidad de dinero se distribuya por decisión ciudadana. Para ello permitirá: recibir propuestas para este fin; que dichas propuestas sean tasadas y evaluadas por un cierto perfil de usuarios mostrando dicho trabajo junto a las mismas; mostrar las propuestas de tal forma que los usuarios verificados puedan votar un conjunto de ellas acorde con la cantidad de dinero reservada. El mecanismo contemplará mecanismos de pre-selección y selección, además de categorizaciones geográficas o temáticas de las propuestas. - -## Legislación colaborativa - -Este módulo permitirá la participación ciudadana en todas las fases de un desarrollo legislativo. Desde la propuesta y selección de los redactores y expertos de la legislación, pasando por la fase de debate y propuesta asociada a la misma (que a su vez se dividirá en espacios de debate libre y mecanismos de pregunta-respuesta), hasta la redacción colaborativa y la revisión detallada del texto creado. El módulo permitirá activar independientemente las diferentes fases del proceso, de tal forma que su uso pueda extenderse mucho más allá del caso de la redacción colaborativa. From 0abc9c8376a2c6f07253e797edd3d80525ba80dd Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 16 Jun 2016 17:42:16 +0200 Subject: [PATCH 067/126] adds stats for direct messages and proposal notifications --- app/controllers/admin/stats_controller.rb | 9 +++++ .../admin/stats/direct_messages.html.erb | 27 ++++++++++++++ .../stats/proposal_notifications.html.erb | 35 +++++++++++++++++++ app/views/admin/stats/show.html.erb | 11 ++++++ config/locales/admin.es.yml | 9 +++++ config/routes.rb | 5 ++- 6 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 app/views/admin/stats/direct_messages.html.erb create mode 100644 app/views/admin/stats/proposal_notifications.html.erb diff --git a/app/controllers/admin/stats_controller.rb b/app/controllers/admin/stats_controller.rb index abfecdd7f..8cc5d712c 100644 --- a/app/controllers/admin/stats_controller.rb +++ b/app/controllers/admin/stats_controller.rb @@ -21,6 +21,15 @@ class Admin::StatsController < Admin::BaseController @user_ids_who_voted_proposals = ActsAsVotable::Vote.where(votable_type: 'Proposal').distinct.count(:voter_id) @user_ids_who_didnt_vote_proposals = @verified_users - @user_ids_who_voted_proposals @spending_proposals = SpendingProposal.count + end + def proposal_notifications + @proposal_notifications = ProposalNotification.all + @proposals_with_notifications = @proposal_notifications.pluck(:proposal_id).uniq + end + + def direct_messages + @direct_messages = DirectMessage.all + @users_who_have_sent_message = DirectMessage.pluck(:sender_id).uniq end end diff --git a/app/views/admin/stats/direct_messages.html.erb b/app/views/admin/stats/direct_messages.html.erb new file mode 100644 index 000000000..33c6ff517 --- /dev/null +++ b/app/views/admin/stats/direct_messages.html.erb @@ -0,0 +1,27 @@ +<%= render 'shared/back_link' %> + +

<%= t("admin.stats.direct_messages.title")%>

+ +
+
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+
\ No newline at end of file diff --git a/app/views/admin/stats/proposal_notifications.html.erb b/app/views/admin/stats/proposal_notifications.html.erb new file mode 100644 index 000000000..106be14cf --- /dev/null +++ b/app/views/admin/stats/proposal_notifications.html.erb @@ -0,0 +1,35 @@ +<%= render 'shared/back_link' %> + +

<%= t("admin.stats.proposal_notifications.title")%>

+ +
+
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ +
+ <% @proposal_notifications.each do |notification| %> +

<%= link_to notification.proposal.title, proposal_path(notification.proposal) %>

+

<%= notification.title %>

+

<%= notification.body %>

+ <% end %> +
diff --git a/app/views/admin/stats/show.html.erb b/app/views/admin/stats/show.html.erb index 9a9ecbfa8..66d4cbf6c 100644 --- a/app/views/admin/stats/show.html.erb +++ b/app/views/admin/stats/show.html.erb @@ -6,6 +6,17 @@

<%= t "admin.stats.show.stats_title" %>

+
+
+ <%= link_to t("admin.stats.show.direct_messages"), + direct_messages_admin_stats_path %> +
+
+ <%= link_to t("admin.stats.show.proposal_notifications"), + proposal_notifications_admin_stats_path %> +
+
+
diff --git a/app/views/admin/stats/proposal_notifications.html.erb b/app/views/admin/stats/proposal_notifications.html.erb index 106be14cf..10f620ff6 100644 --- a/app/views/admin/stats/proposal_notifications.html.erb +++ b/app/views/admin/stats/proposal_notifications.html.erb @@ -10,14 +10,18 @@
@@ -28,8 +32,10 @@
<% @proposal_notifications.each do |notification| %> -

<%= link_to notification.proposal.title, proposal_path(notification.proposal) %>

-

<%= notification.title %>

-

<%= notification.body %>

+
+

<%= link_to notification.proposal.title, proposal_path(notification.proposal) %>

+

<%= notification.title %>

+

<%= notification.body %>

+
<% end %>
diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index ec3542c2c..088fd1078 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -288,6 +288,15 @@ en: votes: Total votes spending_proposals_title: Spending Proposals visits_title: Visits + direct_messages: Direct messages + proposal_notifications: Proposal notifications + direct_messages: + title: Direct messages + users_who_have_sent_message: Users that have sent a private message + proposal_notifications: + title: Proposal notifications + total: Total + proposals_with_notifications: Proposals with notifications tags: create: Create Topic destroy: Destroy Topic diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 62778a194..b0b83f6ac 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -292,7 +292,7 @@ es: title: Mensajes directos users_who_have_sent_message: Usuarios que han enviado un mensaje privado proposal_notifications: - title: Mensajes directos + title: Notificaciones de propuestas total: Total proposals_with_notifications: Propuestas con notificaciones tags: diff --git a/spec/factories.rb b/spec/factories.rb index 4ead8ecac..209f45b28 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -327,8 +327,8 @@ FactoryGirl.define do end factory :proposal_notification do - title "Thank you for supporting my proposal" - body "Please let others know so we can make it happen" + sequence(:title) { |n| "Thank you for supporting my proposal #{n}" } + sequence(:body) { |n| "Please let others know so we can make it happen #{n}" } proposal end diff --git a/spec/features/admin/stats_spec.rb b/spec/features/admin/stats_spec.rb index 461f7ef32..7f343d1bc 100644 --- a/spec/features/admin/stats_spec.rb +++ b/spec/features/admin/stats_spec.rb @@ -70,4 +70,64 @@ feature 'Stats' do expect(page).to have_content "Level 2 User (1)" end + context "Proposal notifications" do + + scenario "Summary stats" do + proposal = create(:proposal) + + create(:proposal_notification, proposal: proposal) + create(:proposal_notification, proposal: proposal) + create(:proposal_notification) + + visit admin_stats_path + click_link "Proposal notifications" + + within("#proposal_notifications_count") do + expect(page).to have_content "3" + end + + within("#proposals_with_notifications_count") do + expect(page).to have_content "2" + end + end + + scenario "Index" do + 3.times { create(:proposal_notification) } + + visit admin_stats_path + click_link "Proposal notifications" + + expect(page).to have_css(".proposal_notification", count: 3) + + ProposalNotification.all.each do |proposal_notification| + expect(page).to have_content proposal_notification.title + expect(page).to have_content proposal_notification.body + end + end + + end + + context "Direct messages" do + + scenario "Summary stats" do + sender = create(:user, :level_two) + + create(:direct_message, sender: sender) + create(:direct_message, sender: sender) + create(:direct_message) + + visit admin_stats_path + click_link "Direct messages" + + within("#direct_messages_count") do + expect(page).to have_content "3" + end + + within("#users_who_have_sent_message_count") do + expect(page).to have_content "2" + end + end + + end + end From 352f3fa2f9ff21b5a17d9a1cda26505e3e100e4f Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Thu, 16 Jun 2016 18:07:13 +0200 Subject: [PATCH 069/126] Resolves conflicts and improves styles for stats --- .../admin/stats/direct_messages.html.erb | 38 +++++------- .../stats/proposal_notifications.html.erb | 60 +++++++++---------- app/views/admin/stats/show.html.erb | 21 ++++--- 3 files changed, 52 insertions(+), 67 deletions(-) diff --git a/app/views/admin/stats/direct_messages.html.erb b/app/views/admin/stats/direct_messages.html.erb index 17532f00f..432152db5 100644 --- a/app/views/admin/stats/direct_messages.html.erb +++ b/app/views/admin/stats/direct_messages.html.erb @@ -2,30 +2,20 @@

<%= t("admin.stats.direct_messages.title")%>

-
-
-
- -
-
- -
- -
- -
-
+
+
+
+ +
+
+

+ <%= t("admin.stats.direct_messages.users_who_have_sent_message") %>
+ <%= @users_who_have_sent_message.count %> +

-
\ No newline at end of file +
diff --git a/app/views/admin/stats/proposal_notifications.html.erb b/app/views/admin/stats/proposal_notifications.html.erb index 10f620ff6..75b1c04f5 100644 --- a/app/views/admin/stats/proposal_notifications.html.erb +++ b/app/views/admin/stats/proposal_notifications.html.erb @@ -2,40 +2,36 @@

<%= t("admin.stats.proposal_notifications.title")%>

-
-
-
- -
-
- -
- -
- -
-
+
+
+
+ +
+
+

+ <%= t("admin.stats.proposal_notifications.proposals_with_notifications") %>
+ <%= @proposals_with_notifications.count %> +

-
- <% @proposal_notifications.each do |notification| %> -
-

<%= link_to notification.proposal.title, proposal_path(notification.proposal) %>

-

<%= notification.title %>

-

<%= notification.body %>

-
- <% end %> -
+ + + <% @proposal_notifications.each do |notification| %> + + + + <% end %> + +
+

+ <%= notification.title %> + <%= link_to notification.proposal.title, proposal_path(notification.proposal) %> +

+

<%= notification.body %>

+
diff --git a/app/views/admin/stats/show.html.erb b/app/views/admin/stats/show.html.erb index 66d4cbf6c..ef17536c3 100644 --- a/app/views/admin/stats/show.html.erb +++ b/app/views/admin/stats/show.html.erb @@ -1,22 +1,21 @@ <% content_for :head do %> <%= javascript_include_tag "stat_graphs", 'data-turbolinks-track' => true %> <% end %> -
+
-

<%= t "admin.stats.show.stats_title" %>

+

<%= t "admin.stats.show.stats_title" %>

+ +
+ <%= link_to t("admin.stats.show.direct_messages"), + direct_messages_admin_stats_path, class: "button hollow" %> + <%= link_to t("admin.stats.show.proposal_notifications"), + proposal_notifications_admin_stats_path, class: "button hollow" %> -
-
- <%= link_to t("admin.stats.show.direct_messages"), - direct_messages_admin_stats_path %> -
-
- <%= link_to t("admin.stats.show.proposal_notifications"), - proposal_notifications_admin_stats_path %> -
+
+

<%= t("admin.stats.direct_messages.users_who_have_sent_message") %>
- <%= @users_who_have_sent_message.count %> + <%= @users_who_have_sent_message %>

diff --git a/app/views/admin/stats/proposal_notifications.html.erb b/app/views/admin/stats/proposal_notifications.html.erb index 75b1c04f5..79e19a247 100644 --- a/app/views/admin/stats/proposal_notifications.html.erb +++ b/app/views/admin/stats/proposal_notifications.html.erb @@ -7,14 +7,14 @@

<%= t("admin.stats.proposal_notifications.proposals_with_notifications") %>
- <%= @proposals_with_notifications.count %> + <%= @proposals_with_notifications %>

From 3c2098eb1400deef8bd4eb729fc710517d33448c Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 16 Jun 2016 18:40:05 +0200 Subject: [PATCH 073/126] improves legibility of counts --- app/controllers/admin/stats_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/stats_controller.rb b/app/controllers/admin/stats_controller.rb index 5543a2d1f..7e5b902e9 100644 --- a/app/controllers/admin/stats_controller.rb +++ b/app/controllers/admin/stats_controller.rb @@ -25,11 +25,11 @@ class Admin::StatsController < Admin::BaseController def proposal_notifications @proposal_notifications = ProposalNotification.all - @proposals_with_notifications = @proposal_notifications.distinct.count(:proposal_id) + @proposals_with_notifications = @proposal_notifications.select(:proposal_id).distinct.count end def direct_messages @direct_messages = DirectMessage.count - @users_who_have_sent_message = DirectMessage.distinct.count(:sender_id) + @users_who_have_sent_message = DirectMessage.select(:sender_id).distinct.count end end From 74282bb0d7981e4099b8ddc651f21ad19ece68f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Fri, 17 Jun 2016 11:58:53 +0200 Subject: [PATCH 074/126] updates ruby version to 2.3.1 --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 276cbf9e2..2bf1c1ccf 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.0 +2.3.1 From 18354587ab371f199f023eff63837f52fef61e49 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 17 Jun 2016 15:47:23 +0200 Subject: [PATCH 075/126] force travis restart --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 2bf1c1ccf..a6254504e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.1 +2.3.1 \ No newline at end of file From 3299b595aa888804b0027b498d57830868c32a30 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 20 Jun 2016 16:28:56 +0200 Subject: [PATCH 076/126] Adds info text on proposal notification digest --- app/views/mailer/proposal_notification_digest.html.erb | 6 +++++- config/locales/mailers.en.yml | 1 + config/locales/mailers.es.yml | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index 0b839150f..1a0ef1468 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -3,10 +3,14 @@ -

+

<%= t('mailers.proposal_notification_digest.title', org_name: Setting['org_name']) %>

+

+ <%= t('mailers.proposal_notification_digest.info', + org_name: Setting['org_name']) %> +

diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index c2e2b5d85..100955cab 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -32,6 +32,7 @@ en: subject: "Your investment project '%{code}' has been marked as unfeasible" unfeasible_html: "From the Madrid City Council we want to thank you for your participation in the participatory budgets of the city of Madrid. We regret to inform you that your proposal '%{title}' will be excluded from this participatory process for the following reason:" proposal_notification_digest: + info: "Here are the new notifications that have published the authors of the proposals that your are supporting in %{org_name}." title: "Proposal notifications in %{org_name}" share: Share proposal comment: Comment proposal diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index d90636c32..2a7a85013 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -32,6 +32,7 @@ es: subject: "Tu propuesta de inversión '%{code}' ha sido marcada como inviable" unfeasible_html: "Desde el Ayuntamiento de Madrid queremos agradecer tu participación en los Presupuestos Participativos de la ciudad de Madrid. Lamentamos informarte de que tu propuesta '%{title}' quedará excluida de este proceso participativo por el siguiente motivo:" proposal_notification_digest: + info: "A continuación te mostramos las nuevas notificaciones que han publicado los autores de las propuestas que estás apoyando en %{org_name}." title: "Notificaciones de propuestas en %{org_name}" share: Compartir propuesta comment: Comentar propuesta From ecd9d514afc13b8c339497f9c495141d7bea516c Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 20 Jun 2016 16:33:08 +0200 Subject: [PATCH 077/126] Improves translation --- config/locales/mailers.en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 100955cab..17e3f6cf8 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -32,7 +32,7 @@ en: subject: "Your investment project '%{code}' has been marked as unfeasible" unfeasible_html: "From the Madrid City Council we want to thank you for your participation in the participatory budgets of the city of Madrid. We regret to inform you that your proposal '%{title}' will be excluded from this participatory process for the following reason:" proposal_notification_digest: - info: "Here are the new notifications that have published the authors of the proposals that your are supporting in %{org_name}." + info: "Here are the new notifications that have been published by authors of the proposals that you have supported in %{org_name}." title: "Proposal notifications in %{org_name}" share: Share proposal comment: Comment proposal From 98040e191ef04721eea038f838596c5f342bee2a Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 17 Jun 2016 19:40:30 +0200 Subject: [PATCH 078/126] fixes conflicts with fork --- app/controllers/account_controller.rb | 2 +- app/views/account/show.html.erb | 11 +++++++++++ config/locales/en.yml | 1 + config/locales/es.yml | 1 + db/migrate/20160617172616_add_badge_to_users.rb | 5 +++++ db/schema.rb | 3 ++- spec/features/account_spec.rb | 2 ++ spec/models/user_spec.rb | 6 ++++++ 8 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20160617172616_add_badge_to_users.rb diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 9212eb4fa..c3d814b38 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -25,7 +25,7 @@ class AccountController < ApplicationController if @account.organization? params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, :newsletter, organization_attributes: [:name, :responsible_name]) else - params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_direct_message, :email_digest, :newsletter) + params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_direct_message, :email_digest, :newsletter, :official_position_badge) end end diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index 98987626d..deaa4c889 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -87,6 +87,17 @@ <% end %>
+
+ <%= f.label :official_position_badge do %> + <%= f.check_box :official_position_badge, + title: t('account.show.official_position_badge_label'), + label: false %> + + <%= t("account.show.official_position_badge_label") %> + + <% end %> +
+ <%= f.submit t("account.show.save_changes_submit"), class: "button" %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index b16f1092a..608e0efab 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -17,6 +17,7 @@ en: subscription_to_website_newsletter_label: Receive by email website relevant information email_on_direct_message_label: Receive emails about direct messages email_digest_label: Receive a summary of proposal notifications + official_position_badge_label: Show official position badge title: My account user_permission_debates: Participate on debates user_permission_info: With your account you can... diff --git a/config/locales/es.yml b/config/locales/es.yml index 620499ace..9678ed5c1 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -17,6 +17,7 @@ es: subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web email_on_direct_message_label: Recibir emails con mensajes privados email_digest_label: Recibir resumen de notificaciones sobre propuestas + official_position_badge_label: Mostrar etiqueta de tipo de usuario title: Mi cuenta user_permission_debates: Participar en debates user_permission_info: Con tu cuenta ya puedes... diff --git a/db/migrate/20160617172616_add_badge_to_users.rb b/db/migrate/20160617172616_add_badge_to_users.rb new file mode 100644 index 000000000..2f634aa49 --- /dev/null +++ b/db/migrate/20160617172616_add_badge_to_users.rb @@ -0,0 +1,5 @@ +class AddBadgeToUsers < ActiveRecord::Migration + def change + add_column :users, :official_position_badge, :boolean, default: false + end +end diff --git a/db/schema.rb b/db/schema.rb index f5671b3a3..6932611e4 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: 20160614160949) do +ActiveRecord::Schema.define(version: 20160617172616) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -462,6 +462,7 @@ ActiveRecord::Schema.define(version: 20160614160949) do t.boolean "email_on_proposal_notification", default: true t.boolean "email_digest", default: true t.boolean "email_on_direct_message", default: true + t.boolean "official_position_badge", default: false end add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index 0d5da38b2..604872a58 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -37,6 +37,7 @@ feature 'Account' do check 'account_email_on_comment_reply' uncheck 'account_email_digest' uncheck 'account_email_on_direct_message' + check 'account_official_position_badge' click_button 'Save changes' expect(page).to have_content "Changes saved" @@ -48,6 +49,7 @@ feature 'Account' do expect(find("#account_email_on_comment_reply")).to be_checked expect(find("#account_email_digest")).to_not be_checked expect(find("#account_email_on_direct_message")).to_not be_checked + expect(find("#account_official_position_badge")).to be_checked end scenario 'Edit Organization' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 143053c77..41455eb1d 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -95,6 +95,12 @@ describe User do expect(subject.email_on_direct_message).to eq(true) end end + + describe 'official_position_badge' do + it 'should be false by default' do + expect(subject.official_position_badge).to eq(false) + end + end end describe "administrator?" do From 51d688897aba29b5993317c465a714723db7bf27 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 20 Jun 2016 21:07:32 +0200 Subject: [PATCH 079/126] displays badge option if official position is level 1 --- app/views/account/show.html.erb | 22 +++++++++++---------- spec/features/account_spec.rb | 35 +++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb index deaa4c889..247aa6024 100644 --- a/app/views/account/show.html.erb +++ b/app/views/account/show.html.erb @@ -87,16 +87,18 @@ <% end %>
-
- <%= f.label :official_position_badge do %> - <%= f.check_box :official_position_badge, - title: t('account.show.official_position_badge_label'), - label: false %> - - <%= t("account.show.official_position_badge_label") %> - - <% end %> -
+ <% if @account.official_level == 1 %> +
+ <%= f.label :official_position_badge do %> + <%= f.check_box :official_position_badge, + title: t('account.show.official_position_badge_label'), + label: false %> + + <%= t("account.show.official_position_badge_label") %> + + <% end %> +
+ <% end %> <%= f.submit t("account.show.save_changes_submit"), class: "button" %>
diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index 604872a58..d1c547185 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -37,7 +37,6 @@ feature 'Account' do check 'account_email_on_comment_reply' uncheck 'account_email_digest' uncheck 'account_email_on_direct_message' - check 'account_official_position_badge' click_button 'Save changes' expect(page).to have_content "Changes saved" @@ -49,7 +48,6 @@ feature 'Account' do expect(find("#account_email_on_comment_reply")).to be_checked expect(find("#account_email_digest")).to_not be_checked expect(find("#account_email_on_direct_message")).to_not be_checked - expect(find("#account_official_position_badge")).to be_checked end scenario 'Edit Organization' do @@ -71,6 +69,39 @@ feature 'Account' do expect(find("#account_email_on_comment_reply")).to be_checked end + context "Option to display badge for official position" do + + scenario "Users with official position of level 1" do + official_user = create(:user, official_level: 1) + + login_as(official_user) + visit account_path + + check 'account_official_position_badge' + click_button 'Save changes' + expect(page).to have_content "Changes saved" + + visit account_path + expect(find("#account_official_position_badge")).to be_checked + end + + scenario "Users with official position of level 2 and above" do + official_user2 = create(:user, official_level: 2) + official_user3 = create(:user, official_level: 3) + + login_as(official_user2) + visit account_path + + expect(page).to_not have_css '#account_official_position_badge' + + login_as(official_user3) + visit account_path + + expect(page).to_not have_css '#account_official_position_badge' + end + + end + scenario "Errors on edit" do visit account_path From 9e910a834baeddb31da012f78dde85dad542a655 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 20 Jun 2016 21:08:49 +0200 Subject: [PATCH 080/126] Displays badge for official positions --- app/models/user.rb | 15 ++- app/views/comments/_comment.html.erb | 2 +- app/views/debates/_debate.html.erb | 2 +- app/views/proposals/_proposal.html.erb | 2 +- app/views/proposals/summary.html.erb | 2 +- app/views/shared/_author_info.html.erb | 2 +- .../_spending_proposal.html.erb | 2 +- spec/features/official_positions_spec.rb | 97 +++++++++++++++++++ spec/models/user_spec.rb | 36 +++++++ spec/support/common_actions.rb | 14 +++ 10 files changed, 163 insertions(+), 11 deletions(-) create mode 100644 spec/features/official_positions_spec.rb diff --git a/app/models/user.rb b/app/models/user.rb index 7240c8929..4bb09c4a0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -133,6 +133,16 @@ class User < ActiveRecord::Base update official_position: nil, official_level: 0 end + def has_official_email? + domain = Setting['email_domain_for_officials'] + !email.blank? && ( (email.end_with? "@#{domain}") || (email.end_with? ".#{domain}") ) + end + + def display_official_position_badge? + return true if official_level > 1 + official_position_badge? && official_level == 1 + end + def block debates_ids = Debate.where(author_id: id).pluck(:id) comments_ids = Comment.where(user_id: id).pluck(:id) @@ -197,11 +207,6 @@ class User < ActiveRecord::Base !erased? end - def has_official_email? - domain = Setting['email_domain_for_officials'] - !email.blank? && ( (email.end_with? "@#{domain}") || (email.end_with? ".#{domain}") ) - end - def locale self[:locale] ||= I18n.default_locale.to_s end diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 0e88614c5..7b5ff4b7d 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -36,7 +36,7 @@ <%= t("comments.comment.user_deleted") %> <% else %> <%= link_to comment.user.name, user_path(comment.user) %> - <% if comment.user.official? %> + <% if comment.user.display_official_position_badge? %>  •  <%= comment.user.official_position %> diff --git a/app/views/debates/_debate.html.erb b/app/views/debates/_debate.html.erb index c9807041b..09d7d79c0 100644 --- a/app/views/debates/_debate.html.erb +++ b/app/views/debates/_debate.html.erb @@ -24,7 +24,7 @@ <%= debate.author.name %> - <% if debate.author.official? %> + <% if debate.author.display_official_position_badge? %>  •  <%= debate.author.official_position %> diff --git a/app/views/proposals/_proposal.html.erb b/app/views/proposals/_proposal.html.erb index e1e5d36a0..70c2b9c89 100644 --- a/app/views/proposals/_proposal.html.erb +++ b/app/views/proposals/_proposal.html.erb @@ -26,7 +26,7 @@ <%= proposal.author.name %> - <% if proposal.author.official? %> + <% if proposal.author.display_official_position_badge? %>  •  <%= proposal.author.official_position %> diff --git a/app/views/proposals/summary.html.erb b/app/views/proposals/summary.html.erb index 05ed7dac9..38c56c963 100644 --- a/app/views/proposals/summary.html.erb +++ b/app/views/proposals/summary.html.erb @@ -20,7 +20,7 @@ <%= t("proposals.show.author_deleted") %> <% else %> <%= proposal.author.name %> - <% if proposal.author.official? %> + <% if proposal.author.display_official_position_badge? %> <%= proposal.author.official_position %> diff --git a/app/views/shared/_author_info.html.erb b/app/views/shared/_author_info.html.erb index 1a0315341..d61317321 100644 --- a/app/views/shared/_author_info.html.erb +++ b/app/views/shared/_author_info.html.erb @@ -15,7 +15,7 @@ <% end %> - <% if resource.author.official? %> + <% if resource.author.display_official_position_badge? %>  •  <%= resource.author.official_position %> diff --git a/app/views/spending_proposals/_spending_proposal.html.erb b/app/views/spending_proposals/_spending_proposal.html.erb index af59def70..2854353bb 100644 --- a/app/views/spending_proposals/_spending_proposal.html.erb +++ b/app/views/spending_proposals/_spending_proposal.html.erb @@ -23,7 +23,7 @@ <%= spending_proposal.author.name %> - <% if spending_proposal.author.official? %> + <% if spending_proposal.author.display_official_position_badge? %>  •  <%= spending_proposal.author.official_position %> diff --git a/spec/features/official_positions_spec.rb b/spec/features/official_positions_spec.rb new file mode 100644 index 000000000..01f78370a --- /dev/null +++ b/spec/features/official_positions_spec.rb @@ -0,0 +1,97 @@ +require 'rails_helper' + +feature 'Official positions' do + + context "Badge" do + + background do + @user1 = create(:user, official_level: 1, official_position: "Employee", official_position_badge: true) + @user2 = create(:user, official_level: 0, official_position: "") + end + + scenario "Comments" do + proposal = create(:proposal) + comment1 = create(:comment, commentable: proposal, user: @user1) + comment2 = create(:comment, commentable: proposal, user: @user2) + + visit proposal_path(proposal) + + expect_badge_for("comment", comment1) + expect_no_badge_for("comment", comment2) + end + + context "Debates" do + + background do + @debate1 = create(:debate, author: @user1) + @debate2 = create(:debate, author: @user2) + end + + scenario "Index" do + visit debates_path + + expect_badge_for("debate", @debate1) + expect_no_badge_for("debate", @debate2) + end + + scenario "Show" do + visit debate_path(@debate1) + expect_badge_for("debate", @debate1) + + visit debate_path(@debate2) + expect_no_badge_for("debate", @debate2) + end + + end + + context "Proposals" do + + background do + @proposal1 = create(:proposal, author: @user1) + @proposal2 = create(:proposal, author: @user2) + + featured_proposals = 3.times { create(:proposal) } + end + + scenario "Index" do + visit proposals_path + + expect_badge_for("proposal", @proposal1) + expect_no_badge_for("proposal", @proposal2) + end + + scenario "Show" do + visit proposal_path(@proposal1) + expect_badge_for("proposal", @proposal1) + + visit proposal_path(@proposal2) + expect_no_badge_for("proposal", @proposal2) + end + + end + + context "Spending proposals" do + + background do + @spending_proposal1 = create(:spending_proposal, author: @user1) + @spending_proposal2 = create(:spending_proposal, author: @user2) + end + + scenario "Index" do + visit spending_proposals_path + + expect_badge_for("spending_proposal", @spending_proposal1) + expect_no_badge_for("spending_proposal", @spending_proposal2) + end + + scenario "Show" do + visit spending_proposal_path(@spending_proposal1) + expect_badge_for("spending_proposal", @spending_proposal1) + + visit spending_proposal_path(@spending_proposal2) + expect_no_badge_for("spending_proposal", @spending_proposal2) + end + + end + end +end \ No newline at end of file diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 41455eb1d..c56e7a115 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -289,6 +289,42 @@ describe User do end end + describe "official_position_badge" do + + describe "Users of level 1" do + + it "displays the badge if set in preferences" do + user = create(:user, official_level: 1, official_position_badge: true) + + expect(user.display_official_position_badge?).to eq true + end + + it "does not display the badge if set in preferences" do + user = create(:user, official_level: 1, official_position_badge: false) + + expect(user.display_official_position_badge?).to eq false + end + + end + + describe "Users higher than level 1" do + + it "displays the badge regardless of preferences" do + user1 = create(:user, official_level: 2, official_position_badge: false) + user2 = create(:user, official_level: 3, official_position_badge: false) + user3 = create(:user, official_level: 4, official_position_badge: false) + user4 = create(:user, official_level: 5, official_position_badge: false) + + expect(user1.display_official_position_badge?).to eq true + expect(user2.display_official_position_badge?).to eq true + expect(user3.display_official_position_badge?).to eq true + expect(user4.display_official_position_badge?).to eq true + end + + end + + end + describe "self.search" do it "find users by email" do user1 = create(:user, email: "larry@madrid.es") diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 80bdde907..ca5c7b64a 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -231,4 +231,18 @@ module CommonActions DirectMessage.last end + def expect_badge_for(resource_name, resource) + within("##{resource_name}_#{resource.id}") do + expect(page).to have_css ".label.round" + expect(page).to have_content "Employee" + end + end + + def expect_no_badge_for(resource_name, resource) + within("##{resource_name}_#{resource.id}") do + expect(page).to_not have_css ".label.round" + expect(page).to_not have_content "Employee" + end + end + end From 00dbbd0689f90e97ab65823ddb4783efe8ceebd2 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 20 Jun 2016 21:54:45 +0200 Subject: [PATCH 081/126] fixes specs (unauthenticated users can view spending proposal show) --- app/controllers/spending_proposals_controller.rb | 2 +- spec/features/spending_proposals_spec.rb | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/spending_proposals_controller.rb b/app/controllers/spending_proposals_controller.rb index 3f590f414..5f8b04717 100644 --- a/app/controllers/spending_proposals_controller.rb +++ b/app/controllers/spending_proposals_controller.rb @@ -1,7 +1,7 @@ class SpendingProposalsController < ApplicationController include FeatureFlags - before_action :authenticate_user!, except: [:index] + before_action :authenticate_user!, except: [:index, :show] before_action -> { flash.now[:notice] = flash[:notice].html_safe if flash[:html_safe] && flash[:notice] } load_and_authorize_resource diff --git a/spec/features/spending_proposals_spec.rb b/spec/features/spending_proposals_spec.rb index 8b52bd014..01220ab27 100644 --- a/spec/features/spending_proposals_spec.rb +++ b/spec/features/spending_proposals_spec.rb @@ -178,9 +178,6 @@ feature 'Spending proposals' do end scenario "Show" do - user = create(:user) - login_as(user) - spending_proposal = create(:spending_proposal, geozone: create(:geozone), association_name: 'People of the neighbourhood') From 1f7e86e206736125403dcfdb84ca3d110dbc4e81 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 20 Jun 2016 22:06:49 +0200 Subject: [PATCH 082/126] fixes specs --- app/views/admin/stats/proposal_notifications.html.erb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/admin/stats/proposal_notifications.html.erb b/app/views/admin/stats/proposal_notifications.html.erb index 79e19a247..51130424d 100644 --- a/app/views/admin/stats/proposal_notifications.html.erb +++ b/app/views/admin/stats/proposal_notifications.html.erb @@ -7,14 +7,18 @@

<%= t("admin.stats.proposal_notifications.proposals_with_notifications") %>
- <%= @proposals_with_notifications %> + + <%= @proposals_with_notifications %> +

From e01162bc7af49dbd0db5dbf3b0079e69703729b8 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 22 Jun 2016 11:17:27 +0200 Subject: [PATCH 083/126] Changes message for ie alert --- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 608e0efab..fb1138a44 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -161,7 +161,7 @@ en: application: chrome: Google Chrome firefox: Firefox - ie: We have detected that you are browsing with Internet Explorer. For an enhanced experience, we recommend using %{chrome} or %{firefox}. + ie: We have detected that you are browsing with Internet Explorer. For an enhanced experience, we recommend using %{firefox} or %{chrome}. ie_title: This website is not optimised for your browser footer: accessibility: Accessibility diff --git a/config/locales/es.yml b/config/locales/es.yml index 9678ed5c1..f4a74afbf 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -161,7 +161,7 @@ es: application: chrome: Google Chrome firefox: Firefox - ie: Hemos detectado que estás navegando desde Internet Explorer. Para una mejor experiencia te recomendamos utilizar %{chrome} o %{firefox}. + ie: Hemos detectado que estás navegando desde Internet Explorer. Para una mejor experiencia te recomendamos utilizar %{firefox} o %{chrome}. ie_title: Esta web no está optimizada para tu navegador footer: accessibility: Accesibilidad From 0972f5284aa34b2cdffd14dc498cb6880eef7c06 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Thu, 23 Jun 2016 13:56:57 +0200 Subject: [PATCH 084/126] Creates new scss file for IE styles --- app/assets/stylesheets/admin.scss | 5 - app/assets/stylesheets/ie.scss | 199 +++++++++++++++++++++++++ app/assets/stylesheets/layout.scss | 17 --- app/views/layouts/application.html.erb | 3 + config/initializers/assets.rb | 1 + 5 files changed, 203 insertions(+), 22 deletions(-) create mode 100644 app/assets/stylesheets/ie.scss diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index e99392fc1..cd8241fca 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -34,9 +34,6 @@ body.admin { } input[type="text"], textarea { - height: 48px\9; - line-height: 48px\9; - margin-bottom: 24px\9; width: 100%; } } @@ -163,8 +160,6 @@ body.admin { font-size: rem-calc(24); padding-right: rem-calc(12); padding-top: rem-calc(4); - padding-left: 12px\9 !important; - padding-right: 12px\9 !important; vertical-align: middle; } diff --git a/app/assets/stylesheets/ie.scss b/app/assets/stylesheets/ie.scss new file mode 100644 index 000000000..2c494747b --- /dev/null +++ b/app/assets/stylesheets/ie.scss @@ -0,0 +1,199 @@ +// Stylesheet for Internet Explorer +// +// Table of Contents +// 01. Global styles +// 02. Admin +// + +// 01. Global styles +// ----------------- + +*, *:before, *:after { + box-sizing: border-box !important; +} + +.show-for-medium-down, +.show-for-medium, +.show-for-small { + display: none !important; +} + +.show-for-large-up, +.hide-for-medium-down { + display: block !important; +} + +.column, .columns { + display: inline-block !important; + float: none !important; + box-sizing: border-box !important; +} + +.small-1, .row .small-1 { width: 7.33333%; } +.small-2, .row .small-2 { width: 15.66667%; } +.small-3, .row .small-3 { width: 24%; } +.small-4, .row .small-4 { width: 32.33333%; } +.small-5, .row .small-5 { width: 40.66667%; } +.small-6, .row .small-6 { width: 49%; } +.small-7, .row .small-7 { width: 57.33333%; } +.small-8, .row .small-8 { width: 65.66667%; } +.small-9, .row .small-9 { width: 74%; } +.small-10, .row .small-10 { width: 82.33333%; } +.small-11, .row .small-11 { width: 90.66667%; } +.small-12, .row .small-12 { width: 99%; } + +.medium-1, .row .medium-1 { width: 7.33333%; } +.medium-2, .row .medium-2 { width: 15.66667%; } +.medium-3, .row .medium-3 { width: 24%; } +.medium-4, .row .medium-4 { width: 32.33333%; } +.medium-5, .row .medium-5 { width: 40.66667%; } +.medium-6, .row .medium-6 { width: 49%; } +.medium-7, .row .medium-7 { width: 57.33333%; } +.medium-8, .row .medium-8 { width: 65.66667%; } +.medium-9, .row .medium-9 { width: 74%; } +.medium-10, .row .medium-10 { width: 82.33333%; } +.medium-11, .row .medium-11 { width: 90.66667%; } +.medium-12, .row .medium-12 { width: 99%; } + +.large-1, .row .large-1 { width: 7.33333%; } +.large-2, .row .large-2 { width: 15.66667%; } +.large-3, .row .large-3 { width: 24%; } +.large-4, .row .large-4 { width: 32.33333%; } +.large-5, .row .large-5 { width: 40.66667%; } +.large-6, .row .large-6 { width: 49%; } +.large-7, .row .large-7 { width: 57.33333%; } +.large-8, .row .large-8 { width: 65.66667%; } +.large-9, .row .large-9 { width: 74%; } +.large-10, .row .large-10 { width: 82.33333%; } +.large-11, .row .large-11 { width: 90.66667%; } +.large-12, .row .large-12 { width: 99%; } + +.row .small-offset-1 { margin-left: 7.33333%; } +.row .small-offset-2 { margin-left: 15.66667%; } +.row .small-offset-3 { margin-left: 24%; } +.row .small-offset-4 { margin-left: 32.33333%; } +.row .small-offset-5 { margin-left: 40.66667%; } +.row .small-offset-6 { margin-left: 49%; } +.row .small-offset-7 { margin-left: 57.33333%; } +.row .small-offset-8 { margin-left: 65.66667%; } +.row .small-offset-9 { margin-left: 74%; } +.row .small-offset-10 { margin-left: 82.33333%; } +.row .small-offset-11 { margin-left: 90.66667%; } +.row .small-offset-12 { margin-left: 99%; } + +.row .medium-offset-1 { margin-left: 7.33333%; } +.row .medium-offset-2 { margin-left: 15.66667%; } +.row .medium-offset-3 { margin-left: 24%; } +.row .medium-offset-4 { margin-left: 32.33333%; } +.row .medium-offset-5 { margin-left: 40.66667%; } +.row .medium-offset-6 { margin-left: 49%; } +.row .medium-offset-7 { margin-left: 57.33333%; } +.row .medium-offset-8 { margin-left: 65.66667%; } +.row .medium-offset-9 { margin-left: 74%; } +.row .medium-offset-10 { margin-left: 82.33333%; } +.row .medium-offset-11 { margin-left: 90.66667%; } +.row .medium-offset-12 { margin-left: 99%; } + +.row .large-offset-1 { margin-left: 7.33333%; } +.row .large-offset-2 { margin-left: 15.66667%; } +.row .large-offset-3 { margin-left: 24%; } +.row .large-offset-4 { margin-left: 32.33333%; } +.row .large-offset-5 { margin-left: 40.66667%; } +.row .large-offset-6 { margin-left: 49%; } +.row .large-offset-7 { margin-left: 57.33333%; } +.row .large-offset-8 { margin-left: 65.66667%; } +.row .large-offset-9 { margin-left: 74%; } +.row .large-offset-10 { margin-left: 82.33333%; } +.row .large-offset-11 { margin-left: 90.66667%; } +.row .large-offset-12 { margin-left: 99%; } + +.top-bar { + clear: both !important; + height: 100px !important; +} + +.locale, .external-links { + background: #002d50 !important; +} + +.locale { + float: left !important; +} + +.external-links { + color: white !important; + float: right !important; +} + +.top-bar-title, .top-bar-title a, .top-bar-title a { + display: inline-block !important; + float: none !important; +} + +.top-bar-title a { + line-height: 24px !important; + width: 100% !important; +} + +.proposal .supports { + display: inline-block !important; + margin: 0 !important; + position: inherit !important; + + &:after { + content: none !important; + } +} + +form { + + input, textarea { + height: 48px !important; + line-height: 48px !important; + margin-bottom: 24px !important; + width: 100% !important; + } + + input[type="checkbox"], + input[type="radio"] { + height: auto !important; + line-height: inherit !important; + width: auto !important; + } + + input[type="radio"] { + width: 18px !important; + } +} + +.subnavigation { + display: block; + height: 60px !important; + width: 100%; + + ul li a { + margin-left: 10px !important; + margin-right: 10px !important; + } +} + +.truncate { + background: none; +} + +// 02. Admin +// --------- + +body.admin form { + + input[type="text"], textarea { + height: 48px !important; + line-height: 48px !important; + margin-bottom: 24px !important; + } +} + +.admin-sidebar ul [class^="icon-"] { + padding-left: 12px !important; + padding-right: 12px !important; +} diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 9152955dc..0ec0c12eb 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -396,8 +396,6 @@ header { color: $text; display: block; font-weight: bold; - margin-left: 18px\9; - margin-right: 18px\9; width: auto; &:hover { @@ -671,24 +669,9 @@ form { font-weight: bold; } - input, textarea { - height: 48px\9; - line-height: 48px\9; - margin-bottom: 24px\9; - width: 100%\9; - } - - input[type="checkbox"], - input[type="radio"] { - height: auto\9; - line-height: inherit\9; - width: auto\9; - } - input[type="radio"] { height: $line-height !important; vertical-align: top; - width: 18px\9; + label { font-weight: normal; diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 269764328..35f8729c8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,6 +7,9 @@ <%=render "layouts/tracking_data"%> <%= content_for?(:title) ? yield(:title) : setting['org_name'] %> <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application", 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> <%= favicon_link_tag "favicon.ico" %> diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index a13ed5320..7764ae0ec 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -13,3 +13,4 @@ Rails.application.config.assets.precompile += %w( ckeditor/* ) Rails.application.config.assets.precompile += %w( ie_lt9.js ) Rails.application.config.assets.precompile += %w( stat_graphs.js ) Rails.application.config.assets.precompile += %w( print.css ) +Rails.application.config.assets.precompile += %w( ie.css ) From 73d3d0c8c30b745bd4ba701fdb772872b572ffe6 Mon Sep 17 00:00:00 2001 From: kikito Date: Thu, 23 Jun 2016 17:48:18 +0200 Subject: [PATCH 085/126] hides the retire proposal link for admins in User#show --- app/views/users/_proposals.html.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/users/_proposals.html.erb b/app/views/users/_proposals.html.erb index f50045635..3112dd572 100644 --- a/app/views/users/_proposals.html.erb +++ b/app/views/users/_proposals.html.erb @@ -12,9 +12,7 @@ <%= link_to t("users.proposals.send_notification"), new_proposal_notification_path(proposal_id: proposal.id), class: 'button hollow' %> - <% end %> - <% if author_or_admin? %> <% if proposal.retired? %> <%= t('users.proposals.retired') %> @@ -30,4 +28,4 @@ <% end %> -<%= paginate @proposals %> \ No newline at end of file +<%= paginate @proposals %> From 947b2bcb0d87375e2d06dfc214154d2cd9497086 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 27 Jun 2016 14:25:20 +0200 Subject: [PATCH 086/126] Adds user invites views on management --- .../management/user_invites_controller.rb | 9 +++++++++ app/views/management/_menu.html.erb | 11 +++++++---- app/views/management/user_invites/create.html.erb | 9 +++++++++ app/views/management/user_invites/new.html.erb | 12 ++++++++++++ config/locales/management.en.yml | 11 ++++++++++- config/locales/management.es.yml | 11 ++++++++++- config/routes.rb | 2 ++ 7 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 app/controllers/management/user_invites_controller.rb create mode 100644 app/views/management/user_invites/create.html.erb create mode 100644 app/views/management/user_invites/new.html.erb diff --git a/app/controllers/management/user_invites_controller.rb b/app/controllers/management/user_invites_controller.rb new file mode 100644 index 000000000..707759877 --- /dev/null +++ b/app/controllers/management/user_invites_controller.rb @@ -0,0 +1,9 @@ +class Management::UserInvitesController < Management::BaseController + + def new + end + + def create + end + +end diff --git a/app/views/management/_menu.html.erb b/app/views/management/_menu.html.erb index 00e3b0516..aa154212e 100644 --- a/app/views/management/_menu.html.erb +++ b/app/views/management/_menu.html.erb @@ -1,9 +1,5 @@
    -
  • - <%= link_to t("management.menu.title"), management_root_path %> -
  • -
  • > @@ -61,5 +57,12 @@ <%= t("management.menu.print_spending_proposals") %> <% end %>
  • + +
  • + <%= link_to new_management_user_invite_path do %> + + <%= t("management.menu.user_invites") %> + <% end %> +
diff --git a/app/views/management/user_invites/create.html.erb b/app/views/management/user_invites/create.html.erb new file mode 100644 index 000000000..def83ef15 --- /dev/null +++ b/app/views/management/user_invites/create.html.erb @@ -0,0 +1,9 @@ +
+ <%= render 'shared/back_link' %> + +

<%= t('management.user_invites.create.title') %>

+ +
+ <%= t('management.user_invites.create.success_html') %> +
+
diff --git a/app/views/management/user_invites/new.html.erb b/app/views/management/user_invites/new.html.erb new file mode 100644 index 000000000..2779648d2 --- /dev/null +++ b/app/views/management/user_invites/new.html.erb @@ -0,0 +1,12 @@ +
+

<%= t('management.user_invites.new.title') %>

+ +
+ +

<%= t('management.user_invites.new.info') %>

+ +
+ +
+
+
diff --git a/config/locales/management.en.yml b/config/locales/management.en.yml index 74a58ac26..8060ac2c5 100644 --- a/config/locales/management.en.yml +++ b/config/locales/management.en.yml @@ -49,9 +49,9 @@ en: create_spending_proposal: Create spending proposal print_spending_proposals: Print spending proposals support_spending_proposals: Support spending proposals - title: Management users: Users edit_user_accounts: Edit user account + user_invites: User's invites permissions: create_proposals: Create proposals debates: Engage in debates @@ -97,3 +97,12 @@ en: erase_account_confirm: Are you sure you want to erase the account? This action can not be undone erase_warning: This action can not be undone. Please make sure you want to erase this account. erase_submit: Delete account + user_invites: + new: + label: Emails + info: "Enter the emails separated by commas (',')" + submit: Send invites + title: User's invites + create: + success_html: COUNT invitations have been sent. + title: User's invites \ No newline at end of file diff --git a/config/locales/management.es.yml b/config/locales/management.es.yml index c4545e675..749a7f449 100644 --- a/config/locales/management.es.yml +++ b/config/locales/management.es.yml @@ -49,9 +49,9 @@ es: create_spending_proposal: Crear propuesta de inversión print_spending_proposals: Imprimir propts. de inversión support_spending_proposals: Apoyar propts. de inversión - title: Gestión users: Usuarios edit_user_accounts: Editar cuenta de usuario + user_invites: Invitaciones para usuarios permissions: create_proposals: Crear nuevas propuestas debates: Participar en debates @@ -97,3 +97,12 @@ es: erase_account_confirm: ¿Seguro que quieres borrar a este usuario? Esta acción no se puede deshacer erase_warning: Esta acción no se puede deshacer. Por favor asegurese de que quiere eliminar esta cuenta. erase_submit: Borrar cuenta + user_invites: + new: + label: Emails + info: "Introduce los emails separados por ','" + submit: Enviar invitaciones + title: Invitaciones para usuarios + create: + success_html: Se han enviado COUNT invitaciones. + title: Invitaciones para usuarios \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ed2ee34e4..37497268c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -235,6 +235,8 @@ Rails.application.routes.draw do resources :email_verifications, only: [:new, :create] + resources :user_invites, only: [:new, :create] + resources :users, only: [:new, :create] do collection do delete :logout From a2a2960867a58cc755dfb0cf8457e3af4662edac Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 27 Jun 2016 15:37:45 +0200 Subject: [PATCH 087/126] Adds mailer template for user invites --- app/views/mailer/user_invites.html.erb | 22 ++++++++++++++++++++++ config/locales/mailers.en.yml | 8 +++++++- config/locales/mailers.es.yml | 8 +++++++- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 app/views/mailer/user_invites.html.erb diff --git a/app/views/mailer/user_invites.html.erb b/app/views/mailer/user_invites.html.erb new file mode 100644 index 000000000..3510a6c88 --- /dev/null +++ b/app/views/mailer/user_invites.html.erb @@ -0,0 +1,22 @@ + +

+ <%= t('mailers.user_invites.title', + org: Setting['org_name']) %> +

+ +

+ <%= t('mailers.user_invites.text') %> +

+ +

+ <%= link_to t('mailers.user_invites.button'), new_user_registration_path, style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #004A83; border-radius: 6px; color: #fff !important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block; margin-left: 12px;" %> +

+ +

+ <%= t('mailers.user_invites.ignore') %> +

+ +

+ <%= t('mailers.user_invites.thanks') %> +

+ diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 17e3f6cf8..e17ccc68b 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -45,4 +45,10 @@ en: unsubscribe_account: My account direct_message_for_sender: subject: "You have send a new private message" - title_html: "You have send a new private message to %{receiver} with the content:" \ No newline at end of file + title_html: "You have send a new private message to %{receiver} with the content:" + user_invites: + ignore: "Please, if you have not requested this invite ignore this email." + text: "To start participating complete your registration in the Open Government Portal of the Madrid City Council." + thanks: "Thank you very much." + title: "Complete your registration in %{org}" + button: Complete registration \ No newline at end of file diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 2a7a85013..48eade29f 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -45,4 +45,10 @@ es: unsubscribe_account: Mi cuenta direct_message_for_sender: subject: "Has enviado un nuevo mensaje privado" - title_html: "Has enviado un nuevo mensaje privado a %{receiver} con el siguiente contenido:" \ No newline at end of file + title_html: "Has enviado un nuevo mensaje privado a %{receiver} con el siguiente contenido:" + user_invites: + ignore: "Por favor, si no has solicitado esta invitación ignora este email." + text: "Para empezar a participar completa tu registro en el Portal de Gobierno Abierto del Ayuntamiento de Madrid." + thanks: "Muchas gracias." + title: "Completa tu registro en %{org}" + button: Completar registro \ No newline at end of file From 0bb948a0135e4583dd650b21a7c9cbf37492eff2 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 27 Jun 2016 16:01:03 +0200 Subject: [PATCH 088/126] Updates mailer texts --- app/views/mailer/user_invites.html.erb | 3 ++- config/locales/mailers.en.yml | 6 +++--- config/locales/mailers.es.yml | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/views/mailer/user_invites.html.erb b/app/views/mailer/user_invites.html.erb index 3510a6c88..6d02022d3 100644 --- a/app/views/mailer/user_invites.html.erb +++ b/app/views/mailer/user_invites.html.erb @@ -5,7 +5,8 @@

- <%= t('mailers.user_invites.text') %> + <%= t('mailers.user_invites.text', + org: Setting['org_name']) %>

diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index e17ccc68b..6a14540be 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -47,8 +47,8 @@ en: subject: "You have send a new private message" title_html: "You have send a new private message to %{receiver} with the content:" user_invites: - ignore: "Please, if you have not requested this invite ignore this email." - text: "To start participating complete your registration in the Open Government Portal of the Madrid City Council." + ignore: "If you have not requested this invitation don't worry, you can ignore this email." + text: "Thank you for applying to join %{org}! In seconds you can start to decide the city you want, just fill the form below:" thanks: "Thank you very much." - title: "Complete your registration in %{org}" + title: "Welcome to %{org}" button: Complete registration \ No newline at end of file diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 48eade29f..86d591134 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -47,8 +47,8 @@ es: subject: "Has enviado un nuevo mensaje privado" title_html: "Has enviado un nuevo mensaje privado a %{receiver} con el siguiente contenido:" user_invites: - ignore: "Por favor, si no has solicitado esta invitación ignora este email." - text: "Para empezar a participar completa tu registro en el Portal de Gobierno Abierto del Ayuntamiento de Madrid." + ignore: "Si no has solicitado esta invitación no te preocupes, puedes ignorar este correo." + text: "¡Gracias por solicitar unirte a %{org}! En unos segundos podrás empezar a decidir la ciudad que quieres, sólo tienes que rellenar el siguiente formulario:" thanks: "Muchas gracias." - title: "Completa tu registro en %{org}" + title: "Bienvenido a %{org}" button: Completar registro \ No newline at end of file From 745de9bb7775686d721956212c62936e07fd65e6 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 27 Jun 2016 23:31:47 +0200 Subject: [PATCH 089/126] sends invitation email to users --- .../management/user_invites_controller.rb | 4 ++++ app/mailers/mailer.rb | 4 ++++ ..._invites.html.erb => user_invite.html.erb} | 10 ++++----- .../management/user_invites/create.html.erb | 2 +- .../management/user_invites/new.html.erb | 6 ++--- config/locales/mailers.en.yml | 5 +++-- config/locales/mailers.es.yml | 5 +++-- config/locales/management.en.yml | 2 +- config/locales/management.es.yml | 2 +- spec/features/emails_spec.rb | 22 +++++++++++++++++++ spec/features/user_invites_spec.rb | 18 +++++++++++++++ 11 files changed, 65 insertions(+), 15 deletions(-) rename app/views/mailer/{user_invites.html.erb => user_invite.html.erb} (55%) create mode 100644 spec/features/user_invites_spec.rb diff --git a/app/controllers/management/user_invites_controller.rb b/app/controllers/management/user_invites_controller.rb index 707759877..b022e6a86 100644 --- a/app/controllers/management/user_invites_controller.rb +++ b/app/controllers/management/user_invites_controller.rb @@ -4,6 +4,10 @@ class Management::UserInvitesController < Management::BaseController end def create + @emails = params[:emails].split + @emails.each do |email| + Mailer.user_invite(email).deliver_later + end end end diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index d987e34cc..55229ab72 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -68,6 +68,10 @@ class Mailer < ApplicationMailer end end + def user_invite(email) + mail(to: email, subject: t('mailers.user_invite.subject', org_name: Setting["org_name"])) + end + private def with_user(user, &block) diff --git a/app/views/mailer/user_invites.html.erb b/app/views/mailer/user_invite.html.erb similarity index 55% rename from app/views/mailer/user_invites.html.erb rename to app/views/mailer/user_invite.html.erb index 6d02022d3..43b95626c 100644 --- a/app/views/mailer/user_invites.html.erb +++ b/app/views/mailer/user_invite.html.erb @@ -1,23 +1,23 @@

- <%= t('mailers.user_invites.title', + <%= t('mailers.user_invite.title', org: Setting['org_name']) %>

- <%= t('mailers.user_invites.text', + <%= t('mailers.user_invite.text', org: Setting['org_name']) %>

- <%= link_to t('mailers.user_invites.button'), new_user_registration_path, style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #004A83; border-radius: 6px; color: #fff !important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block; margin-left: 12px;" %> + <%= link_to t('mailers.user_invite.button'), new_user_registration_url, style: "font-family: 'Open Sans','Helvetica Neue',arial,sans-serif; background: #004A83; border-radius: 6px; color: #fff !important; font-weight: bold; margin: 0px; padding: 10px 15px; text-align: center; text-decoration: none; min-width: 160px; display: inline-block; margin-left: 12px;" %>

- <%= t('mailers.user_invites.ignore') %> + <%= t('mailers.user_invite.ignore') %>

- <%= t('mailers.user_invites.thanks') %> + <%= t('mailers.user_invite.thanks') %>

diff --git a/app/views/management/user_invites/create.html.erb b/app/views/management/user_invites/create.html.erb index def83ef15..3d573532f 100644 --- a/app/views/management/user_invites/create.html.erb +++ b/app/views/management/user_invites/create.html.erb @@ -4,6 +4,6 @@

<%= t('management.user_invites.create.title') %>

- <%= t('management.user_invites.create.success_html') %> + <%= t('management.user_invites.create.success_html', count: @emails.count) %>
diff --git a/app/views/management/user_invites/new.html.erb b/app/views/management/user_invites/new.html.erb index 2779648d2..a49a84538 100644 --- a/app/views/management/user_invites/new.html.erb +++ b/app/views/management/user_invites/new.html.erb @@ -1,12 +1,12 @@

<%= t('management.user_invites.new.title') %>

-
+ <%= form_tag management_user_invites_path do %>

<%= t('management.user_invites.new.info') %>

- + <%= text_area_tag "emails", nil, rows: 5, placeholder: t('management.user_invites.new.info') %>
-
+ <% end %>
diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 6a14540be..9362b3202 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -46,9 +46,10 @@ en: direct_message_for_sender: subject: "You have send a new private message" title_html: "You have send a new private message to %{receiver} with the content:" - user_invites: + user_invite: ignore: "If you have not requested this invitation don't worry, you can ignore this email." text: "Thank you for applying to join %{org}! In seconds you can start to decide the city you want, just fill the form below:" thanks: "Thank you very much." title: "Welcome to %{org}" - button: Complete registration \ No newline at end of file + button: Complete registration + subject: "Invitation to %{org_name}" \ No newline at end of file diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 86d591134..75523cf6c 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -46,9 +46,10 @@ es: direct_message_for_sender: subject: "Has enviado un nuevo mensaje privado" title_html: "Has enviado un nuevo mensaje privado a %{receiver} con el siguiente contenido:" - user_invites: + user_invite: ignore: "Si no has solicitado esta invitación no te preocupes, puedes ignorar este correo." text: "¡Gracias por solicitar unirte a %{org}! En unos segundos podrás empezar a decidir la ciudad que quieres, sólo tienes que rellenar el siguiente formulario:" thanks: "Muchas gracias." title: "Bienvenido a %{org}" - button: Completar registro \ No newline at end of file + button: Completar registro + subject: "Invitación a %{org_name}" \ No newline at end of file diff --git a/config/locales/management.en.yml b/config/locales/management.en.yml index 8060ac2c5..a0fffbde4 100644 --- a/config/locales/management.en.yml +++ b/config/locales/management.en.yml @@ -104,5 +104,5 @@ en: submit: Send invites title: User's invites create: - success_html: COUNT invitations have been sent. + success_html: %{count} invitations have been sent. title: User's invites \ No newline at end of file diff --git a/config/locales/management.es.yml b/config/locales/management.es.yml index 749a7f449..e5ee1c074 100644 --- a/config/locales/management.es.yml +++ b/config/locales/management.es.yml @@ -104,5 +104,5 @@ es: submit: Enviar invitaciones title: Invitaciones para usuarios create: - success_html: Se han enviado COUNT invitaciones. + success_html: Se han enviado %{count} invitaciones. title: Invitaciones para usuarios \ No newline at end of file diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index f793b5bb7..dcc90ca27 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -231,4 +231,26 @@ feature 'Emails' do end + context "User invites" do + + scenario "Send an invitation" do + login_as_manager + visit new_management_user_invite_path + + fill_in "emails", with: "john@example.com, ana@example.com, isable@example.com" + click_button "Send invites" + + expect(page).to have_content "3 invitations have been sent." + + expect(unread_emails_for("john@example.com").count).to eq 1 + expect(unread_emails_for("ana@example.com").count).to eq 1 + expect(unread_emails_for("isable@example.com").count).to eq 1 + + email = open_last_email + expect(email).to have_subject("Invitation to Consul") + expect(email).to have_body_text(/#{new_user_registration_path}/) + end + + end + end diff --git a/spec/features/user_invites_spec.rb b/spec/features/user_invites_spec.rb new file mode 100644 index 000000000..5627b0b7e --- /dev/null +++ b/spec/features/user_invites_spec.rb @@ -0,0 +1,18 @@ +require 'rails_helper' + +feature 'User invites' do + + background do + login_as_manager + end + + scenario "Send invitations" do + visit new_management_user_invite_path + + fill_in "emails", with: "john@example.com, ana@example.com, isable@example.com" + click_button "Send invites" + + expect(page).to have_content "3 invitations have been sent." + end + +end \ No newline at end of file From ad1720ba02ab7248f36c7924872e14c7cce1bcd2 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 27 Jun 2016 23:38:23 +0200 Subject: [PATCH 090/126] uses applications's default locale --- app/mailers/mailer.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 55229ab72..ad87359af 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -69,7 +69,9 @@ class Mailer < ApplicationMailer end def user_invite(email) - mail(to: email, subject: t('mailers.user_invite.subject', org_name: Setting["org_name"])) + I18n.with_locale(I18n.default_locale) do + mail(to: email, subject: t('mailers.user_invite.subject', org_name: Setting["org_name"])) + end end private From 9e55d4f7199bb0ebbc0057c15a553f0eff2fb8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Tue, 28 Jun 2016 21:28:21 +0200 Subject: [PATCH 091/126] updates nokogiri (security update) --- Gemfile.lock | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b3c908001..cda18fa77 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -231,7 +231,7 @@ GEM mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) - mini_portile2 (2.0.0) + mini_portile2 (2.1.0) minitest (5.9.0) multi_json (1.12.1) multi_xml (0.5.5) @@ -240,8 +240,9 @@ GEM net-ssh (>= 2.6.5) net-ssh (3.1.1) newrelic_rpm (3.15.2.317) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) + nokogiri (1.6.8) + mini_portile2 (~> 2.1.0) + pkg-config (~> 1.1.7) nori (2.6.0) oauth (0.5.0) oauth2 (1.0.0) @@ -279,6 +280,7 @@ GEM activerecord (>= 3.1) activesupport (>= 3.1) arel + pkg-config (1.1.7) poltergeist (1.9.0) capybara (~> 2.1) cliver (~> 0.3.1) @@ -505,4 +507,4 @@ DEPENDENCIES whenever BUNDLED WITH - 1.12.4 + 1.12.5 From 47a6480652c59631c713dba13d39540bb49c4135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Tue, 28 Jun 2016 21:30:22 +0200 Subject: [PATCH 092/126] updates monitoring dependencies --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 50b9e37e9..31743146f 100644 --- a/Gemfile +++ b/Gemfile @@ -48,7 +48,7 @@ gem 'rollbar', '~> 2.11.0' gem 'delayed_job_active_record', '~> 4.1.0' gem 'daemons' gem 'devise-async' -gem 'newrelic_rpm', '~> 3.14' +gem 'newrelic_rpm', '~> 3.16' gem 'whenever', require: false gem 'pg_search' diff --git a/Gemfile.lock b/Gemfile.lock index cda18fa77..b420e7327 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -239,7 +239,7 @@ GEM net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (3.1.1) - newrelic_rpm (3.15.2.317) + newrelic_rpm (3.16.0.318) nokogiri (1.6.8) mini_portile2 (~> 2.1.0) pkg-config (~> 1.1.7) @@ -327,7 +327,7 @@ GEM responders (2.2.0) railties (>= 4.2.0, < 5.1) rinku (2.0.0) - rollbar (2.11.3) + rollbar (2.11.5) multi_json rspec (3.4.0) rspec-core (~> 3.4.0) @@ -477,7 +477,7 @@ DEPENDENCIES kaminari launchy letter_opener_web (~> 1.3.0) - newrelic_rpm (~> 3.14) + newrelic_rpm (~> 3.16) omniauth omniauth-facebook (~> 3.0.0) omniauth-google-oauth2 (~> 0.4.0) From 96630f88f26a08ad244b5519d0f093ae6e76bf84 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 29 Jun 2016 21:46:03 +0200 Subject: [PATCH 093/126] takes into account emails separated by commas without spaces --- app/controllers/management/user_invites_controller.rb | 2 +- spec/features/emails_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/management/user_invites_controller.rb b/app/controllers/management/user_invites_controller.rb index b022e6a86..cbe3d1914 100644 --- a/app/controllers/management/user_invites_controller.rb +++ b/app/controllers/management/user_invites_controller.rb @@ -4,7 +4,7 @@ class Management::UserInvitesController < Management::BaseController end def create - @emails = params[:emails].split + @emails = params[:emails].split(",").map(&:strip) @emails.each do |email| Mailer.user_invite(email).deliver_later end diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index dcc90ca27..ac1249fd6 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -237,7 +237,7 @@ feature 'Emails' do login_as_manager visit new_management_user_invite_path - fill_in "emails", with: "john@example.com, ana@example.com, isable@example.com" + fill_in "emails", with: " john@example.com, ana@example.com,isable@example.com " click_button "Send invites" expect(page).to have_content "3 invitations have been sent." From 22e1b533bc2dd5a376e1168bec9ea2d691e2e866 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 4 Jul 2016 18:06:51 +0200 Subject: [PATCH 094/126] Removes Madrid from translations --- config/locales/devise.en.yml | 4 +-- config/locales/devise.es.yml | 4 +-- config/locales/devise_views.en.yml | 2 +- config/locales/devise_views.es.yml | 2 +- config/locales/en.yml | 21 ++++++------ config/locales/es.yml | 21 ++++++------ config/locales/mailers.en.yml | 4 +-- config/locales/mailers.es.yml | 4 +-- config/locales/management.en.yml | 7 ++-- config/locales/management.es.yml | 9 +++--- config/locales/pages.en.yml | 16 ++++----- config/locales/pages.es.yml | 16 ++++----- config/locales/verification.en.yml | 12 +++---- config/locales/verification.es.yml | 12 +++---- doc/locales/fr.yaml | 52 ++++++------------------------ doc/locales/pt-br.yaml | 48 +++++---------------------- 16 files changed, 83 insertions(+), 151 deletions(-) diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index a7504ff3d..30fb488ce 100755 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -35,8 +35,8 @@ en: registrations: destroyed: "Goodbye! Your account has been cancelled. We hope to see you again soon. In accordance with your request, personal data registered as - a user of the site decide.madrid.es and form part of the file 'Gestión de procesos participativos' under the responsibility of the - Dirección General de Participación Ciudadana, they have been canceled under the terms of the provisions of Article 16 of the + a user of the site and form part of the file 'File' under the responsibility of the + 'Responsible', they have been canceled under the terms of the provisions of Article 16 of the Ley Orgánica 15/1999 de Protección de Datos de Carácter Personal and Article 31 of its Reglamento de desarrollo (RD 1720/2007)." signed_up: "Welcome! You have been authenticated." signed_up_but_inactive: "Your registration was successful, but you could not be signed in because your account has not been activated." diff --git a/config/locales/devise.es.yml b/config/locales/devise.es.yml index 9e5ad1f36..1a9c3a3b8 100644 --- a/config/locales/devise.es.yml +++ b/config/locales/devise.es.yml @@ -33,8 +33,8 @@ es: registrations: destroyed: "¡Adiós! Tu cuenta ha sido cancelada. Esperamos volver a verte pronto. Le informamos que de conformidad con su petición, - sus datos personales registrados como usuario de la Web decide.madrid.es y que forman parte del fichero 'Gestión de procesos participativos' - cuyo responsable es la Dirección General de Participación Ciudadana, han sido cancelados en los términos de lo previsto en el artículo 16 de la + sus datos personales registrados como usuario de la Web y que forman parte del fichero 'Fichero' + cuyo responsable es 'Responsable', han sido cancelados en los términos de lo previsto en el artículo 16 de la Ley Orgánica 15/1999 de Protección de Datos de Carácter Personal y del artículo 31 de su Reglamento de desarrollo (RD 1720/2007)." signed_up: "¡Bienvenido! Has sido identificado." signed_up_but_inactive: "Te has registrado correctamente, pero no has podido iniciar sesión porque tu cuenta no ha sido activada." diff --git a/config/locales/devise_views.en.yml b/config/locales/devise_views.en.yml index 8901e989d..bcd1f1a77 100755 --- a/config/locales/devise_views.en.yml +++ b/config/locales/devise_views.en.yml @@ -17,7 +17,7 @@ en: confirmation_instructions: confirm_link: Confirm my account text: 'You can confirm your email account at the following link:' - title: Welcome to the Open Government Portal of the Madrid City Council + title: Welcome to the Open Government Portal welcome: Welcome reset_password_instructions: change_link: Change my password diff --git a/config/locales/devise_views.es.yml b/config/locales/devise_views.es.yml index 97d618643..be8aff97b 100644 --- a/config/locales/devise_views.es.yml +++ b/config/locales/devise_views.es.yml @@ -17,7 +17,7 @@ es: confirmation_instructions: confirm_link: Confirmar mi cuenta text: 'Puedes confirmar tu cuenta de correo electrónico en el siguiente enlace:' - title: Te damos la bienvenida al Portal de Gobierno Abierto del Ayuntamiento de Madrid + title: Te damos la bienvenida al Portal de Gobierno Abierto welcome: Bienvenido/a reset_password_instructions: change_link: Cambiar mi contraseña diff --git a/config/locales/en.yml b/config/locales/en.yml index fb1138a44..adc9b275a 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -25,7 +25,7 @@ en: user_permission_support_proposal: Support proposals user_permission_title: Participation user_permission_verify: To perform all the actions verify your account. - user_permission_verify_info: "* Only for users on Madrid City Census." + user_permission_verify_info: "* Only for users on Census." user_permission_votes: Participate on final voting username_label: Username verified_account: Account verified @@ -169,30 +169,29 @@ en: consul: Consul application consul_url: https://github.com/consul/consul contact_us: For technical assistance enters - copyright: Ayuntamiento de Madrid, %{year} - description: This portal uses the %{consul} which is %{open_source}. From Madrid out into the world. + copyright: Consul, %{year} + description: This portal uses the %{consul} which is %{open_source}. faq: technical assistance more_info: More information open_data_text: Every detail about the City Council is yours to access. open_data_title: Open data open_source: open-source software open_source_url: http://www.gnu.org/licenses/agpl-3.0.html - participation_text: Decide how to shape the Madrid you want to live in. + participation_text: Decide how to shape the city you want to live in. participation_title: Participation privacy: Privacy Policy - transparency_text: Find out anything about the Madrid City Council. + transparency_text: Find out anything about the city. transparency_title: Transparency - transparency_url: https://transparencia.madrid.es + transparency_url: https://yourtransparencysite.com header: administration: Administration debates: Debates external_link_blog: Blog external_link_opendata: Open data - external_link_opendata_url: http://datos.madrid.es external_link_transparency: Transparency - external_link_transparency_url: https://transparencia.madrid.es + external_link_transparency_url: https://yourtransparencysite.com locale: 'Language:' - logo: Madrid + logo: Consul management: Management moderation: Moderation valuation: Valuation @@ -204,7 +203,7 @@ en: other: You have %{count} new notifications no_notifications: You don't have new notifications open: open - open_city_slogan_html: There are cities that are governed directly by their inhabitants, who discuss the topics they are concerned about, propose ideas to improve their lives and decide among themselves which ones will be carried out. Madrid is already one of these cities. + open_city_slogan_html: There are cities that are governed directly by their inhabitants, who discuss the topics they are concerned about, propose ideas to improve their lives and decide 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 @@ -593,7 +592,7 @@ en: user_permission_proposal: Create new proposals user_permission_support_proposal: Support proposals* user_permission_verify: To perform all the actions verify your account. - user_permission_verify_info: "* Only for users on Madrid Census." + user_permission_verify_info: "* Only for users on Census." user_permission_verify_my_account: Verify my account user_permission_votes: Participate on final voting omniauth: diff --git a/config/locales/es.yml b/config/locales/es.yml index f4a74afbf..9a586e96a 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -25,7 +25,7 @@ es: user_permission_support_proposal: Apoyar propuestas* user_permission_title: Participación user_permission_verify: Para poder realizar todas las acciones verifica tu cuenta. - user_permission_verify_info: "* Sólo usuarios empadronados en el municipio de Madrid." + user_permission_verify_info: "* Sólo usuarios empadronados." user_permission_votes: Participar en las votaciones finales* username_label: Nombre de usuario verified_account: Cuenta verificada @@ -169,30 +169,29 @@ es: consul: aplicación Consul consul_url: https://github.com/consul/consul contact_us: Para asistencia técnica entra en - copyright: Ayuntamiento de Madrid, %{year} - description: Este portal usa la %{consul} que es %{open_source}. De Madrid, para el mundo entero. + copyright: Consul, %{year} + description: Este portal usa la %{consul} que es %{open_source}. faq: Asistencia técnica more_info: Más información open_data_text: Todos los datos del Ayuntamiento son tuyos. open_data_title: Datos Abiertos open_source: software libre open_source_url: http://www.gnu.org/licenses/agpl-3.0.html - participation_text: Decide cómo debe ser la ciudad de Madrid que quieres. + participation_text: Decide cómo debe ser la ciudad que quieres. participation_title: Participación privacy: Política de privacidad - transparency_text: Obtén cualquier información sobre el Ayuntamiento de Madrid. + transparency_text: Obtén cualquier información sobre la ciudad. transparency_title: Transparencia - transparency_url: https://transparencia.madrid.es + transparency_url: https://yourtransparencysite.com header: administration: Administrar debates: Debates external_link_blog: Blog external_link_opendata: Datos abiertos - external_link_opendata_url: http://datos.madrid.es external_link_transparency: Transparencia - external_link_transparency_url: https://transparencia.madrid.es + external_link_transparency_url: https://yourtransparencysite.com locale: 'Idioma:' - logo: Madrid + logo: Consul management: Gestión moderation: Moderar valuation: Evaluación @@ -204,7 +203,7 @@ es: other: Tienes %{count} notificaciones nuevas no_notifications: No tienes notificaciones nuevas open: abierto - open_city_slogan_html: 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_slogan_html: 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. open_city_title: La ciudad que quieres será la ciudad que quieras. open_data: Datos abiertos open_gov: Gobierno %{open} @@ -593,7 +592,7 @@ es: user_permission_proposal: Crear nuevas propuestas user_permission_support_proposal: Apoyar propuestas* user_permission_verify: Para poder realizar todas las acciones, verifica tu cuenta. - user_permission_verify_info: "* Sólo usuarios empadronados en el municipio de Madrid." + user_permission_verify_info: "* Sólo usuarios empadronados." user_permission_verify_my_account: Verificar mi cuenta user_permission_votes: Participar en las votaciones finales* omniauth: diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 9362b3202..f4cdaf563 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -12,7 +12,7 @@ en: email_verification: click_here_to_verify: this link instructions_2_html: This email will verify your account with %{document_type} %{document_number}. If these don't belong to you, please don't click on the previous link and ignore this email. - instructions_html: To complete the verification of your user account in the Open Government Portal of the Madrid City Council, you must click %{verification_link}. + instructions_html: To complete the verification of your user account in the Open Government Portal, you must click %{verification_link}. subject: Confirm your email thanks: Thank you very much. title: Confirm your account using the following link @@ -30,7 +30,7 @@ en: signatory: "DEPARTMENT OF PUBLIC PARTICIPATION" sorry: "Sorry for the inconvenience and we again thank you for your invaluable participation." subject: "Your investment project '%{code}' has been marked as unfeasible" - unfeasible_html: "From the Madrid City Council we want to thank you for your participation in the participatory budgets of the city of Madrid. We regret to inform you that your proposal '%{title}' will be excluded from this participatory process for the following reason:" + unfeasible_html: "From the City Council we want to thank you for your participation in the participatory budgets. We regret to inform you that your proposal '%{title}' will be excluded from this participatory process for the following reason:" proposal_notification_digest: info: "Here are the new notifications that have been published by authors of the proposals that you have supported in %{org_name}." title: "Proposal notifications in %{org_name}" diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 75523cf6c..ec6d50dcc 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -12,7 +12,7 @@ es: email_verification: click_here_to_verify: en este enlace instructions_2_html: Este email es para verificar tu cuenta con %{document_type} %{document_number}. Si esos no son tus datos, por favor no pulses el enlace anterior e ignora este email. - instructions_html: Para terminar de verificar tu cuenta de usuario en el Portal de Gobierno Abierto del Ayuntamiento de Madrid, necesitamos que pulses %{verification_link}. + instructions_html: Para terminar de verificar tu cuenta de usuario en el Portal de Gobierno Abierto, necesitamos que pulses %{verification_link}. subject: Verifica tu email thanks: Muchas gracias. title: Verifica tu cuenta con el siguiente enlace @@ -30,7 +30,7 @@ es: signatory: "DIRECCIÓN GENERAL DE PARTICIPACIÓN CIUDADANA" sorry: "Sentimos las molestias ocasionadas y volvemos a darte las gracias por tu inestimable participación." subject: "Tu propuesta de inversión '%{code}' ha sido marcada como inviable" - unfeasible_html: "Desde el Ayuntamiento de Madrid queremos agradecer tu participación en los Presupuestos Participativos de la ciudad de Madrid. Lamentamos informarte de que tu propuesta '%{title}' quedará excluida de este proceso participativo por el siguiente motivo:" + unfeasible_html: "Desde el Ayuntamiento queremos agradecer tu participación en los Presupuestos Participativos. Lamentamos informarte de que tu propuesta '%{title}' quedará excluida de este proceso participativo por el siguiente motivo:" proposal_notification_digest: info: "A continuación te mostramos las nuevas notificaciones que han publicado los autores de las propuestas que estás apoyando en %{org_name}." title: "Notificaciones de propuestas en %{org_name}" diff --git a/config/locales/management.en.yml b/config/locales/management.en.yml index a0fffbde4..8833eac0f 100644 --- a/config/locales/management.en.yml +++ b/config/locales/management.en.yml @@ -23,8 +23,9 @@ en: document_verifications: already_verified: This user account is already verified. has_no_account_html: In order to create an account, go to %{link} and click in 'Register' in the upper-left part of the screen. + link: Consul in_census_has_following_permissions: 'This user can participate in the website with the following permissions:' - not_in_census: This document is not registered in Madrid. + not_in_census: This document is not registered. not_in_census_info: 'Citizens not in the Census can participate in the website with the following permissions:' please_check_account_data: Please check that the account data above are correct. title: User management @@ -58,10 +59,10 @@ en: support_proposals: Support proposals vote_proposals: Vote proposals print: - proposals_info: Create yor proposal on http://decide.madrid.es + proposals_info: Create yor proposal on http://hereyoursite.com proposals_note: The proposals more supported will be voted. If are accepted by a majority, the city Council shall be carried out. proposals_title: 'Proposals:' - spending_proposals_info: Participate at http://decide.madrid.es + spending_proposals_info: Participate at http://hereyoursite.com spending_proposals_note: Participatory budget will be assigned to the most votes spending proposals. print_info: Print this info proposals: diff --git a/config/locales/management.es.yml b/config/locales/management.es.yml index e5ee1c074..4b2e9061a 100644 --- a/config/locales/management.es.yml +++ b/config/locales/management.es.yml @@ -23,8 +23,9 @@ es: document_verifications: already_verified: Esta cuenta de usuario ya está verificada. has_no_account_html: Para crear un usuario entre en %{link} y haga clic en la opción 'Registrarse' en la parte superior derecha de la pantalla. - in_census_has_following_permissions: 'Este usuario puede participar en el Portal de Gobierno Abierto del Ayuntamiento de Madrid con las siguientes posibilidades:' - not_in_census: Este documento no está registrado en el Padrón Municipal de Madrid. + link: Consul + in_census_has_following_permissions: 'Este usuario puede participar en el Portal de Gobierno Abierto con las siguientes posibilidades:' + not_in_census: Este documento no está registrado. not_in_census_info: 'Las personas no empadronadas en Madrid pueden participar en el Portal de Gobierno Abierto del Ayuntamiento de Madrid con las siguientes posibilidades:' please_check_account_data: Compruebe que los datos anteriores son correctos para proceder a verificar la cuenta completamente. title: Gestión de usuarios @@ -58,10 +59,10 @@ es: support_proposals: Apoyar propuestas vote_proposals: Participar en las votaciones finales print: - proposals_info: Haz tu propuesta en http://decide.madrid.es + proposals_info: Haz tu propuesta en http://hereyoursite.com proposals_note: Las propuestas más apoyadas serán llevadas a votación. Y si las acepta una mayoría, el Ayuntamiento las llevará a cabo. proposals_title: 'Propuestas:' - spending_proposals_info: Participa en http://decide.madrid.es + spending_proposals_info: Participa en http://hereyoursite.com spending_proposals_note: Los presupuestos participativos se invertirán en las propuestas de inversión más apoyadas. print_info: Imprimir esta información proposals: diff --git a/config/locales/pages.en.yml b/config/locales/pages.en.yml index 72d3b117d..bb2a12a0d 100755 --- a/config/locales/pages.en.yml +++ b/config/locales/pages.en.yml @@ -1,7 +1,7 @@ --- en: pages: - census_terms: To confirm the account, you must be 16 or older and be registered as resident in Madrid, having provided the information requested previously, which the Directorate-General of Civil Participation will verify against the files 'Municipal Census of Inhabitants', for which the Directorate-General for Statistics is responsible, and the 'Citizen Support Services', for which the Directorate-General for Quality and Citizen Services is responsible. By accepting the verification process, you also consent to the verification of this information, as well as the contact methods featuring in said files. The data provided will be acquired and processed by the Directorate-General for Civil Participation in the file 'Management of Participatory Activities' mentioned previously in the terms and conditions of use for the Portal. + census_terms: To confirm the account, you must be 16 or older and be registered, having provided the information requested previously, will verify. By accepting the verification process, you also consent to the verification of this information, as well as the contact methods featuring in said files. The data provided will be acquired and processed in a file mentioned previously in the terms and conditions of use for the Portal. conditions: Terms and conditions of use general_terms: Terms and Conditions more_information: @@ -22,7 +22,7 @@ en: text: |- The new Open Government Portal is divided in three parts: Participation, Transparency and Open Data (you can see the links in the upper right-hand part). >**I. Participation:** In this part we can decide which city we want (using citizen proposals, debate areas, participatory budgets , collaborative legislation, and many others we will implement). - **II. Transparency:** In this part information about how Madrid is managed will be published every day: name, position, salary, contracts, agenda,... of the persons in charge. It is also the place where exercise your right to access information, having the chance to request any information about Madrid City Council easily and rapidly. + **II. Transparency:** In this part information about how the city is managed will be published every day: name, position, salary, contracts, agenda,... of the persons in charge. It is also the place where exercise your right to access information, having the chance to request any information about City Council easily and rapidly. **III. Open data:** In this part the city council databases are posted, so that anyone can use information directly, without having to ask. It can also be requested the publication of more databases. We have opened the new Participation portal and we will open the new Transparency and Open Data seccion shortly (meanwhile the links to existing sites are kept). @@ -33,13 +33,13 @@ en: Both threads and comments could be valued by anyone, so the citizenship, and not someone in its name, will decide which are the most important issues in every moment. These will be showed in the main page of the space, being able to access also the rest of issues in following pages, or using others order criteria (the most commented, the newst, the most controversial, etc.). - Every city council employee has its own user, which will be designated as such, allowing them to participate in debates at the same level than the rest of citizens. That will allow creating direct communication spaces between them, avoiding the problems that implies the measured communication, and following clear approach of the new Madrid City Council by virtue of which the city council works for the citizenship. + Every city council employee has its own user, which will be designated as such, allowing them to participate in debates at the same level than the rest of citizens. That will allow creating direct communication spaces between them, avoiding the problems that implies the measured communication, and following clear approach of the new City Council by virtue of which the city council works for the citizenship. ## I.I. Proposals area In the proposals area everyone can propose an initiative with the intention of collecting support enough for the idea being consulting to the whole citizenship with binding effect. - The proposals can be supported by every citizen registered in Madrid that has verified their account in the participation platform. In this way, the citizenship, and not someone in its name, will decide which are the proposals that are worthwhile to carry out. + The proposals can be supported by every citizen registered that has verified their account in the participation platform. In this way, the citizenship, and not someone in its name, will decide which are the proposals that are worthwhile to carry out. - One that the proposal has achive support of 2% Madrid census (arround 53000 people), it will be studied by a city council group and to move beyond the popular referendum phase, in which Madrid citizenship will vote if it is carried out or not. The maximum period to obtain support enough is 12 months. + One that the proposal has achive support of 2% census, it will be studied by a city council group and to move beyond the popular referendum phase, in which citizenship will vote if it is carried out or not. The maximum period to obtain support enough is 12 months. how_to_use: text: |- Use it in your local government or help us to improve it, it is free software. @@ -53,15 +53,14 @@ en: faq: Solution to tecnical problemas (FAQ) how_it_works: How does this Open Government Portal work? how_to_use: Use it in your local government - participation: Madrid Participation and Transparency y Transparencia - coming news + participation: Participation and Transparency y Transparencia - coming news participation_facts: Facts about citizen participation and direct democracy participation_world: Direct citizen participation in the world proposals_info: How does citizen proposals work? signature_sheet: Signature sheet spending_proposals_info: How does participatory budgeting work? opendata: - go_old: Go to Open Data Portal - slogan_html: 'We are working on the new Madrid City Council Open Data Portal, meanwhile you can visit the actual Open Data Portal:' + slogan: "Information about Open Data." title: Open Data privacy: Privacy Policy titles: @@ -78,4 +77,3 @@ en: password: Password submit: Verify my account title: Verify your account - while_unfinished_html: While we finish, we encourage you to visit the Citizen Participation Area, Transparency and Open Government blog to know about our progress and news; or the Citizen Participation section where you can decide which is the city you want. diff --git a/config/locales/pages.es.yml b/config/locales/pages.es.yml index 6b47a950c..733b064b3 100644 --- a/config/locales/pages.es.yml +++ b/config/locales/pages.es.yml @@ -1,7 +1,7 @@ --- es: pages: - census_terms: Para verificar la cuenta hay que tener 16 años o más y estar empadronado en Madrid aportando los datos indicados anteriormente, los cuales serán contrastados por la Dirección General de Participación Ciudadana con los ficheros 'Padrón Municipal de Habitantes' cuyo responsable es la Dirección General de Estadística y 'Servicios Atención al Ciudadano' cuyo responsable es la Dirección General de Calidad y Atención al Ciudadano. Aceptando el proceso de verificación acepta dar su consentimiento para contrastar dicha información, así como medios de contacto que figuren en dichos ficheros. Los datos aportados serán incorporados y tratados por la Dirección General de Participación Ciudadana en el fichero 'Gestión de Procesos Participativos' indicado anteriormente en las condiciones de uso del portal. + census_terms: Para verificar la cuenta hay que tener 16 años o más y estar empadronado aportando los datos indicados anteriormente, los cuales serán contrastados. Aceptando el proceso de verificación acepta dar su consentimiento para contrastar dicha información, así como medios de contacto que figuren en dichos ficheros. Los datos aportados serán incorporados y tratados en un fichero indicado anteriormente en las condiciones de uso del portal. conditions: Condiciones de uso general_terms: Términos y Condiciones more_information: @@ -22,7 +22,7 @@ es: text: |- El nuevo Portal de Gobierno Abierto está dividido en tres partes: Participación, Transparencia y Datos Abiertos (verás los enlaces en la parte superior derecha). >**I. Participación:** Donde poder decidir qué ciudad queremos tener (a través de propuestas ciudadanas, espacios de debate, presupuestos participativos, legislación colaborativa, y muchos otros procesos que iremos implementando). - **II. Transparencia:** En este espacio se publicarán todos los datos relativos a quién y cómo se gestiona Madrid (nombres de los responsables, cargos, sueldos, planes de gobierno, contratos, agendas de los responsables...). Además es el espacio donde ejercer el derecho de acceso a la información, pudiendo solicitar cualquier información sobre el Ayuntamiento de Madrid de manera fácil y rápida. + **II. Transparencia:** En este espacio se publicarán todos los datos relativos a quién y cómo se gestiona la ciudad (nombres de los responsables, cargos, sueldos, planes de gobierno, contratos, agendas de los responsables...). Además es el espacio donde ejercer el derecho de acceso a la información, pudiendo solicitar cualquier información sobre el Ayuntamiento de manera fácil y rápida. **III. Datos Abiertos:** En este espacio se cuelgan las bases de datos que tiene el Ayuntamiento, para que cualquiera pueda usar toda la información directamente, sin necesidad ni siquiera de preguntar. También se puede solicitar la publicación de más bases de datos. Inauguramos el nuevo portal con la nueva sección de Participación, y en breve añadiremos las nuevas secciones de Transparencia y Datos Abiertos (así que mantenemos por el momento los enlaces a las páginas al respecto que ya existían). @@ -33,13 +33,13 @@ es: Tanto los hilos, como los comentarios podrán ser valorados por cualquiera, de tal manera que será la propia ciudadanía, y nadie en su nombre, la que decida cuáles son los temas más importantes en cada momento. Estos serán presentados en la portada del espacio, pudiendo por supuesto accederse a todos los demás temas en páginas posteriores, o usando otros criterios de ordenación (los temas con más comentarios, los más nuevos, los más controvertidos, etc.). - Cada uno de los trabajadores del Ayuntamiento tiene un usuario propio, que será resaltado como tal, permitiendo que participen en los debates al mismo nivel que todos los demás ciudadanos. Esto permitirá crear espacios de comunicación directos entre unos y otros, evitando los inconvenientes que implica la comunicación medidada, y respondiendo a un planteamiento claro por parte del nuevo gobierno de Madrid por el cual el Ayuntamiento trabaja para la ciudadanía, y ante ella debe responder. + Cada uno de los trabajadores del Ayuntamiento tiene un usuario propio, que será resaltado como tal, permitiendo que participen en los debates al mismo nivel que todos los demás ciudadanos. Esto permitirá crear espacios de comunicación directos entre unos y otros, evitando los inconvenientes que implica la comunicación medidada, y respondiendo a un planteamiento claro por parte del nuevo gobierno por el cual el Ayuntamiento trabaja para la ciudadanía, y ante ella debe responder. ## I.I. Espacio de propuestas En este espacio, cualquier persona puede proponer una iniciativa con la intención de recabar los suficientes apoyos como para que la idea pase a ser consultada a toda la ciudadanía con caracter vinculante. - Las propuestas pueden ser apoyadas por ciudadanos empadronados en Madrid que hayan verificado su cuenta en la plataforma de participación, de tal manera que será la propia ciudadanía, y nadie en su nombre, la que decida cuáles son las propuestas que merecen la pena ser llevadas a cabo. + Las propuestas pueden ser apoyadas por ciudadanos empadronados que hayan verificado su cuenta en la plataforma de participación, de tal manera que será la propia ciudadanía, y nadie en su nombre, la que decida cuáles son las propuestas que merecen la pena ser llevadas a cabo. - Una vez que una propuesta alcance una cantidad de apoyos equivalente al 2% del censo de Madrid (unos 53000), automaticamente pasa a ser estudiada por un grupo de trabajo del Ayuntamiento y pasará a la siguiente fase de consulta popular, en la que la ciudadanía de Madrid votará si se lleva a cabo o no. El plazo máximo para recabar los apoyos necesarios será de 12 meses. + Una vez que una propuesta alcance una cantidad de apoyos equivalente al 2% del censo, automaticamente pasa a ser estudiada por un grupo de trabajo del Ayuntamiento y pasará a la siguiente fase de consulta popular, en la que la ciudadanía votará si se lleva a cabo o no. El plazo máximo para recabar los apoyos necesarios será de 12 meses. how_to_use: text: |- Utilízalo en tu municipio libremente o ayúdanos a mejorarlo, es software libre. @@ -53,15 +53,14 @@ es: faq: Soluciones a problemas técnicos (FAQ) how_it_works: "¿Cómo funciona este Portal de Gobierno Abierto?" how_to_use: Utilízalo en tu municipio - participation: Participación y Transparencia en Madrid - Próximas novedades + participation: Participación y Transparencia - Próximas novedades participation_facts: Hechos sobre participación ciudadana y democracia directa participation_world: Participación ciudadana directa en el mundo proposals_info: "¿Cómo funcionan las propuestas ciudadanas?" signature_sheet: Hojas de firmas spending_proposals_info: "¿Cómo funcionan los presupuestos participativos?" opendata: - go_old: Ir al Portal de Datos Abiertos - slogan_html: 'Estamos trabajando en el nuevo Portal de Datos Abiertos del Ayuntamiento de Madrid, por ahora puedes visitar el portal que existía hasta ahora:' + slogan: "Información sobre Datos abiertos." title: Datos abiertos privacy: Política de Privacidad titles: @@ -78,4 +77,3 @@ es: password: Contraseña submit: Verificar mi cuenta title: Verifica tu cuenta - while_unfinished_html: Mientras acabamos el nuevo portal, te invitamos a visitar el blog del Área de Participación Ciudadana, Transparencia y Gobierno Abierto para conocer nuestros avances y novedades; o la sección de Participación Ciudadana donde poder decidir qué ciudad es la que quieres. diff --git a/config/locales/verification.en.yml b/config/locales/verification.en.yml index 8b7617f1a..6474ac20d 100755 --- a/config/locales/verification.en.yml +++ b/config/locales/verification.en.yml @@ -21,7 +21,7 @@ en: create: flash: offices: Citizen Support Offices - offices_url: http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD + offices_url: http://yourcitizensupportofficesite.com success_html: Thank you for requesting your maximum security code (only required for the final votes). In a few days we will send it to the address featuring in the data we have on file. Please remember that, if you prefer, you can collect your code from any of the %{offices}. edit: see_all: See proposals @@ -33,7 +33,7 @@ en: go_to_index: See proposals office: Verify in any %{office} offices: Citizen Support Offices - offices_url: http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD + offices_url: http://yourcitizensupportofficesite.com send_letter: Send me a letter with the code title: Congratulations! user_permission_info: With your account you can... @@ -62,12 +62,12 @@ en: spanish_id: DNI document_type_label: Document type error_not_allowed_age: You must be at least 16 years old - error_not_allowed_postal_code: In order to be verified, you must be registered in the municipality of Madrid. - error_verifying_census: The Madrid Census was unable to verify your information. Please confirm that your census details are correct by calling 010 (or 915298210) or visit any of %{offices}. - error_verifying_census_offices: 26 Office of Citizen + error_not_allowed_postal_code: In order to be verified, you must be registered. + error_verifying_census: The Census was unable to verify your information. Please confirm that your census details are correct by calling to City Council or visit one %{offices}. + error_verifying_census_offices: Citizen Support Office form_errors: prevented the verification of your residence postal_code: Postcode - postal_code_note: To verify your account you must be on Madrid city Census + postal_code_note: To verify your account you must be registered terms: the terms and conditions of access title: Verify residence verify_residence: Verify residence diff --git a/config/locales/verification.es.yml b/config/locales/verification.es.yml index 7c27584a7..e6d0ffa0d 100644 --- a/config/locales/verification.es.yml +++ b/config/locales/verification.es.yml @@ -21,7 +21,7 @@ es: create: flash: offices: Oficinas de Atención al Ciudadano - offices_url: http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD + offices_url: http://yourcitizensupportofficesite.com success_html: Antes de las votaciones recibirás una carta con las instrucciones para verificar tu cuenta.
Recuerda que puedes ahorrar el envío verificándote presencialmente en cualquiera de las %{offices}. edit: see_all: Ver propuestas @@ -33,7 +33,7 @@ es: go_to_index: Ver propuestas office: Verificarte presencialmente en cualquier %{office} offices: Oficina de Atención al Ciudadano - offices_url: http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD + offices_url: http://yourcitizensupportofficesite.com send_letter: Solicitar una carta por correo postal title: "¡Felicidades!" user_permission_info: Con tu cuenta ya puedes... @@ -62,12 +62,12 @@ es: spanish_id: DNI document_type_label: Tipo de documento error_not_allowed_age: Hay que tener al menos 16 años - error_not_allowed_postal_code: Para verificarte debes estar empadronado en el municipio de Madrid. - error_verifying_census: El Padrón de Madrid no pudo verificar tu información. Por favor, confirma que tus datos de empadronamiento sean correctos llamando al 010 (o a su versión gratuita 915298210) o visita cualquiera de las %{offices}. - error_verifying_census_offices: 26 Oficinas de Atención al Ciudadano + error_not_allowed_postal_code: Para verificarte debes estar empadronado. + error_verifying_census: El Padrón no pudo verificar tu información. Por favor, confirma que tus datos de empadronamiento sean correctos llamando al Ayuntamiento o visitando una %{offices}. + error_verifying_census_offices: oficina de Atención al ciudadano form_errors: evitaron verificar tu residencia postal_code: Código postal - postal_code_note: Para verificar tus datos debes estar empadronado en el municipio de Madrid + postal_code_note: Para verificar tus datos debes estar empadronado terms: los términos de acceso title: Verificar residencia verify_residence: Verificar residencia diff --git a/doc/locales/fr.yaml b/doc/locales/fr.yaml index 5ed967599..3b8e5571c 100644 --- a/doc/locales/fr.yaml +++ b/doc/locales/fr.yaml @@ -362,7 +362,7 @@ fr: - Ven - Sam abbr_month_names: - - + - - Jan - Fév - Mar @@ -388,7 +388,7 @@ fr: long: "%B %d, %Y" short: "%b %d" month_names: - - + - - Janvier - Février - Mars @@ -850,7 +850,7 @@ fr: consul: Application Consul consul_url: https://github.com/consul/consul contact_us: Pour l'assistance technique entrer - copyright: Mairie de Madrid, %{year} + copyright: Consul, %{year} description: Ce portail utiliser %{consul} qui est %{open_source}. De Madrid ouvert sur le monde. faq: assistance technique @@ -865,17 +865,16 @@ fr: privacy: Vie privée transparency_text: Trouver tout à propos de la mairie de Madrid transparency_title: Transparence - transparency_url: https://transparencia.madrid.es + transparency_url: https://yourtransparencysite.com header: administration: Administration debates: Débats external_link_blog: Blog external_link_opendata: Open data - external_link_opendata_url: http://datos.madrid.es external_link_transparency: Transparence - external_link_transparency_url: https://transparencia.madrid.es + external_link_transparency_url: https://yourtransparencysite.com locale: 'Langue :' - logo: Madrid + logo: Consul moderation: Modération more_information: Plus d'information my_account_link: Mon compte @@ -892,7 +891,6 @@ fr: open_city_title: Aimez la ville, et elle deviendra la ville que vous aimez open_data: Open data open_gov: Gouvernement ouvert - processes: Processus ouverts proposals: Propositions spending_proposals: Propositions de dépense locale: Français @@ -942,7 +940,7 @@ fr: écran. in_census_has_following_permissions: 'Cet utilisateur peut participer dans la plateforme avec les autorisations suivantes :' - not_in_census: Ce document n'est pas enregistré à Madrid. + not_in_census: Ce document n'est pas enregistré. not_in_census_info: 'Les personnes non-enregistrées dans le recensement peuvent participer dans la plateforme avec les autorisations suivantes :' please_check_account_data: Merci de vérifier que vos informations ci-dessus @@ -1227,35 +1225,10 @@ fr: signature_sheet: Feuille de signature spending_proposals_info: Comment marche le budget participatif ? opendata: - go_old: Visiter le portail Open Data - slogan_html: Nous travaillons sur le nouveau portail Open Data de la Ville de + slogan: Nous travaillons sur le nouveau portail Open Data de la Ville de Madrid, tandis que vous pouvez toujours visiter la version actuelle. title: Open Data privacy: Vie privée - processes: - back: Revenir - index: - process_1_button: Plus d'informations - process_1_description: Madrid veut lancer un système de transparence publique - le plus avancé dans le monde et vous avons besoin de votre aide. - process_1_title: Loi de transparence - process_2_button: Plus d'informations - process_2_description: Nous comptons sur vous pour décider comment vous voyez - ce nouvel espace dans la ville. - process_2_title: Remodelage de la Plaza España - process_1: - button: Ordonnance - comment: Laissez vos commentaires - text: "Jusqu'au 31 Janvier vous pouvez %{comment} sur le projet d'ordonnace - de Transparence de la ville de Madrid ou envoyer un mail à transparence@madrid.es.\r\n\r\nVous - pouvez voir maintenant le [projet d'ordonnance final de Transparence de - la ville de Madrid](/docs/ordenanza_de_transparencia_de_la_ciudad_de_madrid.doc - 'Transparency Ordinance of the City of Madrid')" - title: Aidez-nous à traduire l'ordonnance de transparence de la ville de Madrid - process_2: - text: Nous comptons sur vous pour remplir ce court questionnaire pour décider - de ce nouvel espace dans votre ville. - title: Transformation de la Plaza de España titles: accessibility: Accessibilité conditions: Conditions d'utilisation @@ -1270,11 +1243,6 @@ fr: password: Mot de passe submit: Vérifier mon compte title: Vérifier mon compte - while_unfinished_html: Pendant que nous terminons, nous vous encourageons à visiter - Citizen Participation Area, Transparency and - Open Government blog pour vous informer sur nos nouvelles et pogrès ou sur - Citizen Participation section où vous décidez de la ville que - vous souhaitez. proposals: create: form: @@ -1529,7 +1497,7 @@ fr: create: flash: offices: Bureaux de soutien aux citoyens - offices_url: http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD + offices_url: http://yourcitizensupportofficesite.com success_html: Merci d'avoir demandé votre code de sécurité maximum (uniquement requis pour le vote final). Dans quelques jours, nous vous enverrons un courrier vers votre adresse postale. Vous pouvez le réclamer dans n'importe @@ -1544,7 +1512,7 @@ fr: go_to_index: Voir les propositions office: Vérifier dans n'importe quel %{office} offices: Bureaux de soutien aux citoyens - offices_url: http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD + offices_url: http://yourcitizensupportofficesite.com send_letter: Envoyer une lettre avec le code title: Félicitations user_permission_info: Avec votre compte, vous pouvez diff --git a/doc/locales/pt-br.yaml b/doc/locales/pt-br.yaml index 09521ecc2..363427030 100644 --- a/doc/locales/pt-br.yaml +++ b/doc/locales/pt-br.yaml @@ -840,7 +840,7 @@ pt-BR: consul: Aplicativo Consul consul_url: https://github.com/consul/consul contact_us: Para suporte técnico entre - copyright: Ayuntamiento de Madrid, %{year} + copyright: Consul, %{year} description: Este portal usa o %{consul} que é %{open_source}. De Madrid para o mundo. faq: suporte técnico @@ -854,17 +854,16 @@ pt-BR: privacy: Política de privacidade transparency_text: Descubra tudo sobre a Câmara da Cidade de Madrid. transparency_title: Transparência - transparency_url: https://transparencia.madrid.es + transparency_url: https://yourtransparencysite.com header: administration: Administração debates: Debates external_link_blog: Blog external_link_opendata: Dados abertos - external_link_opendata_url: http://datos.madrid.es external_link_transparency: Transparência - external_link_transparency_url: https://transparencia.madrid.es + external_link_transparency_url: https://yourtransparencysite.com locale: 'Idioma:' - logo: Madrid + logo: Consul moderation: Moderação more_information: Mais informações my_account_link: Minha conta @@ -881,7 +880,6 @@ pt-BR: open_city_title: Ame a cidade e ela se transformará na cidade que você ama. open_data: Dados abertos open_gov: Governo aberto - processes: Processos abertos proposals: Propostas spending_proposals: Propostas de despesas locale: Português brasileiro @@ -928,7 +926,7 @@ pt-BR: em 'Register' na parte superior esquerda de sua tela/janela. in_census_has_following_permissions: 'Este usuário pode participar no website com as seguintes permissões:' - not_in_census: Este documento não está registrado em Madrid. + not_in_census: Este documento não está registrado. not_in_census_info: 'Cidadãos fora do Censo podem participar no website com as seguintes permissões:' please_check_account_data: Por favor confira se os dados da conta acima estão @@ -1246,36 +1244,11 @@ pt-BR: signature_sheet: Página de assinaturas spending_proposals_info: Como funciona o orçamento participativo? opendata: - go_old: Vá para o Portal de Dados Abertos - slogan_html: 'Estamos trabalhando no novo Portal de Dados Abertos da Câmara + slogan: 'Estamos trabalhando no novo Portal de Dados Abertos da Câmara da Cidade de Madrid, enquanto isso você pode visitar o atual Portal de Dados abertos:' title: Dados Abertos privacy: Políticas de Privacidade - processes: - back: Voltar - index: - process_1_button: Mais informações - process_1_description: Madrid quer lançar um sistema de transparência pública - de nível mais avançado no mundo e nós precisamos de sua ajuda. - process_1_title: Planejamento transparente - process_2_button: Mais informações - process_2_description: Contamos com você para decidir como você deseja este - novo espaço em sua cidade. - process_2_title: Remodelagem da Plaza Espanã. - process_1: - button: Comentar o planejamento - comment: deixe seus comentários - text: "Até o próximo 31 de janeiro você pode %{comment} o ante-projeto de - Orçamento Transparente da cidade de Madrid ou enviar um e-mail para transparencia@madrid.es.\r\n\r\nAgora - você pode ver o [projeto final Orçamento Transparente da Cidade de Madrid] - (/docs/ordenanza_de_transparencia_de_la_ciudad_de_madrid.doc 'Orçamento - Transparente da Cidade de Madrid')." - title: Ajude-nos a melhorar - process_2: - text: Contamos com você no preenchimento de uma enquete curta de como você - gostaria que fosse este novo espaço em sua cidade. - title: Remodelagem da Plaza de España titles: accessibility: Acessibilidade conditions: Termos de uso @@ -1290,11 +1263,6 @@ pt-BR: password: Senha submit: Verificar minha conta title: Verificar sua conta - while_unfinished_html: Enquanto terminamos, nós encorajamos você a visitar o Blog da Área de Participação Cidadã, Transparência - e Governo Aberto para saber de nossos progressos e notícias; ou a Seção - de Participação Cidadã onde você poderá decidir qual é a cidade que você - quer. proposals: create: form: @@ -1547,7 +1515,7 @@ pt-BR: create: flash: offices: Escritórios de Apoio ao Cidadão - offices_url: http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD + offices_url: http://yourcitizensupportofficesite.com success_html: Obrigado por solicitar seu código de segurança máxima (somente solicitado em votações finais). Em poucos dias nós lhe enviaremos para seu endereço relacionado nos dados que temos em arquivo. Por favor @@ -1563,7 +1531,7 @@ pt-BR: go_to_index: Ver propostas office: Verificar em qualquer %{office} offices: Escritórios de Apoio ao Cidadão - offices_url: http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD + offices_url: http://yourcitizensupportofficesite.com send_letter: Envie-me uma carta com o código title: Parabéns! user_permission_info: Com a sua conta você pode... From ece2f6f019e1f101e0859ba9a93fe305448e46c6 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 4 Jul 2016 18:07:45 +0200 Subject: [PATCH 095/126] Removes Madrid references on pages --- app/views/pages/conditions.html.erb | 91 +------------------ app/views/pages/faq.html.erb | 96 ++------------------ app/views/pages/opendata.html.erb | 15 +-- app/views/pages/participation.html.erb | 72 ++++----------- app/views/pages/participation_facts.html.erb | 6 +- app/views/pages/participation_world.html.erb | 4 +- app/views/pages/privacy.html.erb | 10 +- app/views/pages/proposals_info.html.erb | 89 ++---------------- public/maintenance.html | 2 +- 9 files changed, 49 insertions(+), 336 deletions(-) diff --git a/app/views/pages/conditions.html.erb b/app/views/pages/conditions.html.erb index 642881be4..fbe53c1ca 100644 --- a/app/views/pages/conditions.html.erb +++ b/app/views/pages/conditions.html.erb @@ -4,95 +4,8 @@

<%= t("pages.conditions") %>

-

AVISO LEGAL SOBRE LAS CONDICIONES DE USO, PRIVACIDAD Y PROTECCIÓN DE DATOS PERSONALES DEL PORTAL DE GOBIERNO ABIERTO DEL AYUNTAMIENTO DE MADRID

- -

1. Ámbito de aplicación de las condiciones de uso

-

La participación (entendiéndola como participación activa más allá de la lectura del contenido presente) en el Portal de Gobierno Abierto del Ayuntamiento de Madrid se regula por las presentes condiciones de uso que vinculan a todas las personas que participen en este sitio web. Por ello, cualquier persona que desee participar deberá registrarse, a cuyo fin se solicitará la aceptación de estas condiciones de uso.

-

El Ayuntamiento de Madrid se reserva la facultad de modificar las presentes condiciones de uso para la participación en el Portal de Gobierno Abierto del Ayuntamiento de Madrid, cuya última versión se publicará en este sitio web.

-

La participación en el Portal de Gobierno Abierto del Ayuntamiento de Madrid se regula por las presentes condiciones de uso que vinculan a todas las personas que participen en este sitio web. Cualquier persona que desee participar deberá registrarse, a cuyo fin se solicitará la aceptación de estas condiciones de uso.

-

El Ayuntamiento de Madrid se reserva la facultad de modificar las presentes condiciones de uso del Portal de Gobierno Abierto del Ayuntamiento de Madrid cuya última versión se publicará en este sitio web.

- - -

2. Objetivo de la iniciativa

-

A través del Portal de Gobierno Abierto, el Ayuntamiento de Madrid quiere fomentar la participación de los ciudadanos en la gestión de la ciudad, implicándoles en la generación de ideas y propuestas novedosas y viables, con el objeto de mejorar su calidad de vida. Es una apuesta decidida por una gestión más cercana a los ciudadanos que permitirá recibir sus propuestas y además, crear canales directos de comunicación con el gobierno municipal, contribuyendo a tomar las decisiones más acertadas para el interés general.

-

3. Cuestiones generales sobre la participación en el Portal de Gobierno Abierto del Ayuntamiento de Madrid

-

Podrá participar cualquier persona física a partir de los 16 años que se haya registrado previamente en el Portal de Gobierno Abierto. Mediante la aceptación de estas condiciones de uso se declara tener 16 años o más. Los mayores de edad a cuyo cargo se encuentran los menores, son los plenos responsables de la actuación que tengan éstos en el Portal de Gobierno Abierto. No existe limitación en cuanto al número de debates, comentarios o propuestas a presentar por los participantes.

-

Al introducir el título de las propuestas, se recomienda escribir una descripción breve y precisa con un máximo de 2000 caracteres. Para completar la argumentación se podrán asociar documentos adjuntos o de las Redes Sociales Vimeo, Youtube, Slideshare, Flickr o SoundCloud.

- -

4. Obligaciones de los usuarios del Portal de Gobierno Abierto

-

Al ser el Ayuntamiento de Madrid un punto de encuentro cuyo objetivo es debatir, y compartir y valorar propuestas relacionadas con la mejora de la ciudad, los usuarios están obligados a hacer un uso diligente y acorde a dicho objetivo.

-

El Ayuntamiento de Madrid no es responsable del uso incorrecto del Portal de Gobierno Abierto por los usuarios o de los contenidos localizados en el mismo, siendo cada usuario responsable de su uso correcto y de la legalidad de los contenidos y opiniones que haya compartido.

-

El Ayuntamiento de Madrid se reserva, por lo tanto, el derecho a limitar el acceso al Portal de Gobierno Abierto del Ayuntamiento de Madrid de opiniones, informaciones, comentarios o documentos que los usuarios quieran incorporar, pudiendo instalar filtros a tal efecto. Todo ello se realizará únicamente mientras tenga el fin de preservar el objetivo fundamental del Portal de Gobierno Abierto.

-

De acuerdo a la normativa legal vigente queda prohibida la utilización del Portal de Gobierno Abierto del Ayuntamiento de Madrid con fines distintos a los de debatir, compartir y valorar propuestas, y específicamente:

-

Compartir cualquier contenido que pueda ser considerado como una vulneración en cualquier forma de los derechos fundamentales al honor, imagen e intimidad personal y familiar de terceros o contra la dignidad de las personas.

-

Compartir imágenes o fotografías que recojan imágenes o datos personales de terceros sin haber obtenido el oportuno consentimiento de sus titulares.

-

Compartir cualquier contenido que vulnere el secreto en las comunicaciones, la infracción de derechos de propiedad industrial e intelectual o de las normas reguladoras de la protección de datos de carácter personal.

-

Reproducir, distribuir, compartir contenidos, informaciones o imágenes que hayan sido puestas a disposición por otros usuarios sin la autorización expresa de estos.

-

Su utilización con fines de publicidad.

-

La realización de cualquiera de los anteriores comportamientos permitirá al Ayuntamiento de Madrid suspender temporalmente la actividad de un participante, inhabilitar su cuenta o borrar su contenido, sin perjuicio de otras responsabilidades que puedan ser reclamadas.

-

En caso de que el contenido introducido por los usuarios incorpore un enlace a otro sitio web, el Ayuntamiento de Madrid no será responsable por los daños o perjuicios derivados del acceso al enlace o a sus contenidos.

-

En caso de litigio de cualquier clase o por cualquier motivo entre los participantes en el sitio web y/o un tercero, el Ayuntamiento de Madrid quedará exento de cualquier responsabilidad por reclamaciones, demandas o daños de cualquier naturaleza relacionados o derivados del litigio.

- -

5. Uso del Portal de Gobierno Abierto

-

Los participantes podrán acceder y navegar por el Portal de Gobierno Abierto libremente y de forma anónima. Sólo cuando quieran realizar alguna acción que implique la creación, apoyo o comentario de una propuesta, o a la participación en un debate, se le solicitará que introduzca sus credenciales, para cuya obtención será necesario registrarse previamente. El registro que permitirá participar comentando en cualquiera de las secciones, creando debates o propuestas, se realizará introduciendo los siguientes datos:

-
    -
  • Nombre de usuario
  • -
  • Correo electrónico
  • -
  • Aceptación de las condiciones de uso de el Portal de Gobierno Abierto
  • -
-

El Portal de Gobierno Abierto también permite la identificación mediante el usuario de Facebook, Twitter y Google+.

-

Para participar apoyando propuestas, al usuario se le requerirá que verifique su cuenta cumpliendo que tiene 16 años o más y está empadronado en Madrid, para lo cual se le guiará a través de una serie de pasos donde se le solicitarán datos relativos al padrón y un medio de comunicación a través del cual facilitarle uno o dos códigos seguros para completar la verificación de su cuenta (dependiendo del medio de comunicación elegido por el usuario).

- -

El usuario podrá interactuar con la herramienta interviniendo, al menos, de las siguientes formas:

-

1. DEBATES

-

En el apartado de debates el usuario podrá participar:

-
    -
  • Creando un debate. Cada usuario podrá abrir uno o más debates. Los debates serán publicados automáticamente.
  • -
  • Votando de manera positiva o negativa a los debates creadas por los usuarios. Los debates aparecerán con los votos positivos y negativos recibidos. Cada usuario podrá exclusivamente votar o bien positivo o bien negativo, y una vez a un mismo debate.
  • -
  • Comentando los debates del resto de usuarios. Cada debate podrá ser comentado por el resto de usuarios.
  • -
-

2. PROPUESTAS

-

En el apartado de propuestas ciudadanas el usuario podrá participar:

-
    -
  • Creando una propuesta. Cada usuario podrá dar de alta una o más propuestas. Las propuestas serán publicadas automáticamente.
  • -
  • Apoyando las propuestas creadas por los usuarios. Las propuestas aparecerán con el número de apoyos recibidos. Cada usuario podrá exclusivamente apoyar una vez a una misma propuesta. Cuando una propuesta reciba apoyos equivalente al 2% del padrón de personas con 16 años o más, la propuesta pasará a una fase posterior donde durante una semana se invitará a la ciudadanía a aceptarla o rechazarla como propuesta colectiva.
  • -
  • Comentando las propuestas del resto de usuarios. Cada propuesta podrá ser comentada por el resto de usuarios, pudiendo argumentar las razones del apoyo o introducir mejoras a la misma.
  • -
- -

6. Condiciones para el tratamiento de los contenidos proporcionados por los usuarios

-

Las presentes condiciones regulan los términos aplicables al contenido remitido por los usuarios de esta plataforma a través del formulario correspondiente (en adelante, el contenido). Estas condiciones se aplican tanto al contenido inicialmente remitido al Portal de Gobierno Abierto como a cualquier contenido que se envíe con posterioridad o se manifieste al Ayuntamiento de Madrid, debiendo significarse lo siguiente:

-
    -
  • A. No Confidencialidad: Todo el contenido remitido por el usuario al Ayuntamiento de Madrid deberá ser susceptible de ser conocido por el público en general. Por lo tanto, el Ayuntamiento de Madrid tratará el citado contenido como información no confidencial.
  • -
  • B. Procedimiento: En el caso de que el Ayuntamiento de Madrid esté interesado en el contenido remitido por el usuario, se pondrá en contacto con él para solicitarle información adicional. Dicha información tendrá asimismo carácter de no confidencial, sin perjuicio de que en el caso de que las partes consideren la necesidad de intercambiarse información de carácter confidencial se firme el correspondiente Acuerdo de Confidencialidad.

    - El Ayuntamiento de Madrid se reserva el derecho de no contactar con los usuarios que le hubieran remitido el contenido. Todo ello sin perjuicio de lo establecido en el apartado relativo a "Derechos de Propiedad Intelectual e industrial".

    - En el supuesto que el Ayuntamiento de Madrid, a su entera discreción, decidiera contactar con determinados usuarios, éstos conocen y aceptan que por ello el Ayuntamiento de Madrid no adquiere compromiso alguno.
  • - -
  • C. Publicidad o difusión de los contenidos presentados: Los participantes en el Portal de Gobierno Abierto del Ayuntamiento de Madrid declaran conocer y aceptar el hecho de que la información aportada podrá ser publicada en la web www.madrid.es, así como a través de otros medios que la organización considere oportunos para dar a conocer esta iniciativa.
  • - -
  • D. No devolución material: El Ayuntamiento de Madrid carece de obligación alguna de devolver el Contenido remitido por los usuarios.
  • -
  • E. Procedimiento de aviso y retirada: El Ayuntamiento de Madrid procesará las peticiones de eliminación o retirada de contenidos que incumplan las condiciones de uso que hayan añadido los participantes. Asimismo, cualquier persona, con motivos razonados si existe incumplimiento de las presentes condiciones de uso, podrá solicitar la retirada de contenidos al Ayuntamiento de Madrid. El Ayuntamiento de Madrid se reserva el derecho de hacer las comprobaciones o verificaciones oportunas con carácter previo a la retirada de cualquier contenido.
  • -
- -

7. Política de privacidad y protección de datos

-
    -
  • A. Titularidad de los derechos de propiedad intelectual e industrial: El usuario que aporta el Contenido declara, con la aceptación de las presentes Condiciones, ser titular de los derechos de propiedad intelectual y/o industrial u ostentar derechos suficientes sobre dicho contenido y que además lo remite al Ayuntamiento de Madrid de forma voluntaria para su divulgación en el Portal de Gobierno Abierto del Ayuntamiento de Madrid.

    - La titularidad de todos y cada uno de los Contenidos presentados que se encuentren protegidos o sean susceptibles de encontrarse protegidos, por el Derecho de la Propiedad Industrial e Intelectual, corresponde a los autores y/o titulares de los mencionados Contenidos.

    - El Ayuntamiento de Madrid no asume responsabilidad alguna, ya sea directa o indirecta, respecto de cualquier tipo de controversia, disputa y/o litigio que pudiera derivarse de la publicación, divulgación y/o difusión de los contenidos aportados sin el preceptivo consentimiento de sus legítimos titulares.

    - El Ayuntamiento de Madrid respetará todos los Derechos de Propiedad Intelectual o Industrial sobre el contenido remitido por los usuarios. Cualquier vulneración de los Derechos de Propiedad Intelectual o Industrial será responsabilidad de la persona que aporte el contenido.

    - El Ayuntamiento de Madrid, por la mera recepción del contenido, no recibe del usuario licencia alguna de propiedad intelectual o industrial, por lo que no hará uso del contenido salvo aceptación expresa de su titular.
  • -
  • B. Protección de datos: Los datos personales aportados por los usuarios que se registren en el Portal de Gobierno Abierto, serán incorporados y tratados en el fichero Gestión de Procesos Participativos, cuya finalidad es gestionar los procesos participativos para el control de la habilitación de las personas que participan en los mismos y recuento meramente numérico y estadístico de los resultados derivados de los procesos de participación ciudadana. Gestión de Agendas para convocatorias y envío de información solicitada. El órgano responsable del fichero es la Dirección General competente en materia de Participación Ciudadana, ante la que la persona interesada podrá ejercer los derechos de acceso, rectificación, cancelación y oposición, todo lo cual se informa en cumplimiento del artículo 5 de la Ley Orgánica 15/1999, de 13 de diciembre, de Protección de Datos de Carácter Personal.
  • -
- -

Como principio general, los datos personales no serán comunicados a terceros, excepto cuando la comunicación haya sido autorizada por el usuario, o la información sea requerida por la autoridad judicial, ministerio fiscal o la policía judicial, o se de alguno de los supuestos regulados en el artículo 11 de la Ley Orgánica 15/1999, de 13 de diciembre, de Protección de Datos de Carácter Personal.

-
    -
  • Los derechos de acceso, rectificación, cancelación y oposición, se podrán ejercitar dirigiendo una comunicación por escrito al Ayuntamiento de Madrid, Área de Gobierno de Participación Ciudadana, Transparencia y Gobierno Abierto, Dirección General de Participación Ciudadana.
  • -
- -

8. Normativa aplicable

-

Las normas del ordenamiento jurídico español rigen de manera exclusiva estas condiciones de uso. Cualquier disputa, controversia o reclamación derivada de estas condiciones de uso, o el incumplimiento, rescisión o invalidación de estas, se resolverán exclusivamente ante los juzgados competentes.

- -

9. Revisión de las condiciones de uso

-

El Ayuntamiento de Madrid se reserva el derecho de revisar las presentes condiciones de uso y la política de privacidad en cualquier momento y por cualquier razón. En dicho caso, los usuarios registrados serán avisados a través de este espacio en línea y, si continúan utilizando el Portal de Gobierno Abierto, se entenderán aceptadas las modificaciones introducidas.

+

AVISO LEGAL SOBRE LAS CONDICIONES DE USO, PRIVACIDAD Y PROTECCIÓN DE DATOS PERSONALES DEL PORTAL DE GOBIERNO ABIERTO

+

Página de información sobre las condiciones de uso, privacidad y protección de datos personales.

-

Soluciones a problemas técnicos (FAQ)

-

Te presentamos una lista de las soluciones a los problemas y dudas técnicas más frecuentes del Portal de Gobierno Abierto. Si esto no resuelve tu problema, puedes llamar al 010 (o a su versión grauita 915298210) o acercarte a cualquiera de las 26 Oficinas de Atención al Ciudadano que tienes en Madrid.

+

Preguntas Frecuentes (FAQ)

-

No me funciona la verificación de residencia.

-

Comprueba las siguientes posibilidades:

-
    -
  • ¿Has puesto el DNI o documento con todos los caracteres juntos, incluyendo la letra al final?
  • -
  • ¿Estás seguro de que estás empadronado en el municipio de Madrid? (el municipio es geográficamente más pequeño que la Comunidad de Madrid).
  • -
  • Puede que haya algún problema en el registro de empadronamiento con tus datos. Por favor llama al 010 (o a su versión grauita 915298210) y confirma que tu información de Padrón es correcta.
  • -
  • Si todo lo anterior no soluciona el problema, puedes acercarte a cualquiera de las 26 Oficinas de Atención al Ciudadano que hay por todo Madrid, y te lo resolverán en el acto.
  • -
+

Pregunta frecuente 1

+

Texto de respuesta para la pregunta frecuente 1.

-

No estoy empadronado en Madrid ¿por qué no puedo participar?

-

El apoyo y votación de propuestas está limitado a la gente empadronada en Madrid, ya que se trata de tomar decisiones que afectarán al municipio y a los que viven en él, y por tanto nos parece que son ellos los que tienen que tomar la decisión final. Es cierto que hay personas que no están empadronadas en Madrid y que aun así les pueden afectar esas decisiones, pero el Padrón es el censo más amplio del que disponemos que nos permite que el proceso de participación sea seguro y lleguemos al máximo posible de personas. No obstante, sí que es posible participar aunque no se esté empadronado. La sección de debates está abierta a todo el mundo, y también es posible lanzar una propuesta, o comentar las propuestas existentes sin necesidad de estar empadronado. Sólo la decisión sobre las propuestas (apoyos y votaciones) están limitadas a la gente empadronada.

+

Pregunta frecuente 2

+

Texto de respuesta para la pregunta frecuente 2.

-

¿Para qué sirve verificar mi cuenta? ¿qué es esto de la carta con un código que me vais a mandar?

-

Para usar la web necesitamos una cuenta de usuario, que podrá hacer más o menos cosas según esté más o menos verificada:

-
    -
  • Si nos registramos en la web con nuestro correo electrónico y no damos ningún dato más (no hacemos el proceso de verificación de residencia) podremos:
  • -
- -

Participar en debates

-

Crear propuestas

- -
    -
  • Si despues de registrarnos realizamos la verificación básica (a través de la web consiste en verificar la residencia y dar un móvil para que nos manden un código de confirmación; ver información detallada del proceso en la sección "¿Cómo creo y verifico mi cuenta?" será posible:
  • -
- -

Participar en debates

-

Crear propuestas

-

Apoyar propuestas

- -
    -
  • Si realizamos la verificación completa de nuestra cuenta (esto se puede realizar presencialmente en cualquiera de las 26 Oficinas de Atención al Ciudadano que hay por todo Madrid, o después de realizar la verificación básica pulsando en el enlace "Solicitar una carta por correo postal" que nos mandará a casa una carta con un código y unas instrucciones muy sencillas para terminar de verificarnos completamente) nos será posible realizar todas las acciones:
  • -
- -

Participar en debates

-

Crear propuestas

-

Apoyar propuestas

-

Votar propuestas

- -

Recuerda que la votación de propuestas es un proceso muy concreto que sólo ocurre durante una semana una vez las propuestas han llegado al 2% de apoyos, por lo tanto por lo general será posible realizar todas las acciones en la web con la verificación básica de nuestra cuenta.

- -

También es importante recalcar que podemos crear y verificar completamente nuestra cuenta sin pasar por Internet, realizando el proceso completamente de manera presencial en cualquiera de las 26 Oficinas de Atención al Ciudadano que hay por todo Madrid. - -

¿Necesito teléfono móvil o acceso a Internet para poder participar?

-

No. Todas las acciones relacionadas con las propuestas, tanto crearlas, como apoyarlas, votarlas o informarnos sobre ellas, es algo que podemos hacer presencialmente en cualquiera de las 26 Oficinas de Atención al Ciudadano que hay por todo Madrid, simplemente presentando nuestro DNI, pasaporte o tarjeta de residencia (recuerda que para apoyar o votar propuestas es necesario estar empadronado en Madrid). Además podremos presentar hojas de firmas para apoyar una propuesta concreta. También podremos crearnos una cuenta de usuario completamente verificada, en caso de que optemos en algún momento por utilizar la web directamente. -

- -

¿Cómo creo y verifico mi cuenta?

-
    -
  • Lo primero es crear una cuenta básica. Para ello hacemos clic en el enlace Registrarse y rellenamos los datos que nos piden. Es un requisito marcar la casilla de aceptación de las condiciones de uso. Al crear una cuenta nos llegará un correo electrónico a la dirección que hayamos especificado, y tendremos que hacer click en el enlace que contiene (el enlace que pone "Confirmar mi cuenta") para terminar de crear la cuenta.
  • -
  • Una vez creada la cuenta básica, y tras entrar con nuestro correo y contraseña, el sistema nos dará la opción de realizar una verificación básica de la misma. Tanto este paso como el siguiente se pueden realizar presencialmente en cualquiera de las 26 Oficinas de Atención al Ciudadano que hay por todo Madrid. Si preferimos hacerlo a través de la web, hacemos click en el enlace "Mi cuenta" de la parte superior derecha, y luego en el botón "Verificar mi cuenta". Lo primero que se nos pedirá es que introduzcamos nuestros datos de residencia, para verificar que estamos empadronados en el municipio de Madrid (es importante introducir el número de documento con la letra; y marcar la casilla de aceptación de acceso al Padrón). Si los datos son correctos, se nos pedirá un teléfono móvil para mandarnos un código de confirmación, que introduciremos en la siguiente página que se nos presente. Este móvil no se utilizará para contactarnos ni para enviarnos nada en ningún momento, sólo es una medida de seguridad. Si preferimos no dar ningún teléfono móvil, podemos realizar el proceso sin necesidad de él en las Oficinas de Atención al Ciudadano, como comentamos anteriormente. Una vez introducido correctamente el código de confirmación, nuestra cuenta nos permitirá apoyar propuestas.
  • -
  • Para poder acceder a las votaciones finales de las propuestas, tendremos que verificar completamente nuestra cuenta. No obstante recuerda que la votación de propuestas es un proceso muy concreto que sólo ocurre durante una semana una vez las propuestas han llegado al 2% de apoyos, por lo tanto por lo general será posible realizar todas las acciones en la web con la anterior verificación básica de nuestracuenta. Para verificar completamente nuestra cuenta, podemos hacerlo presencialmente en cualquiera de las 26 Oficinas de Atención al Ciudadano, o bien a través de la web entrando con nuestro correo y contraseña, hacer clic en el enlace "Mi cuenta" de la parte superior derecha, pulsar el botón "Finalizar verificación", y finalmente hacer click en "Solicitar el envío de un correo postal". Una vez solicitado, nos llegará a nuestra dirección de empadronamiento una carta, con un código de seguridad y unas sencillas instrucciones para realizar la verificación.
  • -
- -

¿Cómo puedo enviar una propuesta al Ayuntamiento? ¿Puedo mandaros directamente mi propuesta a alguno de los correos electrónico que aparecen en la web de participación?

-

El camino correcto para hacer una propuesta es añadirla uno mismo directamente en la web de participación dentro de la sección "Propuestas" (para ello es necesario primero crear una cuenta haciendo click en el enlace Registrarse, y una vez creada, hacer click en el botón "Crear propuesta" de la sección "Propuestas"), o presencialmente a través de cualquiera de las 26 Oficinas de Atención al Ciudadano que hay por todo Madrid. En caso de que lo que queremos presentar sea una sugerencia o reclamación, la información para presentarlas se encuentra en esta página. - -

Hay muchas propuestas parecidas, ¿no se podrían unificar?

-

En breve implementaremos una nueva funcionalidad de la web que permitirá marcar propuestas similares como tales, y que se muestren al visualizar cualquiera de ellas. De esta forma la gente podrá decidir cuál de ellas apoyar tras compararlas, y ayudará a que no se dispersen tanto los apoyos y no se repitan tanto las mismas propuestas. También implementaremos un sistema que cuando creemos nuestra propuesta nos mostrará propuestas similares, por si la idea que queremos lanzar ya existiera en el portal de participación.

- -

Sobre la posibilidad de unificar propuestas, lo que pueden parecer pequeñas diferencias entre dos propuestas similares, pueden marcar grandes diferencias a la hora de hacerlas realidad. Por ello hay personas que pueden querer apoyar una de ellas y no otras. Es por eso que debemos respetar los apoyos particulares que haya dado la gente, y no unificar las propuestas. Esto es independiente de que los autores de las propuestas quieran unirlas. Una vez las propuestas están recibiendo apoyos pasan a ser tanto de la gente que las apoya como de sus autores.

- -

Me he olvidado de mi contraseña o no me funciona ¿qué puedo hacer?

-
    -
  • Puedes hacer solicitar un nueva contraseña para que se te envíe una nueva contraseña a tu correo electrónico.
  • -
  • Si la anterior solución no funcionan, puedes acercarte a cualquiera de las 26 Oficinas de Atención al Ciudadano que hay por todo Madrid, donde te resolverán el problema presencialmente solucionando el problema asociado a tu cuenta o creándote una cuenta nueva.
  • -
- -

No consigo crear mi cuenta correctamente.

- - -

¿Cómo puedo cambiar mi correo electrónico, mi nombre de usuario, mi contraseña, darme de baja o activar/desactivar las notificaciones que me llegan al correo electrónico?

-

Haz click en el enlace "Entrar", introduce tu correo electrónico y tu contraseña, y pulsa el botón "Entrar". Una vez hecho esto, haz click en el enlace "Mi cuenta" donde encontrarás todas las opciones que te permitirán cambiar tu correo electrónico, nombre de usuario, contraseña, darte de baja o activar/desactivar las notificaciones. Una vez realizado el cambio adecuado asegúrate de hacer click en el botón "Guardar cambios".

+

Pregunta frecuente 3

+

Texto de respuesta para la pregunta frecuente 3.

diff --git a/app/views/pages/opendata.html.erb b/app/views/pages/opendata.html.erb index 496ae5938..aeee6b465 100644 --- a/app/views/pages/opendata.html.erb +++ b/app/views/pages/opendata.html.erb @@ -1,13 +1,10 @@ <% provide :title do %><%= t('pages.titles.opendata') %><% end %> -
-
+
+

<%= t("pages.opendata.title") %>

-

<%= t("pages.opendata.slogan_html") %>

- <%= link_to t("pages.opendata.go_old"), t("layouts.header.external_link_opendata_url"), - title: t('shared.target_blank_html'), - target: "_blank", class: "button" %> +

<%= t("pages.opendata.slogan") %>

@@ -15,9 +12,3 @@
- -
-
-

<%= t('pages.while_unfinished_html') %>

-
-
diff --git a/app/views/pages/participation.html.erb b/app/views/pages/participation.html.erb index 5e274986c..9d92140fb 100644 --- a/app/views/pages/participation.html.erb +++ b/app/views/pages/participation.html.erb @@ -6,79 +6,41 @@
  • I. Participación
  • II. Transparencia
  • -

    Participación y Transparencia en Madrid - Próximas novedades

    +

    Participación y Transparencia

    -

    Desde el nuevo gobierno del Ayuntamiento de Madrid ponemos en marcha un nuevo proyecto de participación y transparencia, desarrollado a través de la recién creada área de gobierno: Participación Ciudadana, Transparencia y Gobierno Abierto. El objetivo de este nuevo proyecto es claro: que los madrileños puedan decidir directamente la política de la ciudad, y que todo lo que ocurra en el Ayuntamiento, hasta el último rincón, esté a la vista de todos.

    - -

    Este nuevo área de gobierno también es la encargada de la atención al ciudadano, de las sugerencias y reclamaciones, de la evaluación y calidad de las políticas y gestión del Ayuntamiento, de la administración electrónica y otros temas relacionados con la relación entre ciudadanía e institución.

    - -

    Iremos publicando nuestros avances, las novedades y cualquier otra cosa que queramos compartir con vosotros en relación con el proyecto en nuestro blog.

    - -

    Podéis escribirnos para lo que queráis a ag.gobiernoabierto@madrid.es

    - -

    A continuación os presentamos algunas de las principales novedades que tenemos planeadas poner en marcha en relación con el proyecto de participación y transparencia, aparte de las que vayamos diseñando o se nos vayan proponiendo durante la legislatura:

    +

    Página de información sobre Participación y Transparencia.

    I. Participación.

    +
      -
    • I.1. Propuestas ciudadanas. Un espacio que permite que entre todos decidamos qué debe ser Madrid. Cualquiera puede presentar propuestas, que en caso de que sean aceptadas mayoritariamente se llevarán a cabo por parte del Ayuntamiento. Debate, propón, decide.
    • - -
    • I.2. Presupuestos participativos. Parte del presupuesto de inversión del Ayuntamiento (el que no está comprometido ya con necesidades básicas como pueden ser los servicios sociales o las emergencias), será reservado para ser decidido su uso por la ciudadanía. La gente hará propuestas, se tasarán las más apoyadas, y luego los ciudadanos decidirán en cuáles de esos proyectos priorizar el presupuesto reservado.
    • - -
    • I.3. Legislacion colaborativa. A través de diferentes fases de participación, la ciudadanía tendrá un papel fundamental colaborando directamente en la elaboración de las propuestas, reglamentos, decretos o cualquier otro tipo de trabajo político desarrollado por el gobierno municipal. Una participación real desde el principio al fin del proceso legislativo, desde decidir los expertos en la materia hasta revisar el texto final.
    • - -
    • I.4. Co-gobierno ciudadano. Mediante este sistema la ciudadanía podrá decidir las líneas prioritarias de actuación del Ayuntamiento a medio plazo.
    • - -
    • I.5. Participación sectorial. La participación ciudadana se va a tratar de manera transversal en todas las áreas de gobierno del Ayuntamiento, afectando a todos los procesos que se lleven a cabo. Un ejemplo de esto es el proceso de auditoría ciudadana de la deuda, que llevaremos a cabo con el Área de Gobierno de Economía y Hacienda.
    • - -
    • I.6. Inclusión, neutralidad y privacidad. Una de las misiones principales del área será velar por la inclusión de todo el mundo en los procesos participativos, para que todas las voces y voluntades formen parte de ellos y no se quede nadie fuera. Para ello, desarrollaremos una mesa de inclusión a la que invitaremos a todos los expertos, colectivos y asociaciones que trabajen con colectivos excluidos, para diseñar las maneras adecuadas de superar estas brechas. La protección de la participación se complementará con la protección de la neutralidad y privacidad en todos los procesos, para asegurar su legitimidad y confianza.
    • - -
    • I.7. Innovación social. Pretendemos crear un entorno que movilice la inteligencia colectiva existente en favor de una ciudad más hospitalaria e inclusiva. Espacios donde la sociedad se hable y piense con la administración, con la convicción de que son los ciudadanos quienes mejor conocen sus problemas, y es en lo colectivo donde están los expertos que pueden hallar las soluciones.
    • +
    • I.1. Participación. Información sobre Participación
    • +
    • I.1. Participación. Información sobre Participación
    • +
    • I.1. Participación. Información sobre Participación
    +

    II. Transparencia

    +
      -
    • II.1. Ordenanza de transparencia - Este ayuntamiento cree en la transparencia como medio para conseguir objetivos claves para el desarrollo de la democracia. En la práctica, el derecho de acceso a la información tiene un efecto disuasorio y preventivo sobre la corrupción. Además tiene un impacto directo sobre los derechos democráticos más esenciales como es el derecho a la participación, desde su concepción más básica como es votar en las elecciones, el derecho a una prensa libre e independiente o sobre todo nuestro derecho a obtener o a exigir una rendición de cuentas completa de lo público.
      - El Ayuntamiento de Madrid se propone aprobar una norma de transparencia que incluya los principios más avanzados en esta materia y que incluya la obligación de las instituciones públicas hacer pública, reactiva o proactivamente, toda la información, registrada, archivada, elaborada, recibida o en posesión de las autoridades públicas sea cual sea el formato. Se trata de explicar todo lo que afecte a una decisión sobre lo público: qué se hace, quién lo hace, por qué se hace, cómo se hace y cuánto cuesta. Además esta información debe ser publicada en formatos abiertos que la hagan más accesible y reutilizable por cualquiera.
    • - -
    • II.2. Portal de transparencia - En cumplimiento de la Ley 19/2013 de Transparencia, Acceso a la Información y Buen Gobierno, y de su futura implementación en una Ordenanza Municipal en Madrid, el Ayuntamiento de Madrid plantea el desarrollo y mejora del Portal de la Transparencia. El Ayuntamiento no se limitará a cumplir con las obligaciones que se adquieran cuando entre en vigor la ley 19/2013 sino que aprobará mediante su Ordenanza las obligaciones y derechos que posibiliten la publicación de una lista de la información más ambiciosa que debe encontrarse en el Portal de transparencia del Ayuntamiento siguiendo los mandatos legales.
      - El objetivo de esta mejora es no solo la publicación de un mayor volumen de información sino también la publicación de esta información en formatos que la hagan más accesible y fácil de entender para los ciudadanos.
    • - -
    • II.3. Datos abiertos - El Ayuntamiento tiene como objetivo compartir todos los datos que tienen en su poder en formatos abiertos y fomentar su reutilización por parte de la sociedad. El objetivo por tanto es doble, por un lado se trabajará en la mejora del portal de datos, en aumentar la cantidad, la calidad y la frecuencia en la publicación de datos, y por otro lado se abrirán canales de colaboración para promover las aplicaciones y los usos que resulten de la reutilización de los datos.
    • - -
    • II.4. Agendas públicas - En el moderno proceso de toma de decisiones por los responsables políticos, la publicación de las agendas de los cargos públicos es una medida fundamental para garantizar la transparencia de las instituciones. De esta forma, la ciudadanía puede tener una idea clara de quiénes participan en el proceso de toma de decisiones.
      - Esta necesidad de publicidad viene refrendada por destacados organismos internacionales, como el Grupo de Estados Contra la Corrupción del Consejo de Europa (GRECO), que la señala como uno de los estándares internacionales a tener en cuenta para incorporar al sistema parlamentario español; o la Organización para la Cooperación y el Desarrollo Económico (OCDE) que, en junio de 2013, destacaba que "en el despertar de una crisis global donde la protección del interés público ha sido cuestionada de forma mundial, hay una creciente necesidad de valorar el progreso alcanzado para garantizar un proceso de toma de decisiones abierto, balanceado y con un público informado".
      - En línea con este espíritu de apertura, y con la decidida voluntad de que exista fluidez en la información, se considera necesario hacer públicas las agendas de los Concejales como inicio de una política de transparencia y rendición de cuentas en el Ayuntamiento de Madrid, de forma que sea posible saber qué trabajo realizan los miembros del gobierno municipal y qué colectivos o circunstancias pueden tener repercusión en las decisiones que se toman.
      - Ya se pueden consultar las agendas de los concejales pero el Ayuntamiento está trabajando en una aplicación mejor que permita encontrar las reuniones más fácilmente.
    • - -
    • II.5. Transparencia del Lobby - Con el objetivo de hacer el proceso de toma de decisiones del Ayuntamiento de Madrid un proceso lo más transparente posible, se propone la creación de un registro de lobbies que obligue a todas las personas que quieran reunirse con el Gobierno para ejercer influencia sobre los asuntos públicos a estar registrada en el mismo. El objetivo de este registro es conocer a qué intereses representan las personas que se reúnen con los representantes públicos.
    • +
    • II.1. Transparencia Información sobre Transparencia
    • +
    • II.1. Transparencia Información sobre Transparencia
    • +
    • II.1. Transparencia Información sobre Transparencia
    - diff --git a/app/views/pages/participation_facts.html.erb b/app/views/pages/participation_facts.html.erb index 579638028..9a52f6a6c 100644 --- a/app/views/pages/participation_facts.html.erb +++ b/app/views/pages/participation_facts.html.erb @@ -1,13 +1,9 @@
    -
    +
    <%= render "shared/back_link" %>

    Hechos sobre participación ciudadana y democracia directa

    -
    - -
    -

    La democracia directa produce gente más informada y con más cultura política.

    El poner en marcha mecanismos de participación reales hace que la gente se preocupe por las decisiones que tiene que tomar, y que por lo tanto se informe sobre ellas. Esto se observa sistemáticamente al comparar diferentes regiones de un mismo país con diferentes grados de democracia directa, o en procesos particulares como por ejemplo la votación del Tratado por una Constitución para Europa, comparando los países que lo votaron en referéndum y los que no.

    En ocasiones se argumenta que no se deben crear mecanismos de decisión ciudadana, porque un posible bajo nivel cultural o de conocimiento político haría que se tomaran malas decisiones. Esto se ha argumentado tradicionalmente en contra del voto femenino, del voto inmigrante, del voto de la gente sin renta, etc. pero lo que se ha demostrado es que permitir a toda esa gente decidir ha sido precisamente lo que ha permitido que escaparan de su situación de desigualdad cultural y de derechos, o al menos que la mejoraran considerablemente.

    diff --git a/app/views/pages/participation_world.html.erb b/app/views/pages/participation_world.html.erb index 57ad94c7b..38ab0275d 100644 --- a/app/views/pages/participation_world.html.erb +++ b/app/views/pages/participation_world.html.erb @@ -10,13 +10,13 @@

    Participación ciudadana directa en el mundo

    -

    En el mundo existen sistemas de participación ciudadana muy similares al que vamos a implementar en Madrid, que llevan funcionando desde hace más de cien años y en países muy diferentes. La experiencia larga y variada de dichos sistemas demuestra que lo que ponemos en marcha en Madrid tendrá un impacto muy positivo en la sociedad, como ha tenido en esos otros países.

    +

    En el mundo existen sistemas de participación ciudadana que llevan funcionando desde hace más de cien años y en países muy diferentes. La experiencia larga y variada de dichos sistemas demuestra el impacto muy positivo en la sociedad que ha tenido en esos otros países.

    Además de los ejemplos clásicos, como Suiza, asistimos a un desarrollo muy fuerte de los sistemas de participación ciudadana en todo el mundo, en particular en los últimos años, gracias especialmente a las nuevas posibilidades que nos brinda Internet. Islandia, Finlandia, Brasil, Estados Unidos, son algunos de los países que más están apostando por una participación directa de la ciudadanía en la toma de decisiones.

    La nueva ola global de participación ciudadana

    -

    Las nuevas formas de participación se están dirigiendo principalmente a que sean la ciudadanía quien decida qué caminos debe tomar la política de su país, a través de mecanismos de iniciativas ciudadanas. Finlandia es uno de los países donde se están desarrollando nuevas herramientas similares al nuevo portal de gobierno abierto de Madrid. Su plataforma Open Ministry permite a la población presentar y apoyar propuestas, y ha conseguido por ejemplo que se apruebe gracias a él la ley de matrimonio igualitario. Islandia también ha tenido una gran repercusión desde 2011, cuando lanzaron su plataforma Better Reykjavik, que ha permitido que el 58% de la población participe en el proceso de propuestas, seleccionando cada mes las 15 ideas más votadas.

    +

    Las nuevas formas de participación se están dirigiendo principalmente a que sean la ciudadanía quien decida qué caminos debe tomar la política de su país, a través de mecanismos de iniciativas ciudadanas. Finlandia es uno de los países donde se están desarrollando nuevas herramientas similares al nuevo portal de gobierno abierto. Su plataforma Open Ministry permite a la población presentar y apoyar propuestas, y ha conseguido por ejemplo que se apruebe gracias a él la ley de matrimonio igualitario. Islandia también ha tenido una gran repercusión desde 2011, cuando lanzaron su plataforma Better Reykjavik, que ha permitido que el 58% de la población participe en el proceso de propuestas, seleccionando cada mes las 15 ideas más votadas.

    Estonia es uno de los países que gracias a una apuesta clara por las nuevas tecnologías, ha podido situarse en cabeza de Europa en el nivel de uso por parte de la ciudadanía de Internet para la interacción con el gobierno. No sólo los ciudadanos y ciudadanas resuelven diariamente todos sus trámites a través de Internet, sino que han puesto en marcha plataformas como Rahvakogu, donde después de los escándalos políticos de 2012, 50.000 personas (de un total de 1.3 millones) participaron proponiendo medidas para mejorar la situación democrática del país.

    diff --git a/app/views/pages/privacy.html.erb b/app/views/pages/privacy.html.erb index d78961d88..3ecbc0a4b 100644 --- a/app/views/pages/privacy.html.erb +++ b/app/views/pages/privacy.html.erb @@ -7,13 +7,13 @@

    AVISO DE PROTECCIÓN DE DATOS

      -
    1. La navegación por la informacion disponible en el Portal de Gobierno Abierto del Ayuntamiento de Madrid es anónima.
    2. -
    3. Para utilizar los servicios contenidos en el Portal de Gobierno Abierto del Ayuntamiento de Madrid el usuario deberá darse de alta y proporcionar previamente los datos de carácter personal segun la informacion especifica que consta en cada tipo de alta.
    4. -
    5. Los datos aportados serán incorporados y tratados por el Ayuntamiento de Madrid de acuerdo con la descripción del fichero siguiente: +
    6. La navegación por la informacion disponible en el Portal de Gobierno Abierto es anónima.
    7. +
    8. Para utilizar los servicios contenidos en el Portal de Gobierno Abierto el usuario deberá darse de alta y proporcionar previamente los datos de carácter personal segun la informacion especifica que consta en cada tipo de alta.
    9. +
    10. Los datos aportados serán incorporados y tratados por el Ayuntamiento de acuerdo con la descripción del fichero siguiente:
        -
      • Nombre del fichero/tratamiento: GESTIÓN DE PROCESOS PARTICIPATIVOS
      • +
      • Nombre del fichero/tratamiento: NOMBRE DEL FICHERO
      • Finalidad del fichero/tratamiento: Gestionar los procesos participativos para el control de la habilitación de las personas que participan en los mismos y recuento meramente numérico y estadístico de los resultados derivados de los procesos de participación ciudadana
      • -
      • Órgano responsable: DIRECCIÓN GENERAL DE PARTICIPACIÓN CIUDADANA (c/ Alcalá 45, 28014-Madrid)
      • +
      • Órgano responsable: ÓRGANO RESPONSABLE
    11. El interesado podrá ejercer los derechos de acceso, rectificación, cancelación y oposición, ante el órgano responsable indicado todo lo cual se informa en el cumplimiento del artículo 5 de la Ley Orgánica 15/1999, de 13 de diciembre, de Protección de Datos de Carácter Personal.
    12. diff --git a/app/views/pages/proposals_info.html.erb b/app/views/pages/proposals_info.html.erb index ffe0eec32..09bf8585e 100644 --- a/app/views/pages/proposals_info.html.erb +++ b/app/views/pages/proposals_info.html.erb @@ -3,9 +3,7 @@ <%= render "shared/back_link" %>
    @@ -14,88 +12,17 @@

    El mecanismo de propuestas ciudadanas se resume en cuatro pasos muy sencillos:

    1. ¡Propones! Creas una propuesta en esta web.
    2. -
    3. ¡Apoyas! La gente hace click en el botón de apoyar tu propuesta (necesitas el apoyo del 2% de los empadronados mayores de 16 años para pasar a la siguiente fase).
    4. -
    5. ¡Decides! Si has conseguido suficientes apoyos, dejamos 45 días para que la gente pueda debatir sobre la propuesta, y después durante una semana se invita a toda la gente de Madrid a decidir si están a favor o en contra de tu propuesta, en esta misma web.
    6. -
    7. ¡Se hace! Si hay más gente a favor de tu propuesta que en contra, el gobierno del Ayuntamiento de Madrid asumirá como propia la propuesta y la llevará a cabo.
    8. +
    9. ¡Apoyas! La gente hace clic en el botón de apoyar tu propuesta (necesitas el apoyo del 2% de los empadronados mayores de 16 años para pasar a la siguiente fase).
    10. +
    11. ¡Decides! Si has conseguido suficientes apoyos, dejamos 45 días para que la gente pueda debatir sobre la propuesta, y después durante una semana se invita a toda la gente empadronada a decidir si están a favor o en contra de tu propuesta, en esta misma web.
    12. +
    13. ¡Se hace! Si hay más gente a favor de tu propuesta que en contra, el gobierno del Ayuntamiento asumirá como propia la propuesta y la llevará a cabo.
    -

    Además no hace falta ni que tengas Internet, todos los pasos se pueden hacer en cualquiera de las 26 Oficinas de Atención al Ciudadano que hay por todo Madrid.

    - -
    - -
    -

    Explicación detallada del proceso

      -
    1. Creación de una propuesta. Cualquier persona (sin necesidad siquiera de estar empadronada en Madrid) puede crear una propuesta. Lo único que hay que hacer es pulsar el botón “Crear una propuesta” y rellenar los campos requeridos. La propuesta puede ser tan sencilla como una simple frase, pero te recomendamos detallarla todo lo posible, incluso añadiendo material adicional, para que sea más completa e interesante. Una vez creada aparecerá en esta web para que cualquiera pueda apoyarla.
    2. -
    3. Apoyo de propuestas. Para apoyar una de las propuestas que aparece en la web, pulsamos el botón “apoyar esta propuesta” que aparece en cada una. Para este paso tendremos que estar empadronados en Madrid, así que al llevarlo a cabo por primera vez se nos pedirá que verifiquemos nuestra cuenta para estar seguros de este requerimiento. Se nos va a pedir que introduzcamos algunos datos para comprobar nuestra información de empadronamiento, y se nos enviará un código personal para que el proceso sea seguro. Las propuestas necesitan una cierta cantidad de apoyos para pasar a la siguiente fase; concretamente el 2% de los empadronados mayores de 16 años (que suponen 53.726 apoyos).
    4. -
    5. Decisión sobre propuestas. Cuando una propuesta consigue los apoyos necesarios, se anuncia en la web. Desde ese momento se dejan 45 días para que todo el mundo pueda debatir e informarse sobre la propuesta. Todas las otras propuestas que hayan conseguido los apoyos necesarios en los primeros 30 días del tiempo de debate se agruparán junto a la primera para decidir sobre ellas al mismo tiempo. Pasados los 45 días se exponen estas propuestas en un espacio especial de votación de la web, donde durante una semana cualquier persona empadronada en Madrid y mayor de 16 años podrá decidir si está a favor o rechaza la propuesta. Para participar en este paso tendrás que tener tu cuenta de usuario verificada completamente, de tal forma que nos aseguremos que cada persona no tiene más de una cuenta y el proceso es seguro.
    6. -
    7. Realización de las propuestas. En caso de que haya más gente a favor de una propuesta que rechazándola se aceptará como propuesta colectiva de la ciudadanía de Madrid, y el gobierno del Ayuntamiento de Madrid la asumirá como propia y la llevará a cabo. Para ello en un plazo máximo de un mes, se realizarán los informes técnicos correspondientes sobre su legalidad, viabilidad y coste económico, teniendo en cuenta a los sectores afectados y a la persona que haya lanzado la propuesta, para detallar la actuación correspondiente por parte del Ayuntamiento. Se publicarán en la web todos los informes realizados, y un seguimiento de las actuaciones que se lleven a cabo, para asegurar un correcto desarrollo de la propuesta.
    8. +
    9. Creación de una propuesta. Cualquier persona (sin necesidad siquiera de estar empadronada) puede crear una propuesta. Lo único que hay que hacer es pulsar el botón “Crear una propuesta” y rellenar los campos requeridos. La propuesta puede ser tan sencilla como una simple frase, pero te recomendamos detallarla todo lo posible, incluso añadiendo material adicional, para que sea más completa e interesante. Una vez creada aparecerá en esta web para que cualquiera pueda apoyarla.
    10. +
    11. Apoyo de propuestas. Para apoyar una de las propuestas que aparece en la web, pulsamos el botón “apoyar esta propuesta” que aparece en cada una. Para este paso tendremos que estar empadronados, así que al llevarlo a cabo por primera vez se nos pedirá que verifiquemos nuestra cuenta para estar seguros de este requerimiento. Se nos va a pedir que introduzcamos algunos datos para comprobar nuestra información de empadronamiento, y se nos enviará un código personal para que el proceso sea seguro. Las propuestas necesitan una cierta cantidad de apoyos para pasar a la siguiente fase; concretamente el 2% de los empadronados mayores de 16 años.
    12. +
    13. Decisión sobre propuestas. Cuando una propuesta consigue los apoyos necesarios, se anuncia en la web. Desde ese momento se dejan 45 días para que todo el mundo pueda debatir e informarse sobre la propuesta. Todas las otras propuestas que hayan conseguido los apoyos necesarios en los primeros 30 días del tiempo de debate se agruparán junto a la primera para decidir sobre ellas al mismo tiempo. Pasados los 45 días se exponen estas propuestas en un espacio especial de votación de la web, donde durante una semana cualquier persona empadronada y mayor de 16 años podrá decidir si está a favor o rechaza la propuesta. Para participar en este paso tendrás que tener tu cuenta de usuario verificada completamente, de tal forma que nos aseguremos que cada persona no tiene más de una cuenta y el proceso es seguro.
    14. +
    15. Realización de las propuestas. En caso de que haya más gente a favor de una propuesta que rechazándola se aceptará como propuesta colectiva de la ciudadanía, y el gobierno del Ayuntamiento la asumirá como propia y la llevará a cabo. Para ello en un plazo máximo de un mes, se realizarán los informes técnicos correspondientes sobre su legalidad, viabilidad y coste económico, teniendo en cuenta a los sectores afectados y a la persona que haya lanzado la propuesta, para detallar la actuación correspondiente por parte del Ayuntamiento. Se publicarán en la web todos los informes realizados, y un seguimiento de las actuaciones que se lleven a cabo, para asegurar un correcto desarrollo de la propuesta.
    - -

    Todas las acciones relacionadas con el proceso de propuestas ciudadanas pueden realizarse a través del portal de gobierno abierto, o presencialmente en cualquiera de las 26 Oficinas de Atención al Ciudadano existentes en Madrid.

    - -

    El proceso de recogida de apoyos de una propuesta puede realizarse también a través de hojas de firmas, cuyo modelo puede ser descargado en este documento PDF. Los apoyos recogidos de esta manera se sumarán a los apoyos ya existentes en el portal de gobierno abierto. Las hojas pueden ser entregadas en cualquiera de los Registros del Ayuntamiento, presentes en cada una de las Juntas de Distrito. Ver la lista completa de Oficinas de Registro.

    - -

    Las directrices aprobadas por el Ayuntamiento por las que se regulan las propuestas ciudadanas son las siguientes: Directrices sobre el derecho de propuesta (documento PDF).

    - -

    Preguntas Frecuentes

    -
      -
    1. ¿Cuáles son los requisitos que se solicitan para poder apoyar o votar propuestas?
      - Estar empadronado en Madrid y ser mayor de 16 años. En caso de que se haga a través de Internet se requerirá que se haya verificado la cuenta de usuario de la web (encontramos el botón de verificación en el apartado “Mi cuenta” en la esquina superior derecha), proporcionando la información del padrón, y un medio de comunicación para obtener un código seguro de participación que introduciremos en la web para validar nuestra cuenta. -
    2. - -
    3. ¿Cómo va a controlarse que cada persona vote una única vez por propuesta?
      - Las votaciones presenciales en las Oficinas de Atención al Ciudadano están controladas porque la persona tiene que presentar su DNI. Para la votación a través de Internet se verifica que la cuenta de usuario corresponde a un único ciudadano/a. Para ello se le facilita un código personal seguro de verificación de la cuenta que se comunica a través de canales de comunicación privados, como son teléfonos móviles que constan en el Ayuntamiento que pertenecen a la persona adecuada, o por correo a través del buzón que figura en la dirección de empadronamiento. De esta forma nos aseguramos de que sólo esa persona ha recibido el código. En caso de que dichos medios de comunicación no estén disponibles se solicitará a la persona que acuda presencialmente a alguna de las Oficinas de Atención al Ciudadano, para obtener su código. -
    4. - -
    5. ¿Se llevará a cabo cualquier propuesta que se acepte por mayoría en la web? ¿incluso aunque sean ilegales o atenten contra los derechos humanos? ¿y si no hay presupuesto para llevarla a cabo?
      - Se establecen una serie de criterios objetivos por los que una propuesta no podrá ser aceptada como, por ejemplo, que tenga fines delictivos o que atente contra derechos fundamentales y libertades públicas. Además se excluyen del proceso las propuestas sobre otras modalidades de participación tales como presupuestos participativos, procesos revocatorios, audiencia pública o iniciativas normativas populares. -
      Este mecanismo de participación no cambia los límites ya existentes para el Ayuntamiento, lo que hace es trasladar quién toma la decisión de lo que haya que hacer, incluyendo a toda la ciudadanía en el proceso de toma de decisiones. -
      En el caso de las propuestas que quedan fuera de las competencias municipales el Ayuntamiento no podrá llevarlas a cabo, pero emprenderá actuaciones alternativas dentro de sus capacidades que intenten cumplir con la decisión de la propuesta. Lo mismo sucede con el presupuesto para llevar a cabo la propuesta; el ayuntamiento utilizará los recursos necesarios en cuanto sea posible, de la misma manera que se costean las decisiones adoptadas sin participación ciudadana. -
      También puede ocurrir que la actuación requiera la aprobación del Pleno, por lo que el resultado dependerá del posicionamiento de todas las fuerzas políticas respecto a la actuación presentada.
    6. - -
    7. ¿Qué diferencia existe entre los debates y las propuestas?
      - Aunque ambos pueden ser apoyados, los primeros no activan ningún mecanismo de actuación concreto, mientras que las segundas pasan a una fase de decisión colectiva y en caso de que sean aprobadas, son asumidas por el Ayuntamiento.
    8. - -
    9. ¿Vota toda la gente de Madrid en cada propuesta? ¿incluso aunque haga referencia a un único distrito?
      - Sí. El mecanismo actual se desarrolla a nivel de toda la ciudad. Lo que no entra en colisión con que a nivel distrital se puedan desarrollar mecanismos de participación ciudadana que afecten únicamente a cada distrito.
    10. - -
    11. ¿Y si se presentan varias propuestas iguales? ¿Se plantea la posibilidad de unificarlas para evitar que se diversifiquen los apoyos y/o votos?
      - Propuestas similares pueden ser marcadas como tales en la plataforma, lo que se señala al visualizar cada una de ellas. Más allá de eso no se unifican, dejando que sea la gente la que decida si apoyar a una o a otra.
    12. - -
    13. ¿Durante cuanto tiempo se pueden recoger apoyos?
      - Las propuestas pueden recoger apoyos durante 12 meses. Si en ese tiempo no consiguen alcanzar el 2% de los apoyos necesarios dejan de poder recibir más apoyos.
    14. - -
    15. ¿Durante cuanto tiempo se votará cada propuesta?
      - Una vez que las propuestas reciben el apoyo del 2% pasan a la fase de decisión final donde la gente puede votar aceptando o rechazando la propuesta durante un plazo de una semana.
    16. - -
    17. ¿Pueden participar asociaciones, fundaciones y ONG´s? ¿Y empresas?
      - Las propuestas tienen que ser presentadas individualmente, sin problema de que la persona que la presenta represente a una organización de cualquier tipo. Al registrar una propuesta en la web existe la posibilidad de señalar este caso como registro de asociaciones/colectivos.
    18. - -
    19. ¿Cuánta gente tiene que votar una propuesta para que sea aprobada? ¿Qué quórum mínimo se necesita para que las votaciones sean vinculantes?
      - El quórum es el mínimo de participación necesaria para considerar una votación vinculante de manera legal. Ningún reglamento del Ayuntamiento puede hacer que este mecanismo sea vinculante juridicamente, porque eso está en contra de la legislación española. La vinculación con el mecanismo es política y se asume de manera personal por los concejales y la Alcaldesa. Por ello no se considerará ningún quórum.
    20. - -
    21. ¿Existen mecanismos presenciales para participar? ¿Se ha planteado llegar a los ciudadanos y ciudadanas con dificultades de acceso a Internet o en situación de exclusión?
      - Todas las acciones relacionadas con el proceso de propuestas ciudadanas pueden realizarse presencialmente en cualquiera de las 26 Oficinas de Atención al Ciudadano repartidas por todos los distritos de Madrid. Además, el proceso de recogida de apoyos de una propuesta puede realizarse también a través de hojas de firmas, cuyo modelo puede ser descargado en este documento PDF. -
      Adicionalmente se ha creado en el Área de Gobierno de Participación Ciudadana, Transparencia y Gobierno Abierto el Servicio de Inclusión, Neutralidad y Privacidad que pondrá en marcha una mesa de inclusión con personal del Ayuntamiento y asociaciones que trabajan con colectivos en situación de exclusión, para diseñar mecanismos especiales para que puedan participar dichos colectivos.
    22. - -
    23. ¿Cómo puede participar la gente que no esté empadronada en Madrid?
      - Presentando propuestas, participando en los debates, y difundiendo lo que ocurra en la plataforma.
    24. - -
    25. ¿El voto es secreto? ¿el Ayuntamiento podrá tener acceso a los votos de los ciudadanos?
      - El voto es totalmente secreto. Se encripta de manera conjunta con diferentes autoridades externas al Ayuntamiento, de tal manera que para poder conocer la identidad de un votante todas las autoridades tendrían que realizar fraude conjuntamente.
    26. - -
    27. ¿Al ser electrónico el voto no se aumenta el riesgo de fraude? - No, incluso lo reducimos. Hay una sensación subjetiva muy fuerte de diferencia de seguridad entre procesos en papel y procesos electrónicos que no se corresponde con la realidad. En las elecciones generales donde el voto es en papel, después de que las mesas hayan hecho el recuento, las papeletas de los votos se tiran a la basura, y la persona responsable se dirige en persona con el recuento en la mano al centro donde se comparten los datos. Y sin embargo pensemos por ejemplo en el sistema de tarjetas de crédito y cuentas bancarias, donde cada día confiamos la seguridad de nuestro dinero a un sistema electrónico. En el caso del Ayuntamiento, la votación está asegurada mediante diferentes entidades externas, y además cualquier votante puede tanto comprobar que su voto particular está en el recuento final, como realizar el recuento completo de todos los votos por su cuenta. Dos garantías de seguridad completamente imposibles en un votación tradicional.
    28. - -
    29. ¿Cómo se sabe que una propuesta se ha cumplido?
      - Cuando se aprueba una propuesta, el Ayuntamiento publica en la página web cuáles son los pasos que se van a realizar para ponerla en práctica, incluyendo los informes que las correspondientes áreas redacten y las acciones que se emprenden. La información es completa y transparente para que puedas hacer un seguimiento de cómo evoluciona cada propuesta ciudadana.
    30. -
    - -

    Hojas de firmas para recoger apoyos

    -

    El proceso de recogida de apoyos de una propuesta, además de en la web, puede realizarse a través de hojas de firmas, cuyo modelo puede ser descargado en este documento PDF.

    -

    La hoja debe contener en las casillas superiores el código de la propuesta y su título, según figura en la página web específica de la propuesta, dentro del Portal de Gobierno Abierto.

    -

    Los apoyos recogidos de esta manera se sumarán a los apoyos ya existentes en el portal de gobierno abierto. Las hojas pueden ser entregadas en cualquiera de los Registros del Ayuntamiento, presentes en cada una de las Juntas de Distrito. Ver la lista completa de Oficinas de Registro.

    diff --git a/public/maintenance.html b/public/maintenance.html index 059c93782..ebbe5fe28 100644 --- a/public/maintenance.html +++ b/public/maintenance.html @@ -68,7 +68,7 @@
    -

    MadridDecide

    +

    Consul

    Página en mantenimiento

    Por favor, inténtalo de nuevo en unos minutos.

    From 42722080fca946d37c73360a5f247905ef825aac Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Tue, 5 Jul 2016 13:47:14 +0200 Subject: [PATCH 096/126] Changes references to Madrid --- app/mailers/application_mailer.rb | 2 +- .../document_verifications/invalid_document.html.erb | 2 +- app/views/shared/_social_media_meta_tags.html.erb | 2 +- app/views/verification/residence/_errors.html.erb | 2 +- config/deploy-secrets.yml.example | 6 +++--- config/initializers/devise.rb | 2 +- config/locales/mailers.en.yml | 2 +- config/locales/mailers.es.yml | 2 +- config/locales/management.es.yml | 2 +- config/locales/pages.en.yml | 4 +--- config/locales/pages.es.yml | 6 ++---- config/routes.rb | 2 +- lib/sms_api.rb | 2 +- 13 files changed, 16 insertions(+), 20 deletions(-) diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 8838f522f..1dbc5baa2 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,5 +1,5 @@ class ApplicationMailer < ActionMailer::Base helper :settings - default from: "Decide Madrid " + default from: "Consul " layout 'mailer' end diff --git a/app/views/management/document_verifications/invalid_document.html.erb b/app/views/management/document_verifications/invalid_document.html.erb index 58ddb221e..d2b2f22c1 100644 --- a/app/views/management/document_verifications/invalid_document.html.erb +++ b/app/views/management/document_verifications/invalid_document.html.erb @@ -12,6 +12,6 @@

    <%= t("management.document_verifications.has_no_account_html", - link: link_to('http://decide.madrid.es', 'http://decide.madrid.es'), + link: link_to(t('management.document_verifications.link'), root_path)).html_safe, target: "_blank") %>

    diff --git a/app/views/shared/_social_media_meta_tags.html.erb b/app/views/shared/_social_media_meta_tags.html.erb index 5a2efbd04..50a2efec9 100644 --- a/app/views/shared/_social_media_meta_tags.html.erb +++ b/app/views/shared/_social_media_meta_tags.html.erb @@ -1,6 +1,6 @@ - + diff --git a/app/views/verification/residence/_errors.html.erb b/app/views/verification/residence/_errors.html.erb index c19640a3d..dd4112d7c 100644 --- a/app/views/verification/residence/_errors.html.erb +++ b/app/views/verification/residence/_errors.html.erb @@ -6,7 +6,7 @@ <%= t("verification.residence.new.error_verifying_census", offices: link_to( t("verification.residence.new.error_verifying_census_offices"), - "http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD", title: t('shared.target_blank_html'), target: "_blank")).html_safe %> + t("verification.residence.new.error_verifying_census_offices_url"), title: t('shared.target_blank_html'), target: "_blank")).html_safe %>
    <% else %> diff --git a/config/deploy-secrets.yml.example b/config/deploy-secrets.yml.example index 15869cf51..671263b1c 100644 --- a/config/deploy-secrets.yml.example +++ b/config/deploy-secrets.yml.example @@ -1,11 +1,11 @@ staging: deploy_to: "/var/www/consul" ssh_port: 21 - server: staging.consul.madrid.es + server: staging.consul.es user: xxxxx full_app_name: consul - server_name: staging.consul.madrid.es - db_server: postgre.consul.madrid.es + server_name: staging.consul.es + db_server: postgre.consul.es preproduction: deploy_to: "/var/www/consul" diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 2780e30b6..edabf24d4 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -12,7 +12,7 @@ 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@madrid.es' + config.mailer_sender = 'noreply@consul.es' # Configure the class responsible to send e-mails. config.mailer = 'DeviseMailer' diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index f4cdaf563..3fa63f9ec 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -25,7 +25,7 @@ en: hi: "Dear user," new_html: "For all these, we invite you to elaborate a new proposal that ajusts to the conditions of this process. You can do it following this link: %{url}." new_href: "new investment project" - reconsider_html: "If you believe that the rejected proposal meets the requirements to be an investment proposal, you can communicate this, within 48 hours, responding to the email address preparticipativos@madrid.es. Including the code %{code} in the subject of the email." + reconsider_html: "If you believe that the rejected proposal meets the requirements to be an investment proposal, you can communicate this, within 48 hours, responding to the email address examples@consul.es. Including the code %{code} in the subject of the email." sincerely: "Sincerely" signatory: "DEPARTMENT OF PUBLIC PARTICIPATION" sorry: "Sorry for the inconvenience and we again thank you for your invaluable participation." diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index ec6d50dcc..49e3e0796 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -25,7 +25,7 @@ es: hi: "Estimado usuario," new_html: "Por todo ello, te invitamos a que elabores una nueva propuesta que se ajuste a las condiciones de este proceso. Esto lo puedes hacer en este enlace: %{url}." new_href: "nueva propuesta de inversión" - reconsider_html: "Si consideras que la propuesta rechazada cumple los requisitos para mantenerla como propuesta de inversión, podrás comunicarlo, en el plazo de 48 horas, al correo preparticipativos@madrid.es, indicando necesariamente para su tramitación el código %{code} como asunto del correo, correspondiente a tu propuesta." + reconsider_html: "Si consideras que la propuesta rechazada cumple los requisitos para mantenerla como propuesta de inversión, podrás comunicarlo, en el plazo de 48 horas, al correo example@consul.es, indicando necesariamente para su tramitación el código %{code} como asunto del correo, correspondiente a tu propuesta." sincerely: "Atentamente" signatory: "DIRECCIÓN GENERAL DE PARTICIPACIÓN CIUDADANA" sorry: "Sentimos las molestias ocasionadas y volvemos a darte las gracias por tu inestimable participación." diff --git a/config/locales/management.es.yml b/config/locales/management.es.yml index 4b2e9061a..e9c39d406 100644 --- a/config/locales/management.es.yml +++ b/config/locales/management.es.yml @@ -26,7 +26,7 @@ es: link: Consul in_census_has_following_permissions: 'Este usuario puede participar en el Portal de Gobierno Abierto con las siguientes posibilidades:' not_in_census: Este documento no está registrado. - not_in_census_info: 'Las personas no empadronadas en Madrid pueden participar en el Portal de Gobierno Abierto del Ayuntamiento de Madrid con las siguientes posibilidades:' + not_in_census_info: 'Las personas no empadronadas pueden participar en el Portal de Gobierno Abierto con las siguientes posibilidades:' please_check_account_data: Compruebe que los datos anteriores son correctos para proceder a verificar la cuenta completamente. title: Gestión de usuarios under_age: Debes ser mayor de 16 años para verificar tu cuenta. diff --git a/config/locales/pages.en.yml b/config/locales/pages.en.yml index bb2a12a0d..2374e3d4b 100755 --- a/config/locales/pages.en.yml +++ b/config/locales/pages.en.yml @@ -46,9 +46,7 @@ en: This Open Government Portal use the [Consul app](https://github.com/ayuntamientomadrid 'consul github') that is free software, with [licence AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html 'AGPLv3 gnu' ), that means in simple words that anyone can use the code freely, copy it, see it in detail, modify it and redistribute it to the word with the modifications he wants (allowing others to do the same). Because we think culture is better and richer when it is released. - Not only can you use freely this portal in yout local government, but you also will be helped by Madrid city council as much as possible to do it, so if you are interested write us: ag.gobiernoabierto@madrid.es - - If you are a programmer, you can see the code and help us to improve it at [Consul app](https://github.com/ayuntamientomadrid 'consul github ' ). + If you are a programmer, you can see the code and help us to improve it at [Consul app](https://github.com/ayuntamientomadrid 'consul github'). titles: faq: Solution to tecnical problemas (FAQ) how_it_works: How does this Open Government Portal work? diff --git a/config/locales/pages.es.yml b/config/locales/pages.es.yml index 733b064b3..c9f282a4f 100644 --- a/config/locales/pages.es.yml +++ b/config/locales/pages.es.yml @@ -44,11 +44,9 @@ es: text: |- Utilízalo en tu municipio libremente o ayúdanos a mejorarlo, es software libre. - Este Portal de Gobierno Abierto usa la [aplicación Consul](https://github.com/ayuntamientomadrid 'github consul' ) que es software libre, con [licencia AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html 'AGPLv3 gnu' ), esto significa en palabras sencillas, que cualquiera puede libremente usar el código, copiarlo, verlo en detalle, modificarlo, y redistribuirlo al mundo con las modificaciones que quiera (manteniendo el que otros puedan a su vez hacer lo mismo). Porque creemos que la cultura es mejor y más rica cuando se libera. + Este Portal de Gobierno Abierto usa la [aplicación Consul](https://github.com/ayuntamientomadrid 'github consul') que es software libre, con [licencia AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html 'AGPLv3 gnu' ), esto significa en palabras sencillas, que cualquiera puede libremente usar el código, copiarlo, verlo en detalle, modificarlo, y redistribuirlo al mundo con las modificaciones que quiera (manteniendo el que otros puedan a su vez hacer lo mismo). Porque creemos que la cultura es mejor y más rica cuando se libera. - No sólo puedes utilizar libremente este portal en tu municipio, sino que desde el Ayuntamiento de Madrid vamos a ayudarte todo lo posible a que lo hagas, así que si estás interesado, escríbenos a ag.gobiernoabierto@madrid.es - - Si eres programador, puedes ver el código y ayudarnos a mejorarlo en [aplicación Consul](https://github.com/ayuntamientomadrid 'github consul' ). + Si eres programador, puedes ver el código y ayudarnos a mejorarlo en [aplicación Consul](https://github.com/ayuntamientomadrid 'github consul'). titles: faq: Soluciones a problemas técnicos (FAQ) how_it_works: "¿Cómo funciona este Portal de Gobierno Abierto?" diff --git a/config/routes.rb b/config/routes.rb index 37497268c..658a9b027 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -267,6 +267,6 @@ Rails.application.routes.draw do mount Tolk::Engine => '/translate', :as => 'tolk' # static pages - get '/blog' => redirect("http://diario.madrid.es/participa/") + get '/blog' => redirect("http://hereyourblogsite.com/") resources :pages, path: '/', only: [:show] end diff --git a/lib/sms_api.rb b/lib/sms_api.rb index e3a7c6ff2..de0e2c312 100644 --- a/lib/sms_api.rb +++ b/lib/sms_api.rb @@ -25,7 +25,7 @@ class SMSApi def request(phone, code) { autorizacion: authorization, destinatarios: { destinatario: phone }, - texto_mensaje: "Clave para verificarte: #{code}. Gobierno Abierto - Ayuntamiento de Madrid", + texto_mensaje: "Clave para verificarte: #{code}. Gobierno Abierto", solicita_notificacion: "All" } end From d24efbad60e9b9a41849f4de61848f3d72c4a4a5 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 6 Jul 2016 12:32:07 +0200 Subject: [PATCH 097/126] Changes .com urls examples to .consul --- config/environments/test.rb | 2 +- config/locales/en.yml | 4 ++-- config/locales/es.yml | 4 ++-- config/locales/management.en.yml | 4 ++-- config/locales/management.es.yml | 4 ++-- config/locales/verification.en.yml | 5 +++-- config/locales/verification.es.yml | 5 +++-- config/routes.rb | 2 +- doc/locales/fr.yaml | 8 ++++---- doc/locales/pt-br.yaml | 8 ++++---- 10 files changed, 24 insertions(+), 22 deletions(-) diff --git a/config/environments/test.rb b/config/environments/test.rb index 4912a6cc2..29682e8e1 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -38,7 +38,7 @@ Rails.application.configure do config.action_mailer.default_url_options = { host: 'test' } - config.action_mailer.asset_host = 'http://madrid.test' + config.action_mailer.asset_host = 'http://consul.test' # Randomize the order test cases are executed. config.active_support.test_order = :random diff --git a/config/locales/en.yml b/config/locales/en.yml index adc9b275a..05153d714 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -182,14 +182,14 @@ en: privacy: Privacy Policy transparency_text: Find out anything about the city. transparency_title: Transparency - transparency_url: https://yourtransparencysite.com + transparency_url: https://transparency.consul header: administration: Administration debates: Debates external_link_blog: Blog external_link_opendata: Open data external_link_transparency: Transparency - external_link_transparency_url: https://yourtransparencysite.com + external_link_transparency_url: https://transparency.consul locale: 'Language:' logo: Consul management: Management diff --git a/config/locales/es.yml b/config/locales/es.yml index 9a586e96a..9391da3bf 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -182,14 +182,14 @@ es: privacy: Política de privacidad transparency_text: Obtén cualquier información sobre la ciudad. transparency_title: Transparencia - transparency_url: https://yourtransparencysite.com + transparency_url: https://transparency.consul header: administration: Administrar debates: Debates external_link_blog: Blog external_link_opendata: Datos abiertos external_link_transparency: Transparencia - external_link_transparency_url: https://yourtransparencysite.com + external_link_transparency_url: https://transparency.consul locale: 'Idioma:' logo: Consul management: Gestión diff --git a/config/locales/management.en.yml b/config/locales/management.en.yml index 8833eac0f..fa02e5bc3 100644 --- a/config/locales/management.en.yml +++ b/config/locales/management.en.yml @@ -59,10 +59,10 @@ en: support_proposals: Support proposals vote_proposals: Vote proposals print: - proposals_info: Create yor proposal on http://hereyoursite.com + proposals_info: Create yor proposal on http://url.consul proposals_note: The proposals more supported will be voted. If are accepted by a majority, the city Council shall be carried out. proposals_title: 'Proposals:' - spending_proposals_info: Participate at http://hereyoursite.com + spending_proposals_info: Participate at http://url.consul spending_proposals_note: Participatory budget will be assigned to the most votes spending proposals. print_info: Print this info proposals: diff --git a/config/locales/management.es.yml b/config/locales/management.es.yml index e9c39d406..fe3d08697 100644 --- a/config/locales/management.es.yml +++ b/config/locales/management.es.yml @@ -59,10 +59,10 @@ es: support_proposals: Apoyar propuestas vote_proposals: Participar en las votaciones finales print: - proposals_info: Haz tu propuesta en http://hereyoursite.com + proposals_info: Haz tu propuesta en http://url.consul proposals_note: Las propuestas más apoyadas serán llevadas a votación. Y si las acepta una mayoría, el Ayuntamiento las llevará a cabo. proposals_title: 'Propuestas:' - spending_proposals_info: Participa en http://hereyoursite.com + spending_proposals_info: Participa en http://url.consul spending_proposals_note: Los presupuestos participativos se invertirán en las propuestas de inversión más apoyadas. print_info: Imprimir esta información proposals: diff --git a/config/locales/verification.en.yml b/config/locales/verification.en.yml index 6474ac20d..e47e5a6b3 100755 --- a/config/locales/verification.en.yml +++ b/config/locales/verification.en.yml @@ -21,7 +21,7 @@ en: create: flash: offices: Citizen Support Offices - offices_url: http://yourcitizensupportofficesite.com + offices_url: http://offices.consul success_html: Thank you for requesting your maximum security code (only required for the final votes). In a few days we will send it to the address featuring in the data we have on file. Please remember that, if you prefer, you can collect your code from any of the %{offices}. edit: see_all: See proposals @@ -33,7 +33,7 @@ en: go_to_index: See proposals office: Verify in any %{office} offices: Citizen Support Offices - offices_url: http://yourcitizensupportofficesite.com + offices_url: http://offices.consul send_letter: Send me a letter with the code title: Congratulations! user_permission_info: With your account you can... @@ -65,6 +65,7 @@ en: error_not_allowed_postal_code: In order to be verified, you must be registered. error_verifying_census: The Census was unable to verify your information. Please confirm that your census details are correct by calling to City Council or visit one %{offices}. error_verifying_census_offices: Citizen Support Office + error_verifying_census_offices_url: http://offices.consul form_errors: prevented the verification of your residence postal_code: Postcode postal_code_note: To verify your account you must be registered diff --git a/config/locales/verification.es.yml b/config/locales/verification.es.yml index e6d0ffa0d..a8e41ea09 100644 --- a/config/locales/verification.es.yml +++ b/config/locales/verification.es.yml @@ -21,7 +21,7 @@ es: create: flash: offices: Oficinas de Atención al Ciudadano - offices_url: http://yourcitizensupportofficesite.com + offices_url: http://offices.consul success_html: Antes de las votaciones recibirás una carta con las instrucciones para verificar tu cuenta.
    Recuerda que puedes ahorrar el envío verificándote presencialmente en cualquiera de las %{offices}. edit: see_all: Ver propuestas @@ -33,7 +33,7 @@ es: go_to_index: Ver propuestas office: Verificarte presencialmente en cualquier %{office} offices: Oficina de Atención al Ciudadano - offices_url: http://yourcitizensupportofficesite.com + offices_url: http://offices.consul send_letter: Solicitar una carta por correo postal title: "¡Felicidades!" user_permission_info: Con tu cuenta ya puedes... @@ -65,6 +65,7 @@ es: error_not_allowed_postal_code: Para verificarte debes estar empadronado. error_verifying_census: El Padrón no pudo verificar tu información. Por favor, confirma que tus datos de empadronamiento sean correctos llamando al Ayuntamiento o visitando una %{offices}. error_verifying_census_offices: oficina de Atención al ciudadano + error_verifying_census_offices_url: http://offices.consul form_errors: evitaron verificar tu residencia postal_code: Código postal postal_code_note: Para verificar tus datos debes estar empadronado diff --git a/config/routes.rb b/config/routes.rb index 658a9b027..4f3eb94ec 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -267,6 +267,6 @@ Rails.application.routes.draw do mount Tolk::Engine => '/translate', :as => 'tolk' # static pages - get '/blog' => redirect("http://hereyourblogsite.com/") + get '/blog' => redirect("http://blog.consul/") resources :pages, path: '/', only: [:show] end diff --git a/doc/locales/fr.yaml b/doc/locales/fr.yaml index 3b8e5571c..e3298cb1f 100644 --- a/doc/locales/fr.yaml +++ b/doc/locales/fr.yaml @@ -865,14 +865,14 @@ fr: privacy: Vie privée transparency_text: Trouver tout à propos de la mairie de Madrid transparency_title: Transparence - transparency_url: https://yourtransparencysite.com + transparency_url: https://transparency.consul header: administration: Administration debates: Débats external_link_blog: Blog external_link_opendata: Open data external_link_transparency: Transparence - external_link_transparency_url: https://yourtransparencysite.com + external_link_transparency_url: https://transparency.consul locale: 'Langue :' logo: Consul moderation: Modération @@ -1497,7 +1497,7 @@ fr: create: flash: offices: Bureaux de soutien aux citoyens - offices_url: http://yourcitizensupportofficesite.com + offices_url: http://offices.consul success_html: Merci d'avoir demandé votre code de sécurité maximum (uniquement requis pour le vote final). Dans quelques jours, nous vous enverrons un courrier vers votre adresse postale. Vous pouvez le réclamer dans n'importe @@ -1512,7 +1512,7 @@ fr: go_to_index: Voir les propositions office: Vérifier dans n'importe quel %{office} offices: Bureaux de soutien aux citoyens - offices_url: http://yourcitizensupportofficesite.com + offices_url: http://offices.consul send_letter: Envoyer une lettre avec le code title: Félicitations user_permission_info: Avec votre compte, vous pouvez diff --git a/doc/locales/pt-br.yaml b/doc/locales/pt-br.yaml index 363427030..9098a933e 100644 --- a/doc/locales/pt-br.yaml +++ b/doc/locales/pt-br.yaml @@ -854,14 +854,14 @@ pt-BR: privacy: Política de privacidade transparency_text: Descubra tudo sobre a Câmara da Cidade de Madrid. transparency_title: Transparência - transparency_url: https://yourtransparencysite.com + transparency_url: https://transparency.consul header: administration: Administração debates: Debates external_link_blog: Blog external_link_opendata: Dados abertos external_link_transparency: Transparência - external_link_transparency_url: https://yourtransparencysite.com + external_link_transparency_url: https://transparency.consul locale: 'Idioma:' logo: Consul moderation: Moderação @@ -1515,7 +1515,7 @@ pt-BR: create: flash: offices: Escritórios de Apoio ao Cidadão - offices_url: http://yourcitizensupportofficesite.com + offices_url: http://offices.consul success_html: Obrigado por solicitar seu código de segurança máxima (somente solicitado em votações finais). Em poucos dias nós lhe enviaremos para seu endereço relacionado nos dados que temos em arquivo. Por favor @@ -1531,7 +1531,7 @@ pt-BR: go_to_index: Ver propostas office: Verificar em qualquer %{office} offices: Escritórios de Apoio ao Cidadão - offices_url: http://yourcitizensupportofficesite.com + offices_url: http://offices.consul send_letter: Envie-me uma carta com o código title: Parabéns! user_permission_info: Com a sua conta você pode... From 219f4e2c15d447e35d9fc948eb2975dfbdaa756d Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 6 Jul 2016 12:32:14 +0200 Subject: [PATCH 098/126] Deletes sitemap --- public/sitemap.xml | 49 ---------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 public/sitemap.xml diff --git a/public/sitemap.xml b/public/sitemap.xml deleted file mode 100644 index 0740af73a..000000000 --- a/public/sitemap.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - https://decide.madrid.es/ - 0.7 - - - https://decide.madrid.es/proposals - 0.9 - always - - - https://decide.madrid.es/debates - 0.7 - - - https://decide.madrid.es/users/sign_up - - - https://decide.madrid.es/users/sign_in - - - https://decide.madrid.es/more_information - - - https://decide.madrid.es/how_it_works - - - https://decide.madrid.es/how_to_use - - - https://decide.madrid.es/participation - - - https://decide.madrid.es/proposals_info - - - https://decide.madrid.es/participation_world - - - https://decide.madrid.es/participation_facts - - - https://decide.madrid.es/privacy - - - https://decide.madrid.es/conditions - - From edd8883deba401b04528fccb9b6b4cb3ad052217 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 6 Jul 2016 13:43:05 +0200 Subject: [PATCH 099/126] Fixes specs --- .../document_verifications/invalid_document.html.erb | 3 +-- spec/features/admin/banners_spec.rb | 4 ++-- spec/features/comments/debates_spec.rb | 6 +++--- spec/features/comments/proposals_spec.rb | 6 +++--- spec/features/official_positions_spec.rb | 1 + spec/features/verification/letter_spec.rb | 2 +- spec/features/verification/residence_spec.rb | 12 ++++++------ spec/models/residence_spec.rb | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/views/management/document_verifications/invalid_document.html.erb b/app/views/management/document_verifications/invalid_document.html.erb index d2b2f22c1..4e867b8f6 100644 --- a/app/views/management/document_verifications/invalid_document.html.erb +++ b/app/views/management/document_verifications/invalid_document.html.erb @@ -12,6 +12,5 @@

    <%= t("management.document_verifications.has_no_account_html", - link: link_to(t('management.document_verifications.link'), root_path)).html_safe, - target: "_blank") %> + link: link_to(t('management.document_verifications.link'), root_path, target: "_blank")).html_safe %>

    diff --git a/spec/features/admin/banners_spec.rb b/spec/features/admin/banners_spec.rb index 6d7779aa4..8578778ed 100644 --- a/spec/features/admin/banners_spec.rb +++ b/spec/features/admin/banners_spec.rb @@ -85,7 +85,7 @@ feature 'Admin banners magement' do select 'Banner image 2', from: 'banner_image' fill_in 'banner_title', with: 'Such banner' fill_in 'banner_description', with: 'many text wow link' - fill_in 'banner_target_url', with: 'https://decide.madrid.es' + fill_in 'banner_target_url', with: 'https://www.url.com' last_week = Time.now - 7.days next_week = Time.now + 7.days fill_in 'post_started_at', with: last_week.strftime("%d/%m/%Y") @@ -98,7 +98,7 @@ feature 'Admin banners magement' do visit proposals_path expect(page).to have_content 'Such banner' - expect(page).to have_link 'Such banner many text wow link', href: 'https://decide.madrid.es' + expect(page).to have_link 'Such banner many text wow link', href: 'https://www.url.com' end scenario 'Edit banner with live refresh', :js do diff --git a/spec/features/comments/debates_spec.rb b/spec/features/comments/debates_spec.rb index d80b08bc0..d9e58343a 100644 --- a/spec/features/comments/debates_spec.rb +++ b/spec/features/comments/debates_spec.rb @@ -118,13 +118,13 @@ feature 'Commenting debates' do end scenario 'Sanitizes comment body for security' do - create :comment, commentable: debate, body: " click me http://madrid.es" + create :comment, commentable: debate, body: " click me http://www.url.com" visit debate_path(debate) within first('.comment') do - expect(page).to have_content "click me http://madrid.es" - expect(page).to have_link('http://madrid.es', href: 'http://madrid.es') + expect(page).to have_content "click me http://www.url.com" + expect(page).to have_link('http://www.url.com', href: 'http://www.url.com') expect(page).not_to have_link('click me') end end diff --git a/spec/features/comments/proposals_spec.rb b/spec/features/comments/proposals_spec.rb index 8312176cd..a861615b7 100644 --- a/spec/features/comments/proposals_spec.rb +++ b/spec/features/comments/proposals_spec.rb @@ -118,13 +118,13 @@ feature 'Commenting proposals' do end scenario 'Sanitizes comment body for security' do - create :comment, commentable: proposal, body: " click me http://madrid.es" + create :comment, commentable: proposal, body: " click me http://www.url.com" visit proposal_path(proposal) within first('.comment') do - expect(page).to have_content "click me http://madrid.es" - expect(page).to have_link('http://madrid.es', href: 'http://madrid.es') + expect(page).to have_content "click me http://www.url.com" + expect(page).to have_link('http://www.url.com', href: 'http://www.url.com') expect(page).not_to have_link('click me') end end diff --git a/spec/features/official_positions_spec.rb b/spec/features/official_positions_spec.rb index 01f78370a..ff31c0a27 100644 --- a/spec/features/official_positions_spec.rb +++ b/spec/features/official_positions_spec.rb @@ -55,6 +55,7 @@ feature 'Official positions' do scenario "Index" do visit proposals_path + debugger expect_badge_for("proposal", @proposal1) expect_no_badge_for("proposal", @proposal2) diff --git a/spec/features/verification/letter_spec.rb b/spec/features/verification/letter_spec.rb index 50635a73c..9a9b2500b 100644 --- a/spec/features/verification/letter_spec.rb +++ b/spec/features/verification/letter_spec.rb @@ -26,7 +26,7 @@ feature 'Verify Letter' do login_as(user) visit new_letter_path - expect(page).to have_link "Citizen Support Offices", href: "http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD" + expect(page).to have_link "Citizen Support Offices", href: "http://offices.consul" end scenario "Deny access unless verified residence" do diff --git a/spec/features/verification/residence_spec.rb b/spec/features/verification/residence_spec.rb index 1961269da..88d1579a9 100644 --- a/spec/features/verification/residence_spec.rb +++ b/spec/features/verification/residence_spec.rb @@ -4,7 +4,7 @@ feature 'Residence' do background { create(:geozone) } - scenario 'Verify resident in Madrid' do + scenario 'Verify resident' do user = create(:user) login_as(user) @@ -34,7 +34,7 @@ feature 'Residence' do expect(page).to have_content /\d errors? prevented the verification of your residence/ end - scenario 'Error on postal code not in Madrid census' do + scenario 'Error on postal code not in census' do user = create(:user) login_as(user) @@ -51,10 +51,10 @@ feature 'Residence' do click_button 'Verify residence' - expect(page).to have_content 'In order to be verified, you must be registered in the municipality of Madrid' + expect(page).to have_content 'In order to be verified, you must be registered' end - scenario 'Error on Madrid census' do + scenario 'Error on census' do user = create(:user) login_as(user) @@ -71,7 +71,7 @@ feature 'Residence' do click_button 'Verify residence' - expect(page).to have_content 'The Madrid Census was unable to verify your information' + expect(page).to have_content 'The Census was unable to verify your information' end scenario '5 tries allowed' do @@ -91,7 +91,7 @@ feature 'Residence' do check 'residence_terms_of_service' click_button 'Verify residence' - expect(page).to have_content 'The Madrid Census was unable to verify your information' + expect(page).to have_content 'The Census was unable to verify your information' end click_button 'Verify residence' diff --git a/spec/models/residence_spec.rb b/spec/models/residence_spec.rb index ce151eaee..5288a20b5 100644 --- a/spec/models/residence_spec.rb +++ b/spec/models/residence_spec.rb @@ -49,7 +49,7 @@ describe Verification::Residence do residence.postal_code = "13280" residence.valid? expect(residence.errors[:postal_code].size).to eq(1) - expect(residence.errors[:postal_code]).to include("In order to be verified, you must be registered in the municipality of Madrid.") + expect(residence.errors[:postal_code]).to include("In order to be verified, you must be registered.") end end From 702cfe13d11e33b6c612f3f60f88e758b928f6fa Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 6 Jul 2016 14:47:09 +0200 Subject: [PATCH 100/126] Fixes specs --- .../document_verifications/invalid_document.html.erb | 3 +-- spec/features/admin/banners_spec.rb | 4 ++-- spec/features/comments/debates_spec.rb | 6 +++--- spec/features/comments/proposals_spec.rb | 6 +++--- spec/features/verification/letter_spec.rb | 2 +- spec/features/verification/residence_spec.rb | 12 ++++++------ spec/models/residence_spec.rb | 2 +- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/app/views/management/document_verifications/invalid_document.html.erb b/app/views/management/document_verifications/invalid_document.html.erb index d2b2f22c1..4e867b8f6 100644 --- a/app/views/management/document_verifications/invalid_document.html.erb +++ b/app/views/management/document_verifications/invalid_document.html.erb @@ -12,6 +12,5 @@

    <%= t("management.document_verifications.has_no_account_html", - link: link_to(t('management.document_verifications.link'), root_path)).html_safe, - target: "_blank") %> + link: link_to(t('management.document_verifications.link'), root_path, target: "_blank")).html_safe %>

    diff --git a/spec/features/admin/banners_spec.rb b/spec/features/admin/banners_spec.rb index 6d7779aa4..8578778ed 100644 --- a/spec/features/admin/banners_spec.rb +++ b/spec/features/admin/banners_spec.rb @@ -85,7 +85,7 @@ feature 'Admin banners magement' do select 'Banner image 2', from: 'banner_image' fill_in 'banner_title', with: 'Such banner' fill_in 'banner_description', with: 'many text wow link' - fill_in 'banner_target_url', with: 'https://decide.madrid.es' + fill_in 'banner_target_url', with: 'https://www.url.com' last_week = Time.now - 7.days next_week = Time.now + 7.days fill_in 'post_started_at', with: last_week.strftime("%d/%m/%Y") @@ -98,7 +98,7 @@ feature 'Admin banners magement' do visit proposals_path expect(page).to have_content 'Such banner' - expect(page).to have_link 'Such banner many text wow link', href: 'https://decide.madrid.es' + expect(page).to have_link 'Such banner many text wow link', href: 'https://www.url.com' end scenario 'Edit banner with live refresh', :js do diff --git a/spec/features/comments/debates_spec.rb b/spec/features/comments/debates_spec.rb index d80b08bc0..d9e58343a 100644 --- a/spec/features/comments/debates_spec.rb +++ b/spec/features/comments/debates_spec.rb @@ -118,13 +118,13 @@ feature 'Commenting debates' do end scenario 'Sanitizes comment body for security' do - create :comment, commentable: debate, body: "
    click me http://madrid.es" + create :comment, commentable: debate, body: " click me http://www.url.com" visit debate_path(debate) within first('.comment') do - expect(page).to have_content "click me http://madrid.es" - expect(page).to have_link('http://madrid.es', href: 'http://madrid.es') + expect(page).to have_content "click me http://www.url.com" + expect(page).to have_link('http://www.url.com', href: 'http://www.url.com') expect(page).not_to have_link('click me') end end diff --git a/spec/features/comments/proposals_spec.rb b/spec/features/comments/proposals_spec.rb index 8312176cd..a861615b7 100644 --- a/spec/features/comments/proposals_spec.rb +++ b/spec/features/comments/proposals_spec.rb @@ -118,13 +118,13 @@ feature 'Commenting proposals' do end scenario 'Sanitizes comment body for security' do - create :comment, commentable: proposal, body: " click me http://madrid.es" + create :comment, commentable: proposal, body: " click me http://www.url.com" visit proposal_path(proposal) within first('.comment') do - expect(page).to have_content "click me http://madrid.es" - expect(page).to have_link('http://madrid.es', href: 'http://madrid.es') + expect(page).to have_content "click me http://www.url.com" + expect(page).to have_link('http://www.url.com', href: 'http://www.url.com') expect(page).not_to have_link('click me') end end diff --git a/spec/features/verification/letter_spec.rb b/spec/features/verification/letter_spec.rb index 50635a73c..9a9b2500b 100644 --- a/spec/features/verification/letter_spec.rb +++ b/spec/features/verification/letter_spec.rb @@ -26,7 +26,7 @@ feature 'Verify Letter' do login_as(user) visit new_letter_path - expect(page).to have_link "Citizen Support Offices", href: "http://www.madrid.es/portales/munimadrid/es/Inicio/El-Ayuntamiento/Atencion-al-ciudadano/Oficinas-de-Atencion-al-Ciudadano?vgnextfmt=default&vgnextchannel=5b99cde2e09a4310VgnVCM1000000b205a0aRCRD" + expect(page).to have_link "Citizen Support Offices", href: "http://offices.consul" end scenario "Deny access unless verified residence" do diff --git a/spec/features/verification/residence_spec.rb b/spec/features/verification/residence_spec.rb index 1961269da..88d1579a9 100644 --- a/spec/features/verification/residence_spec.rb +++ b/spec/features/verification/residence_spec.rb @@ -4,7 +4,7 @@ feature 'Residence' do background { create(:geozone) } - scenario 'Verify resident in Madrid' do + scenario 'Verify resident' do user = create(:user) login_as(user) @@ -34,7 +34,7 @@ feature 'Residence' do expect(page).to have_content /\d errors? prevented the verification of your residence/ end - scenario 'Error on postal code not in Madrid census' do + scenario 'Error on postal code not in census' do user = create(:user) login_as(user) @@ -51,10 +51,10 @@ feature 'Residence' do click_button 'Verify residence' - expect(page).to have_content 'In order to be verified, you must be registered in the municipality of Madrid' + expect(page).to have_content 'In order to be verified, you must be registered' end - scenario 'Error on Madrid census' do + scenario 'Error on census' do user = create(:user) login_as(user) @@ -71,7 +71,7 @@ feature 'Residence' do click_button 'Verify residence' - expect(page).to have_content 'The Madrid Census was unable to verify your information' + expect(page).to have_content 'The Census was unable to verify your information' end scenario '5 tries allowed' do @@ -91,7 +91,7 @@ feature 'Residence' do check 'residence_terms_of_service' click_button 'Verify residence' - expect(page).to have_content 'The Madrid Census was unable to verify your information' + expect(page).to have_content 'The Census was unable to verify your information' end click_button 'Verify residence' diff --git a/spec/models/residence_spec.rb b/spec/models/residence_spec.rb index ce151eaee..5288a20b5 100644 --- a/spec/models/residence_spec.rb +++ b/spec/models/residence_spec.rb @@ -49,7 +49,7 @@ describe Verification::Residence do residence.postal_code = "13280" residence.valid? expect(residence.errors[:postal_code].size).to eq(1) - expect(residence.errors[:postal_code]).to include("In order to be verified, you must be registered in the municipality of Madrid.") + expect(residence.errors[:postal_code]).to include("In order to be verified, you must be registered.") end end From 67f07ba73a9dc4ea27cc379fdd8c99ab79d52395 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 6 Jul 2016 14:48:51 +0200 Subject: [PATCH 101/126] Fixes typo --- spec/features/official_positions_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/features/official_positions_spec.rb b/spec/features/official_positions_spec.rb index ff31c0a27..01f78370a 100644 --- a/spec/features/official_positions_spec.rb +++ b/spec/features/official_positions_spec.rb @@ -55,7 +55,6 @@ feature 'Official positions' do scenario "Index" do visit proposals_path - debugger expect_badge_for("proposal", @proposal1) expect_no_badge_for("proposal", @proposal2) From 811dcc20b2a3c6c032500f2b57996cf7380379bb Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Fri, 8 Jul 2016 10:50:55 +0200 Subject: [PATCH 102/126] Updates Gemfile --- Gemfile | 2 +- Gemfile.lock | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index 31743146f..d5c8f3838 100644 --- a/Gemfile +++ b/Gemfile @@ -37,7 +37,7 @@ gem 'acts_as_votable' gem 'ckeditor', '~> 4.1.5' gem 'invisible_captcha', '~> 0.8.2' gem 'cancancan' -gem 'social-share-button', git: 'https://github.com/huacnlee/social-share-button.git', ref: 'e46a6a3e82b86023bc' +gem 'social-share-button' gem 'initialjs-rails', '0.2.0.1' gem 'unicorn', '~> 5.1.0' gem 'paranoia' diff --git a/Gemfile.lock b/Gemfile.lock index b420e7327..bbb81b63e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,3 @@ -GIT - remote: https://github.com/huacnlee/social-share-button.git - revision: e46a6a3e82b86023bc43b72c9379d3c6afe36b6b - ref: e46a6a3e82b86023bc - specs: - social-share-button (0.1.9) - coffee-rails - sass-rails - GEM remote: https://rubygems.org/ specs: @@ -374,6 +365,9 @@ GEM json (~> 1.8) simplecov-html (~> 0.10.0) simplecov-html (0.10.0) + social-share-button (0.3.1) + coffee-rails + sass-rails spring (1.7.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) @@ -495,7 +489,7 @@ DEPENDENCIES rspec-rails (~> 3.3) sass-rails (~> 5.0, >= 5.0.4) savon - social-share-button! + social-share-button spring spring-commands-rspec tolk From e55fdc42ee607292341c7ae90a4b2f14ddee03a2 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Fri, 8 Jul 2016 14:13:13 +0200 Subject: [PATCH 103/126] Updates classes names for social share button --- app/assets/stylesheets/layout.scss | 27 +++++++++++++---------- app/assets/stylesheets/participation.scss | 12 +++++----- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 0ec0c12eb..b99f0300a 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -1085,12 +1085,13 @@ table { } } -.social-share-button-twitter { +.ssb-twitter { background: #45B0E3; + background-image: none !important; color: white; - height: $line-height*2; + height: $line-height*2 !important; position: relative; - width: $line-height*2; + width: $line-height*2 !important; &:before { content: "f"; @@ -1124,12 +1125,13 @@ table { } } -.social-share-button-facebook { +.ssb-facebook { background: #3B5998; + background-image: none !important; color: white; - height: rem-calc(48); + height: rem-calc(48) !important; position: relative; - width: rem-calc(48); + width: rem-calc(48) !important; &:before { content: "A"; @@ -1163,12 +1165,13 @@ table { } } -.social-share-button-google_plus { +.ssb-google_plus { background: #DE4C34; + background-image: none !important; color: white; - height: $line-height*2; + height: $line-height*2 !important; position: relative; - width: $line-height*2; + width: $line-height*2 !important; &:before { content: "B"; @@ -1206,7 +1209,7 @@ table { display: inline-block; } - .social-share-button-twitter { + .ssb-twitter { background: none; color: white; height: $line-height; @@ -1229,7 +1232,7 @@ table { } } - .social-share-button-facebook { + .ssb-facebook { background: none; color: white; height: rem-calc(24); @@ -1252,7 +1255,7 @@ table { } } - .social-share-button-google_plus { + .ssb-google_plus { background: none; color: white; height: rem-calc(24); diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index 6e5b4273a..ffe08617f 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -900,9 +900,9 @@ .share-supported { - .social-share-button-twitter, - .social-share-button-facebook, - .social-share-button-google_plus { + .ssb-twitter, + .ssb-facebook, + .ssb-google_plus { color: $budget; } } @@ -1016,9 +1016,9 @@ .share-supported { - .social-share-button-twitter, - .social-share-button-facebook, - .social-share-button-google_plus { + .ssb-twitter, + .ssb-facebook, + .ssb-google_plus { height: rem-calc(33); &:before { From 7f01dbdca239a9969f8ce09c4d2197b9d9ec87e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Fri, 8 Jul 2016 14:42:28 +0200 Subject: [PATCH 104/126] makes sure setting helper is used in views --- app/views/admin/dashboard/index.html.erb | 2 +- app/views/layouts/_admin_header.html.erb | 4 ++-- app/views/layouts/_header.html.erb | 2 +- app/views/layouts/management.html.erb | 4 ++-- app/views/moderation/dashboard/index.html.erb | 2 +- app/views/shared/_top_links.html.erb | 6 +++--- app/views/welcome/verification.html.erb | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/admin/dashboard/index.html.erb b/app/views/admin/dashboard/index.html.erb index 0b4fad794..793b4e407 100644 --- a/app/views/admin/dashboard/index.html.erb +++ b/app/views/admin/dashboard/index.html.erb @@ -1,4 +1,4 @@ -<%= link_to t("admin.dashboard.index.back") + " " + Setting['org_name'], root_path, class: "button float-right" %> +<%= link_to t("admin.dashboard.index.back") + " " + setting['org_name'], root_path, class: "button float-right" %>

    <%= t("admin.dashboard.index.title") %>

    diff --git a/app/views/layouts/_admin_header.html.erb b/app/views/layouts/_admin_header.html.erb index 2b15faaaa..095e351d6 100644 --- a/app/views/layouts/_admin_header.html.erb +++ b/app/views/layouts/_admin_header.html.erb @@ -8,7 +8,7 @@
    - <%= link_to Setting['org_name'], admin_root_path, class: "logo show-for-small-only" %> + <%= link_to setting['org_name'], admin_root_path, class: "logo show-for-small-only" %> @@ -19,7 +19,7 @@
    <%= link_to admin_root_path, class: "hide-for-small-only" do %> <%= image_tag('logo_header.png', class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %> - <%= Setting['org_name'] %> + <%= setting['org_name'] %>  | <%= t("admin.dashboard.index.title") %> <% end %>
    diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 16c81fb50..2ad2303f8 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -5,7 +5,7 @@
    - <%= link_to Setting['org_name'], root_path, class: "logo show-for-small-only" %> + <%= link_to setting['org_name'], root_path, class: "logo show-for-small-only" %> diff --git a/app/views/layouts/management.html.erb b/app/views/layouts/management.html.erb index 2607f1b82..8e497bf24 100644 --- a/app/views/layouts/management.html.erb +++ b/app/views/layouts/management.html.erb @@ -25,7 +25,7 @@
    - <%= link_to Setting['org_name'], management_root_path, class: "logo show-for-small-only" %> + <%= link_to setting['org_name'], management_root_path, class: "logo show-for-small-only" %> @@ -36,7 +36,7 @@
    <%= link_to management_root_path, class: "hide-for-small-only" do %> <%= image_tag('logo_header.png', class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %> - <%= Setting['org_name'] %> + <%= setting['org_name'] %>  | <%= t("management.dashboard.index.title") %> <% end %>
    diff --git a/app/views/moderation/dashboard/index.html.erb b/app/views/moderation/dashboard/index.html.erb index aa214c561..acdfa954a 100644 --- a/app/views/moderation/dashboard/index.html.erb +++ b/app/views/moderation/dashboard/index.html.erb @@ -1,4 +1,4 @@ -<%= link_to t("admin.dashboard.index.back") + " " + Setting['org_name'], root_path, class: "button float-right" %> +<%= link_to t("admin.dashboard.index.back") + " " + setting['org_name'], root_path, class: "button float-right" %>

    <%= t("moderation.dashboard.index.title") %>

    diff --git a/app/views/shared/_top_links.html.erb b/app/views/shared/_top_links.html.erb index 07973ee60..be6afb0d7 100644 --- a/app/views/shared/_top_links.html.erb +++ b/app/views/shared/_top_links.html.erb @@ -2,12 +2,12 @@
    <%= render "shared/locale_switcher" %>