add endpoint to facilitate external mailings
This commit is contained in:
parent
b1e1283cbe
commit
13cc5836c7
|
@ -81,7 +81,7 @@ journalctl -u ingang
|
|||
- bij `/rooms` -> `Edit` tweak de [mail text](https://cloud.bij1.org/s/4kT8KZRqGWWqerw)
|
||||
- test via `Users` -> `Send test invite`
|
||||
- als deze goed is `Send Invitations` naar de rest
|
||||
- doe `Export Voters` en [laad in Helios stemmingen in](https://bij1.org/handleiding-stemsysteem/#stemgerechtigden-inladen)
|
||||
- doe `Export Voters for Helios` en [laad in Helios stemmingen in](https://bij1.org/handleiding-stemsysteem/#stemgerechtigden-inladen)
|
||||
- ofwel:
|
||||
- Ingang in (stemmingen): `Import Votes` (vergt SSH toegang tot Helios server)
|
||||
- in Helios stuur per stemming een invite
|
||||
|
|
|
@ -96,6 +96,29 @@ class RoomsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# GET /rooms/1/mailing
|
||||
# GET /rooms/1/mailing.csv
|
||||
def export_for_mailing
|
||||
require 'csv'
|
||||
attendees = params[:user].present? ? User.where(room_id: @room.id, id: params[:user].to_i) : User.where(room_id: @room.id)
|
||||
csv_data = CSV.generate do |csv|
|
||||
attendees.each do |attendee|
|
||||
if not attendee.proxy
|
||||
if attendee.vote and voter = attendee
|
||||
csv << [voter.email, voter.name, voter.token, "https://vergadering.bij1.org/ingang/#{voter.token}/"]
|
||||
end
|
||||
User.where(email: attendee.email, vote: true, proxy: true, room_id: @room.id).each do |proxy|
|
||||
csv << [proxy.email, "gemachtigde voor #{proxy.name}", voter.token, "https://vergadering.bij1.org/ingang/#{voter.token}/"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.csv { send_data csv_data, filename: "#{@room.name} #{Time.zone.now}.csv" }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /rooms/1/aanwezig
|
||||
# GET /rooms/1/aanwezig.csv
|
||||
def present
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
<%= link_to 'Mark all as present', mark_presence_room_users_path(v: 1), method: :post, data: { confirm: 'Are you sure you wish to mark all users as present?' } %> |
|
||||
<%= link_to 'Mark all as not present', mark_presence_room_users_path(v: 0), method: :post, data: { confirm: 'Are you sure you wish to mark all users as not present?' } %> |
|
||||
<%= link_to 'Bulk import', bulk_new_room_users_path, method: :get %> |
|
||||
<%= link_to 'Export Voters', room_export_voters_path(params[:room_id]) %> |
|
||||
<%= link_to 'Export Voters for Helios', room_export_voters_path(params[:room_id]) %> |
|
||||
<%= link_to 'Export Voters for Mailing', room_export_voters_for_mailing_path(params[:room_id]) %> |
|
||||
<%= link_to 'Present Users', room_present_users_path(id: params[:room_id], v: 1) %> |
|
||||
<%= link_to 'Absent Users', room_present_users_path(id: params[:room_id], v: 0) %> |
|
||||
<%= link_to 'Destroy all', destroy_room_users_path(params[:room_id]), method: :delete %> |
|
||||
|
|
|
@ -16,6 +16,7 @@ Rails.application.routes.draw do
|
|||
get 'rooms/:room_id/votes/bulk', to: 'votes#bulk', as: 'bulk_new_room_votes'
|
||||
post 'rooms/:room_id/votes/bulk', to: 'votes#create_bulk', as: 'bulk_create_room_votes'
|
||||
get 'rooms/:id/voters.csv', to: 'rooms#voters', as: 'room_export_voters'
|
||||
get 'rooms/:id/mailing.csv', to: 'rooms#export_for_mailing', as: 'room_export_voters_for_mailing'
|
||||
get 'rooms/:id/aanwezig.csv', to: 'rooms#present', as: 'room_present_users'
|
||||
get ':token', to: 'main#stemmen', as: 'user_elections'
|
||||
get ':token/stream', to: 'main#stream', as: 'user_stream'
|
||||
|
|
Loading…
Reference in New Issue