Skip to content

Commit 175c0b4

Browse files
authored
Merge pull request #622 from codeRIT/hm-621
refactor: Updates check-in/out flash verbiage
2 parents d2c8ae3 + 74d9365 commit 175c0b4

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

app/controllers/manage/questionnaires_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ def check_in
9191
return
9292
end
9393
check_in_attendee
94-
flash[:notice] = "Checked in #{@questionnaire.user.full_name}."
94+
flash[:notice] = t(:checked_in, scope: 'messages', user_full_name: @questionnaire.user.full_name)
9595
elsif params[:check_in] == "false"
9696
check_out_attendee
97-
flash[:notice] = "#{@questionnaire.user.full_name} no longer checked in."
97+
flash[:notice] = t(:checked_out, scope: 'messages', user_full_name: @questionnaire.user.full_name)
9898
else
99-
flash[:alert] = "No check-in action provided!"
99+
flash[:alert] = t(:missing_check_in, scope: 'messages')
100100
redirect_to show_redirect_path
101101
return
102102
end

config/locales/en.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ en:
124124
homepage_url: Homepage URL
125125
thanks_for_rsvp_message: Thanks For RSVP Message
126126
questionnaires_closed_message: Questionnaires Closed Message
127+
messages:
128+
checked_in: "%{user_full_name} has been checked in."
129+
checked_out: "%{user_full_name} is no longer checked in."
130+
missing_check_in: No check-in action provided!
127131
pages:
128132
manage:
129133
dashboard:

test/controllers/manage/questionnaires_controller_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class Manage::QuestionnairesControllerTest < ActionController::TestCase
363363
patch :check_in, params: { id: @questionnaire, check_in: "true" }, format: :html
364364
assert 1.minute.ago < @questionnaire.reload.checked_in_at
365365
assert_equal @user.id, @questionnaire.reload.checked_in_by_id
366-
assert_match /Checked in/, flash[:notice]
366+
assert_match /has been checked in./, flash[:notice]
367367
assert_response :redirect
368368
assert_redirected_to manage_questionnaires_path
369369
end
@@ -401,7 +401,7 @@ class Manage::QuestionnairesControllerTest < ActionController::TestCase
401401
assert_equal true, @questionnaire.can_share_info
402402
assert_equal "1233333333", @questionnaire.phone
403403
assert_equal "[email protected]", @questionnaire.email
404-
assert_match /Checked in/, flash[:notice]
404+
assert_match /has been checked in./, flash[:notice]
405405
assert_response :redirect
406406
assert_redirected_to manage_questionnaires_path
407407
end

0 commit comments

Comments
 (0)