プロジェクト

全般

プロフィール

Vote #76494

完了

Make the updateIssueFrom(url) function return the XMLHttpRequest object

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Code cleanup/refactoring_30
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
30
version_id:
90
issue_org_id:
20180
author_id:
88801
assigned_to_id:
1
comments:
3
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

The current javascript function @updateIssueFrom(url)@ does not return anything.
If we could just return the XMLHttpRequest object (as it is returned by the @ajax()@ call), it would allow us to chain methods like this:

updateIssueFrom(url).done(function() {
  $( this ).addClass( "done" );
});

Here is the patch:

diff --git a/public/javascripts/application.js b/public/javascripts/application.js
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -471,7 +471,7 @@ function updateIssueFrom(url) {
   $('#all_attributes input, #all_attributes textarea, #all_attributes select').each(function(){
     $(this).data('valuebeforeupdate', $(this).val());
   });
-  $.ajax({
+  return $.ajax({
     url: url,
     type: 'post',
     data: $('#issue-form').serialize()

This simple patch could really help me to simplify my Redmine plugins. Thank you.


journals

Committed in r14372, thanks.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
FTR the object returned by the function is not a XMLHttpRequest but a Promise.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリCode cleanup/refactoring_30 にセット
  • 対象バージョン3.1.0_90 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0