diff --git a/tailbone/static/js/tailbone.mobile.js b/tailbone/static/js/tailbone.mobile.js index 15ac0cd4..432f3170 100644 --- a/tailbone/static/js/tailbone.mobile.js +++ b/tailbone/static/js/tailbone.mobile.js @@ -20,7 +20,7 @@ $(document).on('pagecontainerchange', function(event, ui) { // in some cases (i.e. when no user is logged in) we may want the (external) // header toolbar button to change between pages. here's how we do that. // note however that we do this *always* even when not technically needed - var link = $('[data-role="header"] a'); + var link = $('[data-role="header"] a:first'); var newlink = ui.toPage.find('.replacement-header a'); link.text(newlink.text()); link.attr('href', newlink.attr('href')); @@ -29,6 +29,54 @@ $(document).on('pagecontainerchange', function(event, ui) { }); +$(document).on('click', '#feedback-button', function() { + + // prepare and display 'feedback' popup dialog + var popup = $('.ui-page-active #feedback-popup'); + popup.find('.referrer .field').html(location.href); + popup.find('.referrer input').val(location.href); + popup.find('.user_name input').val(''); + popup.find('.message textarea').val(''); + popup.data('feedback-sent', false); + popup.popup('open'); +}); + + +$(document).on('click', '#feedback-popup .submit', function() { + + // send message when 'feedback' submit button pressed + var popup = $('.ui-page-active #feedback-popup'); + var form = popup.find('form'); + $.post(form.attr('action'), form.serializeArray(), function(data) { + if (data.ok) { + + // mark "feedback sent" flag, for popupafterclose + popup.data('feedback-sent', true); + popup.popup('close'); + } + }); + +}); + + +$(document).on('click', '#feedback-form-buttons .cancel', function() { + + // close 'feedback' popup when user clicks Cancel + var popup = $('.ui-page-active #feedback-popup'); + popup.popup('close'); +}); + + +$(document).on('popupafterclose', '#feedback-popup', function() { + + // thank the user for their feedback, after msg is sent + if ($(this).data('feedback-sent')) { + var popup = $('.ui-page-active #feedback-thanks'); + popup.popup('open'); + } +}); + + $(document).on('pagecreate', function() { // setup any autocomplete fields diff --git a/tailbone/templates/mobile/base.mako b/tailbone/templates/mobile/base.mako index 11ee47ef..c05c2100 100644 --- a/tailbone/templates/mobile/base.mako +++ b/tailbone/templates/mobile/base.mako @@ -52,7 +52,7 @@ ${self.mobile_header()} -
+ Questions, suggestions, comments, complaints, etc. regarding this website + are welcome and may be submitted below. +
+ +