Merge branch 'master' into budget

This commit is contained in:
kikito
2016-11-28 11:41:49 +01:00
219 changed files with 3311 additions and 1189 deletions

View File

@@ -20,11 +20,8 @@ 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]
# Add the new directories to the locales load path
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
config.i18n.available_locales = [:en, :es, :fr, 'pt-BR']
config.i18n.fallbacks = {'fr' => 'es', 'pt-br' => 'es'}
config.assets.paths << Rails.root.join("app", "assets", "fonts")
@@ -44,7 +41,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

View File

@@ -7,15 +7,12 @@ def deploysecret(key)
end
set :rails_env, fetch(:stage)
set :rvm_ruby_version, '2.3.1'
set :rvm_type, :user
set :rvm1_ruby_version, '2.3.2'
set :application, 'consul'
set :full_app_name, deploysecret(:full_app_name)
set :server_name, deploysecret(:server_name)
#set :repo_url, 'git@github.com:consul/consul.git'
# If ssh access is restricted, probably you need to use https access
set :repo_url, 'https://github.com/consul/consul.git'
set :scm, :git
@@ -32,34 +29,30 @@ set :keep_releases, 5
set :local_user, ENV['USER']
# Run test before deploy
set :tests, ["spec"]
set :delayed_job_workers, 2
# Config files should be copied by deploy:setup_config
set(:config_files, %w(
log_rotation
database.yml
secrets.yml
unicorn.rb
sidekiq.yml
))
set :whenever_roles, -> { :cron }
namespace :deploy do
# Check right version of deploy branch
# before :deploy, "deploy:check_revision"
# Run test aund continue only if passed
# before :deploy, "deploy:run_tests"
before :starting, 'rvm1:install:rvm' # install/update RVM
before :starting, 'rvm1:install:ruby' # install Ruby and create gemset
before :starting, 'install_bundler_gem' # install bundler gem
# Custom compile and rsync of assets - works, but it is very slow
#after 'deploy:symlink:shared', 'deploy:compile_assets_locally'
after :publishing, 'deploy:restart'
after :published, 'delayed_job:restart'
after :finishing, 'deploy:cleanup'
# Restart unicorn
after 'deploy:publishing', 'deploy:restart'
# Restart Delayed Jobs
after 'deploy:published', 'delayed_job:restart'
end
task :install_bundler_gem do
on roles(:app) do
execute "rvm use #{fetch(:rvm1_ruby_version)}; gem install bundler"
end
end

View File

@@ -59,4 +59,4 @@ Rails.application.configure do
end
end
end
end

View File

@@ -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
@@ -103,6 +103,7 @@ ignore_missing:
- 'errors.messages.taken'
- 'devise.failure.invalid'
- 'devise.registrations.destroyed'
- 'devise.password_expired.*'
## Consider these keys used:
ignore_unused:

View File

@@ -52,4 +52,4 @@ module ActsAsTaggableOn
end
end
end
end

View File

@@ -0,0 +1,71 @@
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?
self.administrator? && password_expired?
end
def password_expired?
self.password_changed_at < self.expire_password_after.ago
end
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
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
end
end
end

View File

@@ -66,6 +66,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"

View File

@@ -66,6 +66,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"

View File

@@ -2,6 +2,12 @@
en:
devise:
password_expired:
expire_password: "Password expired"
change_required: "Your password is 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."

View File

@@ -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"

View File

@@ -209,6 +209,7 @@ en:
open_data: Open data
open_gov: Open government
proposals: Proposals
proposal_ballot: Voting
see_all: See proposals
budgets: Participatory budgeting
legislation:
@@ -301,6 +302,7 @@ en:
hot_score: most active
most_commented: most commented
relevance: relevance
archival_date: Archived
retired_proposals: Retired proposals
retired_proposals_link: "Proposals retired by the author"
retired_links:
@@ -341,7 +343,7 @@ en:
other: "%{count} comments"
zero: No comments
proposal: Proposal
reason_for_supports_necessary: 2% of Census
reason_for_supports_necessary: 1% of Census
support: Support
support_title: Support this proposal
supports:
@@ -350,6 +352,7 @@ en:
zero: No supports
supports_necessary: "%{number} supports needed"
total_percent: 100%
archived: "This proposal has been archived and can't collect supports."
show:
author_deleted: User deleted
code: 'Proposal code:'
@@ -371,6 +374,17 @@ en:
update:
form:
submit_button: Save changes
proposal_ballots:
title: "Votings"
description_html: "The following citizen proposals that have reached the <strong>required supports</strong> and will be voted."
date_title: "Dates of participation"
date: "Soon we'll announce the date of vote these proposals."
successfull: "This proposal has reached the required supports and will be voted in the %{voting}."
voting: "next voting"
featured_title: "#NextVoting"
nothing_to_vote: "There is nothing to vote at the moment."
info: "New proposals that have reached the voting phase."
button: "I want to decide"
proposal_notifications:
new:
title: "Send message"
@@ -435,6 +449,12 @@ en:
categories: "Categories"
target_blank_html: " (link opens in new window)"
unflag: Unflag
outline:
debates: Debates
proposals: Proposals
budget: Participatory budget
pagination: Pagination
searcher: Searcher
social:
blog: Blog
facebook: Facebook

View File

@@ -209,6 +209,7 @@ es:
open_data: Datos abiertos
open_gov: Gobierno %{open}
proposals: Propuestas
proposal_ballot: Votaciones
see_all: Ver propuestas
budgets: Presupuestos ciudadanos
legislation:
@@ -301,6 +302,7 @@ es:
hot_score: Más activas hoy
most_commented: Más comentadas
relevance: Más relevantes
archival_date: Archivadas
retired_proposals: Propuestas retiradas
retired_proposals_link: "Propuestas retiradas por sus autores"
retired_links:
@@ -341,7 +343,7 @@ es:
other: "%{count} Comentarios"
zero: Sin comentarios
proposal: Propuesta
reason_for_supports_necessary: 2% del Censo
reason_for_supports_necessary: 1% del Censo
support: Apoyar
support_title: Apoyar esta propuesta
supports:
@@ -350,6 +352,7 @@ es:
zero: Sin apoyos
supports_necessary: "%{number} apoyos necesarios"
total_percent: 100%
archived: "Esta propuesta ha sido archivada y ya no puede recoger apoyos."
show:
author_deleted: Usuario eliminado
code: 'Código de la propuesta:'
@@ -371,6 +374,17 @@ es:
update:
form:
submit_button: Guardar cambios
proposal_ballots:
title: "Votaciones"
description_html: "Las siguientes propuestas ciudadanas han alcanzado el <strong>número de apoyos necesarios</strong> y pasarán a votación."
date_title: "Fechas de participación"
date: "En breve anunciaremos la fecha de votación de estas propuestas."
successfull: "Esta propuesta ha alcanzado los apoyos necesarios y pasará a la %{voting}."
voting: "próxima votación"
featured_title: "#PróximaVotación"
nothing_to_vote: "No hay nada que votar en este momento."
info: "Nuevas propuestas ciudadanas han llegado a la fase de votación."
button: "Quiero decidir"
proposal_notifications:
new:
title: "Enviar mensaje"
@@ -435,6 +449,12 @@ es:
categories: "Categorías"
target_blank_html: " (se abre en ventana nueva)"
unflag: Deshacer denuncia
outline:
debates: Debates
proposals: Propuestas
budget: Presupuestos ciudadanos
pagination: Paginación
searcher: Buscador
social:
blog: Blog
facebook: Facebook

1654
config/locales/fr.yml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -39,7 +39,7 @@ en:
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% 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.
One that the proposal has achive support of 1% 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.

View File

@@ -39,7 +39,7 @@ es:
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, automáticamente 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.
Una vez que una propuesta alcance una cantidad de apoyos equivalente al 1% del censo, automáticamente 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.

1674
config/locales/pt-BR.yml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -11,10 +11,22 @@ en:
max_votes_for_debate_edit: "Number of votes from which a Debate can no longer be edited"
proposal_code_prefix: "Prefix for Proposal codes"
votes_for_proposal_success: "Number of votes necessary for approval of a Proposal"
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:
budgets: Participatory budgeting
twitter_login: Twitter login
facebook_login: Facebook login
google_login: Google login
debates: Debates
spending_proposals: Investment projects
spending_proposal_features:

View File

@@ -11,11 +11,23 @@ es:
max_votes_for_debate_edit: "Número de votos en que un Debate deja de poderse editar"
proposal_code_prefix: "Prefijo para los códigos de Propuestas"
votes_for_proposal_success: "Número de votos necesarios para aprobar una Propuesta"
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:
budgets: Presupuestos participativos
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:
voting_allowed: Votaciones sobre propuestas de inversión
voting_allowed: Votaciones sobre propuestas de inversión

View File

@@ -61,6 +61,8 @@ Rails.application.routes.draw do
end
end
resources :proposal_ballots, only: [:index]
resources :comments, only: [:create, :show], shallow: true do
member do
post :vote