Browse Source

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
tags/3.4.0
Jean-Philippe Lang 7 years ago
parent
commit
327a6e54da
2 changed files with 14 additions and 9 deletions
  1. 13
    8
      app/helpers/my_helper.rb
  2. 1
    1
      app/views/my/update_page.js.erb

+ 13
- 8
app/helpers/my_helper.rb 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)

+ 1
- 1
app/views/my/update_page.js.erb 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 %>

Loading…
Cancel
Save