[ARVADOS] updated: 7808f351a96eebb8726e3a3a4fa36fc662b06251
git at public.curoverse.com
git at public.curoverse.com
Fri Aug 15 13:24:17 EDT 2014
Summary of changes:
.../views/application/_report_issue_popup.html.erb | 9 ++---
.../app/views/application/report_issue.js.erb | 3 +-
.../views/application/report_issue_popup.js.erb | 41 ++++++++++++++++++++++
3 files changed, 47 insertions(+), 6 deletions(-)
via 7808f351a96eebb8726e3a3a4fa36fc662b06251 (commit)
from a968b13628bbd34f5c217ffe3cfaab7615aa4eb5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 7808f351a96eebb8726e3a3a4fa36fc662b06251
Author: radhika <radhika at curoverse.com>
Date: Fri Aug 15 13:22:18 2014 -0400
3112: add ajax event handling
diff --git a/apps/workbench/app/views/application/_report_issue_popup.html.erb b/apps/workbench/app/views/application/_report_issue_popup.html.erb
index 31c76d0..2600593 100644
--- a/apps/workbench/app/views/application/_report_issue_popup.html.erb
+++ b/apps/workbench/app/views/application/_report_issue_popup.html.erb
@@ -7,7 +7,8 @@
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")
@@ -25,7 +26,7 @@
<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 %>
<%
@@ -97,8 +98,8 @@
<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 %>
diff --git a/apps/workbench/app/views/application/report_issue.js.erb b/apps/workbench/app/views/application/report_issue.js.erb
index 6247a3c..26113a9 100644
--- a/apps/workbench/app/views/application/report_issue.js.erb
+++ b/apps/workbench/app/views/application/report_issue.js.erb
@@ -1,2 +1 @@
-$("#report-issue-modal-window").modal("hide");
-document.location.reload();
+// Let ajax events handle hiding of the popup.
diff --git a/apps/workbench/app/views/application/report_issue_popup.js.erb b/apps/workbench/app/views/application/report_issue_popup.js.erb
index 59aedbc..48b66dc 100644
--- a/apps/workbench/app/views/application/report_issue_popup.js.erb
+++ b/apps/workbench/app/views/application/report_issue_popup.js.erb
@@ -5,3 +5,44 @@ function reset_form() {
$('#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";
+ }
+ });
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list