##// END OF EJS Templates
notifications: fixing alerts when gist has been edited
lisaq -
r837:7fa43a0b default
parent child Browse files
Show More
@@ -24,12 +24,6 b''
24 </div>
24 </div>
25
25
26 <div class="table">
26 <div class="table">
27 <div id="edit_error" class="flash_msg" style="display:none;">
28 <div class="alert alert-warning">
29 ${h.literal(_('Gist was updated since you started editing. Copy your changes and click %(here)s to reload the new version.')
30 % {'here': h.link_to('here',h.url('edit_gist', gist_id=c.gist.gist_access_id))})}
31 </div>
32 </div>
33
27
34 <div id="files_data">
28 <div id="files_data">
35 ${h.secure_form(h.url('edit_gist', gist_id=c.gist.gist_access_id), method='post', id='eform')}
29 ${h.secure_form(h.url('edit_gist', gist_id=c.gist.gist_access_id), method='post', id='eform')}
@@ -115,7 +109,6 b''
115 <script>
109 <script>
116 $('#update').on('click', function(e){
110 $('#update').on('click', function(e){
117 e.preventDefault();
111 e.preventDefault();
118
119 // check for newer version.
112 // check for newer version.
120 $.ajax({
113 $.ajax({
121 url: "${h.url('edit_gist_check_revision', gist_id=c.gist.gist_access_id)}",
114 url: "${h.url('edit_gist_check_revision', gist_id=c.gist.gist_access_id)}",
@@ -126,8 +119,11 b''
126 type: 'GET',
119 type: 'GET',
127 success: function(data) {
120 success: function(data) {
128 if(data.success === false){
121 if(data.success === false){
129 $('#edit_error').show();
122 message = '${h.literal(_('Gist was updated since you started editing. Copy your changes and click %(here)s to reload the new version.')
130 window.scrollTo(0,0);
123 % {'here': h.link_to('here',h.url('edit_gist', gist_id=c.gist.gist_access_id))})}'
124 alertMessage = [{"message": {
125 "message": message, "force": "true", "level": "warning"}}];
126 $.Topic('/notifications').publish(alertMessage[0]);
131 }
127 }
132 else{
128 else{
133 $('#eform').submit();
129 $('#eform').submit();
General Comments 0
You need to be logged in to leave comments. Login now