Skip to content

Commit 5c3dff5

Browse files
committed
Squashed commit of the following:
commit ede300f Author: Chris Baudouin, Jr <[email protected]> Date: Sat Aug 29 21:05:53 2020 -0400 feat: Updates MyMLH to V3 (#329) * feat: Updates MyMLH to V3 * fix(User): Adds missing provider field * refactor: Updates MyMLH branding * Autofill MyMLH provider if info is missing * houndbot Co-authored-by: Peter Kos <[email protected]> commit 675b3f6 Author: Chris Baudouin, Jr <[email protected]> Date: Sun Aug 23 22:43:48 2020 -0400 refactor: Changes "Applications" to "Questionnaires" in map (#326) commit 388c9bd Author: Chris Baudouin, Jr <[email protected]> Date: Sun Aug 23 22:08:26 2020 -0400 fix(Dashboard): Fixes missing location data in map (#324) commit a062140 Author: Chris Baudouin, Jr <[email protected]> Date: Wed Aug 19 11:02:07 2020 -0400 feat(docs): Initial documentation for 2.0 (#291) * feat(docs): Initial documentation for 2.0 * refactor: Updates maintenance.md for verbage changes * refactor: Refactors structure of navigation commit 79831f6 Author: JeremyRudman <[email protected]> Date: Sat Jul 25 12:47:35 2020 -0400 feat(messages): Adds a confirmation modal to send messages (#272) * feat(message): added a confirmation modal to send messages added a modal for when you send a message that displays the number of people you are sending it to in large red text. * fix: houndci formatting errors * fix(messages): fixed error and made changes to text made "send message" singular and made only the the number red. I also fixed the variable not loading properly * fix: houndci styling changes * feat: made email modal text black instead of red the email confirmation modal displays the number in black instead of red * refactor: Adds number delimiter to recipients, changes cancel outline Co-authored-by: Chris Baudouin, Jr <[email protected]> commit e4169a7 Author: JeremyRudman <[email protected]> Date: Thu Jul 9 00:39:23 2020 -0400 fix(questionnaire): School autocomplete matches form field width (#278) * fix(questionnaire): school autocomplete matchs fourm field width * fix(questionnaires): added ellipsis to autocomplete when the forum field is smaller the school name the autocomplete goes beyond the width the field and this causes the text to ellipsis in thet case
1 parent 900a0a8 commit 5c3dff5

File tree

21 files changed

+128
-73
lines changed

21 files changed

+128
-73
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ gem 'bootsnap', '>= 1.1.0', require: false
3939

4040
# Authentication
4141
gem 'devise', '~> 4.7'
42-
gem 'omniauth-mlh', '~> 0.1'
42+
gem 'omniauth-mlh', '~> 0.4.1'
4343
gem 'doorkeeper', '~> 5.0'
4444
gem 'devise-doorkeeper'
4545
gem 'omniauth-rails_csrf_protection'

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ GEM
233233
minitest (>= 5.0)
234234
ruby-progressbar
235235
msgpack (1.3.3)
236-
multi_json (1.14.1)
236+
multi_json (1.15.0)
237237
multi_xml (0.6.0)
238238
multipart-post (2.1.1)
239239
mustache (1.1.1)
@@ -254,7 +254,7 @@ GEM
254254
omniauth (1.9.1)
255255
hashie (>= 3.4.6)
256256
rack (>= 1.6.2, < 3)
257-
omniauth-mlh (0.3.1)
257+
omniauth-mlh (0.4.1)
258258
activesupport
259259
omniauth (~> 1.0)
260260
omniauth-oauth2 (~> 1.3.1)
@@ -466,7 +466,7 @@ DEPENDENCIES
466466
minitest-reporters
467467
mustache (~> 1.0)
468468
mysql2 (>= 0.4.4, < 0.6.0)
469-
omniauth-mlh (~> 0.1)
469+
omniauth-mlh (~> 0.4.1)
470470
omniauth-rails_csrf_protection
471471
puma (~> 4.3)
472472
rails (~> 5.2.4.3)

app/assets/javascripts/manage/map.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ $.fn.initMap = function() {
6161
})
6262
.append('title')
6363
.text(function(d) {
64-
return d.properties.name + '\nApplications: ' + formatNumber(appsById.get(d.id) || 0);
64+
return d.properties.name + '\nQuestionnaires: ' + formatNumber(appsById.get(d.id) || 0);
6565
});
6666
}
6767

app/assets/stylesheets/forms/_forms.sass

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,17 @@ input[type=submit]
265265
padding: 2px 5px
266266
display: block
267267
cursor: pointer
268-
&:hover, &.ui-state-focus
268+
overflow: hidden
269+
text-overflow: ellipsis
270+
white-space: nowrap
271+
&:hover
269272
@include css4
270273
background: var(--primary)
271274
@include css4
272275
color: var(--white)
276+
// needed for ellipsis in text to work and acts as a min-width
277+
.ui-menu
278+
width: 50px
273279

274280
// form wizard
275281
.wizard-stage

app/controllers/questionnaires_controller.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ def new
3232
q.level_of_study = session["devise.provider_data"]["info"]["level_of_study"]
3333
q.major = session["devise.provider_data"]["info"]["major"]
3434
q.date_of_birth = session["devise.provider_data"]["info"]["date_of_birth"]
35-
q.shirt_size = session["devise.provider_data"]["info"]["shirt_size"]
36-
q.dietary_restrictions = session["devise.provider_data"]["info"]["dietary_restrictions"]
37-
q.special_needs = session["devise.provider_data"]["info"]["special_needs"]
3835
q.gender = session["devise.provider_data"]["info"]["gender"]
3936

4037
school = School.where(name: session["devise.provider_data"]["info"]["school"]["name"]).first_or_create do |s|

app/controllers/users/omniauth_callbacks_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def mlh
44
if @user.persisted?
55
sign_in_and_redirect @user, event: :authentication # this will throw if @user is not activated
66
session["devise.provider_data"] = request.env["omniauth.auth"]
7-
set_flash_message(:notice, :success, kind: "My MLH") if is_navigational_format?
7+
set_flash_message(:notice, :success, kind: "MyMLH") if is_navigational_format?
88
else
99
redirect_to new_user_registration_url
1010
end

app/models/user.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,25 @@ def self.from_omniauth(auth)
6060
matching_provider = where(provider: auth.provider, uid: auth.uid)
6161
matching_email = where(email: auth.info.email)
6262
matching_provider.or(matching_email).first_or_create do |user|
63+
user.uid = auth.uid
6364
user.first_name = auth.first_name
6465
user.last_name = auth.last_name
65-
user.uid = auth.uid
6666
user.email = auth.info.email
67+
user.provider = auth.provider
6768
user.password = Devise.friendly_token[0, 20]
6869
end
70+
# Autofill MyMLH provider if provider info is missing
71+
# (as we are executing this from OAuth)
72+
if current_user.provider.blank?
73+
current_user.provider = auth.provider
74+
end
75+
current_user
6976
end
7077

7178
def self.non_admins
7279
User.where.not(role: :admin).where.not(role: :admin_limited_access)
7380
end
7481

75-
# TODO: No longer needed?
7682
def self.without_questionnaire
7783
non_admins.left_outer_joins(:questionnaire).where(questionnaires: { id: nil })
7884
end

app/views/application/_questionnaire_summary.html.haml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,19 @@
1717
%p
1818
%b Traveling from:
1919
= @questionnaire.travel_not_from_school ? "Somewhere else (#{@questionnaire.travel_location})" : "My school (#{@questionnaire.school.full_name})"
20+
%p
21+
%b Shirt size:
22+
= @questionnaire.shirt_size
23+
%p
24+
%b Dietary restrictions
25+
= @questionnaire.dietary_restrictions || "<i>(none)</i>".html_safe
26+
%p
27+
%b Special needs
28+
= @questionnaire.special_needs || "<i>(none)</i>".html_safe
2029

2130
%fieldset
2231
- if @questionnaire.user.provider == 'mlh'
23-
%legend Provided by My MLH
32+
%legend Provided by MyMLH
2433
%p
2534
%b First name:
2635
= @questionnaire.user.first_name
@@ -48,12 +57,3 @@
4857
%p
4958
%b Level of study:
5059
= @questionnaire.level_of_study
51-
%p
52-
%b Shirt size:
53-
= @questionnaire.shirt_size
54-
%p
55-
%b Dietary restrictions
56-
= @questionnaire.dietary_restrictions || "<i>(none)</i>".html_safe
57-
%p
58-
%b Special needs
59-
= @questionnaire.special_needs || "<i>(none)</i>".html_safe

app/views/manage/dashboard/map_data.tsv.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ redo_limit = 10
2323
addressMatches = result["addressMatches"]
2424
next if addressMatches.blank?
2525

26-
lat = result["addressMatches"][0]["coordinates"]["x"]
27-
lng = result["addressMatches"][0]["coordinates"]["y"]
26+
lng = result["addressMatches"][0]["coordinates"]["x"]
27+
lat = result["addressMatches"][0]["coordinates"]["y"]
2828
next if lat.blank? || lng.blank?
2929

3030
resp = HTTParty.get("https://geo.fcc.gov/api/census/area?lat=#{lat}&lon=#{lng}&format=json")

app/views/manage/messages/show.html.haml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
:ruby
22
begin
3-
recipient_count = pluralize(BulkMessageJob.build_recipients(@message.recipients).count, "recipient")
3+
recipient_count = pluralize(BulkMessageJob.build_recipients(@message.recipients).count, "Recipient")
4+
number_of_recipients = BulkMessageJob.build_recipients(@message.recipients).count
5+
recipient_plural = "Recipient"
6+
if number_of_recipients > 1
7+
recipient_plural = "Recipients"
8+
end
9+
410
rescue => recipient_error
511
end
612

@@ -10,9 +16,25 @@
1016
- if recipient_error.present?
1117
%button.btn.btn-sm.btn-outline-secondary{disabled: 'disabled', title: 'Cannot deliver when there is a recipient error; see error above.'} Deliver
1218
- else
13-
= link_to deliver_manage_message_path(@message), method: :patch, data: { confirm: "Are you sure? The message \"#{@message.name}\" will be sent to #{recipient_count}." }, class: 'btn btn-sm btn-primary' do
19+
%button.btn.btn-sm.btn-primary{"data-toggle"=>"modal", "data-target"=>"#confirm-messages"}
1420
%span.fa.fa-send.icon-space-r-half
15-
Send
21+
%span Send
22+
.modal{:id => "confirm-messages"}
23+
.modal-dialog{:role => "document"}
24+
.modal-content
25+
.modal-header
26+
%h5{:class => "modal-title"} Confirm
27+
.modal-body
28+
%p Are you sure? The message "#{@message.name}" will be sent to:
29+
%h3.center
30+
%span.font-weight-bold
31+
= number_with_delimiter(number_of_recipients)
32+
%span
33+
= recipient_plural
34+
.modal-footer
35+
%button.btn.btn-outline-secondary{'data-dismiss'=>"modal"} Close
36+
= link_to deliver_manage_message_path(@message), method: :patch, class: 'btn btn-danger' do
37+
%span Send Message
1638
- if @message.can_edit?
1739
= link_to 'Edit', edit_manage_message_path(@message), class: 'btn btn-sm btn-outline-secondary'
1840
= link_to 'Delete', manage_message_path(@message), method: :delete, data: { confirm: "Are you sure? The message \"#{@message.name}\" will be permanently erased. This action is irreversible." }, class: 'btn btn-sm btn-outline-secondary'

0 commit comments

Comments
 (0)