diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-03-13 19:57:49 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-03-13 19:57:49 +0000 |
commit | 327a6e54da602670d33b33b8054a9aa421e2f09d (patch) | |
tree | 337bff6a7bbbe2bcb5b6416aa1a8ed063d7c2648 | |
parent | 1946c71b3b2a571bad7002fee1a10608d4dc1257 (diff) | |
download | redmine-327a6e54da602670d33b33b8054a9aa421e2f09d.tar.gz redmine-327a6e54da602670d33b33b8054a9aa421e2f09d.zip |
Fix that move/delete links disappear after updating block settings.
git-svn-id: http://svn.redmine.org/redmine/trunk@16393 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/helpers/my_helper.rb | 21 | ||||
-rw-r--r-- | app/views/my/update_page.js.erb | 2 |
2 files changed, 14 insertions, 9 deletions
diff --git a/app/helpers/my_helper.rb b/app/helpers/my_helper.rb index fe29dfafa..3c0313f90 100644 --- a/app/helpers/my_helper.rb +++ b/app/helpers/my_helper.rb @@ -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) diff --git a/app/views/my/update_page.js.erb b/app/views/my/update_page.js.erb index 5329f77af..d51ab8105 100644 --- a/app/views/my/update_page.js.erb +++ b/app/views/my/update_page.js.erb @@ -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 %> |