hackathon_manager 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/manage/messages_controller.rb +3 -1
- data/app/controllers/manage/questionnaires_controller.rb +2 -15
- data/app/controllers/manage/trackable_events_controller.rb +5 -0
- data/app/helpers/manage/bootstrap_form_helper.rb +2 -2
- data/app/mailers/mail_preview.rb +0 -4
- data/app/mailers/mailer.rb +0 -6
- data/app/models/message_recipient_query.rb +2 -2
- data/app/models/questionnaire.rb +0 -4
- data/app/views/manage/bus_lists/show.html.haml +9 -1
- data/app/views/manage/configs/show.html.haml +0 -6
- data/app/views/manage/questionnaires/_checkin.html.haml +0 -4
- data/app/views/manage/questionnaires/index.html.haml +0 -7
- data/app/views/manage/questionnaires/show.html.haml +0 -1
- data/app/views/manage/schools/show.html.haml +7 -0
- data/app/views/manage/trackable_events/index.html.haml +9 -0
- data/config/routes.rb +0 -1
- data/lib/hackathon_manager/version.rb +1 -1
- metadata +2 -4
- data/app/views/mailer/slack_invite_email.html.erb +0 -10
- data/app/workers/slack_invite_worker.rb +0 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b110c6f81f04a941dba3abb72df318fd8f861320fd400a23cfc60b07cb64abee
|
4
|
+
data.tar.gz: 489f044a7cd227ca530bf8439f8ed3ac81b487c66fbe61ee2c21e97cd41bf69f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dc4cc8c4da1a98ad2ec2e1dd49ec92793f1348ecd1fc00bf6ea7e6b9ecfa7e0304bed004ee9799146e35c6a2c2cdb0308e815964eff2f9817a5b08c631fc0e6
|
7
|
+
data.tar.gz: f150b6ed570e822bdbac891a8500daa9fb70e36bc4adb3ed1dc3a35da83191bec9a3f895eb4937e5b2842336d2e0d718cb955b1a55c65c17b61102cffa1c9729
|
@@ -17,7 +17,9 @@ class Manage::MessagesController < Manage::ApplicationController
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def new
|
20
|
-
|
20
|
+
type = params[:type]
|
21
|
+
recipients = params[:recipients]
|
22
|
+
@message = Message.new(type: type, recipients: recipients)
|
21
23
|
respond_with(:manage, @message)
|
22
24
|
end
|
23
25
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Manage::QuestionnairesController < Manage::ApplicationController
|
2
2
|
include QuestionnairesControllable
|
3
3
|
|
4
|
-
before_action :set_questionnaire, only: [:show, :edit, :update, :destroy, :check_in, :convert_to_admin, :update_acc_status, :message_events
|
4
|
+
before_action :set_questionnaire, only: [:show, :edit, :update, :destroy, :check_in, :convert_to_admin, :update_acc_status, :message_events]
|
5
5
|
|
6
6
|
respond_to :html, :json
|
7
7
|
|
@@ -70,7 +70,6 @@ class Manage::QuestionnairesController < Manage::ApplicationController
|
|
70
70
|
end
|
71
71
|
@questionnaire.update_attribute(:checked_in_at, Time.now)
|
72
72
|
@questionnaire.update_attribute(:checked_in_by_id, current_user.id)
|
73
|
-
@questionnaire.invite_to_slack
|
74
73
|
flash[:notice] = "Checked in #{@questionnaire.full_name}."
|
75
74
|
elsif params[:check_in] == "false"
|
76
75
|
@questionnaire.update_attribute(:checked_in_at, nil)
|
@@ -116,8 +115,6 @@ class Manage::QuestionnairesController < Manage::ApplicationController
|
|
116
115
|
flash[:notice] = "Failed to update acceptance status"
|
117
116
|
end
|
118
117
|
|
119
|
-
process_acc_status_notifications(@questionnaire, new_status)
|
120
|
-
|
121
118
|
redirect_to manage_questionnaire_path(@questionnaire)
|
122
119
|
end
|
123
120
|
|
@@ -132,17 +129,11 @@ class Manage::QuestionnairesController < Manage::ApplicationController
|
|
132
129
|
q.acc_status = action
|
133
130
|
q.acc_status_author_id = current_user.id
|
134
131
|
q.acc_status_date = Time.now
|
135
|
-
q.save(validate: false)
|
132
|
+
q.save(validate: false)
|
136
133
|
end
|
137
134
|
head :ok
|
138
135
|
end
|
139
136
|
|
140
|
-
def invite_to_slack
|
141
|
-
@questionnaire.invite_to_slack
|
142
|
-
flash[:notice] = 'Slack invite has been queued for delivery'
|
143
|
-
redirect_to manage_questionnaire_path @questionnaire
|
144
|
-
end
|
145
|
-
|
146
137
|
def message_events
|
147
138
|
render json: @questionnaire.message_events
|
148
139
|
end
|
@@ -165,8 +156,4 @@ class Manage::QuestionnairesController < Manage::ApplicationController
|
|
165
156
|
def set_questionnaire
|
166
157
|
@questionnaire = ::Questionnaire.find(params[:id])
|
167
158
|
end
|
168
|
-
|
169
|
-
def process_acc_status_notifications(questionnaire, new_status)
|
170
|
-
questionnaire.invite_to_slack if ENV['INVITE_TO_SLACK_UPON_RSVP'] == 'true' && new_status == 'rsvp_confirmed'
|
171
|
-
end
|
172
159
|
end
|
@@ -7,6 +7,11 @@ class Manage::TrackableEventsController < Manage::ApplicationController
|
|
7
7
|
# GET /manage/trackable_events
|
8
8
|
def index
|
9
9
|
@trackable_events = TrackableEvent.all
|
10
|
+
@params = {}
|
11
|
+
if params[:trackable_event]
|
12
|
+
@params = params.require(:trackable_event).permit(:user_id, :band_id).reject{|_, v| v.blank?}
|
13
|
+
@trackable_events = @trackable_events.where(@params)
|
14
|
+
end
|
10
15
|
respond_with(:manage, @trackable_events)
|
11
16
|
end
|
12
17
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Manage
|
2
2
|
module BootstrapFormHelper
|
3
|
-
def bs_vertical_simple_form(path, options, &block)
|
3
|
+
def bs_vertical_simple_form(path, options = {}, &block)
|
4
4
|
bootstrap_options = {
|
5
5
|
wrapper: :bootstrap_vertical_form,
|
6
6
|
wrapper_mappings: {
|
@@ -20,7 +20,7 @@ module Manage
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
def bs_horizontal_simple_form_for(path, options, &block)
|
23
|
+
def bs_horizontal_simple_form_for(path, options = {}, &block)
|
24
24
|
bootstrap_options = {
|
25
25
|
wrapper: :bootstrap_horizontal_form,
|
26
26
|
wrapper_mappings: {
|
data/app/mailers/mail_preview.rb
CHANGED
@@ -14,10 +14,6 @@ if defined?(ActionMailer::Preview)
|
|
14
14
|
Mailer.bus_captain_confirmation_email(buslist.id, buslist.captains.first.id)
|
15
15
|
end
|
16
16
|
|
17
|
-
def slack_invite_email
|
18
|
-
Mailer.slack_invite_email(Questionnaire.first.id)
|
19
|
-
end
|
20
|
-
|
21
17
|
def bus_list_update_email
|
22
18
|
Mailer.bus_list_update_email(BusList.first.passengers.first.id)
|
23
19
|
end
|
data/app/mailers/mailer.rb
CHANGED
@@ -31,12 +31,6 @@ class Mailer < ApplicationMailer
|
|
31
31
|
mail_questionnaire("You're a bus captain!")
|
32
32
|
end
|
33
33
|
|
34
|
-
def slack_invite_email(questionnaire_id)
|
35
|
-
@questionnaire = Questionnaire.find_by_id(questionnaire_id)
|
36
|
-
return if @questionnaire.blank?
|
37
|
-
mail_questionnaire("Slack Invite!")
|
38
|
-
end
|
39
|
-
|
40
34
|
def bus_list_update_email(questionnaire_id)
|
41
35
|
@questionnaire = Questionnaire.find_by_id(questionnaire_id)
|
42
36
|
@bus_list = @questionnaire.bus_list
|
@@ -57,11 +57,11 @@ class MessageRecipientQuery
|
|
57
57
|
|
58
58
|
case recipient_query.type
|
59
59
|
when "bus-list"
|
60
|
-
"Bus List: #{model.name} (signed up
|
60
|
+
"Bus List: #{model.name} (signed up passengers)"
|
61
61
|
when "bus-list--eligible"
|
62
62
|
"Bus List: #{model.name} (eligible, not signed up for bus)"
|
63
63
|
when "bus-list--applied"
|
64
|
-
"Bus List: #{model.name} (applied/not accepted)"
|
64
|
+
"Bus List: #{model.name} (applied/not yet accepted)"
|
65
65
|
when "school"
|
66
66
|
"Confirmed or Accepted: #{model.name}"
|
67
67
|
when "blazer"
|
data/app/models/questionnaire.rb
CHANGED
@@ -199,10 +199,6 @@ class Questionnaire < ApplicationRecord
|
|
199
199
|
simple_spark.message_events.search(recipients: email)
|
200
200
|
end
|
201
201
|
|
202
|
-
def invite_to_slack
|
203
|
-
SlackInviteWorker.perform_async(id)
|
204
|
-
end
|
205
|
-
|
206
202
|
def verbal_status
|
207
203
|
if acc_status == "rsvp_denied"
|
208
204
|
"Not Attending"
|
@@ -2,7 +2,15 @@
|
|
2
2
|
.btn-group
|
3
3
|
= link_to 'Edit', edit_manage_bus_list_path(@bus_list), class: 'btn btn-sm btn-outline-secondary'
|
4
4
|
= link_to 'Delete', manage_bus_list_path(@bus_list), method: :delete, data: { confirm: "Are you sure? The bus list \"#{@bus_list.name}\" will be permanently erased. This action is irreversible." }, class: 'btn btn-sm btn-outline-secondary'
|
5
|
-
|
5
|
+
.btn-group{role: "group"}
|
6
|
+
%button.btn.btn-sm.btn-outline-secondary.dropdown-toggle#title-actions{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button"}
|
7
|
+
.fa.fa-envelope-o.pr-1
|
8
|
+
Send email
|
9
|
+
.dropdown-menu.dropdown-menu-right{"aria-labelledby" => "title-actions"}
|
10
|
+
= link_to 'Send Bus Notes Update', send_update_email_manage_bus_list_path(@bus_list), method: :patch, data: { confirm: "Are you sure? All passengers for \"#{@bus_list.name}\" will be immediatley emailed the current bus notes." }, class: 'dropdown-item'
|
11
|
+
= link_to 'Create message (signed up passengers)', new_manage_message_path(type: 'bulk', recipients: ["bus-list::#{@bus_list.id}"]), class: 'dropdown-item'
|
12
|
+
= link_to 'Create message (eligible, not signed up)', new_manage_message_path(type: 'bulk', recipients: ["bus-list::#{@bus_list.id}"]), class: 'dropdown-item'
|
13
|
+
= link_to 'Create message (applied/not yet accepted)', new_manage_message_path(type: 'bulk', recipients: ["bus-list::#{@bus_list.id}"]), class: 'dropdown-item'
|
6
14
|
|
7
15
|
.row
|
8
16
|
.col-lg-6
|
@@ -22,12 +22,6 @@
|
|
22
22
|
%h6.card-subtitle.mb-2.text-muted
|
23
23
|
Environment variables are configured on the production server.
|
24
24
|
%hr
|
25
|
-
%p
|
26
|
-
%b Carpool Link:
|
27
|
-
%pre= ENV['CARPOOL_LINK'] || '[No value]'
|
28
|
-
%p
|
29
|
-
%b Slack Sign Up URL:
|
30
|
-
%pre= ENV['SLACK_SIGNUP_URL'] || '[No value]'
|
31
25
|
%p
|
32
26
|
%b AWS S3 Bucket for Resumes:
|
33
27
|
%pre= ENV['AWS_BUCKET'] || '[No value]'
|
@@ -34,7 +34,3 @@
|
|
34
34
|
= f.input :email, input_html: { "data-validate" => "presence email", value: @questionnaire.user.try(:email) }, required: true
|
35
35
|
= hidden_field_tag("check_in", !@questionnaire.checked_in?)
|
36
36
|
= f.button :submit, value: ( @questionnaire.checked_in? ? "Remove check-in" : "Check In" ), class: 'btn-primary'
|
37
|
-
- if !@questionnaire.checked_in?
|
38
|
-
%p.card-text
|
39
|
-
%small
|
40
|
-
%i An invite to Slack will be sent if they haven't joined already.
|
@@ -2,13 +2,6 @@
|
|
2
2
|
= link_to "New Questionnaire", new_manage_questionnaire_path, class: "btn btn-sm btn-outline-secondary"
|
3
3
|
|
4
4
|
%div
|
5
|
-
- if ENV['INVITE_TO_SLACK_UPON_RSVP']
|
6
|
-
%p.small
|
7
|
-
%strong.text-info
|
8
|
-
%span.fa.fa-info-circle.icon-space-r-half
|
9
|
-
Slack auto-invite enabled.
|
10
|
-
%span.text-muted Invites will automatically be sent upon RSVP confirmation.
|
11
|
-
|
12
5
|
%table.questionnaires.datatable.table.table-striped.table-hover{ "data-source" => datatable_manage_questionnaires_path(format: :json) }
|
13
6
|
%thead
|
14
7
|
%tr
|
@@ -11,7 +11,6 @@
|
|
11
11
|
.btn-group{role: "group"}
|
12
12
|
- unless current_user.admin_limited_access
|
13
13
|
= link_to 'Edit', edit_manage_questionnaire_path(@questionnaire), class: 'btn btn-sm btn-outline-secondary'
|
14
|
-
= link_to 'Invite to Slack', invite_to_slack_manage_questionnaire_path(@questionnaire), method: :patch, class: 'btn btn-sm btn-outline-secondary'
|
15
14
|
- unless current_user.admin_limited_access
|
16
15
|
.btn-group{role: "group"}
|
17
16
|
%button.btn.btn-sm.btn-outline-secondary.dropdown-toggle#title-actions{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button"}
|
@@ -2,6 +2,13 @@
|
|
2
2
|
.btn-group
|
3
3
|
= link_to 'Edit', edit_manage_school_path(@school), class: 'btn btn-sm btn-outline-secondary'
|
4
4
|
= link_to 'Merge', merge_manage_school_path(@school), class: 'btn btn-sm btn-outline-secondary'
|
5
|
+
.btn-group{role: "group"}
|
6
|
+
%button.btn.btn-sm.btn-outline-secondary.dropdown-toggle#title-actions{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", type: "button"}
|
7
|
+
.fa.fa-envelope-o.pr-1
|
8
|
+
Send email
|
9
|
+
.dropdown-menu.dropdown-menu-right{"aria-labelledby" => "title-actions"}
|
10
|
+
= link_to 'Create message (confirmed or accepted applicants)', new_manage_message_path(type: 'bulk', recipients: ["school::#{@school.id}"]), class: 'dropdown-item'
|
11
|
+
|
5
12
|
|
6
13
|
.row
|
7
14
|
.col-md-6
|
@@ -1,5 +1,14 @@
|
|
1
1
|
= render "layouts/manage/page_title", title: "Trackable Events"
|
2
2
|
|
3
|
+
= bs_horizontal_simple_form_for :trackable_event, method: 'get' do |f|
|
4
|
+
.form-row
|
5
|
+
.col-auto
|
6
|
+
= f.input :user_id, collection: User.where(admin: true), label_method: :email, value_method: :id, include_blank: '(show all)', required: false, selected: @params['user_id']
|
7
|
+
.col-auto
|
8
|
+
= f.input :band_id, as: :string, required: false, input_html: { value: @params['band_id'] }, placeholder: '(show all)'
|
9
|
+
.col-auto
|
10
|
+
= f.button :submit, 'Filter', class: 'btn btn-primary'
|
11
|
+
|
3
12
|
%table.table.table-striped
|
4
13
|
%thead
|
5
14
|
%tr
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hackathon_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stuart Olivera
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -590,7 +590,6 @@ files:
|
|
590
590
|
- app/views/mailer/bus_captain_confirmation_email.html.erb
|
591
591
|
- app/views/mailer/bus_list_update_email.html.erb
|
592
592
|
- app/views/mailer/incomplete_reminder_email.html.erb
|
593
|
-
- app/views/mailer/slack_invite_email.html.erb
|
594
593
|
- app/views/manage/admins/_form.html.haml
|
595
594
|
- app/views/manage/admins/edit.html.haml
|
596
595
|
- app/views/manage/admins/index.html.haml
|
@@ -642,7 +641,6 @@ files:
|
|
642
641
|
- app/views/questionnaires/show.html.haml
|
643
642
|
- app/views/rsvps/show.html.haml
|
644
643
|
- app/workers/bulk_message_worker.rb
|
645
|
-
- app/workers/slack_invite_worker.rb
|
646
644
|
- config/blazer.yml
|
647
645
|
- config/initializers/0_hackathon.rb
|
648
646
|
- config/initializers/ajax_datatables_rails.rb
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<% raise 'Slack invite URL missing' if ENV['SLACK_SIGNUP_URL'].blank? %>
|
2
|
-
<h1>Join Slack!</h1>
|
3
|
-
<p>Hey <%= @questionnaire.first_name %>,
|
4
|
-
<p><a href="https://slack.com/is">Slack</a> is being used as a central communication platform at <%= Rails.configuration.hackathon['name'] %>.</p>
|
5
|
-
<p>You can create private <strong>team chats</strong>, reach out to <strong>mentors</strong>, and more. Don't like notifications? Don't worry - you can <a href="https://get.slack.help/hc/en-us/articles/218074567-Customizing-notifications">customize them</a> or <a href="https://get.slack.help/hc/en-us/articles/214908388-Do-Not-Disturb-and-snooze-settings">turn them off entirely</a>.
|
6
|
-
<p style="text-align: center;">
|
7
|
-
<a href="<%= ENV['SLACK_SIGNUP_URL'] %>" class="button">Join our Slack »</a><br>
|
8
|
-
<small><i>Link not working? Go to:</i></small><br />
|
9
|
-
<small><i><%= ENV['SLACK_SIGNUP_URL'] %></i></small>
|
10
|
-
</p>
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'httparty'
|
2
|
-
|
3
|
-
class SlackInviteWorker
|
4
|
-
include Sidekiq::Worker
|
5
|
-
|
6
|
-
def perform(questionnaire_id)
|
7
|
-
questionnaire = Questionnaire.find(questionnaire_id)
|
8
|
-
email = questionnaire.email
|
9
|
-
first_name = questionnaire.first_name
|
10
|
-
last_name = questionnaire.last_name
|
11
|
-
json = query_api('users.admin.invite', "&email=#{email}&first_name=#{first_name}&last_name=#{last_name}&set_active=true")
|
12
|
-
|
13
|
-
return if json[:ok]
|
14
|
-
|
15
|
-
if json[:error]
|
16
|
-
return if ok_errors.include?(json[:error])
|
17
|
-
return attempt_manual_invite(questionnaire.id, email) if use_manual_errors.include?(json[:error])
|
18
|
-
raise "Slack error: #{json[:error]}"
|
19
|
-
end
|
20
|
-
|
21
|
-
raise "Failed to invite to Slack."
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def query_api(method, params = '')
|
27
|
-
response = HTTParty.post("https://#{ENV['SLACK_SUBDOMAIN']}.slack.com/api/#{method}?token=#{ENV['SLACK_API_TOKEN']}#{params}")
|
28
|
-
json = JSON.parse(response.body, symbolize_names: true)
|
29
|
-
raise "Could not read Slack response" unless json
|
30
|
-
json
|
31
|
-
end
|
32
|
-
|
33
|
-
def attempt_manual_invite(questionnaire_id, email)
|
34
|
-
json = query_api('users.list')
|
35
|
-
raise "Slack error: #{json[:error]}" if json[:error]
|
36
|
-
|
37
|
-
return if json[:members].find { |member| member[:profile][:email] == email }
|
38
|
-
|
39
|
-
Mailer.delay.slack_invite_email(questionnaire_id)
|
40
|
-
end
|
41
|
-
|
42
|
-
def ok_errors
|
43
|
-
['already_invited', 'already_in_team']
|
44
|
-
end
|
45
|
-
|
46
|
-
def use_manual_errors
|
47
|
-
['invalid_email', 'invite_limit_reached']
|
48
|
-
end
|
49
|
-
end
|