Skip to content

Commit

Permalink
Merge pull request #853 from sparc-request/kg-proper_navigation_bug
Browse files Browse the repository at this point in the history
KG - Navigation Bug (System Satisfaction JS Handler)
  • Loading branch information
jleonardw9 committed Jan 10, 2017
2 parents f624b9e + 3b83ddf commit a793935
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
50 changes: 25 additions & 25 deletions app/assets/javascripts/system_satisfaction.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

$(document).ready ->
survey_offered = false

$(document).on 'click', '.get-a-cost-estimate, .form-submit-button', (event) ->
button = $(this)

if !survey_offered
event.preventDefault()
$('#modal_place').html($('#participate-in-survey-modal').html())
$('#modal_place').modal('show')

$(document).on 'click', '#modal_place .yes-button', ->
survey_offered = true
$('#modal_place').load "/surveys/system-satisfaction-survey", {survey_version: ""}, ->
$('#survey_form').append("<input type='hidden' id='redirect_to' name='redirect_to' value='#{button.attr('href')}'>")
$('#survey_form div.next_section').append("<input type='button' name='cancel' value='Cancel'/>")

$(document).on 'click', '#survey-submit-button', (event) ->
event.preventDefault()
$("textarea:hidden").val("")
$('#survey_form').append("<input type='hidden' id='finish' name='finish' value='Submit'>")
$(this).attr('disabled', true)
$('#survey_form').submit()

$(document).on 'click', '#modal_place .no-button', ->
window.location = button.attr('href')
survey_offered = false

$(document).on 'click', '.get-a-cost-estimate, .form-submit-button', (event) ->
button = $(this)

if !survey_offered
event.preventDefault()
$('#modal_place').html($('#participate-in-survey-modal').html())
$('#modal_place').modal('show')

$(document).on 'click', '#modal_place .yes-button', ->
survey_offered = true
$('#modal_place').load "/surveys/system-satisfaction-survey", {survey_version: ""}, ->
$('#survey_form').append("<input type='hidden' id='redirect_to' name='redirect_to' value='#{button.attr('href')}'>")
$('#survey_form div.next_section').append("<input type='button' name='cancel' value='Cancel'/>")

$(document).on 'click', '#survey-submit-button', (event) ->
event.preventDefault()
$("textarea:hidden").val("")
$('#survey_form').append("<input type='hidden' id='finish' name='finish' value='Submit'>")
$(this).attr('disabled', true)
$('#survey_form').submit()

$(document).on 'click', '#modal_place .no-button', ->
window.location = button.attr('href')
1 change: 0 additions & 1 deletion app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
= render 'shared/modal'

- if SYSTEM_SATISFACTION_SURVEY
= javascript_include_tag 'system_satisfaction'
= stylesheet_link_tag('surveyor/reset',
'surveyor/jquery-ui-1.10.0.custom',
'surveyor/jquery-ui-timepicker-addon',
Expand Down
1 change: 1 addition & 0 deletions app/views/service_requests/review.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
= render 'service_requests/navigation/footer', service_request: @service_request, css_class: @css_class, back: @back, forward: @forward

- if SYSTEM_SATISFACTION_SURVEY
= javascript_include_tag 'system_satisfaction'
= hidden_field_tag :use_system_satisfaction, 'true'
= render 'service_requests/modals/participate_in_survey_modal'

0 comments on commit a793935

Please sign in to comment.