##// END OF EJS Templates
AJAX call on the issue form resets data entered during the call (#14621)....
Jean-Philippe Lang -
r11936:2c97f9ecde0d
parent child
Show More
@@ -1,4 +1,4
1 $('#all_attributes').html('<%= escape_javascript(render :partial => 'form') %>');
1 replaceIssueFormWith('<%= escape_javascript(render :partial => 'form') %>');
2
2
3 <% if User.current.allowed_to?(:log_time, @issue.project) %>
3 <% if User.current.allowed_to?(:log_time, @issue.project) %>
4 $('#log_time').show();
4 $('#log_time').show();
@@ -444,8 +444,10 function randomKey(size) {
444 return key;
444 return key;
445 }
445 }
446
446
447 // Can't use Rails' remote select because we need the form data
448 function updateIssueFrom(url) {
447 function updateIssueFrom(url) {
448 $('#all_attributes input, #all_attributes textarea, #all_attributes select').each(function(){
449 $(this).data('valuebeforeupdate', $(this).val());
450 });
449 $.ajax({
451 $.ajax({
450 url: url,
452 url: url,
451 type: 'post',
453 type: 'post',
@@ -453,6 +455,21 function updateIssueFrom(url) {
453 });
455 });
454 }
456 }
455
457
458 function replaceIssueFormWith(html){
459 var replacement = $(html);
460 $('#all_attributes input, #all_attributes textarea, #all_attributes select').each(function(){
461 var object_id = $(this).attr('id');
462 if (object_id && $(this).data('valuebeforeupdate')!=$(this).val()) {
463 replacement.find('#'+object_id).val($(this).val());
464 }
465 });
466 $('#all_attributes').empty();
467 $('#all_attributes').prepend(replacement);
468 if (focus) {
469 $('#'+focus).focus();
470 }
471 }
472
456 function updateBulkEditFrom(url) {
473 function updateBulkEditFrom(url) {
457 $.ajax({
474 $.ajax({
458 url: url,
475 url: url,
General Comments 0
You need to be logged in to leave comments. Login now