Merge branch 'master' into legislation-module-stable

This commit is contained in:
Amaia Castro
2017-03-25 13:34:49 +01:00
23 changed files with 107 additions and 32 deletions

View File

@@ -12,6 +12,10 @@ require 'capistrano/delayed_job'
require 'whenever/capistrano' require 'whenever/capistrano'
require 'rvm1/capistrano3' require 'rvm1/capistrano3'
#SCM: Git
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
# Load custom tasks from `lib/capistrano/tasks` if you have any defined # Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

View File

@@ -1,15 +1,19 @@
![Logo of Consul] ![Logo of Consul](https://raw.githubusercontent.com/consul/consul/master/public/consul_logo.png)
(https://raw.githubusercontent.com/consul/consul/master/public/consul_logo.png)
# Consul # Consul
Citizen Participation and Open Government Application Citizen Participation and Open Government Application
[![Join the chat at https://gitter.im/consul/consul](https://badges.gitter.im/consul/consul.svg)](https://gitter.im/consul/consul?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/consul/consul.svg?branch=master)](https://travis-ci.org/consul/consul) [![Build Status](https://travis-ci.org/consul/consul.svg?branch=master)](https://travis-ci.org/consul/consul)
[![Code Climate](https://codeclimate.com/github/consul/consul/badges/gpa.svg)](https://codeclimate.com/github/consul/consul) [![Code Climate](https://codeclimate.com/github/consul/consul/badges/gpa.svg)](https://codeclimate.com/github/consul/consul)
[![Dependency Status](https://gemnasium.com/consul/consul.svg)](https://gemnasium.com/consul/consul) [![Dependency Status](https://gemnasium.com/consul/consul.svg)](https://gemnasium.com/consul/consul)
[![Coverage Status](https://coveralls.io/repos/github/consul/consul/badge.svg?branch=master)](https://coveralls.io/github/consul/consul?branch=master) [![Coverage Status](https://coveralls.io/repos/github/consul/consul/badge.svg?branch=master)](https://coveralls.io/github/consul/consul?branch=master)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](http://www.gnu.org/licenses/agpl-3.0)
[![Accessibility conformance](https://img.shields.io/badge/accessibility-WAI:AA-green.svg)](https://www.w3.org/WAI/eval/Overview)
[![A11y issues checked with Rocket Validator](https://rocketvalidator.com/badges/checked_with_rocket_validator.svg?url=https://rocketvalidator.com)](https://rocketvalidator.com/opensource)
[![Join the chat at https://gitter.im/consul/consul](https://badges.gitter.im/consul/consul.svg)](https://gitter.im/consul/consul?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
This is the opensource code repository of the eParticipation website originally developed for the Madrid City government eParticipation website This is the opensource code repository of the eParticipation website originally developed for the Madrid City government eParticipation website

View File

@@ -1,15 +1,20 @@
![Logotipo de Consul] ![Logotipo de Consul](https://raw.githubusercontent.com/consul/consul/master/public/consul_logo.png)
(https://raw.githubusercontent.com/consul/consul/master/public/consul_logo.png)
# Consul # Consul
Aplicación de Participación Ciudadana y Gobierno Abierto Aplicación de Participación Ciudadana y Gobierno Abierto
[![Join the chat at https://gitter.im/consul/consul](https://badges.gitter.im/consul/consul.svg)](https://gitter.im/consul/consul?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/consul/consul.svg?branch=master)](https://travis-ci.org/consul/consul) [![Build Status](https://travis-ci.org/consul/consul.svg?branch=master)](https://travis-ci.org/consul/consul)
[![Code Climate](https://codeclimate.com/github/consul/consul/badges/gpa.svg)](https://codeclimate.com/github/consul/consul) [![Code Climate](https://codeclimate.com/github/consul/consul/badges/gpa.svg)](https://codeclimate.com/github/consul/consul)
[![Dependency Status](https://gemnasium.com/consul/consul.svg)](https://gemnasium.com/consul/consul) [![Dependency Status](https://gemnasium.com/consul/consul.svg)](https://gemnasium.com/consul/consul)
[![Coverage Status](https://coveralls.io/repos/github/consul/consul/badge.svg?branch=master)](https://coveralls.io/github/consul/consul?branch=master) [![Coverage Status](https://coveralls.io/repos/github/consul/consul/badge.svg?branch=master)](https://coveralls.io/github/consul/consul?branch=master)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](http://www.gnu.org/licenses/agpl-3.0)
[![Accessibility conformance](https://img.shields.io/badge/accessibility-WAI:AA-green.svg)](https://www.w3.org/WAI/eval/Overview)
[![A11y issues checked with Rocket Validator](https://rocketvalidator.com/badges/checked_with_rocket_validator.svg?url=https://rocketvalidator.com)](https://rocketvalidator.com/opensource)
[![Join the chat at https://gitter.im/consul/consul](https://badges.gitter.im/consul/consul.svg)](https://gitter.im/consul/consul?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Este es el repositorio de código abierto de la Aplicación de Participación Ciudadana Consul, creada originariamente por el Ayuntamiento de Madrid. Este es el repositorio de código abierto de la Aplicación de Participación Ciudadana Consul, creada originariamente por el Ayuntamiento de Madrid.

View File

@@ -32,7 +32,7 @@ class Management::UsersController < Management::BaseController
private private
def user_params def user_params
params.require(:user).permit(:document_type, :document_number, :username, :email) params.require(:user).permit(:document_type, :document_number, :username, :email, :date_of_birth)
end end
def destroy_session def destroy_session

View File

@@ -2,6 +2,7 @@ module EmbedVideosHelper
def embedded_video_code def embedded_video_code
link = @proposal.video_url link = @proposal.video_url
title = t('proposals.show.embed_video_title', proposal: @proposal.title)
if link.match(/vimeo.*/) if link.match(/vimeo.*/)
server = "Vimeo" server = "Vimeo"
elsif link.match(/youtu*.*/) elsif link.match(/youtu*.*/)
@@ -21,7 +22,7 @@ module EmbedVideosHelper
end end
if match and match[2] if match and match[2]
'<iframe src="' + src + match[2] + '" frameborder="0" allowfullscreen></iframe>' '<iframe src="' + src + match[2] + '" style="border:0;" allowfullscreen title="' + title + '"></iframe>'
else else
'' ''
end end

View File

@@ -10,8 +10,10 @@
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<table> <table>
<thead> <thead>
<th><%= Budget.human_attribute_name(:name) %></th> <tr>
<th><%= Budget.human_attribute_name(:phase) %></th> <th scope="col"><%= Budget.human_attribute_name(:name) %></th>
<th scope="col"><%= Budget.human_attribute_name(:phase) %></th>
</tr>
</thead> </thead>
<tbody> <tbody>
<% @budgets.each do |budget| %> <% @budgets.each do |budget| %>

View File

@@ -19,6 +19,7 @@
<%= f.submit(t("devise_views.confirmations.new.submit"), class: "button expanded") %> <%= f.submit(t("devise_views.confirmations.new.submit"), class: "button expanded") %>
</div> </div>
</div> </div>
</div>
<% end %> <% end %>
<%= render "devise/shared/links" %> <%= render "devise/shared/links" %>

View File

@@ -11,6 +11,7 @@
<%= f.submit t("devise_views.passwords.new.send_submit"), class: "button expanded" %> <%= f.submit t("devise_views.passwords.new.send_submit"), class: "button expanded" %>
</div> </div>
</div> </div>
</div>
<% end %> <% end %>
<%= render "devise/shared/links" %> <%= render "devise/shared/links" %>

View File

@@ -4,7 +4,7 @@
message: t("management.document_verifications.in_census_has_following_permissions"), message: t("management.document_verifications.in_census_has_following_permissions"),
permissions: [:debates, :create_proposals, :support_proposals, :vote_proposals] %> permissions: [:debates, :create_proposals, :support_proposals, :vote_proposals] %>
<div class="row"> <div class="row verification account">
<div class="small-12 medium-6 column"> <div class="small-12 medium-6 column">
<%= form_for @user, url: management_users_path do |f| %> <%= form_for @user, url: management_users_path do |f| %>
<%= f.hidden_field :document_type %> <%= f.hidden_field :document_type %>
@@ -15,7 +15,13 @@
<%= f.text_field :email, <%= f.text_field :email,
label: t('management.email_label'), label: t('management.email_label'),
placeholder: t('management.email_label') %> placeholder: t('management.email_label') %>
<div class="date-of-birth">
<%= f.label t("management.date_of_birth") %>
<%= f.date_select :date_of_birth,
prompt: true,
start_year: 1900, end_year: 16.years.ago.year,
label: false %>
</div>
<%= f.submit t("management.users.create_user_submit"), class: "button success" %> <%= f.submit t("management.users.create_user_submit"), class: "button success" %>
<% end %> <% end %>
</div> </div>

View File

@@ -11,7 +11,8 @@
</li> </li>
<% end %> <% end %>
<% if feature?(:spending_proposals) && (current_user.administrator? || current_user.valuator?) %> <% if (feature?(:spending_proposals) || feature?(:budgets)) &&
(current_user.administrator? || current_user.valuator?) %>
<li> <li>
<%= link_to t("layouts.header.valuation"), valuation_root_path %> <%= link_to t("layouts.header.valuation"), valuation_root_path %>
</li> </li>

View File

@@ -15,7 +15,6 @@ set :full_app_name, deploysecret(:full_app_name)
set :server_name, deploysecret(:server_name) set :server_name, deploysecret(:server_name)
set :repo_url, 'https://github.com/consul/consul.git' set :repo_url, 'https://github.com/consul/consul.git'
set :scm, :git
set :revision, `git rev-parse --short #{fetch(:branch)}`.strip set :revision, `git rev-parse --short #{fetch(:branch)}`.strip
set :log_level, :info set :log_level, :info

View File

@@ -58,13 +58,13 @@ es:
attributes: attributes:
budget: budget:
name: "Nombre" name: "Nombre"
description_accepting: "Descripción durante la fase de aceptación" description_accepting: "Descripción durante la fase de presentación de proyectos"
description_reviewing: "Descripción durante la fase de revisión" description_reviewing: "Descripción durante la fase de revisión interna"
description_selecting: "Descripción durante la fase de selección" description_selecting: "Descripción durante la fase de apoyos"
description_valuating: "Descripción durante la fase de evaluación" description_valuating: "Descripción durante la fase de evaluación"
description_balloting: "Descripción durante la fase de votación" description_balloting: "Descripción durante la fase de votación"
description_reviewing_ballots: "Descripción durante la fase de revisión de votos" description_reviewing_ballots: "Descripción durante la fase de revisión de votos"
description_finished: "Descripción cuando el presupuesto ha finalizado" description_finished: "Descripción cuando el presupuesto ha finalizado / Resultados"
phase: "Fase" phase: "Fase"
currency_symbol: "Divisa" currency_symbol: "Divisa"
budget/investment: budget/investment:

View File

@@ -25,11 +25,11 @@ en:
unfeasible_title: Unfeasible investments unfeasible_title: Unfeasible investments
unfeasible: See unfeasible investments unfeasible: See unfeasible investments
phase: phase:
accepting: Accepting proposals accepting: Accepting projects
reviewing: Reviewing proposals reviewing: Reviewing projects
selecting: Selecting proposals selecting: Selecting projects
valuating: Valuating proposals valuating: Valuating projects
balloting: Balloting proposals balloting: Balloting projects
reviewing_ballots: Reviewing Ballots reviewing_ballots: Reviewing Ballots
finished: Finished budget finished: Finished budget
index: index:

View File

@@ -25,13 +25,13 @@ es:
unfeasible_title: Propuestas inviables unfeasible_title: Propuestas inviables
unfeasible: Ver propuestas inviables unfeasible: Ver propuestas inviables
phase: phase:
accepting: Aceptando propuestas accepting: Presentación de proyectos
reviewing: Revisando propuestas reviewing: Revisión interna de proyectos
selecting: Selección de propuestas selecting: Fase de apoyos
valuating: Evaluación de propuestas valuating: Evaluación de proyectos
balloting: Votación de propuestas balloting: Votación final
reviewing_ballots: Contando resultados reviewing_ballots: Votación finalizada
finished: Presupuesto terminado finished: Resultados
index: index:
title: Presupuestos participativos title: Presupuestos participativos
investments: investments:

View File

@@ -391,6 +391,7 @@ en:
share: Share share: Share
send_notification: Send notification send_notification: Send notification
no_notifications: "This proposal has any notifications." no_notifications: "This proposal has any notifications."
embed_video_title: "Video on %{proposal}"
update: update:
form: form:
submit_button: Save changes submit_button: Save changes

View File

@@ -391,6 +391,7 @@ es:
send_notification: Enviar notificación send_notification: Enviar notificación
share: Compartir share: Compartir
no_notifications: "Esta propuesta no tiene notificaciones." no_notifications: "Esta propuesta no tiene notificaciones."
embed_video_title: "Vídeo en %{proposal}"
update: update:
form: form:
submit_button: Guardar cambios submit_button: Guardar cambios

View File

@@ -32,6 +32,7 @@ en:
under_age: "You don't have the required age to verify your account." under_age: "You don't have the required age to verify your account."
verify: Verify verify: Verify
email_label: Email email_label: Email
date_of_birth: Date of birth
email_verifications: email_verifications:
already_verified: This user account is already verified. already_verified: This user account is already verified.
choose_options: 'Please choose one of the following options:' choose_options: 'Please choose one of the following options:'

View File

@@ -32,6 +32,7 @@ es:
under_age: No tienes edad suficiente para verificar tu cuenta. under_age: No tienes edad suficiente para verificar tu cuenta.
verify: Verificar usuario verify: Verificar usuario
email_label: Email email_label: Email
date_of_birth: Fecha de nacimiento
email_verifications: email_verifications:
already_verified: Esta cuenta de usuario ya está verificada. already_verified: Esta cuenta de usuario ya está verificada.
choose_options: 'Elige una de las opciones siguientes:' choose_options: 'Elige una de las opciones siguientes:'

View File

@@ -392,7 +392,7 @@ end
puts "Creating Valuation Assignments" puts "Creating Valuation Assignments"
(1..17).to_a.sample.times do (1..50).to_a.sample.times do
Budget::Investment.reorder("RANDOM()").first.valuators << valuator.valuator Budget::Investment.reorder("RANDOM()").first.valuators << valuator.valuator
end end

View File

@@ -84,7 +84,7 @@ feature 'Admin budgets' do
fill_in 'budget_name', with: 'M30 - Summer campaign' fill_in 'budget_name', with: 'M30 - Summer campaign'
fill_in 'budget_description_accepting', with: 'Budgeting for summer 2017 maintenance and improvements of the road M-30' fill_in 'budget_description_accepting', with: 'Budgeting for summer 2017 maintenance and improvements of the road M-30'
select 'Accepting proposals', from: 'budget[phase]' select 'Accepting projects', from: 'budget[phase]'
click_button 'Create Participatory budget' click_button 'Create Participatory budget'

View File

@@ -18,6 +18,7 @@ feature 'Users' do
fill_in 'user_username', with: 'pepe' fill_in 'user_username', with: 'pepe'
fill_in 'user_email', with: 'pepe@gmail.com' fill_in 'user_email', with: 'pepe@gmail.com'
select_date '31-December-1980', from: 'user_date_of_birth'
click_button 'Create user' click_button 'Create user'
@@ -28,6 +29,7 @@ feature 'Users' do
expect(user).to be_level_three_verified expect(user).to be_level_three_verified
expect(user).to be_residence_verified expect(user).to be_residence_verified
expect(user).to_not be_confirmed expect(user).to_not be_confirmed
expect(user.date_of_birth).to have_content (Date.new(1980,12,31))
sent_token = /.*confirmation_token=(.*)".*/.match(ActionMailer::Base.deliveries.last.body.to_s)[1] sent_token = /.*confirmation_token=(.*)".*/.match(ActionMailer::Base.deliveries.last.body.to_s)[1]
visit user_confirmation_path(confirmation_token: sent_token) visit user_confirmation_path(confirmation_token: sent_token)

View File

@@ -13,6 +13,12 @@ feature 'Valuation budget investments' do
expect{ visit valuation_budget_budget_investments_path(create(:budget)) }.to raise_exception(FeatureFlags::FeatureDisabled) expect{ visit valuation_budget_budget_investments_path(create(:budget)) }.to raise_exception(FeatureFlags::FeatureDisabled)
end end
scenario 'Display link to valuation section' do
Setting['feature.budgets'] = true
visit root_path
expect(page).to have_link "Valuation", href: valuation_root_path
end
scenario 'Index shows budget investments assigned to current valuator' do scenario 'Index shows budget investments assigned to current valuator' do
investment1 = create(:budget_investment, budget: @budget) investment1 = create(:budget_investment, budget: @budget)
investment2 = create(:budget_investment, budget: @budget) investment2 = create(:budget_investment, budget: @budget)

View File

@@ -304,6 +304,45 @@ describe Budget::Investment do
expect(salamanca_investment.valid_heading?(user)).to eq(false) expect(salamanca_investment.valid_heading?(user)).to eq(false)
end end
it "allows votes in a group with a single heading" do
all_city_investment = create(:budget_investment, heading: heading)
expect(all_city_investment.valid_heading?(user)).to eq(true)
end
it "allows votes in a group with a single heading after voting in that heading" do
all_city_investment1 = create(:budget_investment, heading: heading)
all_city_investment2 = create(:budget_investment, heading: heading)
create(:vote, votable: all_city_investment1, voter: user)
expect(all_city_investment2.valid_heading?(user)).to eq(true)
end
it "allows votes in a group with a single heading after voting in another group" do
districts = create(:budget_group, budget: budget)
carabanchel = create(:budget_heading, group: districts)
all_city_investment = create(:budget_investment, heading: heading)
carabanchel_investment = create(:budget_investment, heading: carabanchel)
create(:vote, votable: carabanchel_investment, voter: user)
expect(all_city_investment.valid_heading?(user)).to eq(true)
end
it "allows votes in a group with multiple headings after voting in group with a single heading" do
districts = create(:budget_group, budget: budget)
carabanchel = create(:budget_heading, group: districts)
salamanca = create(:budget_heading, group: districts)
all_city_investment = create(:budget_investment, heading: heading)
carabanchel_investment = create(:budget_investment, heading: carabanchel)
create(:vote, votable: all_city_investment, voter: user)
expect(carabanchel_investment.valid_heading?(user)).to eq(true)
end
end end
end end