diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml
index c91719104..3f1b12189 100644
--- a/config/locales/en/admin.yml
+++ b/config/locales/en/admin.yml
@@ -498,16 +498,22 @@ en:
final_recount: "Final recount (by officer)"
poll_shifts:
new:
- new_assignment: "New shift"
+ add_shift: "Add shift"
+ shift: "Assignment"
+ shifts: "Shifts in this booth"
date: "Date"
+ edit_shifts: Edit shifts
+ new_shift: "New shift"
+ no_shifts: "This booth has no shifts"
officer: "Officer"
- assignment: "Assignment"
+ remove_shift: "Remove"
+ search_officer_button: Search
+ search_officer_placeholder: Search officer
+ search_officer_text: Search for an officer to assign a new shift
select_date: "Select day"
- select_officer: "Select officer"
- add_assignment: "Add shift"
- remove_assignment: "Remove"
- assignments: "Shifts in this booth"
- no_assignments: "This booth has no shifts"
+ table_shift: "Shift"
+ table_email: "Email"
+ table_name: "Name"
flash:
create: "Shift added"
destroy: "Shift removed"
@@ -590,6 +596,8 @@ en:
title: Title
valid_answers: Valid answers
description: Description
+ video_url: External video
+ documents: Documents
preview: View on website
recounts:
index:
diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml
index 93075d3dc..321887388 100644
--- a/config/locales/en/general.yml
+++ b/config/locales/en/general.yml
@@ -175,6 +175,7 @@ en:
proposal_notification: "Notification"
spending_proposal: Spending proposal
budget/investment: Investment
+ poll/shift: Shift
user: Account
verification/sms: phone
signature_sheet: Signature sheet
diff --git a/config/locales/en/pages.yml b/config/locales/en/pages.yml
index 83db1a8e4..d1884cbad 100644
--- a/config/locales/en/pages.yml
+++ b/config/locales/en/pages.yml
@@ -63,9 +63,9 @@ en:
text: |-
Use it in your local government or help us to improve it, it is free software.
- This Open Government Portal use the [CONSUL app](https://github.com/ayuntamientomadrid 'consul github') that is free software, with [licence AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html 'AGPLv3 gnu' ), that means in simple words that anyone can use the code freely, copy it, see it in detail, modify it and redistribute it to the word with the modifications he wants (allowing others to do the same). Because we think culture is better and richer when it is released.
+ This Open Government Portal use the [CONSUL app](https://github.com/consul/consul 'consul github') that is free software, with [licence AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html 'AGPLv3 gnu' ), that means in simple words that anyone can use the code freely, copy it, see it in detail, modify it and redistribute it to the word with the modifications he wants (allowing others to do the same). Because we think culture is better and richer when it is released.
- If you are a programmer, you can see the code and help us to improve it at [CONSUL app](https://github.com/ayuntamientomadrid 'consul github').
+ If you are a programmer, you can see the code and help us to improve it at [CONSUL app](https://github.com/consul/consul 'consul github').
titles:
how_to_use: Use it in your local government
privacy: Privacy Policy
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index 58fd31aa1..9872baa0d 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -498,18 +498,24 @@ es:
final_recount: "Recuento final (presidente de mesa)"
poll_shifts:
new:
- new_assignment: "Nuevo turno"
+ add_shift: "Añadir turno"
+ shift: "Asignación"
+ shifts: "Turnos en esta urna"
date: "Fecha"
+ edit_shifts: Asignar turno
+ new_shift: "Nuevo turno"
+ no_shifts: "Esta urna no tiene turnos asignados"
officer: "Presidente de mesa"
- assignment: "Asignación"
+ remove_shift: "Eliminar turno"
+ search_officer_button: Buscar
+ search_officer_placeholder: Buscar presidentes de mesa
+ search_officer_text: Busca al presidente de mesa para asignar un turno
select_date: "Seleccionar día"
- select_officer: "Seleccionar presidente de mesa"
- add_assignment: "Añadir turno"
- remove_assignment: "Eliminar turno"
- assignments: "Turnos en esta urna"
- no_assignments: "Esta urna no tiene turnos asignados"
+ table_shift: "Turno"
+ table_email: "Email"
+ table_name: "Nombre"
flash:
- create: "Añadido turno de presidente de mesa"
+ create: "Añadido turno de presidente de mesa"
destroy: "Eliminado turno de presidente de mesa"
poll_booth_assignments:
flash:
@@ -590,6 +596,8 @@ es:
title: Título
valid_answers: Respuestas válidas
description: Descripción
+ video_url: Video externo
+ documents: Documentos
preview: Ver en la web
recounts:
index:
diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml
index 18597d347..c4fd431b9 100644
--- a/config/locales/es/general.yml
+++ b/config/locales/es/general.yml
@@ -175,6 +175,7 @@ es:
proposal_notification: "la notificación"
spending_proposal: la propuesta de gasto
budget/investment: la propuesta de inversión
+ poll/shift: el turno
user: la cuenta
verification/sms: el teléfono
signature_sheet: la hoja de firmas
diff --git a/config/locales/es/pages.yml b/config/locales/es/pages.yml
index 81c916b5a..d67568b2d 100644
--- a/config/locales/es/pages.yml
+++ b/config/locales/es/pages.yml
@@ -63,9 +63,9 @@ es:
text: |-
Utilízalo en tu municipio libremente o ayúdanos a mejorarlo, es software libre.
- Este Portal de Gobierno Abierto usa la [aplicación CONSUL](https://github.com/ayuntamientomadrid 'github consul') que es software libre, con [licencia AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html 'AGPLv3 gnu' ), esto significa en palabras sencillas, que cualquiera puede libremente usar el código, copiarlo, verlo en detalle, modificarlo, y redistribuirlo al mundo con las modificaciones que quiera (manteniendo el que otros puedan a su vez hacer lo mismo). Porque creemos que la cultura es mejor y más rica cuando se libera.
+ Este Portal de Gobierno Abierto usa la [aplicación CONSUL](https://github.com/consul/consul 'github consul') que es software libre, con [licencia AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html 'AGPLv3 gnu' ), esto significa en palabras sencillas, que cualquiera puede libremente usar el código, copiarlo, verlo en detalle, modificarlo, y redistribuirlo al mundo con las modificaciones que quiera (manteniendo el que otros puedan a su vez hacer lo mismo). Porque creemos que la cultura es mejor y más rica cuando se libera.
- Si eres programador, puedes ver el código y ayudarnos a mejorarlo en [aplicación CONSUL](https://github.com/ayuntamientomadrid 'github consul').
+ Si eres programador, puedes ver el código y ayudarnos a mejorarlo en [aplicación CONSUL](https://github.com/consul/consul 'github consul').
titles:
how_to_use: Utilízalo en tu municipio
privacy: Política de Privacidad
@@ -81,4 +81,4 @@ es:
info_code: 'Ahora introduce el código que has recibido en tu carta:'
password: Contraseña
submit: Verificar mi cuenta
- title: Verifica tu cuenta
\ No newline at end of file
+ title: Verifica tu cuenta
diff --git a/config/locales/fr/general.yml b/config/locales/fr/general.yml
index e4d0f9a51..cf1488375 100644
--- a/config/locales/fr/general.yml
+++ b/config/locales/fr/general.yml
@@ -1196,7 +1196,7 @@ fr:
how_to_use:
text: "Utilisez cet outil dans votre collectivité ou aidez-nous àl'améliorer,
c'est un logiciel libre.\r\n\r\nCe portail de gouvernement ouvert utilise
- cette [application Consul ](https://github.com/ayuntamientomadrid 'consul
+ cette [application Consul ](https://github.com/consul/consul 'consul
github') qui est un logiciel libre, avec une [license AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html
'AGPLv3 gnu' ), ce qui signifie en fait que n'importe qui peut utiliser
le code librement, le copier, l'étudier en détail, le modifier et le redistribuer
@@ -1207,7 +1207,7 @@ fr:
la Mairie de Madrid autant que possible pour le faire. Si vous êtes intéressé,
n'hésitez pas à nous contacter : ag.gobiernoabierto@consul.dev\r\n\r\nSi
vous êtes développeur, vous pouvez voir le code et nous aider à l'améliorer
- sur [Consul app](https://github.com/ayuntamientomadrid 'consul github '
+ sur [Consul app](https://github.com/consul/consul 'consul github '
)."
titles:
faq: Solution pour les problèmes techniques (FAQ)
diff --git a/config/locales/fr/pages.yml b/config/locales/fr/pages.yml
index 42a4e3f2b..dcb57d400 100644
--- a/config/locales/fr/pages.yml
+++ b/config/locales/fr/pages.yml
@@ -59,9 +59,9 @@ fr:
text: |-
Utilisez le librement pour votre gouvernement ou aider nous à l'améliorer, c'est un logiciel libre.
- Ce portail de Gouvernement Ouvert utilise l'[application Consul](https://github.com/ayuntamientomadrid 'consul github') qui est un logiciel libre, sous [licence AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html 'AGPLv3 gnu' ), ce qui, en quelques mots, signifie que tout le monde peut utiliser le code librement, le copier, le voir en détail, le modifier et le redistribuer avec ces modifications (permettant à d'autres d'en faire de même). Car nous pensons que la culture est meilleure et plus riche quand elle est libre.
+ Ce portail de Gouvernement Ouvert utilise l'[application Consul](https://github.com/consul/consul 'consul github') qui est un logiciel libre, sous [licence AGPLv3](http://www.gnu.org/licenses/agpl-3.0.html 'AGPLv3 gnu' ), ce qui, en quelques mots, signifie que tout le monde peut utiliser le code librement, le copier, le voir en détail, le modifier et le redistribuer avec ces modifications (permettant à d'autres d'en faire de même). Car nous pensons que la culture est meilleure et plus riche quand elle est libre.
- Si vous êtes un développeur, vous pouvez voir le code et nous aider à l'améliorer en allant sur l'[applicationConsul](https://github.com/ayuntamientomadrid 'consul github').
+ Si vous êtes un développeur, vous pouvez voir le code et nous aider à l'améliorer en allant sur l'[applicationConsul](https://github.com/consul/consul 'consul github').
titles:
how_to_use: Utilisez-le pour votre gouvernement
privacy: Politique de confidentialité
diff --git a/config/locales/nl/pages.yml b/config/locales/nl/pages.yml
index 71edb19fe..a07151243 100644
--- a/config/locales/nl/pages.yml
+++ b/config/locales/nl/pages.yml
@@ -60,9 +60,9 @@ nl:
text: |-
Gebruik het in uw gemeente en help ons het te verbeteren, het is gratis software.
- Deze Open Overheid site gebruikt de [Consul web-app](https://github.com/ayuntamientomadrid 'consul github'). Gratis software, onder de [AGPLv3 Licentie](http://www.gnu.org/licenses/agpl-3.0.html 'AGPLv3 gnu' ). Simpel gezegd betekend dit dat u de app kunt inspecteren, gebruiken, aanpassen en herdistribueren (onder voorwaarde dat anderen hetzelfde kunnen doen met uw versie).
+ Deze Open Overheid site gebruikt de [Consul web-app](https://github.com/consul/consul 'consul github'). Gratis software, onder de [AGPLv3 Licentie](http://www.gnu.org/licenses/agpl-3.0.html 'AGPLv3 gnu' ). Simpel gezegd betekend dit dat u de app kunt inspecteren, gebruiken, aanpassen en herdistribueren (onder voorwaarde dat anderen hetzelfde kunnen doen met uw versie).
- Voor programmeurs: help ons het te verbeteren via [Consul app](https://github.com/ayuntamientomadrid 'consul github').
+ Voor programmeurs: help ons het te verbeteren via [Consul app](https://github.com/consul/consul 'consul github').
titles:
how_to_use: Gebruik het in uw gemeente
privacy: Privacy Verklaring
@@ -78,4 +78,4 @@ nl:
info_code: 'en de code die u heeft ontvangen:'
password: Wachtwoord
submit: Verifieer mijn account
- title: Verifieer uw account
\ No newline at end of file
+ title: Verifieer uw account
diff --git a/config/locales/pt-BR/general.yml b/config/locales/pt-BR/general.yml
index 69ca72c02..816c14fa2 100644
--- a/config/locales/pt-BR/general.yml
+++ b/config/locales/pt-BR/general.yml
@@ -1212,7 +1212,7 @@ pt-BR:
how_to_use:
text: "Use este programa em seu governo local ou nos ajude a melhorá-lo, ele
é um software livre.\r\n\r\nEste Portal de Governo Aberto usa o [app Consul]
- (https://github.com/ayuntamientomadrid 'cônsul github'), que é um software
+ (https://github.com/consul/consul 'cônsul github'), que é um software
livre, com [licença AGPLv3] (http://www.gnu.org/licenses/agpl- 3.0.html
'AGPLv3 gnu'), o que significa, em palavras simples que qualquer um pode
usar o código livremente, copiá-lo, vê-lo em detalhes, modificá-lo e redistribuí-lo
@@ -1223,7 +1223,7 @@ pt-BR:
Madrid, o tanto quanto possível para fazê-lo, por isso, se você estiver
interessado escreva-nos: ag.gobiernoabierto@consul.dev \r\n\r\nSe você é um programador, você
- pode ver o código e nos ajudar a melhorá-lo em [app Consul] (https://github.com/ayuntamientomadrid
+ pode ver o código e nos ajudar a melhorá-lo em [app Consul] (https://github.com/consul/consul
'cônsul github')."
titles:
faq: Solução para problemas técnicos (FAQ)
diff --git a/config/routes.rb b/config/routes.rb
index eaf6b98f4..a41e8d429 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -287,7 +287,11 @@ Rails.application.routes.draw do
end
resources :booths do
- resources :shifts
+ get :available, on: :collection
+
+ resources :shifts do
+ get :search_officers, on: :collection
+ end
end
resources :questions
diff --git a/db/migrate/20170905111444_add_video_url_to_poll_questions.rb b/db/migrate/20170905111444_add_video_url_to_poll_questions.rb
new file mode 100644
index 000000000..800ca915e
--- /dev/null
+++ b/db/migrate/20170905111444_add_video_url_to_poll_questions.rb
@@ -0,0 +1,5 @@
+class AddVideoUrlToPollQuestions < ActiveRecord::Migration
+ def change
+ add_column :poll_questions, :video_url, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 98f1b69bc..ba856107c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -669,6 +669,7 @@ ActiveRecord::Schema.define(version: 20170908175149) do
t.datetime "created_at"
t.datetime "updated_at"
t.tsvector "tsv"
+ t.string "video_url"
end
add_index "poll_questions", ["author_id"], name: "index_poll_questions_on_author_id", using: :btree
@@ -973,7 +974,7 @@ ActiveRecord::Schema.define(version: 20170908175149) 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", default: '2017-08-07 11:14:09', null: false
+ t.datetime "password_changed_at", default: '2017-09-06 18:19:39', null: false
t.boolean "created_from_signature", default: false
t.integer "failed_email_digests_count", default: 0
t.text "former_users_data_log", default: ""
diff --git a/spec/factories.rb b/spec/factories.rb
index 226723fe3..9cebfddea 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -380,6 +380,10 @@ FactoryGirl.define do
trait :budget_investment_document do
association :documentable, factory: :budget_investment
end
+
+ trait :poll_question_document do
+ association :documentable, factory: :poll_question
+ end
end
factory :comment do
diff --git a/spec/features/admin/poll/booths_spec.rb b/spec/features/admin/poll/booths_spec.rb
index ec8c10d58..fd8fb9e84 100644
--- a/spec/features/admin/poll/booths_spec.rb
+++ b/spec/features/admin/poll/booths_spec.rb
@@ -36,6 +36,32 @@ feature 'Admin booths' do
expect(page).to_not have_content "There are no booths"
end
+ scenario "Available" do
+ booth_for_current_poll = create(:poll_booth)
+ booth_for_incoming_poll = create(:poll_booth)
+ booth_for_expired_poll = create(:poll_booth)
+
+ current_poll = create(:poll, :current)
+ incoming_poll = create(:poll, :incoming)
+ expired_poll = create(:poll, :expired)
+
+ create(:poll_booth_assignment, poll: current_poll, booth: booth_for_current_poll)
+ create(:poll_booth_assignment, poll: incoming_poll, booth: booth_for_incoming_poll)
+ create(:poll_booth_assignment, poll: expired_poll, booth: booth_for_expired_poll)
+
+ visit admin_root_path
+
+ within('#side_menu') do
+ click_link "Manage shifts"
+ end
+
+ expect(page).to have_css(".booth", count: 2)
+
+ expect(page).to have_content booth_for_current_poll.name
+ expect(page).to have_content booth_for_incoming_poll.name
+ expect(page).to_not have_content booth_for_expired_poll.name
+ end
+
scenario 'Show' do
booth = create(:poll_booth)
diff --git a/spec/features/admin/poll/questions_spec.rb b/spec/features/admin/poll/questions_spec.rb
index e9b9f277a..392b2aabf 100644
--- a/spec/features/admin/poll/questions_spec.rb
+++ b/spec/features/admin/poll/questions_spec.rb
@@ -38,6 +38,7 @@ feature 'Admin poll questions' do
Pursued by the Empire's sinister agents, Princess Leia races home aboard her starship, custodian of the stolen plans that can save her
people and restore freedom to the galaxy....
}
+ video_url = "https://puppyvideos.com"
visit admin_questions_path
click_link "Create question"
@@ -45,11 +46,13 @@ feature 'Admin poll questions' do
select 'Movies', from: 'poll_question_poll_id'
fill_in 'poll_question_title', with: title
fill_in 'poll_question_description', with: description
+ fill_in 'poll_question_video_url', with: video_url
click_button 'Save'
expect(page).to have_content(title)
expect(page).to have_content(description)
+ expect(page).to have_content(video_url)
end
scenario 'Create from successful proposal index' do
diff --git a/spec/features/admin/poll/shifts_spec.rb b/spec/features/admin/poll/shifts_spec.rb
index 473b27963..761a79536 100644
--- a/spec/features/admin/poll/shifts_spec.rb
+++ b/spec/features/admin/poll/shifts_spec.rb
@@ -30,7 +30,7 @@ feature 'Admin shifts' do
expect(page).to have_content officer.name
end
- scenario "Create" do
+ scenario "Create", :js do
poll = create(:poll)
booth = create(:poll_booth)
officer = create(:poll_officer)
@@ -41,10 +41,13 @@ feature 'Admin shifts' do
click_link "Manage shifts"
end
- select I18n.l(poll.starts_at.to_date, format: :long), from: 'shift_date'
- select officer.name, from: 'shift_officer_id'
- click_button "Add shift"
+ fill_in "search", with: officer.email
+ click_button "Search"
+ click_link "Edit shifts"
+ select I18n.l(poll.starts_at.to_date, format: :long), from: 'shift_date'
+ click_button "Add shift"
+
expect(page).to have_content "Shift added"
within("#shifts") do
@@ -54,6 +57,25 @@ feature 'Admin shifts' do
end
end
+ scenario "Erros on create", :js do
+ poll = create(:poll)
+ booth = create(:poll_booth)
+ officer = create(:poll_officer)
+
+ visit admin_booths_path
+
+ within("#booth_#{booth.id}") do
+ click_link "Manage shifts"
+ end
+
+ fill_in "search", with: officer.email
+ click_button "Search"
+ click_link "Edit shifts"
+ click_button "Add shift"
+
+ expect(page).to have_content "can't be blank"
+ end
+
scenario "Destroy" do
poll = create(:poll)
booth = create(:poll_booth)
diff --git a/spec/features/polls/questions_spec.rb b/spec/features/polls/questions_spec.rb
index 6f2225175..1563ca81a 100644
--- a/spec/features/polls/questions_spec.rb
+++ b/spec/features/polls/questions_spec.rb
@@ -25,6 +25,25 @@ feature 'Poll Questions' do
expect(page).to have_content(question_with_author_visible_name.author_visible_name)
end
+ scenario '#show view has video_url present' do
+ poll = create(:poll)
+ normal_question = create(:poll_question, poll: poll, video_url: "https://puppyvideos.com")
+
+ visit question_path(normal_question)
+
+ expect(page).to have_link(normal_question.video_url)
+ end
+
+ scenario '#show view has document present' do
+ poll = create(:poll)
+ normal_question = create(:poll_question, poll: poll)
+ document = create(:document, documentable: normal_question)
+
+ visit question_path(normal_question)
+
+ expect(page).to have_content(document.title)
+ end
+
context 'Answering' do
let(:geozone) { create(:geozone) }
let(:poll) { create(:poll, geozone_restricted: true, geozone_ids: [geozone.id]) }
diff --git a/spec/models/abilities/administrator_spec.rb b/spec/models/abilities/administrator_spec.rb
index bbec927a0..dcb099ecd 100644
--- a/spec/models/abilities/administrator_spec.rb
+++ b/spec/models/abilities/administrator_spec.rb
@@ -14,9 +14,11 @@ describe "Abilities::Administrator" do
let(:proposal) { create(:proposal) }
let(:budget_investment) { create(:budget_investment) }
let(:legislation_question) { create(:legislation_question) }
+ let(:poll_question) { create(:poll_question) }
let(:proposal_document) { build(:document, documentable: proposal) }
let(:budget_investment_document) { build(:document, documentable: budget_investment) }
+ let(:poll_question_document) { build(:document, documentable: poll_question) }
let(:hidden_debate) { create(:debate, :hidden) }
let(:hidden_comment) { create(:comment, :hidden) }
@@ -83,4 +85,8 @@ describe "Abilities::Administrator" do
it { should be_able_to(:new, budget_investment_document) }
it { should be_able_to(:create, budget_investment_document) }
it { should be_able_to(:destroy, budget_investment_document) }
+
+ it { should be_able_to(:new, poll_question_document) }
+ it { should be_able_to(:create, poll_question_document) }
+ it { should be_able_to(:destroy, poll_question_document) }
end
diff --git a/spec/models/poll/booth_spec.rb b/spec/models/poll/booth_spec.rb
index c095c62cd..d340d8197 100644
--- a/spec/models/poll/booth_spec.rb
+++ b/spec/models/poll/booth_spec.rb
@@ -24,4 +24,25 @@ describe :booth do
end
end
+ describe "#available" do
+
+ it "returns booths associated to current or incoming polls" do
+ booth_for_current_poll = create(:poll_booth)
+ booth_for_incoming_poll = create(:poll_booth)
+ booth_for_expired_poll = create(:poll_booth)
+
+ current_poll = create(:poll, :current)
+ incoming_poll = create(:poll, :incoming)
+ expired_poll = create(:poll, :expired)
+
+ create(:poll_booth_assignment, poll: current_poll, booth: booth_for_current_poll)
+ create(:poll_booth_assignment, poll: incoming_poll, booth: booth_for_incoming_poll)
+ create(:poll_booth_assignment, poll: expired_poll, booth: booth_for_expired_poll)
+
+ expect(Poll::Booth.available).to include(booth_for_current_poll)
+ expect(Poll::Booth.available).to include(booth_for_incoming_poll)
+ expect(Poll::Booth.available).to_not include(booth_for_expired_poll)
+ end
+
+ end
end
\ No newline at end of file