1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-26 10:21:14 +00:00

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
This commit is contained in:
Jean-Philippe Lang 2017-03-13 19:57:49 +00:00
parent 1946c71b3b
commit 327a6e54da
2 changed files with 14 additions and 9 deletions

View 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)

View 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 %>