support_email = Rails.configuration.support_email_address
additional_info = {}
- additional_info['Current Location'] = @popup_params[:current_location]
+ additional_info['Current location'] = @popup_params[:current_location]
+ additional_info['User UUID'] = current_user.uuid if current_user
additional_info['User email'] = current_user.email if current_user
additional_info_str = additional_info.map {|k,v| "#{k}=#{v}"}.join("\n")
<div class="modal-dialog modal-with-loading-spinner">
<div class="modal-content">
- <%= form_tag report_issue_path, {id: 'report-issue-form', name: 'report-issue-form', method: 'post',
+ <%= form_tag report_issue_path, {name: 'report-issue-form', method: 'post',
class: 'form-horizontal', remote: true} do %>
<%
<div class="modal-footer">
<% if @popup_params[:popup_type] == 'report' %>
- <button type="submit" id="register" class="btn btn-primary" autofocus>Report issue</button>
- <button class="btn btn-default" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">Cancel</button>
+ <button type="submit" id="report-issue-submit" class="btn btn-primary report-issue-submit" autofocus>Report issue</button>
+ <button class="btn btn-default report-issue-cancel" id="report-issue-cancel" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">Cancel</button>
<% else %>
<button class="btn btn-default" onClick="reset_form()" data-dismiss="modal" aria-hidden="true">Close</button>
<% end %>
$('#report_issue_text').val("");
$('#additional_info').val("");
}
+
+// ajax handling for report-issue function
+$(document).
+ on('ajax:send', function() {
+ var sendButton = document.getElementById('report-issue-submit');
+ if (sendButton) {
+ var text = document.getElementById('report-issue-submit').firstChild;
+ text.data = "Sending...";
+ sendButton.disabled = true;
+ }
+ var cancelButton = document.getElementById('report-issue-cancel');
+ if (cancelButton) {
+ var text = document.getElementById('report-issue-cancel').firstChild;
+ text.data = "Close";
+ }
+ $('div').remove('.modal-footer-status');
+ }).
+ on('ajax:success', function() {
+ var sendButton = document.getElementById('report-issue-submit');
+ if (sendButton && sendButton.disabled) {
+ var text = document.getElementById('report-issue-submit').firstChild;
+ text.data = "Report sent";
+ $('div').remove('.modal-footer-status');
+ $('.modal-footer').append('<div class="modal-footer-status pull-left"><div><p>Thanks for reporting this issue!</p></div></div>');
+ }
+ }).
+ on('ajax:failure', function() {
+ var sendButton = document.getElementById('report-issue-submit');
+ if (sendButton && sendButton.disabled) {
+ $('div').remove('.modal-footer-status');
+ $('.modal-footer').append('<div class="modal-footer-status pull-left"></br><p>We are sorry. We could not submit your report! We really want this to work, though -- please try again.</p></div>');
+ var text = document.getElementById('report-issue-submit').firstChild;
+ text.data = "Report issue";
+ sendButton.disabled = false;
+ }
+ var cancelButton = document.getElementById('report-issue-cancel');
+ if (cancelButton) {
+ var text = document.getElementById('report-issue-cancel').firstChild;
+ text.data = "Cancel";
+ }
+ });