Skip to content

Commit

Permalink
Merge pull request #880 from openstax/2020.07.30_is_user_verif_stale
Browse files Browse the repository at this point in the history
Create CS Verification Form and expand user api in order to give all faculty users a way to get faculty access
  • Loading branch information
BryanHouston authored Aug 18, 2020
2 parents f16ee33 + 3b9d9de commit 71d74db
Show file tree
Hide file tree
Showing 50 changed files with 1,587 additions and 592 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ gem 'will_paginate'
gem 'chronic'

# Salesforce
gem 'openstax_salesforce', github: 'openstax/openstax_salesforce', ref: 'e2147f1a3c1f638833e8315246e1de9c68f8d5da'
gem 'openstax_salesforce', github: 'openstax/openstax_salesforce', ref: '58ee73640cbd33c1a8d00277566a2d30074d3657'

# Allows 'ap' alternative to 'pp', used in a mailer
gem 'awesome_print'
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ GIT

GIT
remote: https://github.com/openstax/openstax_salesforce.git
revision: e2147f1a3c1f638833e8315246e1de9c68f8d5da
ref: e2147f1a3c1f638833e8315246e1de9c68f8d5da
revision: 58ee73640cbd33c1a8d00277566a2d30074d3657
ref: 58ee73640cbd33c1a8d00277566a2d30074d3657
specs:
openstax_salesforce (4.5.1)
openstax_salesforce (4.7.0)
openstax_active_force
rails (>= 5.0, < 7.0)
restforce
Expand Down Expand Up @@ -172,7 +172,7 @@ GEM
compass (~> 1.0.0)
sass-rails (< 5.1)
sprockets (< 4.0)
concurrent-ruby (1.1.6)
concurrent-ruby (1.1.7)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.6)
Expand Down Expand Up @@ -317,7 +317,7 @@ GEM
activesupport (>= 4.2)
aes_key_wrap
bindata
jwt (2.2.1)
jwt (2.2.2)
keyword_search (1.5.0)
kgio (2.10.0)
knockoutjs-rails (3.5.0)
Expand Down Expand Up @@ -535,7 +535,7 @@ GEM
responders (2.4.1)
actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0)
restforce (5.0.0)
restforce (5.0.1)
faraday (>= 0.9.0, <= 2.0)
faraday_middleware (>= 0.8.8, <= 2.0)
hashie (>= 1.2.0, < 5.0)
Expand Down Expand Up @@ -668,7 +668,7 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.2)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whenever (0.9.7)
Expand Down
84 changes: 55 additions & 29 deletions app/assets/javascripts/newflow/educator_complete_dynamic.js.coffee
Original file line number Diff line number Diff line change
@@ -1,52 +1,64 @@
class NewflowUi.EducatorComplete

constructor: ->
_.bindAll(@, 'onSchoolNameChange', 'onRoleChange', 'onHowUsingChange', 'onHowChosenChange', 'onTotalNumChange', 'onOtherChange', 'onBooksUsedChange', 'onBooksOfInterestChange', 'onSubmit')
_.bindAll(@, 'onSchoolNameChange', 'onRoleChange', 'onOtherChange', 'onHowUsingChange', 'onHowChosenChange', 'onTotalNumChange', 'onBooksUsedChange', 'onBooksOfInterestChange', 'onSubmit')
@initBooksUsedMultiSelect()
@initBooksOfInterestMultiSelect()
@form = $('.signup-page.completed-step')

# fields locators
@school_name = @findOrLogNotFound(@form, '.school-name-visible')

@completed_role = @findOrLogNotFound(@form, '.completed-role')
@other_specify = @findOrLogNotFound(@form, '.other-specify')

@how_chosen = @findOrLogNotFound(@form, '.how-chosen')
@how_using = @findOrLogNotFound(@form, '.how-using')
@total_num_students = @findOrLogNotFound(@form, '.total-num-students')

@books_used = @findOrLogNotFound(@form, '.books-used')
@books_of_interest = @findOrLogNotFound(@form, '.books-of-interest')
@school_name = @findOrLogNotFound(@form, '.school-name-visible')
@completed_role = @findOrLogNotFound(@form, '.completed-role')

# input fields locators
@school_name_input = @findOrLogNotFound(@school_name, 'input')

@completed_role_radio = @findOrLogNotFound(@completed_role, "input")
@other_input = @findOrLogNotFound(@other_specify, "input")

@how_chosen_radio = @findOrLogNotFound(@how_chosen, "input")
@how_using_radio = @findOrLogNotFound(@how_using, "input")
@total_num_students_input = @findOrLogNotFound(@total_num_students, "input")
@other_input = @findOrLogNotFound(@other_specify, "input")

# book selections
@books_used_select = @findOrLogNotFound(@books_used, "select")
@books_of_interest_select = @findOrLogNotFound(@books_of_interest, "select")

# error messages locators
@please_select_chosen = @findOrLogNotFound(@form, '.how-chosen .chosen.newflow-mustdo-alert')
@please_fill_out_other = @findOrLogNotFound(@form, '.other.newflow-mustdo-alert')
@please_select_role = @findOrLogNotFound(@form, '.completed-role .role.newflow-mustdo-alert')
@please_fill_out_school = @findOrLogNotFound(@form, '.school-name.newflow-mustdo-alert')
@please_fill_out_total_num = @findOrLogNotFound(@form, '.total-num-students .total-num.newflow-mustdo-alert')

@please_select_role = @findOrLogNotFound(@form, '.completed-role .role.newflow-mustdo-alert')
@please_fill_out_other = @findOrLogNotFound(@form, '.other.newflow-mustdo-alert')

@please_select_chosen = @findOrLogNotFound(@form, '.how-chosen .chosen.newflow-mustdo-alert')
@please_select_using = @findOrLogNotFound(@form, '.how-using .using.newflow-mustdo-alert')
@please_fill_out_total_num = @findOrLogNotFound(@form, '.total-num-students .total-num.newflow-mustdo-alert')

@please_select_books_used = @findOrLogNotFound(@form, '.used.newflow-mustdo-alert')
@please_select_books_of_interest = @findOrLogNotFound(@form, '.books-of-interest.newflow-mustdo-alert')

# event listeners
@school_name_input.on('input', @onSchoolNameChange)
@other_input.on('input', @onOtherChange)

@completed_role_radio.change(@onRoleChange)
@other_input.on('input', @onOtherChange)

@how_chosen_radio.change(@onHowChosenChange)
@how_using_radio.change(@onHowUsingChange)
@total_num_students_input.change(@onTotalNumChange)

@books_used_select.change(@onBooksUsedChange)
@books_of_interest_select.change(@onBooksOfInterestChange)

@findOrLogNotFound(@form, 'form').submit(@onSubmit)

# Continue button
Expand All @@ -62,9 +74,12 @@ class NewflowUi.EducatorComplete
@total_num_students.hide()
@books_used.hide()
@books_of_interest.hide()
@please_select_role.hide()

# Hide all validations messages
@please_fill_out_school.hide()
@please_select_role.hide()
@please_fill_out_total_num.hide()

@please_select_books_used.hide()
@please_select_books_of_interest.hide()

Expand All @@ -85,17 +100,20 @@ class NewflowUi.EducatorComplete

onSubmit: (ev) ->
school_name_valid = @checkSchoolNameValid()

role_valid = @checkRoleValid()
other_valid = @checkOtherValid()

chosen_valid = @checkChosenValid()
books_using_valid = @checkBooksUsingValid()
using_how_valid = @checkUsingHowValid()

total_num_valid = @checkTotalNumValid()
other_valid = @checkOtherValid()
books_used_valid = @checkBooksUsedValid()
books_of_interest_valid = @checkBooksOfInterestValid()

if not (role_valid and
chosen_valid and
books_using_valid and
using_how_valid and
other_valid and
school_name_valid and
total_num_valid and
Expand All @@ -121,16 +139,6 @@ class NewflowUi.EducatorComplete
@please_select_role.show()
false

checkTotalNumValid: () ->
return true if @total_num_students_input.is(":hidden")

if @total_num_students_input.val()
@please_fill_out_total_num.hide()
true
else
@please_fill_out_total_num.show()
false

checkChosenValid: () ->
return true if @how_chosen_radio.is(":hidden")

Expand All @@ -141,7 +149,17 @@ class NewflowUi.EducatorComplete
@please_select_chosen.show()
false

checkBooksUsingValid: () ->
checkTotalNumValid: () ->
return true if @total_num_students_input.is(":hidden")

if @total_num_students_input.val()
@please_fill_out_total_num.hide()
true
else
@please_fill_out_total_num.show()
false

checkUsingHowValid: () ->
return true if @how_using_radio.is(":hidden")

if @how_using_radio.is(":checked")
Expand Down Expand Up @@ -189,26 +207,31 @@ class NewflowUi.EducatorComplete
@please_select_role.hide()

if ( @findOrLogNotFound($(document), '#signup_educator_specific_role_instructor').is(':checked') && @checkSchoolNameValid() )
@how_using.show()
@how_chosen.show()
@total_num_students.show()

@other_specify.hide()
@books_used.hide()
@how_using.show()
@please_select_using.hide()
@how_chosen.show()
@please_select_chosen.hide()
@total_num_students.show()
@please_fill_out_total_num.hide()

@onHowUsingChange()
else if ( @findOrLogNotFound($(document), '#signup_educator_specific_role_administrator').is(':checked') && @checkSchoolNameValid() )
@how_chosen.show()
@how_using.show()

@other_specify.hide()
@books_used.hide()
@total_num_students.hide()
@how_chosen.show()
@please_select_chosen.hide()
@how_using.show()
@please_select_using.hide()

@onHowUsingChange()
else if ( @findOrLogNotFound($(document), '#signup_educator_specific_role_other').is(':checked') )
@other_specify.show()

@books_used.hide()
@books_of_interest.hide()
@how_chosen.hide()
Expand All @@ -228,16 +251,19 @@ class NewflowUi.EducatorComplete

if ( @findOrLogNotFound($(document), '#signup_using_openstax_how_as_primary').is(':checked') )
@books_used.show()

@books_of_interest.hide()
@please_select_books_used.hide()
@please_select_books_of_interest.hide()
else if ( @findOrLogNotFound($(document), '#signup_using_openstax_how_as_recommending').is(':checked') )
@books_of_interest.show()

@books_used.hide()
@please_select_books_used.hide()
@please_select_books_of_interest.hide()
else if ( @findOrLogNotFound($(document), '#signup_using_openstax_how_as_future').is(':checked') )
@books_of_interest.show()

@books_used.hide()
@please_select_books_used.hide()
@please_select_books_of_interest.hide()
Expand Down
Loading

0 comments on commit 71d74db

Please sign in to comment.