From 3d5f7f207c81f9f7daef865b7d1896c918e1ac9f Mon Sep 17 00:00:00 2001 From: Jaime Iniesta Date: Wed, 7 Sep 2016 11:58:10 +0200 Subject: [PATCH 01/30] no need to db:create here --- README.md | 1 - README_ES.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 27162bfd7..f376dfded 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ cd consul bundle install cp config/database.yml.example config/database.yml cp config/secrets.yml.example config/secrets.yml -rake db:create bin/rake db:setup bin/rake db:dev_seed RAILS_ENV=test rake db:setup diff --git a/README_ES.md b/README_ES.md index d8c394680..7c7720ee7 100644 --- a/README_ES.md +++ b/README_ES.md @@ -32,7 +32,6 @@ cd consul bundle install cp config/database.yml.example config/database.yml cp config/secrets.yml.example config/secrets.yml -rake db:create bin/rake db:setup bin/rake db:dev_seed RAILS_ENV=test rake db:setup From 8d883b1e1701438218abf62f286a2907e92b5051 Mon Sep 17 00:00:00 2001 From: Marcia Date: Thu, 15 Sep 2016 11:45:03 +0200 Subject: [PATCH 02/30] mejoras de codigo --- Gemfile | 1 + Gemfile.lock | 4 + app/models/user.rb | 4 +- .../devise/password_expired/show.html.erb | 14 ++ config/i18n-tasks.yml | 1 + .../initializers/devise_security_extension.rb | 127 ++++++++++++++++++ config/locales/activerecord.en.yml | 1 + config/locales/activerecord.es.yml | 1 + config/locales/devise.en.yml | 7 + config/locales/devise.es.yml | 7 + .../locales/devise.security_extension.de.yml | 16 +++ .../locales/devise.security_extension.en.yml | 16 +++ .../locales/devise.security_extension.it.yml | 10 ++ .../20160901104320_add_password_expired.rb | 6 + .../20160901104320_add_password_expired.rb~ | 4 + db/schema.rb | 4 +- spec/features/users_auth_spec.rb | 37 +++++ 17 files changed, 257 insertions(+), 3 deletions(-) create mode 100644 app/views/devise/password_expired/show.html.erb create mode 100644 config/initializers/devise_security_extension.rb create mode 100644 config/locales/devise.security_extension.de.yml create mode 100644 config/locales/devise.security_extension.en.yml create mode 100644 config/locales/devise.security_extension.it.yml create mode 100644 db/migrate/20160901104320_add_password_expired.rb create mode 100644 db/migrate/20160901104320_add_password_expired.rb~ diff --git a/Gemfile b/Gemfile index 3f3119770..9d7499d82 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,7 @@ gem 'jquery-ui-rails' gem 'turbolinks' gem 'devise', '~> 3.5.7' +gem 'devise_security_extension' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' gem 'omniauth' diff --git a/Gemfile.lock b/Gemfile.lock index 103ec214d..e918a9648 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -138,6 +138,9 @@ GEM warden (~> 1.2.3) devise-async (0.10.2) devise (>= 3.2, < 4.0) + devise_security_extension (0.10.0) + devise (>= 3.0.0, < 4.0) + railties (>= 3.2.6, < 5.0) diff-lcs (1.2.5) docile (1.1.5) easy_translate (0.5.0) @@ -460,6 +463,7 @@ DEPENDENCIES delayed_job_active_record (~> 4.1.0) devise (~> 3.5.7) devise-async + devise_security_extension email_spec factory_girl_rails faker diff --git a/app/models/user.rb b/app/models/user.rb index 60bc2364a..633610d9d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,8 +1,8 @@ -class User < ActiveRecord::Base + class User < ActiveRecord::Base include Verification - devise :database_authenticatable, :registerable, :confirmable, + devise :password_expirable, :secure_validatable, :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :async acts_as_voter diff --git a/app/views/devise/password_expired/show.html.erb b/app/views/devise/password_expired/show.html.erb new file mode 100644 index 000000000..0c750dd1e --- /dev/null +++ b/app/views/devise/password_expired/show.html.erb @@ -0,0 +1,14 @@ +

<%= t("devise.password_expired.expire_password") %>

+ +<%= form_for(resource, :as => resource_name, :url => [resource_name, :password_expired], :html => { :method => :put }) do |f| %> + <%= devise_error_messages! %> + + <%= f.password_field :current_password %>

+ + <%= f.label t("devise.password_expired.new_password") %> + <%= f.password_field :password, label: false %>

+ + <%= f.password_field :password_confirmation %>

+ +

<%= f.submit t("devise.password_expired.change_password") %>

+<% end %> \ No newline at end of file diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 250ed18f9..9cf9f8137 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -101,6 +101,7 @@ ignore_missing: - 'errors.messages.taken' - 'devise.failure.invalid' - 'devise.registrations.destroyed' + - 'devise.password_expired.*' ## Consider these keys used: ignore_unused: diff --git a/config/initializers/devise_security_extension.rb b/config/initializers/devise_security_extension.rb new file mode 100644 index 000000000..83b88200e --- /dev/null +++ b/config/initializers/devise_security_extension.rb @@ -0,0 +1,127 @@ +Devise.setup do |config| + # ==> Security Extension + # Configure security extension for devise + + # Should the password expire (e.g 3.months) + # config.expire_password_after = false + config.expire_password_after = 1.year + + # Need 1 char of A-Z, a-z and 0-9 + # config.password_regex = /(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])/ + + # How many passwords to keep in archive + # config.password_archiving_count = 5 + + # Deny old password (true, false, count) + # config.deny_old_passwords = true + + # enable email validation for :secure_validatable. (true, false, validation_options) + # dependency: need an email validator like rails_email_validator + # config.email_validation = true + + # captcha integration for recover form + # config.captcha_for_recover = true + + # captcha integration for sign up form + # config.captcha_for_sign_up = true + + # captcha integration for sign in form + # config.captcha_for_sign_in = true + + # captcha integration for unlock form + # config.captcha_for_unlock = true + + # captcha integration for confirmation form + # config.captcha_for_confirmation = true + + # Time period for account expiry from last_activity_at + # config.expire_after = 90.days +end + +module Devise + module Models + module PasswordExpirable + def need_change_password? + if self.administrator? + #is administrator + if self.expire_password_after.is_a? Fixnum or self.expire_password_after.is_a? Float + self.password_changed_at.nil? or self.password_changed_at < self.expire_password_after.ago + else + #not change password + false + end + else + #It is not an administrator + false + end + end + end + + module SecureValidatable + def self.included(base) + base.extend ClassMethods + assert_secure_validations_api!(base) + + base.class_eval do + # validate login in a strict way if not yet validated + unless devise_validation_enabled? + validates :email, :presence => true, :if => :email_required? + validates :email, :uniqueness => true, :allow_blank => true, :if => :email_changed? # check uniq for email ever + validates :password, :presence => true, :length => password_length, :confirmation => true, :if => :password_required? + end + + # extra validations + #validates :password, :format => { :with => password_regex, :message => :password_format }, :if => :password_required? + # don't allow use same password + validate :current_equal_password_validation + end + end + + def self.assert_secure_validations_api!(base) + raise "Could not use SecureValidatable on #{base}" unless base.respond_to?(:validates) + end + + def current_equal_password_validation + if !self.new_record? && !self.encrypted_password_change.nil? && !self.erased? + dummy = self.class.new + dummy.encrypted_password = self.encrypted_password_change.first + dummy.password_salt = self.password_salt_change.first if self.respond_to? :password_salt_change and not self.password_salt_change.nil? + self.errors.add(:password, :equal_to_current_password) if dummy.valid_password?(self.password) + end + end + + protected + + # Checks whether a password is needed or not. For validations only. + # Passwords are always required if it's a new record, or if the password + # or confirmation are being set somewhere. + def password_required? + !persisted? || !password.nil? || !password_confirmation.nil? + end + + def email_required? + true + end + + module ClassMethods + Devise::Models.config(self, :password_regex, :password_length, :email_validation) + + private + def has_uniqueness_validation_of_login? + validators.any? do |validator| + validator.kind_of?(ActiveRecord::Validations::UniquenessValidator) && + validator.attributes.include?(login_attribute) + end + end + + def login_attribute + authentication_keys[0] + end + + def devise_validation_enabled? + self.ancestors.map(&:to_s).include? 'Devise::Models::Validatable' + end + end + end + end +end \ No newline at end of file diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml index 07791e53c..7de5b340e 100644 --- a/config/locales/activerecord.en.yml +++ b/config/locales/activerecord.en.yml @@ -54,6 +54,7 @@ en: username: "Username" password_confirmation: "Password confirmation" password: "Password" + current_password: "Current password" phone_number: "Phone number" official_position: "Official position" official_level: "Official level" diff --git a/config/locales/activerecord.es.yml b/config/locales/activerecord.es.yml index d5b7f0005..4dae4cb56 100644 --- a/config/locales/activerecord.es.yml +++ b/config/locales/activerecord.es.yml @@ -54,6 +54,7 @@ es: username: "Nombre de usuario" password_confirmation: "Confirmación de contraseña" password: "Contraseña" + current_password: "Contraseña actual" phone_number: "Teléfono" official_position: "Cargo público" official_level: "Nivel del cargo" diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 30fb488ce..f031d62b5 100755 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -2,6 +2,12 @@ en: devise: + password_expired: + expire_password: "Password expired" + change_required: "Your password has expired" + change_password: "Change your password" + new_password: "New password" + updated: "Password successfully updated" confirmations: confirmed: "Your account has been confirmed." send_instructions: "In a few minutes you will receive an email containing instructions on how to reset your password." @@ -62,3 +68,4 @@ en: not_saved: one: "1 error prevented this %{resource} from being saved:" other: "%{count} errors prevented this %{resource} from being saved:" + equal_to_current_password: "must be different than the current password." diff --git a/config/locales/devise.es.yml b/config/locales/devise.es.yml index 1a9c3a3b8..6ede31f7d 100644 --- a/config/locales/devise.es.yml +++ b/config/locales/devise.es.yml @@ -1,5 +1,11 @@ es: devise: + password_expired: + expire_password: "Contraseña caducada" + change_required: "Tu contraseña ha caducado" + change_password: "Cambia tu contraseña" + new_password: "Nueva contraseña" + updated: "Contraseña actualizada con éxito" confirmations: confirmed: "Tu cuenta ha sido confirmada. Por favor autentifícate con tu red social o tu usuario y contraseña" send_instructions: "Recibirás un correo electrónico en unos minutos con instrucciones sobre cómo restablecer tu contraseña." @@ -60,3 +66,4 @@ es: not_saved: one: "1 error impidió que este %{resource} fuera guardado:" other: "%{count} errores impidieron que este %{resource} fuera guardado:" + equal_to_current_password: "debe ser diferente a la contraseña actual" diff --git a/config/locales/devise.security_extension.de.yml b/config/locales/devise.security_extension.de.yml new file mode 100644 index 000000000..cad39d9b7 --- /dev/null +++ b/config/locales/devise.security_extension.de.yml @@ -0,0 +1,16 @@ +de: + errors: + messages: + taken_in_past: "wurde bereits in der Vergangenheit verwendet!" + equal_to_current_password: "darf nicht dem aktuellen Passwort entsprechen!" + password_format: "müssen große, kleine Buchstaben und Ziffern enthalten" + devise: + invalid_captcha: "Die Captchaeingabe ist nicht gültig!" + paranoid_verify: + code_required: "Bitte geben Sie den Code unser Support-Team zur Verfügung gestellt" + password_expired: + updated: "Das neue Passwort wurde übernommen." + change_required: "Ihr Passwort ist abgelaufen. Bitte vergeben sie ein neues Passwort!" + failure: + session_limited: 'Ihre Anmeldedaten wurden in einem anderen Browser genutzt. Bitte melden Sie sich erneut an, um in diesem Browser fortzufahren.' + expired: 'Ihr Account ist aufgrund zu langer Inaktiviät abgelaufen. Bitte kontaktieren Sie den Administrator.' diff --git a/config/locales/devise.security_extension.en.yml b/config/locales/devise.security_extension.en.yml new file mode 100644 index 000000000..e73d6e245 --- /dev/null +++ b/config/locales/devise.security_extension.en.yml @@ -0,0 +1,16 @@ +en: + errors: + messages: + taken_in_past: "was used previously." + equal_to_current_password: "must be different than the current password." + password_format: "must contain big, small letters and digits" + devise: + invalid_captcha: "The captcha input was invalid." + paranoid_verify: + code_required: "Please enter the code our support team provided" + password_expired: + updated: "Your new password is saved." + change_required: "Your password is expired. Please renew your password." + failure: + session_limited: 'Your login credentials were used in another browser. Please sign in again to continue in this browser.' + expired: 'Your account has expired due to inactivity. Please contact the site administrator.' diff --git a/config/locales/devise.security_extension.it.yml b/config/locales/devise.security_extension.it.yml new file mode 100644 index 000000000..646ae4ea0 --- /dev/null +++ b/config/locales/devise.security_extension.it.yml @@ -0,0 +1,10 @@ +it: + errors: + messages: + taken_in_past: "e' stata gia' utilizzata in passato!" + equal_to_current_password: " deve essere differente dalla password corrente!" + devise: + invalid_captcha: "Il captcha inserito non e' valido!" + password_expired: + updated: "La tua nuova password e' stata salvata." + change_required: "La tua password e' scaduta. Si prega di rinnovarla!" \ No newline at end of file diff --git a/db/migrate/20160901104320_add_password_expired.rb b/db/migrate/20160901104320_add_password_expired.rb new file mode 100644 index 000000000..aa759dd61 --- /dev/null +++ b/db/migrate/20160901104320_add_password_expired.rb @@ -0,0 +1,6 @@ +class AddPasswordExpired < ActiveRecord::Migration + def change + add_column :users, :password_changed_at, :datetime + add_index :users, :password_changed_at + end +end diff --git a/db/migrate/20160901104320_add_password_expired.rb~ b/db/migrate/20160901104320_add_password_expired.rb~ new file mode 100644 index 000000000..ac3a48f49 --- /dev/null +++ b/db/migrate/20160901104320_add_password_expired.rb~ @@ -0,0 +1,4 @@ +class AddPasswordExpired < ActiveRecord::Migration + def change + end +end diff --git a/db/schema.rb b/db/schema.rb index becde4f8a..339ce7675 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: 20160803154011) do +ActiveRecord::Schema.define(version: 20160901104320) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -464,12 +464,14 @@ ActiveRecord::Schema.define(version: 20160803154011) do t.boolean "email_digest", default: true t.boolean "email_on_direct_message", default: true t.boolean "official_position_badge", default: false + t.datetime "password_changed_at" end add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree add_index "users", ["geozone_id"], name: "index_users_on_geozone_id", using: :btree add_index "users", ["hidden_at"], name: "index_users_on_hidden_at", using: :btree + add_index "users", ["password_changed_at"], name: "index_users_on_password_changed_at", using: :btree add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree add_index "users", ["username"], name: "index_users_on_username", using: :btree diff --git a/spec/features/users_auth_spec.rb b/spec/features/users_auth_spec.rb index 9e1e67ef9..573e34a27 100644 --- a/spec/features/users_auth_spec.rb +++ b/spec/features/users_auth_spec.rb @@ -285,4 +285,41 @@ feature 'Users' do expect(page).to have_content "Your password has been changed successfully." end + + scenario 'Sign in, admin with password expired' do + user = create(:user, password_changed_at: Time.now - 1.year) + admin = create(:administrator, user: user) + + login_as(admin.user) + visit root_path + + expect(page).to have_content "Your password has expired" + + fill_in 'user_current_password', with: 'judgmentday' + fill_in 'user_password', with: '123456789' + fill_in 'user_password_confirmation', with: '123456789' + + click_button 'Change your password' + + expect(page).to have_content "Password successfully updated" + end + + scenario 'Sign in, admin without password expired' do + user = create(:user, password_changed_at: Time.now - 360.days) + admin = create(:administrator, user: user) + + login_as(admin.user) + visit root_path + + expect(page).to_not have_content "Your password has expired" + end + + scenario 'Sign in, user with password expired' do + user = create(:user, password_changed_at: Time.now - 1.year) + + login_as(user) + visit root_path + expect(page).to_not have_content "Your password has expired" + end + end From 48325589485207108aa5cc239da0b0b024fde32d Mon Sep 17 00:00:00 2001 From: Marcia Date: Thu, 15 Sep 2016 12:21:25 +0200 Subject: [PATCH 03/30] modificado mensaje en el test --- spec/features/users_auth_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/features/users_auth_spec.rb b/spec/features/users_auth_spec.rb index 573e34a27..c842e73bc 100644 --- a/spec/features/users_auth_spec.rb +++ b/spec/features/users_auth_spec.rb @@ -311,7 +311,7 @@ feature 'Users' do login_as(admin.user) visit root_path - expect(page).to_not have_content "Your password has expired" + expect(page).to_not have_content "Your password is expired" end scenario 'Sign in, user with password expired' do @@ -319,7 +319,7 @@ feature 'Users' do login_as(user) visit root_path - expect(page).to_not have_content "Your password has expired" + expect(page).to_not have_content "Your password is expired" end end From fa833f5a4a4a913d494907b35970ff6d8620f83a Mon Sep 17 00:00:00 2001 From: Marcia Date: Thu, 15 Sep 2016 13:06:03 +0200 Subject: [PATCH 04/30] modificado otro mensaje en los test --- spec/features/users_auth_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/users_auth_spec.rb b/spec/features/users_auth_spec.rb index c842e73bc..1b365f16d 100644 --- a/spec/features/users_auth_spec.rb +++ b/spec/features/users_auth_spec.rb @@ -293,7 +293,7 @@ feature 'Users' do login_as(admin.user) visit root_path - expect(page).to have_content "Your password has expired" + expect(page).to have_content "Your password is expired" fill_in 'user_current_password', with: 'judgmentday' fill_in 'user_password', with: '123456789' From ae22d9425592401dca90ad91617339b259db7b34 Mon Sep 17 00:00:00 2001 From: gentooza Date: Sun, 18 Sep 2016 20:08:57 +0200 Subject: [PATCH 05/30] added linux config instructions --- doc/en/dev_test_setup.md | 2 + doc/en/dev_test_setup_linux.md | 118 +++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 doc/en/dev_test_setup_linux.md diff --git a/doc/en/dev_test_setup.md b/doc/en/dev_test_setup.md index 7fc7c967e..d5fa28fe0 100644 --- a/doc/en/dev_test_setup.md +++ b/doc/en/dev_test_setup.md @@ -2,6 +2,8 @@ ## Linux +See [here](dev_test_setup_linux.md) + ## Mac OS X See [here](dev_test_setup_osx.md) diff --git a/doc/en/dev_test_setup_linux.md b/doc/en/dev_test_setup_linux.md new file mode 100644 index 000000000..57b3c1463 --- /dev/null +++ b/doc/en/dev_test_setup_linux.md @@ -0,0 +1,118 @@ +# Configuration for development and test environments (GNU/Linux) + +## Git + +Git is officially maintained in Debian/Ubuntu: + +``` +sudo apt-get install git +``` + +## Ruby + +Ruby versions packaged in official repositories are not suitable to work with consul (at least Debian 7 and 8), so we'll have to install it manually. +The preferred method is via rvm:
+**be careful as only the multi user option installs all dependencies automatically, as we use 'sudo'.** + +###as local user: + +``` +$ curl -L https://get.rvm.io | bash -s stable +``` +###for all system users + +``` +$ curl -L https://get.rvm.io | sudo bash -s stable +``` +and then add your user to rvm group +``` +$ sudo usermod -a -G rvm +``` +and finally, add rvm script source to user's bash (~/.bashrc) (this step it's only necessary if you still can't execute rvm command) +``` +[[ -s /usr/local/rvm/scripts/rvm ]] && source /usr/local/rvm/scripts/rvm +``` +with all this, you are suppose to be able to install a ruby version from rvm, as for example version 2.3.0: +``` +rvm install 2.3.0 +``` + + +## Bundler + +with +``` +gem install bundler +``` +or +there is more methods [here](https://rvm.io/integration/bundler) +as: +``` +gem install rubygems-bundler +``` +should be better + + +## PostgreSQL (>=9.4) + +PostgreSQL version 9.4 is not official in debian 7 (wheezy), in 8 it seems to be officially maintained. +So you have to add a repository, the official postgresql works fine. + +Add the repository to apt, for example creating file */etc/apt/sources.list.d/pgdg.list* with: +``` +deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main +``` +afterwards you'll have to download the key, and install it, by: + +``` +wget https://www.postgresql.org/media/keys/ACCC4CF8.asc +apt-key add ACCC4CF8.asc +``` +and install postgresql + +``` +apt-get update +apt-get install postgresql-9.4 +``` + +## Ghostscript + +``` +apt-get install ghostscript +``` + +## Cloning the repository + +Now, with all the dependencies installed, clone the Consul repository: + +``` +git clone https://github.com/consul/consul.git +cd consul +bundle install +cp config/database.yml.example config/database.yml +cp config/secrets.yml.example config/secrets.yml +``` +Perhaps it's needed to create a superuser rol with password in postgresql, and write it in */config/database.yml* 'user:' and 'password:' fields. + +Also, it seems that postgresql use as default an unix socket for localhost communications. If we encounter problems creating database (connection problems) we can change in */config/database.yml* the line: +``` +host: localhost +``` +for: +``` +host: /var/run/postgresql +``` + +After this: + +``` +rake db:create +rake db:setup +rake db:dev_seed +RAILS_ENV=test bin/rake db:setup +``` + +and run it in test mode by executing +``` +bin/rails -s +``` \ No newline at end of file From b107c2461bd41a524df8e7fab2dc0e949a8b4825 Mon Sep 17 00:00:00 2001 From: prointegra Date: Tue, 20 Sep 2016 14:16:47 +0200 Subject: [PATCH 06/30] improved text --- doc/en/dev_test_setup_linux.md | 46 ++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/doc/en/dev_test_setup_linux.md b/doc/en/dev_test_setup_linux.md index 57b3c1463..df0dbb26a 100644 --- a/doc/en/dev_test_setup_linux.md +++ b/doc/en/dev_test_setup_linux.md @@ -11,63 +11,73 @@ sudo apt-get install git ## Ruby Ruby versions packaged in official repositories are not suitable to work with consul (at least Debian 7 and 8), so we'll have to install it manually. -The preferred method is via rvm:
-**be careful as only the multi user option installs all dependencies automatically, as we use 'sudo'.** + +The preferred method is via rvm: + +(only the multi user option installs all dependencies automatically, as we use 'sudo'.) ###as local user: ``` -$ curl -L https://get.rvm.io | bash -s stable +curl -L https://get.rvm.io | bash -s stable ``` ###for all system users ``` -$ curl -L https://get.rvm.io | sudo bash -s stable +curl -L https://get.rvm.io | sudo bash -s stable ``` + and then add your user to rvm group + ``` -$ sudo usermod -a -G rvm +sudo usermod -a -G rvm ``` + and finally, add rvm script source to user's bash (~/.bashrc) (this step it's only necessary if you still can't execute rvm command) + ``` [[ -s /usr/local/rvm/scripts/rvm ]] && source /usr/local/rvm/scripts/rvm ``` -with all this, you are suppose to be able to install a ruby version from rvm, as for example version 2.3.0: -``` -rvm install 2.3.0 -``` +with all this, you are suppose to be able to install a ruby version from rvm, as for example version 2.3.0: + +``` +sudo rvm install 2.3.0 +``` ## Bundler with + ``` gem install bundler ``` -or -there is more methods [here](https://rvm.io/integration/bundler) -as: + +or there is more methods [here](https://rvm.io/integration/bundler) that should be better as: + ``` gem install rubygems-bundler ``` -should be better - ## PostgreSQL (>=9.4) PostgreSQL version 9.4 is not official in debian 7 (wheezy), in 8 it seems to be officially maintained. + So you have to add a repository, the official postgresql works fine. Add the repository to apt, for example creating file */etc/apt/sources.list.d/pgdg.list* with: + ``` deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main ``` + afterwards you'll have to download the key, and install it, by: ``` wget https://www.postgresql.org/media/keys/ACCC4CF8.asc apt-key add ACCC4CF8.asc ``` + and install postgresql ``` @@ -95,10 +105,13 @@ cp config/secrets.yml.example config/secrets.yml Perhaps it's needed to create a superuser rol with password in postgresql, and write it in */config/database.yml* 'user:' and 'password:' fields. Also, it seems that postgresql use as default an unix socket for localhost communications. If we encounter problems creating database (connection problems) we can change in */config/database.yml* the line: + ``` host: localhost ``` + for: + ``` host: /var/run/postgresql ``` @@ -111,8 +124,3 @@ rake db:setup rake db:dev_seed RAILS_ENV=test bin/rake db:setup ``` - -and run it in test mode by executing -``` -bin/rails -s -``` \ No newline at end of file From e4e2706af6b50930f09aa080638ca4a4b56d8539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ignacio=20Aliende=20Garc=C3=ADa?= Date: Tue, 20 Sep 2016 17:34:26 +0100 Subject: [PATCH 07/30] Fixes custom locales inclusion. --- config/application.rb | 2 +- spec/customization_engine_spec.rb | 22 ++++++++++++++++++++++ spec/support/locales/custom/en.yml | 5 +++++ spec/support/locales/en.yml | 5 +++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 spec/customization_engine_spec.rb create mode 100644 spec/support/locales/custom/en.yml create mode 100644 spec/support/locales/en.yml diff --git a/config/application.rb b/config/application.rb index 3f2a0861a..2b842992b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -24,7 +24,6 @@ module Consul config.i18n.available_locales = [:en, :es] # Add the new directories to the locales load path - config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] config.assets.paths << Rails.root.join("app", "assets", "fonts") @@ -44,6 +43,7 @@ module Consul config.autoload_paths << "#{Rails.root}/app/controllers/custom" config.autoload_paths << "#{Rails.root}/app/models/custom" config.paths['app/views'].unshift(Rails.root.join('app', 'views', 'custom')) + config.i18n.load_path += Dir[Rails.root.join('config', 'locales', 'custom', '*.{rb,yml}')] end end diff --git a/spec/customization_engine_spec.rb b/spec/customization_engine_spec.rb new file mode 100644 index 000000000..d68811c73 --- /dev/null +++ b/spec/customization_engine_spec.rb @@ -0,0 +1,22 @@ +require 'rails_helper' + +# This module tests functionality related with custom application files +# TODO test models, controllers, etc... + +describe 'CustomizationEngine' do + + let(:test_key) { I18n.t('account.show.change_credentials_link') } + + it "should load custom and override original locales" do + I18n.load_path += Dir[Rails.root.join('spec', 'support', 'locales', 'custom', '*.{rb,yml}')] + I18n.reload! + expect(test_key).to eq 'Overriden string with custom locales' + end + + it "should not override original locales" do + I18n.load_path.delete_if {|item| item =~ /spec\/support\/locales\/custom/ } + I18n.load_path += Dir[Rails.root.join('spec', 'support', 'locales', '**', '*.{rb,yml}')] + I18n.reload! + expect(test_key).to eq 'Not overriden string with custom locales' + end +end diff --git a/spec/support/locales/custom/en.yml b/spec/support/locales/custom/en.yml new file mode 100644 index 000000000..f601a35bc --- /dev/null +++ b/spec/support/locales/custom/en.yml @@ -0,0 +1,5 @@ +--- +en: + account: + show: + change_credentials_link: Overriden string with custom locales diff --git a/spec/support/locales/en.yml b/spec/support/locales/en.yml new file mode 100644 index 000000000..c1174677b --- /dev/null +++ b/spec/support/locales/en.yml @@ -0,0 +1,5 @@ +--- +en: + account: + show: + change_credentials_link: Not overriden string with custom locales From 78c6a30424df21f6743b8812ac7445a23d3594a3 Mon Sep 17 00:00:00 2001 From: Marcia Date: Tue, 27 Sep 2016 13:07:06 +0200 Subject: [PATCH 08/30] optimize code --- app/models/user.rb | 6 ++ .../initializers/devise_security_extension.rb | 81 +++++-------------- config/locales/devise.en.yml | 2 +- .../locales/devise.security_extension.de.yml | 16 ---- .../locales/devise.security_extension.en.yml | 16 ---- .../locales/devise.security_extension.it.yml | 10 --- lib/tasks/users.rake | 8 ++ spec/features/users_auth_spec.rb | 15 ++++ 8 files changed, 49 insertions(+), 105 deletions(-) delete mode 100644 config/locales/devise.security_extension.de.yml delete mode 100644 config/locales/devise.security_extension.en.yml delete mode 100644 config/locales/devise.security_extension.it.yml diff --git a/app/models/user.rb b/app/models/user.rb index 633610d9d..1c9ace227 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -57,6 +57,8 @@ before_validation :clean_document_number + before_create :set_password_changed_at + # Get the existing user by email if the provider gives us a verified email. def self.first_or_initialize_for_oauth(auth) oauth_email = auth.info.email @@ -240,6 +242,10 @@ true end + def set_password_changed_at + set_password_changed_at = created_at + end + def ability @ability ||= Ability.new(self) end diff --git a/config/initializers/devise_security_extension.rb b/config/initializers/devise_security_extension.rb index 83b88200e..b38393b75 100644 --- a/config/initializers/devise_security_extension.rb +++ b/config/initializers/devise_security_extension.rb @@ -10,7 +10,7 @@ Devise.setup do |config| # config.password_regex = /(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])/ # How many passwords to keep in archive - # config.password_archiving_count = 5 + #config.password_archiving_count = 5 # Deny old password (true, false, count) # config.deny_old_passwords = true @@ -18,7 +18,6 @@ Devise.setup do |config| # enable email validation for :secure_validatable. (true, false, validation_options) # dependency: need an email validator like rails_email_validator # config.email_validation = true - # captcha integration for recover form # config.captcha_for_recover = true @@ -42,20 +41,22 @@ module Devise module Models module PasswordExpirable def need_change_password? - if self.administrator? - #is administrator - if self.expire_password_after.is_a? Fixnum or self.expire_password_after.is_a? Float - self.password_changed_at.nil? or self.password_changed_at < self.expire_password_after.ago - else - #not change password - false - end - else - #It is not an administrator - false + if password_change? + password_expired? + else + false end end - end + + def password_change? + self.administrator? && password_expired? + end + + def password_expired? + self.password_changed_at < self.expire_password_after.ago + end + + end #module PasswordExpirable module SecureValidatable def self.included(base) @@ -63,24 +64,11 @@ module Devise assert_secure_validations_api!(base) base.class_eval do - # validate login in a strict way if not yet validated - unless devise_validation_enabled? - validates :email, :presence => true, :if => :email_required? - validates :email, :uniqueness => true, :allow_blank => true, :if => :email_changed? # check uniq for email ever - validates :password, :presence => true, :length => password_length, :confirmation => true, :if => :password_required? - end - - # extra validations - #validates :password, :format => { :with => password_regex, :message => :password_format }, :if => :password_required? - # don't allow use same password + validate :current_equal_password_validation end end - def self.assert_secure_validations_api!(base) - raise "Could not use SecureValidatable on #{base}" unless base.respond_to?(:validates) - end - def current_equal_password_validation if !self.new_record? && !self.encrypted_password_change.nil? && !self.erased? dummy = self.class.new @@ -90,38 +78,7 @@ module Devise end end - protected + end #module SecureValidatable - # Checks whether a password is needed or not. For validations only. - # Passwords are always required if it's a new record, or if the password - # or confirmation are being set somewhere. - def password_required? - !persisted? || !password.nil? || !password_confirmation.nil? - end - - def email_required? - true - end - - module ClassMethods - Devise::Models.config(self, :password_regex, :password_length, :email_validation) - - private - def has_uniqueness_validation_of_login? - validators.any? do |validator| - validator.kind_of?(ActiveRecord::Validations::UniquenessValidator) && - validator.attributes.include?(login_attribute) - end - end - - def login_attribute - authentication_keys[0] - end - - def devise_validation_enabled? - self.ancestors.map(&:to_s).include? 'Devise::Models::Validatable' - end - end - end - end -end \ No newline at end of file + end #module Models +end #module Devise \ No newline at end of file diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index f031d62b5..29bc0a620 100755 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -4,7 +4,7 @@ en: devise: password_expired: expire_password: "Password expired" - change_required: "Your password has expired" + change_required: "Your password is expired" change_password: "Change your password" new_password: "New password" updated: "Password successfully updated" diff --git a/config/locales/devise.security_extension.de.yml b/config/locales/devise.security_extension.de.yml deleted file mode 100644 index cad39d9b7..000000000 --- a/config/locales/devise.security_extension.de.yml +++ /dev/null @@ -1,16 +0,0 @@ -de: - errors: - messages: - taken_in_past: "wurde bereits in der Vergangenheit verwendet!" - equal_to_current_password: "darf nicht dem aktuellen Passwort entsprechen!" - password_format: "müssen große, kleine Buchstaben und Ziffern enthalten" - devise: - invalid_captcha: "Die Captchaeingabe ist nicht gültig!" - paranoid_verify: - code_required: "Bitte geben Sie den Code unser Support-Team zur Verfügung gestellt" - password_expired: - updated: "Das neue Passwort wurde übernommen." - change_required: "Ihr Passwort ist abgelaufen. Bitte vergeben sie ein neues Passwort!" - failure: - session_limited: 'Ihre Anmeldedaten wurden in einem anderen Browser genutzt. Bitte melden Sie sich erneut an, um in diesem Browser fortzufahren.' - expired: 'Ihr Account ist aufgrund zu langer Inaktiviät abgelaufen. Bitte kontaktieren Sie den Administrator.' diff --git a/config/locales/devise.security_extension.en.yml b/config/locales/devise.security_extension.en.yml deleted file mode 100644 index e73d6e245..000000000 --- a/config/locales/devise.security_extension.en.yml +++ /dev/null @@ -1,16 +0,0 @@ -en: - errors: - messages: - taken_in_past: "was used previously." - equal_to_current_password: "must be different than the current password." - password_format: "must contain big, small letters and digits" - devise: - invalid_captcha: "The captcha input was invalid." - paranoid_verify: - code_required: "Please enter the code our support team provided" - password_expired: - updated: "Your new password is saved." - change_required: "Your password is expired. Please renew your password." - failure: - session_limited: 'Your login credentials were used in another browser. Please sign in again to continue in this browser.' - expired: 'Your account has expired due to inactivity. Please contact the site administrator.' diff --git a/config/locales/devise.security_extension.it.yml b/config/locales/devise.security_extension.it.yml deleted file mode 100644 index 646ae4ea0..000000000 --- a/config/locales/devise.security_extension.it.yml +++ /dev/null @@ -1,10 +0,0 @@ -it: - errors: - messages: - taken_in_past: "e' stata gia' utilizzata in passato!" - equal_to_current_password: " deve essere differente dalla password corrente!" - devise: - invalid_captcha: "Il captcha inserito non e' valido!" - password_expired: - updated: "La tua nuova password e' stata salvata." - change_required: "La tua password e' scaduta. Si prega di rinnovarla!" \ No newline at end of file diff --git a/lib/tasks/users.rake b/lib/tasks/users.rake index efbeeaa94..98fcae5d2 100644 --- a/lib/tasks/users.rake +++ b/lib/tasks/users.rake @@ -76,4 +76,12 @@ namespace :users do task remove_erased_identities: :environment do Identity.joins(:user).where('users.erased_at IS NOT NULL').destroy_all end + + desc "Update password changed at for existing users" + task update_password_changed_at: :environment do + User.all.each do |user| + user.update(password_changed_at:user.created_at) + end + end + end diff --git a/spec/features/users_auth_spec.rb b/spec/features/users_auth_spec.rb index 1b365f16d..f16772fd4 100644 --- a/spec/features/users_auth_spec.rb +++ b/spec/features/users_auth_spec.rb @@ -322,4 +322,19 @@ feature 'Users' do expect(page).to_not have_content "Your password is expired" end + scenario 'Admin with password expired trying to use same password' do + user = create(:user, password_changed_at: Time.now - 1.year, password: '123456789') + admin = create(:administrator, user: user) + login_as(admin.user) + visit root_path + expect(page).to have_content "Your password is expired" + fill_in 'user_current_password', with: 'judgmentday' + fill_in 'user_password', with: '123456789' + fill_in 'user_password_confirmation', with: '123456789' + click_button 'Change your password' + expect(page).to have_content "must be different than the current password." + #expect(page).to have_content "You can not use the same password. Please choose another one." + end + + end From 1e87810593c37659a2b3d388a4c1760c175b0569 Mon Sep 17 00:00:00 2001 From: Marcia Date: Thu, 29 Sep 2016 14:34:37 +0200 Subject: [PATCH 09/30] improves expired password view --- app/models/user.rb | 4 ++-- app/views/devise/password_expired/show.html.erb | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 1c9ace227..75367dbe1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,8 +2,8 @@ include Verification - devise :password_expirable, :secure_validatable, :database_authenticatable, :registerable, :confirmable, - :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :async + devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, + :trackable, :validatable, :omniauthable, :async, :password_expirable, :secure_validatable acts_as_voter acts_as_paranoid column: :hidden_at diff --git a/app/views/devise/password_expired/show.html.erb b/app/views/devise/password_expired/show.html.erb index 0c750dd1e..33dc82f71 100644 --- a/app/views/devise/password_expired/show.html.erb +++ b/app/views/devise/password_expired/show.html.erb @@ -1,7 +1,6 @@

<%= t("devise.password_expired.expire_password") %>

<%= form_for(resource, :as => resource_name, :url => [resource_name, :password_expired], :html => { :method => :put }) do |f| %> - <%= devise_error_messages! %> <%= f.password_field :current_password %>

From 1f72c5cc74ea1cfcb147e1bb58e5bf495a21af00 Mon Sep 17 00:00:00 2001 From: Marcia Date: Fri, 30 Sep 2016 10:10:20 +0200 Subject: [PATCH 10/30] improves expired password view --- config/initializers/devise_security_extension.rb | 13 ++++--------- db/migrate/20160901104320_add_password_expired.rb~ | 4 ---- spec/features/users_auth_spec.rb | 1 - 3 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 db/migrate/20160901104320_add_password_expired.rb~ diff --git a/config/initializers/devise_security_extension.rb b/config/initializers/devise_security_extension.rb index b38393b75..5b13fc905 100644 --- a/config/initializers/devise_security_extension.rb +++ b/config/initializers/devise_security_extension.rb @@ -55,16 +55,13 @@ module Devise def password_expired? self.password_changed_at < self.expire_password_after.ago end - - end #module PasswordExpirable + end module SecureValidatable def self.included(base) base.extend ClassMethods assert_secure_validations_api!(base) - base.class_eval do - validate :current_equal_password_validation end end @@ -77,8 +74,6 @@ module Devise self.errors.add(:password, :equal_to_current_password) if dummy.valid_password?(self.password) end end - - end #module SecureValidatable - - end #module Models -end #module Devise \ No newline at end of file + end + end +end \ No newline at end of file diff --git a/db/migrate/20160901104320_add_password_expired.rb~ b/db/migrate/20160901104320_add_password_expired.rb~ deleted file mode 100644 index ac3a48f49..000000000 --- a/db/migrate/20160901104320_add_password_expired.rb~ +++ /dev/null @@ -1,4 +0,0 @@ -class AddPasswordExpired < ActiveRecord::Migration - def change - end -end diff --git a/spec/features/users_auth_spec.rb b/spec/features/users_auth_spec.rb index f16772fd4..bd58eabe0 100644 --- a/spec/features/users_auth_spec.rb +++ b/spec/features/users_auth_spec.rb @@ -333,7 +333,6 @@ feature 'Users' do fill_in 'user_password_confirmation', with: '123456789' click_button 'Change your password' expect(page).to have_content "must be different than the current password." - #expect(page).to have_content "You can not use the same password. Please choose another one." end From 680c0636edf554ee579212ed6ce9fd3d3530320f Mon Sep 17 00:00:00 2001 From: Marcia Date: Thu, 6 Oct 2016 14:19:48 +0200 Subject: [PATCH 11/30] expired password last --- app/models/user.rb | 8 +------- config/initializers/devise_security_extension.rb | 10 +--------- lib/tasks/users.rake | 2 +- spec/features/users_auth_spec.rb | 8 ++++++-- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 75367dbe1..916c3d0b9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,4 @@ - class User < ActiveRecord::Base +class User < ActiveRecord::Base include Verification @@ -57,8 +57,6 @@ before_validation :clean_document_number - before_create :set_password_changed_at - # Get the existing user by email if the provider gives us a verified email. def self.first_or_initialize_for_oauth(auth) oauth_email = auth.info.email @@ -242,10 +240,6 @@ true end - def set_password_changed_at - set_password_changed_at = created_at - end - def ability @ability ||= Ability.new(self) end diff --git a/config/initializers/devise_security_extension.rb b/config/initializers/devise_security_extension.rb index 5b13fc905..6e691acbe 100644 --- a/config/initializers/devise_security_extension.rb +++ b/config/initializers/devise_security_extension.rb @@ -41,16 +41,8 @@ module Devise module Models module PasswordExpirable def need_change_password? - if password_change? - password_expired? - else - false - end - end - - def password_change? self.administrator? && password_expired? - end + end def password_expired? self.password_changed_at < self.expire_password_after.ago diff --git a/lib/tasks/users.rake b/lib/tasks/users.rake index 98fcae5d2..ccb749f9a 100644 --- a/lib/tasks/users.rake +++ b/lib/tasks/users.rake @@ -80,7 +80,7 @@ namespace :users do desc "Update password changed at for existing users" task update_password_changed_at: :environment do User.all.each do |user| - user.update(password_changed_at:user.created_at) + user.update(password_changed_at: user.created_at) end end diff --git a/spec/features/users_auth_spec.rb b/spec/features/users_auth_spec.rb index bd58eabe0..5b3c157d7 100644 --- a/spec/features/users_auth_spec.rb +++ b/spec/features/users_auth_spec.rb @@ -319,21 +319,25 @@ feature 'Users' do login_as(user) visit root_path + expect(page).to_not have_content "Your password is expired" end scenario 'Admin with password expired trying to use same password' do user = create(:user, password_changed_at: Time.now - 1.year, password: '123456789') admin = create(:administrator, user: user) + login_as(admin.user) - visit root_path + visit root_path + expect(page).to have_content "Your password is expired" + fill_in 'user_current_password', with: 'judgmentday' fill_in 'user_password', with: '123456789' fill_in 'user_password_confirmation', with: '123456789' click_button 'Change your password' + expect(page).to have_content "must be different than the current password." end - end From fb8669292e1581cc9eff8d48b26603a298de213f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Thu, 13 Oct 2016 11:25:29 +0200 Subject: [PATCH 12/30] adds missing i18n keys to settings --- config/locales/settings.en.yml | 11 +++++++++++ config/locales/settings.es.yml | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/config/locales/settings.en.yml b/config/locales/settings.en.yml index 0035eb556..0de4e5feb 100755 --- a/config/locales/settings.en.yml +++ b/config/locales/settings.en.yml @@ -14,7 +14,18 @@ en: months_to_archive_proposals: "Months to archive Proposals" email_domain_for_officials: "Email domain for public officials" per_page_code: "Code to be included on every page" + twitter_handle: "Twitter handle" + twitter_hashtag: "Twitter hashtag" + facebook_handle: "Facebook handle" + youtube_handle: "Youtube handle" + blog_url: "Blog URL" + url: "Main URL" + org_name: "Organization" + place_name: "Place" feature: + twitter_login: Twitter login + facebook_login: Facebook login + google_login: Google login debates: Debates spending_proposals: Investment projects spending_proposal_features: diff --git a/config/locales/settings.es.yml b/config/locales/settings.es.yml index 1235762b4..05ba6c076 100644 --- a/config/locales/settings.es.yml +++ b/config/locales/settings.es.yml @@ -14,7 +14,18 @@ es: months_to_archive_proposals: "Meses para archivar las Propuestas" email_domain_for_officials: "Dominio de email para cargos públicos" per_page_code: "Código a incluir en cada página" + twitter_handle: "Usuario de Twitter" + twitter_hashtag: "Hashtag para Twitter" + facebook_handle: "Identificador de Facebook" + youtube_handle: "Usuario de Youtube" + blog_url: "URL del blog" + url: "URL general de la web" + org_name: "Nombre de la organización" + place_name: "Nombre del lugar" feature: + twitter_login: Registro con Twitter + facebook_login: Registro con Facebook + google_login: Registro con Google debates: Debates spending_proposals: Propuestas de inversión spending_proposal_features: From e8312ff86a96f21a2842c125fa7613abd0e0a2c1 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Tue, 18 Oct 2016 16:40:59 +0200 Subject: [PATCH 13/30] fixes text format on direct messages --- app/views/direct_messages/show.html.erb | 2 +- app/views/mailer/direct_message_for_receiver.html.erb | 6 +++--- app/views/mailer/direct_message_for_sender.html.erb | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/direct_messages/show.html.erb b/app/views/direct_messages/show.html.erb index 30a771a39..8d0f62d84 100644 --- a/app/views/direct_messages/show.html.erb +++ b/app/views/direct_messages/show.html.erb @@ -13,6 +13,6 @@

<%= @direct_message.title %>

-

<%= @direct_message.body %>

+

<%= simple_format text_with_links(@direct_message.body), {}, sanitize: false %>

diff --git a/app/views/mailer/direct_message_for_receiver.html.erb b/app/views/mailer/direct_message_for_receiver.html.erb index 2523f3502..ac86b994a 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -3,9 +3,9 @@ <%= @direct_message.title %> -

- <%= @direct_message.body %> -

+
+ <%= simple_format text_with_links(@direct_message.body), {}, sanitize: false %> +
diff --git a/app/views/mailer/direct_message_for_sender.html.erb b/app/views/mailer/direct_message_for_sender.html.erb index 4cf832414..127526cf4 100644 --- a/app/views/mailer/direct_message_for_sender.html.erb +++ b/app/views/mailer/direct_message_for_sender.html.erb @@ -9,7 +9,7 @@ <%= @direct_message.title %> -

- <%= @direct_message.body %> -

+
+ <%= simple_format text_with_links(@direct_message.body), {}, sanitize: false %> +
From c835d9b1d1b8dec5d7477627e522091b8e560e75 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 19 Oct 2016 10:54:48 +0200 Subject: [PATCH 14/30] improves styles for flash notices --- app/assets/stylesheets/layout.scss | 50 ++++++++++++++++++++++++++++++ app/views/layouts/_flash.html.erb | 8 +++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index b99f0300a..c180735eb 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -732,6 +732,56 @@ form { // 07. Callout // ----------- +.callout-slide { + animation-duration: 1s; + -webkit-animation-duration: 1s; + animation-fill-mode: both; + -webkit-animation-fill-mode: both; + animation-name: slide; + -webkit-animation-name: slide; +} + +@-webkit-keyframes slide { + from { + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes slide { + from { + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.notice-container { + min-width: $line-height*12; + position: absolute; + right: 24px; + top: 24px; + + .notice { + height: $line-height*4; + + .notice-text { + width: 95%; + } + } +} + .callout { font-size: $small-font-size; diff --git a/app/views/layouts/_flash.html.erb b/app/views/layouts/_flash.html.erb index d07259c5c..9f55b449a 100644 --- a/app/views/layouts/_flash.html.erb +++ b/app/views/layouts/_flash.html.erb @@ -1,10 +1,12 @@ <% flash.each do |flash_key, flash_message| %> -
-
+
+
- <%= flash_message %> +
+ <%= flash_message %> +
<% end %> From 1a143dfe0f894bbd8651e1d2273072ce23175048 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Tue, 25 Oct 2016 16:21:52 +0200 Subject: [PATCH 15/30] adds style for selection --- app/assets/stylesheets/layout.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index c180735eb..d850454d6 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -23,6 +23,11 @@ // 01. Global styles // ----------------- +::selection { + color: white; + background-color: $brand; +} + body { font-size: $base-font-size; } From 5c1e1f96ea4981ae0bbfe342ec53db6786ba981c Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Tue, 25 Oct 2016 16:23:45 +0200 Subject: [PATCH 16/30] deletes unused wrap class --- app/assets/stylesheets/layout.scss | 4 ---- app/views/debates/index.html.erb | 2 +- app/views/management/proposals/index.html.erb | 2 +- app/views/management/spending_proposals/index.html.erb | 2 +- app/views/proposals/index.html.erb | 2 +- app/views/proposals/summary.html.erb | 2 +- app/views/spending_proposals/index.html.erb | 2 +- 7 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index d850454d6..8052513fc 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -153,10 +153,6 @@ a { height: 100%; } -.wrap { - background: white; -} - .footer, .push { clear: both; min-height: $line-height*12; diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb index 22d628c65..2cd3f2d53 100644 --- a/app/views/debates/index.html.erb +++ b/app/views/debates/index.html.erb @@ -6,7 +6,7 @@ <% end %>
-
+
diff --git a/app/views/management/proposals/index.html.erb b/app/views/management/proposals/index.html.erb index e7966f0c5..fde056902 100644 --- a/app/views/management/proposals/index.html.erb +++ b/app/views/management/proposals/index.html.erb @@ -1,7 +1,7 @@
<%= render 'admin/shared/proposal_search', url: management_proposals_path %> -
+
diff --git a/app/views/management/spending_proposals/index.html.erb b/app/views/management/spending_proposals/index.html.erb index 49e4151d2..2178caf71 100644 --- a/app/views/management/spending_proposals/index.html.erb +++ b/app/views/management/spending_proposals/index.html.erb @@ -3,7 +3,7 @@ <%= render 'admin/shared/spending_proposal_search', url: management_spending_proposals_path %> -
+
diff --git a/app/views/proposals/index.html.erb b/app/views/proposals/index.html.erb index 5efa3e24c..df9339619 100644 --- a/app/views/proposals/index.html.erb +++ b/app/views/proposals/index.html.erb @@ -6,7 +6,7 @@ <% end %>
-
+
diff --git a/app/views/proposals/summary.html.erb b/app/views/proposals/summary.html.erb index 38c56c963..d5bc22196 100644 --- a/app/views/proposals/summary.html.erb +++ b/app/views/proposals/summary.html.erb @@ -1,5 +1,5 @@
-
+
<%= render "shared/back_link" %> diff --git a/app/views/spending_proposals/index.html.erb b/app/views/spending_proposals/index.html.erb index 563b84e23..4e95fd8db 100644 --- a/app/views/spending_proposals/index.html.erb +++ b/app/views/spending_proposals/index.html.erb @@ -6,7 +6,7 @@ <% end %>
-
+
From 08db2faf86ef12238f9cfd28ae63077a6a42e445 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Tue, 25 Oct 2016 16:30:36 +0200 Subject: [PATCH 17/30] fixes breakpoint on mixins --- app/assets/stylesheets/mixins.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/mixins.scss b/app/assets/stylesheets/mixins.scss index d772b8ace..5ffc534cb 100644 --- a/app/assets/stylesheets/mixins.scss +++ b/app/assets/stylesheets/mixins.scss @@ -13,7 +13,7 @@ font-size: rem-calc(24); font-weight: lighter; - @include breakpoint(small) { + @include breakpoint(medium) { line-height: $line-height*2; margin-top: 0; } @@ -22,7 +22,7 @@ height: 48px; width: 48px; - @include breakpoint(small) { + @include breakpoint(medium) { height: 80px; margin-right: $line-height/2; margin-top: 0; From 4979b6859a24ce00eb8849e7968914c76b8f3c26 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 26 Oct 2016 00:34:23 +0200 Subject: [PATCH 18/30] updates minor version dependencies --- Gemfile | 32 ++++++++++----------- Gemfile.lock | 81 ++++++++++++++++++++++++++-------------------------- 2 files changed, 56 insertions(+), 57 deletions(-) diff --git a/Gemfile b/Gemfile index e61e92e25..665421ce2 100644 --- a/Gemfile +++ b/Gemfile @@ -3,24 +3,24 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.7.1' # Use PostgreSQL -gem 'pg' +gem 'pg', '0.19.0' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0', '>= 5.0.4' # Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' +gem 'uglifier', '>= 3.0.3' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.2.1' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library -gem 'jquery-rails' +gem 'jquery-rails', '4.2.1' gem 'jquery-ui-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' # Fix sprockets on the -gem 'sprockets', '~> 3.6.3' +gem 'sprockets', '~> 3.7.0' gem 'devise', '~> 3.5.7' gem 'devise_security_extension' @@ -32,11 +32,11 @@ gem 'omniauth-facebook', '~> 3.0.0' gem 'omniauth-google-oauth2', '~> 0.4.0' gem 'kaminari' -gem 'ancestry' +gem 'ancestry', '2.2.1' gem 'acts-as-taggable-on' -gem 'responders' -gem 'foundation-rails' -gem 'foundation_rails_helper' +gem 'responders', '2.3.0' +gem 'foundation-rails', '6.2.4.0' +gem 'foundation_rails_helper', '2.0.0' gem 'acts_as_votable' gem 'ckeditor', '~> 4.2.0' gem 'invisible_captcha', '~> 0.9.1' @@ -44,24 +44,24 @@ gem 'cancancan' gem 'social-share-button' gem 'initialjs-rails', '0.2.0.4' gem 'unicorn', '~> 5.1.0' -gem 'paranoia' -gem 'rinku', require: 'rails_rinku' +gem 'paranoia', '2.2.0' +gem 'rinku', '2.0.2', require: 'rails_rinku' gem 'savon' gem 'dalli' -gem 'rollbar', '~> 2.12.0' +gem 'rollbar', '~> 2.13.3' gem 'delayed_job_active_record', '~> 4.1.0' gem 'daemons' gem 'devise-async' -gem 'newrelic_rpm', '~> 3.16' +gem 'newrelic_rpm', '~> 3.17.0.325' gem 'whenever', require: false gem 'pg_search' -gem 'ahoy_matey', '~> 1.4.0' -gem 'groupdate' # group temporary data -gem 'tolk' # Web interface for translations +gem 'ahoy_matey', '~> 1.4.2' +gem 'groupdate', '3.1.0' # group temporary data +gem 'tolk', '2.0.0' # Web interface for translations gem 'browser' -gem 'turnout' +gem 'turnout', '2.4.0' gem 'redcarpet' group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 68570d756..00780d8c2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,7 +56,7 @@ GEM akami (1.3.1) gyoku (>= 0.4.0) nokogiri - ancestry (2.1.0) + ancestry (2.2.1) activerecord (>= 3.0.0) arel (6.0.3) ast (2.2.0) @@ -163,11 +163,11 @@ GEM i18n (~> 0.5) faraday (0.9.2) multipart-post (>= 1.2, < 3) - foundation-rails (6.2.3.0) + foundation-rails (6.2.4.0) railties (>= 3.1.0) sass (>= 3.3.0, < 3.5) sprockets-es6 (>= 0.9.0) - foundation_rails_helper (1.2.1) + foundation_rails_helper (2.0.0) actionpack (>= 4.1) activemodel (>= 4.1) activesupport (>= 4.1) @@ -176,10 +176,10 @@ GEM fuubar (2.1.1) rspec (~> 3.0) ruby-progressbar (~> 1.4) - geocoder (1.3.7) + geocoder (1.4.0) globalid (0.3.7) activesupport (>= 4.1.0) - groupdate (3.0.2) + groupdate (3.1.0) activesupport (>= 3) gyoku (1.3.1) builder (>= 2.1.2) @@ -203,7 +203,7 @@ GEM railties (>= 3.1, < 6.0) invisible_captcha (0.9.1) rails - jquery-rails (4.1.1) + jquery-rails (4.2.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -238,10 +238,9 @@ GEM net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (3.2.0) - newrelic_rpm (3.16.3.323) - nokogiri (1.6.8) + newrelic_rpm (3.17.0.325) + nokogiri (1.6.8.1) mini_portile2 (~> 2.1.0) - pkg-config (~> 1.1.7) nori (2.6.0) oauth (0.5.0) oauth2 (1.0.0) @@ -270,16 +269,15 @@ GEM json (~> 1.3) omniauth-oauth (~> 1.1) orm_adapter (0.5.0) - paranoia (2.1.5) - activerecord (~> 4.0) + paranoia (2.2.0) + activerecord (>= 4.0, < 5.1) parser (2.3.0.6) ast (~> 2.2) - pg (0.18.4) + pg (0.19.0) pg_search (1.0.6) activerecord (>= 3.1) activesupport (>= 3.1) arel - pkg-config (1.1.7) poltergeist (1.10.0) capybara (~> 2.1) cliver (~> 0.3.1) @@ -289,7 +287,7 @@ GEM rack (1.6.4) rack-accept (0.4.5) rack (>= 0.4) - rack-attack (4.4.1) + rack-attack (5.0.1) rack rack-test (0.6.3) rack (>= 1.0) @@ -322,10 +320,10 @@ GEM redcarpet (3.3.4) referer-parser (0.3.0) request_store (1.3.1) - responders (2.2.0) + responders (2.3.0) railties (>= 4.2.0, < 5.1) - rinku (2.0.0) - rollbar (2.12.0) + rinku (2.0.2) + rollbar (2.13.3) multi_json rspec (3.5.0) rspec-core (~> 3.5.0) @@ -378,14 +376,14 @@ GEM spring (1.7.2) spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (3.6.3) + sprockets (3.7.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-es6 (0.9.0) + sprockets-es6 (0.9.2) babel-source (>= 5.8.11) babel-transpiler sprockets (>= 3.0.0) - sprockets-rails (3.1.1) + sprockets-rails (3.2.0) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) @@ -400,18 +398,19 @@ GEM thread_safe (0.3.5) tilt (2.0.5) tins (1.11.0) - tolk (1.9.3) - rails (>= 4.0, < 4.3) + tolk (2.0.0) + rails (>= 4.0) safe_yaml (>= 0.8.6) turbolinks (2.5.3) coffee-rails - turnout (2.3.1) - rack (~> 1.3) + turnout (2.4.0) + i18n (~> 0.7) + rack (>= 1.3, < 3) rack-accept (~> 0.4) tilt (>= 1.4, < 3) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (3.0.2) + uglifier (3.0.3) execjs (>= 0.3.0, < 3) unicorn (5.1.0) kgio (~> 2.6) @@ -442,8 +441,8 @@ PLATFORMS DEPENDENCIES acts-as-taggable-on acts_as_votable - ahoy_matey (~> 1.4.0) - ancestry + ahoy_matey (~> 1.4.2) + ancestry (= 2.2.1) browser bullet byebug @@ -467,44 +466,44 @@ DEPENDENCIES email_spec factory_girl_rails faker - foundation-rails - foundation_rails_helper + foundation-rails (= 6.2.4.0) + foundation_rails_helper (= 2.0.0) fuubar - groupdate + groupdate (= 3.1.0) i18n-tasks initialjs-rails (= 0.2.0.4) invisible_captcha (~> 0.9.1) - jquery-rails + jquery-rails (= 4.2.1) jquery-ui-rails kaminari launchy letter_opener_web (~> 1.3.0) - newrelic_rpm (~> 3.16) + newrelic_rpm (~> 3.17.0.325) omniauth omniauth-facebook (~> 3.0.0) omniauth-google-oauth2 (~> 0.4.0) omniauth-twitter - paranoia - pg + paranoia (= 2.2.0) + pg (= 0.19.0) pg_search poltergeist quiet_assets rails (= 4.2.7.1) redcarpet - responders - rinku - rollbar (~> 2.12.0) + responders (= 2.3.0) + rinku (= 2.0.2) + rollbar (~> 2.13.3) rspec-rails (~> 3.5) sass-rails (~> 5.0, >= 5.0.4) savon social-share-button spring spring-commands-rspec - sprockets (~> 3.6.3) - tolk + sprockets (~> 3.7.0) + tolk (= 2.0.0) turbolinks - turnout - uglifier (>= 1.3.0) + turnout (= 2.4.0) + uglifier (>= 3.0.3) unicorn (~> 5.1.0) web-console (= 3.3.0) whenever From fe3451b4ba71054e25662d958e04dfe2db404180 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 26 Oct 2016 10:31:05 +0200 Subject: [PATCH 19/30] fixes specs --- spec/models/proposal_spec.rb | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index d98392eaa..39c052861 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -793,54 +793,50 @@ describe Proposal do end describe "retired" do - before(:all) do - @proposal1 = create(:proposal) - @proposal2 = create(:proposal, retired_at: Time.now) - end + let!(:proposal1) { create(:proposal) } + let!(:proposal2) { create(:proposal, retired_at: Time.now) } it "retired? is true" do - expect(@proposal1.retired?).to eq false - expect(@proposal2.retired?).to eq true + expect(proposal1.retired?).to eq false + expect(proposal2.retired?).to eq true end it "scope retired" do retired = Proposal.retired expect(retired.size).to eq(1) - expect(retired.first).to eq(@proposal2) + expect(retired.first).to eq(proposal2) end it "scope not_retired" do not_retired = Proposal.not_retired expect(not_retired.size).to eq(1) - expect(not_retired.first).to eq(@proposal1) + expect(not_retired.first).to eq(proposal1) end end describe "archived" do - before(:each) do - @new_proposal = create(:proposal) - @archived_proposal = create(:proposal, :archived) - end + let!(:new_proposal) { create(:proposal) } + let!(:archived_proposal) { create(:proposal, :archived) } it "archived? is true only for proposals created more than n (configured months) ago" do - expect(@new_proposal.archived?).to eq false - expect(@archived_proposal.archived?).to eq true + expect(new_proposal.archived?).to eq false + expect(archived_proposal.archived?).to eq true end it "scope archived" do archived = Proposal.archived expect(archived.size).to eq(1) - expect(archived.first).to eq(@archived_proposal) + expect(archived.first).to eq(archived_proposal) end it "scope archived" do not_archived = Proposal.not_archived expect(not_archived.size).to eq(1) - expect(not_archived.first).to eq(@new_proposal) + expect(not_archived.first).to eq(new_proposal) end end From 29905b61b72d371d02c079d493f5c0581716cb7a Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 28 Oct 2016 12:36:58 +0200 Subject: [PATCH 20/30] Sets gem versions to equal to or greater than in the last digit --- Gemfile | 22 +++++++++++----------- Gemfile.lock | 24 ++++++++++++------------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Gemfile b/Gemfile index 665421ce2..a57c2a7f1 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.7.1' # Use PostgreSQL -gem 'pg', '0.19.0' +gem 'pg', '~> 0.19.0' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0', '>= 5.0.4' # Use Uglifier as compressor for JavaScript assets @@ -14,7 +14,7 @@ gem 'coffee-rails', '~> 4.2.1' # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library -gem 'jquery-rails', '4.2.1' +gem 'jquery-rails', '~> 4.2.1' gem 'jquery-ui-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' @@ -32,11 +32,11 @@ gem 'omniauth-facebook', '~> 3.0.0' gem 'omniauth-google-oauth2', '~> 0.4.0' gem 'kaminari' -gem 'ancestry', '2.2.1' +gem 'ancestry', '~> 2.2.1' gem 'acts-as-taggable-on' -gem 'responders', '2.3.0' -gem 'foundation-rails', '6.2.4.0' -gem 'foundation_rails_helper', '2.0.0' +gem 'responders', '~> 2.3.0' +gem 'foundation-rails', '~> 6.2.4.0' +gem 'foundation_rails_helper', '~> 2.0.0' gem 'acts_as_votable' gem 'ckeditor', '~> 4.2.0' gem 'invisible_captcha', '~> 0.9.1' @@ -44,8 +44,8 @@ gem 'cancancan' gem 'social-share-button' gem 'initialjs-rails', '0.2.0.4' gem 'unicorn', '~> 5.1.0' -gem 'paranoia', '2.2.0' -gem 'rinku', '2.0.2', require: 'rails_rinku' +gem 'paranoia', '~> 2.2.0' +gem 'rinku', '~> 2.0.2', require: 'rails_rinku' gem 'savon' gem 'dalli' gem 'rollbar', '~> 2.13.3' @@ -57,11 +57,11 @@ gem 'whenever', require: false gem 'pg_search' gem 'ahoy_matey', '~> 1.4.2' -gem 'groupdate', '3.1.0' # group temporary data -gem 'tolk', '2.0.0' # Web interface for translations +gem 'groupdate', '~> 3.1.0' # group temporary data +gem 'tolk', '~> 2.0.0' # Web interface for translations gem 'browser' -gem 'turnout', '2.4.0' +gem 'turnout', '~> 2.4.0' gem 'redcarpet' group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 00780d8c2..5e99a8030 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -179,7 +179,7 @@ GEM geocoder (1.4.0) globalid (0.3.7) activesupport (>= 4.1.0) - groupdate (3.1.0) + groupdate (3.1.1) activesupport (>= 3) gyoku (1.3.1) builder (>= 2.1.2) @@ -442,7 +442,7 @@ DEPENDENCIES acts-as-taggable-on acts_as_votable ahoy_matey (~> 1.4.2) - ancestry (= 2.2.1) + ancestry (~> 2.2.1) browser bullet byebug @@ -466,14 +466,14 @@ DEPENDENCIES email_spec factory_girl_rails faker - foundation-rails (= 6.2.4.0) - foundation_rails_helper (= 2.0.0) + foundation-rails (~> 6.2.4.0) + foundation_rails_helper (~> 2.0.0) fuubar - groupdate (= 3.1.0) + groupdate (~> 3.1.0) i18n-tasks initialjs-rails (= 0.2.0.4) invisible_captcha (~> 0.9.1) - jquery-rails (= 4.2.1) + jquery-rails (~> 4.2.1) jquery-ui-rails kaminari launchy @@ -483,15 +483,15 @@ DEPENDENCIES omniauth-facebook (~> 3.0.0) omniauth-google-oauth2 (~> 0.4.0) omniauth-twitter - paranoia (= 2.2.0) - pg (= 0.19.0) + paranoia (~> 2.2.0) + pg (~> 0.19.0) pg_search poltergeist quiet_assets rails (= 4.2.7.1) redcarpet - responders (= 2.3.0) - rinku (= 2.0.2) + responders (~> 2.3.0) + rinku (~> 2.0.2) rollbar (~> 2.13.3) rspec-rails (~> 3.5) sass-rails (~> 5.0, >= 5.0.4) @@ -500,9 +500,9 @@ DEPENDENCIES spring spring-commands-rspec sprockets (~> 3.7.0) - tolk (= 2.0.0) + tolk (~> 2.0.0) turbolinks - turnout (= 2.4.0) + turnout (~> 2.4.0) uglifier (>= 3.0.3) unicorn (~> 5.1.0) web-console (= 3.3.0) From 04ca5f7ae8f5faf1db5a9bb390473149c97eb04b Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 31 Oct 2016 11:50:07 +0100 Subject: [PATCH 21/30] adds french and brazilian portuguese locales --- config/application.rb | 6 +++--- doc/locales/{fr.yaml => fr.yml} | 0 doc/locales/{pt-br.yaml => pt-br.yml} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename doc/locales/{fr.yaml => fr.yml} (100%) rename doc/locales/{pt-br.yaml => pt-br.yml} (100%) diff --git a/config/application.rb b/config/application.rb index 2b842992b..0da522fcf 100644 --- a/config/application.rb +++ b/config/application.rb @@ -20,10 +20,11 @@ module Consul # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] config.i18n.default_locale = :es - - config.i18n.available_locales = [:en, :es] + config.i18n.available_locales = [:en, :es, :fr, 'pt-BR'] + config.i18n.fallbacks = {'fr' => 'en', 'pt-br' => 'en'} # Add the new directories to the locales load path + config.i18n.load_path += Dir[Rails.root.join('doc', 'locales', '*.yml')] config.assets.paths << Rails.root.join("app", "assets", "fonts") @@ -44,7 +45,6 @@ module Consul config.autoload_paths << "#{Rails.root}/app/models/custom" config.paths['app/views'].unshift(Rails.root.join('app', 'views', 'custom')) config.i18n.load_path += Dir[Rails.root.join('config', 'locales', 'custom', '*.{rb,yml}')] - end end diff --git a/doc/locales/fr.yaml b/doc/locales/fr.yml similarity index 100% rename from doc/locales/fr.yaml rename to doc/locales/fr.yml diff --git a/doc/locales/pt-br.yaml b/doc/locales/pt-br.yml similarity index 100% rename from doc/locales/pt-br.yaml rename to doc/locales/pt-br.yml From aeec264b8b5b3616d30c888a8068e5fdd749015d Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 26 Oct 2016 11:21:51 +0200 Subject: [PATCH 22/30] makes fallback locale spanish --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 0da522fcf..8465f081a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -21,7 +21,7 @@ module Consul # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] config.i18n.default_locale = :es config.i18n.available_locales = [:en, :es, :fr, 'pt-BR'] - config.i18n.fallbacks = {'fr' => 'en', 'pt-br' => 'en'} + config.i18n.fallbacks = {'fr' => 'es', 'pt-br' => 'es'} # Add the new directories to the locales load path config.i18n.load_path += Dir[Rails.root.join('doc', 'locales', '*.yml')] From c0f400a4d99622b99e7f5f748b5f9c4ca17926a2 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 31 Oct 2016 11:14:05 +0100 Subject: [PATCH 23/30] =?UTF-8?q?Adds=20custom=20locale=20name=20for=20Por?= =?UTF-8?q?tugu=C3=AAs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/locales_helper.rb | 8 ++++++++ app/views/shared/_locale_switcher.html.erb | 2 +- doc/locales/pt-br.yml | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 app/helpers/locales_helper.rb diff --git a/app/helpers/locales_helper.rb b/app/helpers/locales_helper.rb new file mode 100644 index 000000000..7954cc908 --- /dev/null +++ b/app/helpers/locales_helper.rb @@ -0,0 +1,8 @@ +module LocalesHelper + + def name_for_locale(locale) + default = I18n.t("locale", locale: locale) + I18n.backend.translate(locale, "i18n.language.name", default: default) + end + +end diff --git a/app/views/shared/_locale_switcher.html.erb b/app/views/shared/_locale_switcher.html.erb index f29defcbd..af184fe48 100644 --- a/app/views/shared/_locale_switcher.html.erb +++ b/app/views/shared/_locale_switcher.html.erb @@ -8,7 +8,7 @@ <% I18n.available_locales.map do |loc| %> <% end %> diff --git a/doc/locales/pt-br.yml b/doc/locales/pt-br.yml index 9d2b3ee46..f3159cdc2 100644 --- a/doc/locales/pt-br.yml +++ b/doc/locales/pt-br.yml @@ -1,5 +1,8 @@ --- pt-BR: + i18n: + language: + name: Português account: show: change_credentials_link: Alterar meus dados pessoais From d540be333a1090dd6c17fbf8ece7156f91a487e8 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 31 Oct 2016 11:45:14 +0100 Subject: [PATCH 24/30] Makes tolk aware of french and portuguese translations --- config/application.rb | 3 --- {doc => config}/locales/fr.yml | 0 doc/locales/pt-br.yml => config/locales/pt-BR.yml | 0 3 files changed, 3 deletions(-) rename {doc => config}/locales/fr.yml (100%) rename doc/locales/pt-br.yml => config/locales/pt-BR.yml (100%) diff --git a/config/application.rb b/config/application.rb index 8465f081a..ea799001e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -23,9 +23,6 @@ module Consul config.i18n.available_locales = [:en, :es, :fr, 'pt-BR'] config.i18n.fallbacks = {'fr' => 'es', 'pt-br' => 'es'} - # Add the new directories to the locales load path - config.i18n.load_path += Dir[Rails.root.join('doc', 'locales', '*.yml')] - config.assets.paths << Rails.root.join("app", "assets", "fonts") # Do not swallow errors in after_commit/after_rollback callbacks. diff --git a/doc/locales/fr.yml b/config/locales/fr.yml similarity index 100% rename from doc/locales/fr.yml rename to config/locales/fr.yml diff --git a/doc/locales/pt-br.yml b/config/locales/pt-BR.yml similarity index 100% rename from doc/locales/pt-br.yml rename to config/locales/pt-BR.yml From 028cc4362d45d2ae961b1aae952b5ccaf03ac0d1 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 31 Oct 2016 11:45:37 +0100 Subject: [PATCH 25/30] Makes i18n-tasks only aware of english and spanish locales --- config/i18n-tasks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 9cf9f8137..edaaa0958 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -3,7 +3,7 @@ # The "main" locale. base_locale: en ## All available locales are inferred from the data by default. Alternatively, specify them explicitly: -# locales: [es, fr] +locales: [en, es] ## Reporting locale, default: en. Available: en, ru. # internal_locale: en From 6d9ced63a2d12cfa2e894f97c97c69d4ce16d6d6 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 31 Oct 2016 13:10:15 +0100 Subject: [PATCH 26/30] renames and removes unused variables --- app/assets/stylesheets/_settings.scss | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index 44433938b..242a03b82 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -48,37 +48,32 @@ // -------------------- $base-font-size: rem-calc(17); -$base-line-height: rem-calc(26); +$base-line: 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; +$border: #DEE0E3; + $link: #2895F1; -$link-hover: #2178BF; +$link-hover: darken($link, 20%); $debates: #008CCF; -$votes-bg: #26AEEE; -$votes-border: #1F94CB; -$votes-like: #7BD2A8; -$votes-like-act: #5D9E7F; -$votes-unlike: #EF8585; -$votes-unlike-act: #BD6A6A; +$votes: #26AEEE; +$like: #7BD2A8; +$unlike: #EF8585; $delete: #F04124; $check: #46DB91; $proposals: #FFA42D; -$proposals-border: #CC8425; $budget: #454372; $budget-hover: #7571BF; @@ -86,9 +81,6 @@ $budget-hover: #7571BF; $highlight: #E7F2FC; $featured: #FED900; -$footer-bg: #DEE0E2; -$footer-color: #171819; -$footer-link: #454A4C; $footer-border: #BFC1C3; $success-bg: #DFF0D8; From 7d4f92f10ad26c4afa8aa60bbcd1aede8a4def36 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 31 Oct 2016 13:11:23 +0100 Subject: [PATCH 27/30] unifies styles of page forms --- app/assets/stylesheets/admin.scss | 2 +- app/views/debates/edit.html.erb | 2 +- app/views/debates/new.html.erb | 2 +- app/views/management/proposals/new.html.erb | 2 +- app/views/management/spending_proposals/new.html.erb | 2 +- app/views/proposals/new.html.erb | 2 +- app/views/spending_proposals/new.html.erb | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index cd8241fca..4968983f0 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -82,7 +82,7 @@ body.admin { .admin-content { - .proposal-new, .proposal-edit { + .proposal-form { padding-top: 0; } diff --git a/app/views/debates/edit.html.erb b/app/views/debates/edit.html.erb index eea353438..13a2aa625 100644 --- a/app/views/debates/edit.html.erb +++ b/app/views/debates/edit.html.erb @@ -1,4 +1,4 @@ -
+
<%= render "shared/back_link" %> diff --git a/app/views/debates/new.html.erb b/app/views/debates/new.html.erb index 65d47bbcd..cd4a92cc6 100644 --- a/app/views/debates/new.html.erb +++ b/app/views/debates/new.html.erb @@ -1,4 +1,4 @@ -
+
<%= render "shared/back_link" %> diff --git a/app/views/management/proposals/new.html.erb b/app/views/management/proposals/new.html.erb index e3e2087e9..07c7e734a 100644 --- a/app/views/management/proposals/new.html.erb +++ b/app/views/management/proposals/new.html.erb @@ -1,4 +1,4 @@ -
+
<%= render '/shared/print' %> diff --git a/app/views/management/spending_proposals/new.html.erb b/app/views/management/spending_proposals/new.html.erb index e036a04cb..b4cc82cf2 100644 --- a/app/views/management/spending_proposals/new.html.erb +++ b/app/views/management/spending_proposals/new.html.erb @@ -1,4 +1,4 @@ -
+
<%= render '/shared/print' %> diff --git a/app/views/proposals/new.html.erb b/app/views/proposals/new.html.erb index 2887cd97a..fb9bcaf38 100644 --- a/app/views/proposals/new.html.erb +++ b/app/views/proposals/new.html.erb @@ -1,4 +1,4 @@ -
+
<%= render "shared/back_link" %> diff --git a/app/views/spending_proposals/new.html.erb b/app/views/spending_proposals/new.html.erb index 219444857..6c962c482 100644 --- a/app/views/spending_proposals/new.html.erb +++ b/app/views/spending_proposals/new.html.erb @@ -1,4 +1,4 @@ -
+
<%= render "shared/back_link" %> From d771b739bf2e932beb5ffde8bd9572c446b3093c Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 31 Oct 2016 13:25:48 +0100 Subject: [PATCH 28/30] renames variables, removes unused styles --- app/assets/stylesheets/layout.scss | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 8052513fc..1b186d438 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -40,7 +40,7 @@ h1, h2, h3, h4, h5, h6 { p { font-size: $base-font-size; font-weight: 400; - line-height: $base-line-height; + line-height: $base-line; } a { @@ -487,7 +487,7 @@ header { // ---------- footer { - color: $footer-color; + color: $text; .logo a { font-family: 'Lato' !important; @@ -507,10 +507,11 @@ footer { } a, a:active, a:focus { - color: $footer-link; + color: $text; + text-decoration: underline; &:hover { - color: $footer-color; + color: $text-medium; } } @@ -519,7 +520,7 @@ footer { } h2 a { - border-bottom: 1px solid $footer-border; + border-bottom: 1px solid $text-light; display: block; font-size: rem-calc(24); line-height: rem-calc(31); @@ -529,14 +530,14 @@ footer { } .footer { - background: $footer-bg; + background: $border; border-top: 6px solid $brand; margin-top: $line-height*2; padding-top: $line-height; } .subfooter { - border-top: 1px solid $footer-border; + border-top: 1px solid $text-light; padding-top: $line-height/2; } @@ -563,8 +564,8 @@ footer { color: $link; &:hover { - background: $highlight; - color: $link-hover; + background: $brand; + color: white; } } @@ -1002,15 +1003,6 @@ img.avatar, img.admin-avatar, img.moderator-avatar, img.initialjs-avatar { // 09. Search // ---------- -.search-form h3 { - border-top: 1px solid $votes-border; - display: inline-block; - font-size: rem-calc(16); - margin: -1px 0 $line-height/2; - padding-top: $line-height/4; - text-transform: uppercase; -} - .search-results h2 { margin-bottom: 0; } From 6fd5e6a67acc50d443a5b6c3339f710a3d0d3a95 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 31 Oct 2016 16:50:13 +0100 Subject: [PATCH 29/30] unifies styles for participation not allowed --- app/assets/javascripts/votes.js.coffee | 14 +- app/assets/stylesheets/layout.scss | 1 + app/assets/stylesheets/participation.scss | 239 ++++++------------- app/views/comments/_votes.html.erb | 4 +- app/views/debates/_votes.html.erb | 32 +-- app/views/proposals/_featured_votes.html.erb | 32 +-- app/views/proposals/_votes.html.erb | 32 +-- app/views/spending_proposals/_votes.html.erb | 2 +- spec/support/common_actions.rb | 4 +- 9 files changed, 125 insertions(+), 235 deletions(-) diff --git a/app/assets/javascripts/votes.js.coffee b/app/assets/javascripts/votes.js.coffee index 030b9cf46..b842c3ffc 100644 --- a/app/assets/javascripts/votes.js.coffee +++ b/app/assets/javascripts/votes.js.coffee @@ -3,17 +3,11 @@ App.Votes = hoverize: (votes) -> $(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(); + $("div.participation-not-allowed", this).show(); + $("div.participation-allowed", 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(); + $("div.participation-not-allowed", this).hide(); + $("div.participation-allowed", this).show(); }, votes initialize: -> diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 1b186d438..c3dded973 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -1580,6 +1580,7 @@ table { font-size: $small-font-size; margin: rem-calc(6) 0; padding: rem-calc(6); + position: relative; [class^="icon-arrow"] { font-size: rem-calc(18); diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index efd385c19..1ab1eb726 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -12,15 +12,14 @@ // ---------------------- @mixin votes { - background: $votes-bg; - border-top: 1px solid $votes-border; + background: $votes; margin: 0 rem-calc(-12); padding: rem-calc(14) rem-calc(12); position: relative; - .icon-like { + .icon-like, .icon-unlike { background: white; - border: 2px solid $votes-border; + border: 2px solid $votes; border-radius: rem-calc(3); color: $text-light; display: inline-block; @@ -29,40 +28,25 @@ padding: rem-calc(3) rem-calc(6); position: relative; - &:hover { - background: $votes-like; + &:hover, &:active { border-color: white; color: white; cursor: pointer; opacity: 1 !important; } + } - &:active { - border-color: $votes-like-act; + .icon-like { + + &:hover, &:active { + background: $like; } } .icon-unlike { - background: white; - border: 2px solid $votes-border; - border-radius: rem-calc(3); - color: $text-light; - display: inline-block; - font-size: rem-calc(30); - line-height: rem-calc(30); - padding: rem-calc(3) rem-calc(6); - position: relative; - &:hover { - background: $votes-unlike; - border-color: white; - color: white; - cursor: pointer; - opacity: 1 !important; - } - - &:active { - border-color: $votes-unlike-act; + &:hover, &:active { + background: $unlike; } } @@ -81,20 +65,23 @@ } .voted { - .icon-like { - background: $votes-like; + + .icon-like, .icon-unlike { border-color: white; color: white; } + .icon-like { + background: $like; + } + .icon-unlike { - background: $votes-unlike; - border-color: white; - color: white; + background: $unlike; } } .no-voted { + .icon-like, .icon-unlike { opacity: .5; } @@ -109,54 +96,10 @@ .divider { margin: 0 rem-calc(6); } - - .not-logged { - background: rgba(22,99,135,.9); - color: white; - font-size: $small-font-size; - height: 100%; - left: 0; - position: absolute; - text-align: center; - top: 0; - width: 100%; - filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#222222', endColorstr='#222222'); /* IE */ - - a { - color: white; - text-decoration: underline; - } - } - - .anonymous-votes, .organizations-votes { - background: $warning-bg; - color: $color-warning; - height: 100%; - left: 0; - line-height: $line-height; - padding-top: rem-calc(12); - position: absolute; - text-align: center; - top: 0; - width: 100%; - - p { - color: $color-warning; - margin: 0 rem-calc(12); - text-align: left; - } - - a { - color: $color-warning; - font-weight: bold; - text-decoration: underline; - } - } } @mixin supports { background: $proposals; - border-top: 1px solid $proposals-border; margin: 0 rem-calc(-12); padding: rem-calc(14) rem-calc(12); position: relative; @@ -166,7 +109,7 @@ height: $line-height/2; .meter { - background: $votes-like; + background: $like; display: block; height: $line-height/2; } @@ -197,7 +140,7 @@ margin-top: rem-calc(12); &:hover { - background: $proposals-border; + background: darken($proposals, 35%); color: white; cursor: pointer; } @@ -221,49 +164,6 @@ margin: 0 rem-calc(6); } - .not-logged { - background: rgba(255,164,45,.9); - color: white; - font-size: $small-font-size; - height: 100%; - left: 0; - position: absolute; - text-align: center; - top: 0; - width: 100%; - filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#222222', endColorstr='#222222'); /* IE */ - - a { - color: white; - text-decoration: underline; - } - } - - .anonymous-votes, .organizations-votes, .no-supports-allowed { - background: $warning-bg; - color: $color-warning; - height: 100%; - left: 0; - line-height: $line-height; - padding-top: rem-calc(12); - position: absolute; - text-align: center; - top: 0; - width: 100%; - - p { - color: $color-warning; - margin: 0 rem-calc(12); - text-align: left; - } - - a { - color: $color-warning; - font-weight: bold; - text-decoration: underline; - } - } - .supported { color: white; margin-top: rem-calc(12); @@ -285,32 +185,61 @@ } } +.participation-not-allowed { + background: $warning-bg; + color: $color-warning; + height: 100%; + left: 0; + line-height: $line-height; + padding: $line-height $line-height/2; + position: absolute; + text-align: center; + top: 0; + width: 100%; + z-index: 2; + + p { + color: $color-warning !important; + margin: 0 rem-calc(12); + text-align: left; + } + + a { + color: $color-warning !important; + font-weight: bold; + text-decoration: underline; + } +} + +.reply .participation-not-allowed { + padding-right: $line-height/2; + padding-top: $line-height/6; + text-align: right; +} + // 02. New participation // --------------------- -.debate-new, .debate-edit, -.proposal-new, .proposal-edit, -.spending-proposal-new, .spending-proposal-edit { +.debate-form, +.proposal-form, +.spending-proposal-form { + + .icon-debates, .icon-proposals, .icon-budget { + font-size: rem-calc(50); + line-height: $line-height; + opacity: .5; + } .icon-debates { color: $debates; - font-size: rem-calc(60); - line-height: $line-height; - opacity: .5; } .icon-proposals { color: $proposals; - font-size: rem-calc(50); - line-height: $line-height; - opacity: .5; } .icon-budget { color: $budget; - font-size: rem-calc(50); - line-height: $line-height; - opacity: .5; } .recommendations { @@ -330,14 +259,14 @@ } } -.debate-new, .debate-edit { +.debate-form { .recommendations li:before { color: $debates; } } -.proposal-new, .proposal-edit { +.proposal-form { .recommendations li:before { color: $proposals; @@ -496,11 +425,6 @@ line-height: $line-height; } - .not-logged { - line-height: $line-height; - padding: rem-calc(24); - } - @include breakpoint(small + rem-calc(1) and medium down) { .in-favor, .against { text-align: left; @@ -530,11 +454,6 @@ float: none; line-height: $line-height; } - - .not-logged { - line-height: $line-height; - padding: rem-calc(24); - } } .leave-comment { @@ -711,15 +630,6 @@ } } - .not-logged { - line-height: $line-height; - padding-top: rem-calc(24); - } - - .anonymous-votes, .organizations-votes { - padding-top: rem-calc(24); - } - .divider { display: none; } @@ -745,7 +655,7 @@ .votes { @include votes; - border: 1px solid $votes-border; + border: 1px solid $votes; margin: 0 rem-calc(-12); @include breakpoint(medium) { @@ -803,7 +713,7 @@ .supports { @include supports; - border: 1px solid $proposals-border; + border: 1px solid $proposals; margin: 0 rem-calc(-12); @include breakpoint(medium) { @@ -904,16 +814,6 @@ line-height: rem-calc(70); } - .no-supports-allowed { - background: rgba(69,67,114,.96); - color: white; - padding: rem-calc(12); - } - - .no-supports-allowed p, .no-supports-allowed a { - color: white; - } - .share-supported { .ssb-twitter, @@ -1006,18 +906,13 @@ margin-top: 0; } - .not-logged, - .organizations-votes, - .anonymous-votes { + .participation-not-allowed { background: $featured; - color: $color-warning; font-size: $small-font-size; - line-height: $line-height; padding-top: 0; a { color: $color-warning; - font-weight: bold; } p { diff --git a/app/views/comments/_votes.html.erb b/app/views/comments/_votes.html.erb index 8ee315e35..0de92a675 100644 --- a/app/views/comments/_votes.html.erb +++ b/app/views/comments/_votes.html.erb @@ -33,7 +33,7 @@ <% elsif !user_signed_in? %> -
+
<%= t('comments.comment.votes', count: comment.total_votes) %>  |  @@ -60,7 +60,7 @@ <%= comment.total_dislikes %>
- <% if user_signed_in? && current_user.organization? %> - + <% elsif user_signed_in? && !proposal.votable_by?(current_user)%> - + <% elsif !user_signed_in? %> - + <% end %> <% if voted_for?(@featured_proposals_votes, proposal) %> diff --git a/app/views/proposals/_votes.html.erb b/app/views/proposals/_votes.html.erb index 0c572e71f..198bf5d07 100644 --- a/app/views/proposals/_votes.html.erb +++ b/app/views/proposals/_votes.html.erb @@ -31,24 +31,24 @@
<% if user_signed_in? && current_user.organization? %> - + <% elsif user_signed_in? && !proposal.votable_by?(current_user)%> - + <% elsif !user_signed_in? %> - + <% end %> <% if voted_for?(@proposal_votes, proposal) && setting['twitter_handle'] %> diff --git a/app/views/spending_proposals/_votes.html.erb b/app/views/spending_proposals/_votes.html.erb index a4fd43993..9ef7e75b3 100644 --- a/app/views/spending_proposals/_votes.html.erb +++ b/app/views/spending_proposals/_votes.html.erb @@ -24,7 +24,7 @@
<% if reason.present? && !user_voted_for %> -