]> source.dussan.org Git - redmine.git/commitdiff
Fix that move/delete links disappear after updating block settings.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 13 Mar 2017 19:57:49 +0000 (19:57 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 13 Mar 2017 19:57:49 +0000 (19:57 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@16393 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/my_helper.rb
app/views/my/update_page.js.erb

index fe29dfafa763e5be463f260d84d120048a01c17b..3c0313f9082f863f59feb786b9543eaacccffa77 100644 (file)
@@ -24,19 +24,24 @@ module MyHelper
 
     if blocks.present?
       blocks.each do |block|
-        content = render_block_content(block, user)
-        if content.present?
-          handle = content_tag('span', '', :class => 'sort-handle')
-          close = link_to(l(:button_delete), {:action => "remove_block", :block => block}, :method => 'post', :class => "icon-only icon-close")
-          content = content_tag('div', handle + close, :class => 'contextual') + content
-
-          s << content_tag('div', content, :class => "mypage-box", :id => "block-#{block}")
-        end
+        s << render_block(block, user).to_s
       end
     end
     s
   end
 
+  # Renders a single block
+  def render_block(block, user)
+    content = render_block_content(block, user)
+    if content.present?
+      handle = content_tag('span', '', :class => 'sort-handle')
+      close = link_to(l(:button_delete), {:action => "remove_block", :block => block}, :method => 'post', :class => "icon-only icon-close")
+      content = content_tag('div', handle + close, :class => 'contextual') + content
+
+      content_tag('div', content, :class => "mypage-box", :id => "block-#{block}")
+    end
+  end
+
   # Renders a single block content
   def render_block_content(block, user)
     unless Redmine::MyPage.blocks.key?(block)
index 5329f77af0402d8c97700361e5476dac07c6eb3c..d51ab81051e5f78e0a2faa7067e6afaa84b9f16d 100644 (file)
@@ -1,3 +1,3 @@
 <% @updated_blocks.each do |block| %>
-  $("#block-<%= block %>").html("<%= escape_javascript render_block_content(block.to_s, @user) %>");
+  $("#block-<%= block %>").replaceWith("<%= escape_javascript render_block(block.to_s, @user) %>");
 <% end %>