Convert user feedback mechanism to use modal dialog

instead of navigating to new page.  this is how it should have been done
to begin with...
This commit is contained in:
Lance Edgar 2017-10-13 08:01:43 -07:00
parent 827cc592b4
commit 8d002f76d2
5 changed files with 143 additions and 6 deletions

View file

@ -1,6 +1,7 @@
## -*- coding: utf-8; -*-
<%namespace file="/menu.mako" import="main_menu_items" />
<%namespace file="/grids/nav.mako" import="grid_index_nav" />
<%namespace file="/feedback_dialog.mako" import="feedback_dialog" />
<!DOCTYPE html>
<html lang="en">
<head>
@ -53,7 +54,7 @@
% endif
<div class="feedback">
${h.link_to("Feedback", url('feedback'), class_='button')}
<button type="button" id="feedback">Feedback</button>
</div>
</div><!-- global -->
@ -105,6 +106,7 @@
</div><!-- body-wrapper -->
${feedback_dialog()}
</body>
</html>
@ -139,6 +141,7 @@
var noop_url = '${request.route_url('noop')}';
</script>
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.js') + '?ver={}'.format(tailbone.__version__))}
${h.javascript_link(request.static_url('tailbone:static/js/tailbone.feedback.js'))}
</%def>
<%def name="extra_javascript()"></%def>

View file

@ -0,0 +1,39 @@
## -*- coding: utf-8; -*-
<%def name="feedback_dialog()">
<div id="feedback-dialog">
${h.form(url('feedback'))}
${h.csrf_token(request)}
${h.hidden('user', value=request.user.uuid if request.user else None)}
<p>
Questions, suggestions, comments, complaints, etc. <span class="red">regarding this website</span>
are welcome and may be submitted below.
</p>
<div class="field-wrapper referrer">
<label for="referrer">Referring URL</label>
<div class="field"></div>
</div>
% if request.user:
${h.hidden('user_name', value=six.text_type(request.user))}
% else:
<div class="field-wrapper">
<label for="user_name">Your Name</label>
<div class="field">
${h.text('user_name')}
</div>
</div>
% endif
<div class="field-wrapper">
<label for="referrer">Message</label>
<div class="field">
${h.textarea('message', cols=45, rows=15)}
</div>
</div>
${h.end_form()}
</div>
</%def>