Merge branch 'master' into poll-shifts-search-officers
This commit is contained in:
@@ -30,6 +30,11 @@ class Admin::Poll::BoothsController < Admin::BaseController
|
||||
end
|
||||
end
|
||||
|
||||
def available
|
||||
@booths = Poll::Booth.available.order(name: :asc).page(params[:page])
|
||||
render :index
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def booth_params
|
||||
|
||||
@@ -25,7 +25,7 @@ module AdminHelper
|
||||
end
|
||||
|
||||
def menu_polls?
|
||||
["polls", "questions", "officers", "booths", "officer_assignments", "booth_assignments", "recounts", "results"].include? controller_name
|
||||
["polls", "questions", "officers", "booths", "officer_assignments", "booth_assignments", "recounts", "results", "shifts"].include? controller_name
|
||||
end
|
||||
|
||||
def menu_profiles?
|
||||
|
||||
@@ -57,7 +57,7 @@ module Abilities
|
||||
can [:index, :create, :edit, :update, :destroy], Geozone
|
||||
|
||||
can [:read, :create, :update, :destroy, :add_question, :remove_question, :search_booths, :search_questions, :search_officers], Poll
|
||||
can [:read, :create, :update, :destroy], Poll::Booth
|
||||
can [:read, :create, :update, :destroy, :available], Poll::Booth
|
||||
can [:search, :create, :index, :destroy], ::Poll::Officer
|
||||
can [:create, :destroy], ::Poll::BoothAssignment
|
||||
can [:create, :destroy], ::Poll::OfficerAssignment
|
||||
|
||||
@@ -10,5 +10,10 @@ class Poll
|
||||
return Booth.none if terms.blank?
|
||||
Booth.where("name ILIKE ? OR location ILIKE ?", "%#{terms}%", "%#{terms}%")
|
||||
end
|
||||
|
||||
def self.available
|
||||
where(polls: { id: Poll.current_or_incoming }).includes(:polls)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -73,12 +73,15 @@
|
||||
<%= link_to t('admin.menu.poll_officers'), admin_officers_path %>
|
||||
</li>
|
||||
|
||||
<li <%# "class=active" if controller_name == "booths" %>>
|
||||
<li <%= "class=active" if controller_name == "booths" &&
|
||||
action_name != "available" %>>
|
||||
<%= link_to t('admin.menu.poll_booths'), admin_booths_path %>
|
||||
</li>
|
||||
|
||||
<li <%= "class=active" if controller_name == "booths" %>>
|
||||
<%= link_to t('admin.menu.poll_shifts'), admin_booths_path %>
|
||||
<li <%= "class=active" if controller_name == "shifts" ||
|
||||
controller_name == "booths" &&
|
||||
action_name == "available" %>>
|
||||
<%= link_to t('admin.menu.poll_shifts'), available_admin_booths_path %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
<% end %>
|
||||
|
||||
<% if author_of?(@proposal, current_user) %>
|
||||
<%= link_to t("proposals.show.send_notification"), new_proposal_notification_path(proposal_id: @proposal.id),
|
||||
<%= link_to t("proposals.show.send_notification"),
|
||||
new_proposal_notification_path(proposal_id: @proposal.id),
|
||||
class: 'button hollow float-right' %>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<li>
|
||||
<%= layout_menu_link_to t("layouts.header.poll_questions"),
|
||||
polls_path,
|
||||
controller_name == "polls",
|
||||
controller_name == "polls" || controller_name == "questions",
|
||||
accesskey: "3",
|
||||
title: t("shared.go_to_page") + t("layouts.header.poll_questions") %>
|
||||
</li>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 : <a href='mailto:ag.gobiernoabierto@consul.dev'>ag.gobiernoabierto@consul.dev</a>\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)
|
||||
|
||||
@@ -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é
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: <a href = \"mailto: ag.gobiernoabierto@consul.dev
|
||||
'> ag.gobiernoabierto@consul.dev </a>\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)
|
||||
|
||||
@@ -287,6 +287,8 @@ Rails.application.routes.draw do
|
||||
end
|
||||
|
||||
resources :booths do
|
||||
get :available, on: :collection
|
||||
|
||||
resources :shifts do
|
||||
get :search_officers, on: :collection
|
||||
end
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user