diff --git a/app/controllers/admin/poll/booths_controller.rb b/app/controllers/admin/poll/booths_controller.rb new file mode 100644 index 000000000..9b1e62f8f --- /dev/null +++ b/app/controllers/admin/poll/booths_controller.rb @@ -0,0 +1,16 @@ +class Admin::Poll::BoothsController < Admin::BaseController + skip_authorization_check + + def index + end + + def show + end + + def new + end + + def edit + end + +end \ No newline at end of file diff --git a/app/controllers/admin/poll/officers_controller.rb b/app/controllers/admin/poll/officers_controller.rb index 5495d390c..7f6f918d7 100644 --- a/app/controllers/admin/poll/officers_controller.rb +++ b/app/controllers/admin/poll/officers_controller.rb @@ -1,5 +1,5 @@ class Admin::Poll::OfficersController < Admin::BaseController - load_and_authorize_resource :officer, class: "Poll::Officer" + load_and_authorize_resource :officer, class: "Poll::Officer", except: [:edit, :show] def index @officers = @officers.page(params[:page]) @@ -29,4 +29,11 @@ class Admin::Poll::OfficersController < Admin::BaseController @officer.destroy redirect_to admin_poll_officers_path end + + def show + end + + def edit + end + end \ No newline at end of file diff --git a/app/controllers/admin/poll/polls_controller.rb b/app/controllers/admin/poll/polls_controller.rb new file mode 100644 index 000000000..b90fd2c11 --- /dev/null +++ b/app/controllers/admin/poll/polls_controller.rb @@ -0,0 +1,16 @@ +class Admin::Poll::PollsController < Admin::BaseController + skip_authorization_check + + def index + end + + def show + end + + def new + end + + def edit + end + +end \ No newline at end of file diff --git a/app/controllers/officing/base_controller.rb b/app/controllers/officing/base_controller.rb new file mode 100644 index 000000000..5aeb2431c --- /dev/null +++ b/app/controllers/officing/base_controller.rb @@ -0,0 +1,18 @@ +class Officing::BaseController < ActionController::Base + layout 'admin' + + #before_action :verify_officer + before_action :set_locale + + private + + def set_locale + if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym) + session[:locale] = params[:locale] + end + + session[:locale] ||= I18n.default_locale + + I18n.locale = session[:locale] + end +end \ No newline at end of file diff --git a/app/controllers/officing/dashboard_controller.rb b/app/controllers/officing/dashboard_controller.rb new file mode 100644 index 000000000..4d80a974a --- /dev/null +++ b/app/controllers/officing/dashboard_controller.rb @@ -0,0 +1,6 @@ +class Officing::DashboardController < Officing::BaseController + + def index + end + +end diff --git a/app/controllers/officing/results_controller.rb b/app/controllers/officing/results_controller.rb new file mode 100644 index 000000000..03e638366 --- /dev/null +++ b/app/controllers/officing/results_controller.rb @@ -0,0 +1,15 @@ +class Officing::ResultsController < Officing::BaseController + layout 'admin' + + before_action :authenticate_user! + + def index + end + + def show + end + + def new + end + +end \ No newline at end of file diff --git a/app/controllers/officing/voters_controller.rb b/app/controllers/officing/voters_controller.rb new file mode 100644 index 000000000..6d7ad8512 --- /dev/null +++ b/app/controllers/officing/voters_controller.rb @@ -0,0 +1,9 @@ +class Officing::VotersController < Officing::BaseController + layout 'admin' + + before_action :authenticate_user! + + def new + end + +end \ No newline at end of file diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index 40bcc6330..48736c378 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb @@ -83,12 +83,24 @@ <% end %> -
  • > - <%= link_to admin_poll_officers_path do %> +
  • > + <%= link_to admin_poll_officers_path(Poll.last) do %> <%= t('admin.menu.poll_officers') %> <% end %>
  • +
  • > + <%= link_to admin_polls_path do %> + <%= t('admin.menu.polls') %> + <% end %> +
  • + +
  • > + <%= link_to admin_poll_booths_url(Poll.last) do %> + <%= t('admin.menu.booths') %> + <% end %> +
  • +
  • > <%= link_to admin_activity_path do %> <%= t('admin.menu.activity') %> diff --git a/app/views/admin/poll/booths/edit.html.erb b/app/views/admin/poll/booths/edit.html.erb new file mode 100644 index 000000000..4f66c61cd --- /dev/null +++ b/app/views/admin/poll/booths/edit.html.erb @@ -0,0 +1 @@ +booth edit \ No newline at end of file diff --git a/app/views/admin/poll/booths/index.html.erb b/app/views/admin/poll/booths/index.html.erb new file mode 100644 index 000000000..7ef71767d --- /dev/null +++ b/app/views/admin/poll/booths/index.html.erb @@ -0,0 +1 @@ +booth index \ No newline at end of file diff --git a/app/views/admin/poll/booths/new.html.erb b/app/views/admin/poll/booths/new.html.erb new file mode 100644 index 000000000..ebcb88bd4 --- /dev/null +++ b/app/views/admin/poll/booths/new.html.erb @@ -0,0 +1 @@ +booth new \ No newline at end of file diff --git a/app/views/admin/poll/booths/show.html.erb b/app/views/admin/poll/booths/show.html.erb new file mode 100644 index 000000000..791a97e48 --- /dev/null +++ b/app/views/admin/poll/booths/show.html.erb @@ -0,0 +1 @@ +booth show \ No newline at end of file diff --git a/app/views/admin/poll/officers/edit.html.erb b/app/views/admin/poll/officers/edit.html.erb new file mode 100644 index 000000000..5c64d3aeb --- /dev/null +++ b/app/views/admin/poll/officers/edit.html.erb @@ -0,0 +1 @@ +officer edit \ No newline at end of file diff --git a/app/views/admin/poll/officers/show.html.erb b/app/views/admin/poll/officers/show.html.erb new file mode 100644 index 000000000..fc702276e --- /dev/null +++ b/app/views/admin/poll/officers/show.html.erb @@ -0,0 +1 @@ +officer show \ No newline at end of file diff --git a/app/views/admin/poll/polls/edit.html.erb b/app/views/admin/poll/polls/edit.html.erb new file mode 100644 index 000000000..ca0a8dc14 --- /dev/null +++ b/app/views/admin/poll/polls/edit.html.erb @@ -0,0 +1 @@ +poll edit \ No newline at end of file diff --git a/app/views/admin/poll/polls/index.html.erb b/app/views/admin/poll/polls/index.html.erb new file mode 100644 index 000000000..d01cf64f1 --- /dev/null +++ b/app/views/admin/poll/polls/index.html.erb @@ -0,0 +1 @@ +polls index \ No newline at end of file diff --git a/app/views/admin/poll/polls/new.html.erb b/app/views/admin/poll/polls/new.html.erb new file mode 100644 index 000000000..6e11970d3 --- /dev/null +++ b/app/views/admin/poll/polls/new.html.erb @@ -0,0 +1 @@ +poll new \ No newline at end of file diff --git a/app/views/admin/poll/polls/show.html.erb b/app/views/admin/poll/polls/show.html.erb new file mode 100644 index 000000000..61c9d5afb --- /dev/null +++ b/app/views/admin/poll/polls/show.html.erb @@ -0,0 +1 @@ +poll show \ No newline at end of file diff --git a/app/views/officing/_menu.html.erb b/app/views/officing/_menu.html.erb new file mode 100644 index 000000000..81734d99f --- /dev/null +++ b/app/views/officing/_menu.html.erb @@ -0,0 +1,18 @@ +
    +
    diff --git a/app/views/officing/dashboard/index.html.erb b/app/views/officing/dashboard/index.html.erb new file mode 100644 index 000000000..cf014d719 --- /dev/null +++ b/app/views/officing/dashboard/index.html.erb @@ -0,0 +1,6 @@ +
    +

    <%= t("officing.dashboard.index.title") %>

    + +

    <%= t("officing.dashboard.index.info") %>

    + +
    diff --git a/app/views/officing/results/index.html.erb b/app/views/officing/results/index.html.erb new file mode 100644 index 000000000..8e9faa1ab --- /dev/null +++ b/app/views/officing/results/index.html.erb @@ -0,0 +1 @@ +results index \ No newline at end of file diff --git a/app/views/officing/results/new.html.erb b/app/views/officing/results/new.html.erb new file mode 100644 index 000000000..bb40dff9e --- /dev/null +++ b/app/views/officing/results/new.html.erb @@ -0,0 +1 @@ +results new \ No newline at end of file diff --git a/app/views/officing/results/show.html.erb b/app/views/officing/results/show.html.erb new file mode 100644 index 000000000..b3ca8e29c --- /dev/null +++ b/app/views/officing/results/show.html.erb @@ -0,0 +1 @@ +results show \ No newline at end of file diff --git a/app/views/officing/voters/new.html.erb b/app/views/officing/voters/new.html.erb new file mode 100644 index 000000000..0fb4c6bc3 --- /dev/null +++ b/app/views/officing/voters/new.html.erb @@ -0,0 +1 @@ +voters new diff --git a/app/views/officing/voters/show.html.erb b/app/views/officing/voters/show.html.erb new file mode 100644 index 000000000..fd8c83123 --- /dev/null +++ b/app/views/officing/voters/show.html.erb @@ -0,0 +1 @@ +voters show \ No newline at end of file diff --git a/app/views/poll/voters/new.html.erb b/app/views/poll/voters/new.html.erb new file mode 100644 index 000000000..596b8769c --- /dev/null +++ b/app/views/poll/voters/new.html.erb @@ -0,0 +1 @@ +new.html.erb \ No newline at end of file diff --git a/app/views/shared/_admin_login_items.html.erb b/app/views/shared/_admin_login_items.html.erb index 6ba10bbca..cfe3cc1c9 100644 --- a/app/views/shared/_admin_login_items.html.erb +++ b/app/views/shared/_admin_login_items.html.erb @@ -22,4 +22,10 @@ <%= link_to t("layouts.header.management"), management_sign_in_path %>
  • <% end %> + + <%# if current_user.administrator? || current_user.officer? %> +
  • + <%= link_to t("layouts.header.officing"), officing_root_path %> +
  • + <%# end %> <% end %> diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 97723c9c8..a04595e8b 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -106,6 +106,8 @@ en: moderators: Moderators valuators: Valuators poll_officers: Poll officers + polls: Polls + booths: Booths officials: Officials organizations: Organisations settings: Configuration settings diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index f71293208..ba3548215 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -104,6 +104,8 @@ es: moderators: Moderadores valuators: Evaluadores poll_officers: Presidentes de mesa + polls: Votaciones + booths: Urnas officials: Cargos públicos organizations: Organizaciones settings: Configuración global diff --git a/config/locales/en.yml b/config/locales/en.yml index 233ebf735..9230ecbf8 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -195,6 +195,7 @@ en: management: Management moderation: Moderation valuation: Valuation + officing: Polling officers more_information: More information my_account_link: My account my_activity_link: My activity diff --git a/config/locales/es.yml b/config/locales/es.yml index 54aa483cd..80541466b 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -195,6 +195,7 @@ es: management: Gestión moderation: Moderar valuation: Evaluación + officing: Presidentes de mesa more_information: Más información my_account_link: Mi cuenta my_activity_link: Mi actividad diff --git a/config/locales/officing.en.yml b/config/locales/officing.en.yml new file mode 100644 index 000000000..532d18498 --- /dev/null +++ b/config/locales/officing.en.yml @@ -0,0 +1,10 @@ +--- +en: + officing: + dashboard: + index: + title: Poll officing + info: Here you can validate user documents and store voting results + menu: + voters: Validate citizen document + results: Store voting results \ No newline at end of file diff --git a/config/locales/officing.es.yml b/config/locales/officing.es.yml new file mode 100644 index 000000000..baa60b106 --- /dev/null +++ b/config/locales/officing.es.yml @@ -0,0 +1,10 @@ +--- +es: + officing: + dashboard: + index: + title: Presidir mesa de votaciones + info: Aquí puedes validar documentos de ciudadanos y guardar los resultados de las urnas + menu: + voters: Validar documento de identidad + results: Guardar resultados de la votación \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 1821537e5..2b223b46b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -179,9 +179,12 @@ Rails.application.routes.draw do get :search, on: :collection end - namespace :poll do - resources :officers, only: [:index, :create, :destroy] do - get :search, on: :collection + scope module: 'poll' do + resources :polls do + resources :booths + resources :officers do + get :search, on: :collection + end end end @@ -268,6 +271,14 @@ Rails.application.routes.draw do end end + namespace :officing do + resources :polls do + resources :voters, only: [:new, :show] + resources :results, only: [:new, :index, :show] + end + root to: "dashboard#index" + end + if Rails.env.development? mount LetterOpenerWeb::Engine, at: "/letter_opener" end