Defect #7265

"Loading..." icon does not disappear after add project member

Added by Go MAEDA almost 7 years ago. Updated over 6 years ago.

Status:ClosedStart date:2011-01-10
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Project settings
Target version:1.1.1
Resolution:Fixed Affected version:1.1.0

Description

"Loading..." icon does not disappear after I have finished to add project member.

  • Firefox 3.6.13 (Mac)
  • Safari 5.0.3 (Mac)

loading-icon-does-not-disappear.png (27.1 KB) Go MAEDA, 2011-01-10 15:08

Associated revisions

Revision 4719
Added by Jean-Philippe Lang almost 7 years ago

Fixed: "Loading..." icon does not disappear after adding a project member when there is no other member to add (#7265).

History

#1 Updated by Jean-Philippe Lang almost 7 years ago

Can not reproduce with Firefox 3.6.13 or Chrome 8 under Windows.
Do you have javascript error or something that could help?

#2 Updated by Etienne Massip almost 7 years ago

Got same with FF 4b9.

Here the content of HTTP response to POST request http://localhost:3000/projects/test1/members/new :

Element.update("tab-content-members", "\n\n\n\u003Cdiv class=\"splitcontentleft\"\u003E\n\n\u003Ctable class=\"list members\"\u003E\n\t\u003Cthead\u003E\u003Ctr\u003E\n\t  \u003Cth\u003EUser / Group\u003C/th\u003E\n\t  \u003Cth\u003ERoles\u003C/th\u003E\n\t  \u003Cth style=\"width:15%\"\u003E\u003C/th\u003E\n          \n\t\u003C/tr\u003E\u003C/thead\u003E\n\t\u003Ctbody\u003E\n\t\n\t\n\t\u003Ctr id=\"member-2\" class=\"odd member\"\u003E\n\t\u003Ctd class=\"user\"\u003E\u003Ca href=\"/users/1\"\u003ERedmine Admin\u003C/a\u003E\u003C/td\u003E\n  \u003Ctd class=\"roles\"\u003E\n    \u003Cspan id=\"member-2-roles\"\u003EManager\u003C/span\u003E\n    \n      \u003Cform action=\"/members/edit/2\" class=\"hol\" id=\"member-2-roles-form\" method=\"post\" onsubmit=\"new Ajax.Request('/members/edit/2', {asynchronous:true, evalScripts:true, method:'post', parameters:Form.serialize(this)}); return false;\"\u003E\u003Cdiv style=\"margin:0;padding:0;display:inline\"\u003E\u003Cinput name=\"authenticity_token\" type=\"hidden\" value=\"/RN8aP8OZobvnfvvXdAIWOAOJXhNrQnQpCBnZiH48L0=\" /\u003E\u003C/div\u003E\n      \t\u003Cp\u003E\n        \u003Clabel\u003E\u003Cinput checked=\"checked\" id=\"member_role_ids_\" name=\"member[role_ids][]\" type=\"checkbox\" value=\"3\" /\u003E Manager\u003C/label\u003E\u003Cbr /\u003E\n        \n        \u003Clabel\u003E\u003Cinput id=\"member_role_ids_\" name=\"member[role_ids][]\" type=\"checkbox\" value=\"4\" /\u003E Developer\u003C/label\u003E\u003Cbr /\u003E\n        \n        \u003Clabel\u003E\u003Cinput id=\"member_role_ids_\" name=\"member[role_ids][]\" type=\"checkbox\" value=\"5\" /\u003E Reporter\u003C/label\u003E\u003Cbr /\u003E\n        \u003C/p\u003E\n        \u003Cinput id=\"member_role_ids_\" name=\"member[role_ids][]\" type=\"hidden\" value=\"\" /\u003E\n        \u003Cp\u003E\u003Cinput class=\"small\" name=\"commit\" type=\"submit\" value=\"Change\" /\u003E\n        \u003Ca href=\"#\" onclick=\"$('member-2-roles').show(); $('member-2-roles-form').hide(); return false;; return false;\"\u003ECancel\u003C/a\u003E\u003C/p\u003E\n      \u003C/form\u003E\n    \n  \u003C/td\u003E\n  \u003Ctd class=\"buttons\"\u003E\n      \u003Ca class=\"icon icon-edit\" href=\"#\" onclick=\"$('member-2-roles').hide(); $('member-2-roles-form').show(); return false;; return false;\"\u003EEdit\u003C/a\u003E\n      \u003Ca class=\"icon icon-del\" href=\"#\" onclick=\"new Ajax.Request('/members/destroy/2', {asynchronous:true, evalScripts:true, method:'post', parameters:'authenticity_token=' + encodeURIComponent('/RN8aP8OZobvnfvvXdAIWOAOJXhNrQnQpCBnZiH48L0=')}); return false;\" title=\"Delete\"\u003EDelete\u003C/a\u003E\n  \u003C/td\u003E\n  \n\t\u003C/tr\u003E\n\n\t\u003C/tbody\u003E\n\u003C/table\u003E\n\n\u003C/div\u003E\n\n\n\n\n\u003Cdiv class=\"splitcontentright\"\u003E\n\n\u003C/div\u003E\n");
hideOnLoad()
new Effect.Highlight("member-2",{});

May be a missing semi-colon after hideOnLoad() call ?

Note : I tried to paste response within a "code class="javascript" block" but previewing or submitting the message then cause a HTTP 500 error.

#3 Updated by Etienne Massip almost 7 years ago

And no javascript error or warning in Firebug console.

#4 Updated by Etienne Massip almost 7 years ago

Etienne Massip wrote:

Got same with FF 4b9.

Here the content of HTTP response to POST request http://localhost:3000/projects/test1/members/new :

[...]

May be a missing semi-colon after hideOnLoad() call ?

Note : I tried to paste response within a "code class="javascript" block" but previewing or submitting the message then cause a HTTP 500 error.

Also note that trying to use syntax highlighting on this piece of javascript code may bring your server down ; I just killed http://coderay.rubychan.de and my own Redmine server this way.

Luckily, redmine.org is still up.

About this issue, this is not a browser bug as it can also be reproduced with IE8. Ajax' OnComplete() is never called.

#5 Updated by Kornelius Kalnbach almost 7 years ago

I'll try to fix this CodeRay bug ASAP.

#6 Updated by Kornelius Kalnbach almost 7 years ago

Found the bug. Will be fixed in 0.9.7. Thank you so much for reporting that, Etienne!

#7 Updated by Kornelius Kalnbach almost 7 years ago

Preliminary fixed version is in the 0.9 stable branch.

#8 Updated by Etienne Massip almost 7 years ago

Created a separate issue here : #7329

#9 Updated by Etienne Massip almost 7 years ago

This bug is due to r4371 which overrides default Ajax.OnComplete()

#10 Updated by Etienne Massip almost 7 years ago

Only possible patch, alas :

Index: app/views/projects/settings/_members.rhtml
===================================================================
--- app/views/projects/settings/_members.rhtml    (revision 4686)
+++ app/views/projects/settings/_members.rhtml    (working copy)
@@ -57,7 +57,8 @@
 <% if roles.any? && principals.any? %>
   <% remote_form_for(:member, @member, :url => {:controller => 'members', :action => 'new', :id => @project}, :method => :post,
                                        :loading => "$('member-add-submit').disable()",
-                                       :complete => "$('member-add-submit').enable()") do |f| %>
+                                       :failure => "$('member-add-submit').enable()",
+                                       :success => "$('member-add-submit').enable()") do |f| %>
     <fieldset><legend><%=l(:label_member_new)%></legend>

         <p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p>

Can't find a way to have both "local" and "global" OnComplete() triggered.

#11 Updated by Jean-Philippe Lang almost 7 years ago

Looking at the prototype code, responders do not override those that were previously defined. They should be all called.
The :complete option is used in many places and I don't to make this change unless the problem is clearly found. For example, do you have the same problem when doing a wiki preview?

#12 Updated by Etienne Massip almost 7 years ago

Jean-Philippe Lang wrote:

Looking at the prototype code, responders do not override those that were previously defined. They should be all called.
The :complete option is used in many places and I don't to make this change unless the problem is clearly found. For example, do you have the same problem when doing a wiki preview?

I think every other time the :complete option is used is outside of an ajax context.

I've found some posts related to this local override effect, but I didn't look at the code.

#13 Updated by Jean-Philippe Lang almost 7 years ago

Etienne Massip wrote:

I think every other time the :complete option is used is outside of an ajax context.

No, the :complete option applies to ajax calls. It's used in link_to_remote most of the time.

#14 Updated by Etienne Massip almost 7 years ago

Jean-Philippe Lang wrote:

Looking at the prototype code, responders do not override those that were previously defined. They should be all called.
The :complete option is used in many places and I don't to make this change unless the problem is clearly found. For example, do you have the same problem when doing a wiki preview?

You're right, it should work as wiki preview is working, I will investigate further later.

#15 Updated by Etienne Massip almost 7 years ago

Ok, that was stupid, bug is in fact that the "Add" member button does not exist if there is no member to add anymore :

Index: _members.rhtml
--- _members.rhtml Base (BASE)
+++ _members.rhtml Locally Modified (Based On LOCAL)
@@ -56,8 +56,8 @@
 <div class="splitcontentright">
 <% if roles.any? && principals.any? %>
   <% remote_form_for(:member, @member, :url => {:controller => 'members', :action => 'new', :id => @project}, :method => :post,
-                                       :loading => "$('member-add-submit').disable()",
-                                       :complete => "$('member-add-submit').enable()") do |f| %>
+                                       :loading => '$(\'member-add-submit\').disable();',
+                                       :complete => 'if($(\'member-add-submit\')) $(\'member-add-submit\').enable();') do |f| %>
     <fieldset><legend><%=l(:label_member_new)%></legend>

         <p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p>

#16 Updated by Jean-Philippe Lang almost 7 years ago

  • Status changed from New to Resolved
  • Target version set to 1.1.1
  • Resolution set to Fixed

Thanks for providing the fix, it's committed in r4719.

#17 Updated by Jean-Philippe Lang almost 7 years ago

  • Status changed from Resolved to Closed

Merged in 1.1-stable in r4762.

#18 Updated by Etienne Massip over 6 years ago

  • Category set to Project settings

Also available in: Atom PDF