Commit b40cea44a70c3c9703e548d4362baff1c38e6e63

Authored by Daniela Feitosa
Committed by Antonio Terceiro
1 parent 8383b52e

Thickbox not looping when trying to login while viewing an image

   * thickbox_inline_popup_link has url as parameter
   * thickbox_inline_popup_icon has url as parameter

(ActionItem1372)
app/helpers/boxes_helper.rb
... ... @@ -206,7 +206,7 @@ module BoxesHelper
206 206 end
207 207  
208 208 if block.respond_to?(:help)
209   - buttons << thickbox_inline_popup_icon(:help, _('Help on this block'), "help-on-box-#{block.id}") << content_tag('div', content_tag('h2', _('Help')) + content_tag('div', block.help, :style => 'margin-bottom: 1em;') + thickbox_close_button(_('Close')), :style => 'display: none;', :id => "help-on-box-#{block.id}")
  209 + buttons << thickbox_inline_popup_icon(:help, _('Help on this block'), {}, "help-on-box-#{block.id}") << content_tag('div', content_tag('h2', _('Help')) + content_tag('div', block.help, :style => 'margin-bottom: 1em;') + thickbox_close_button(_('Close')), :style => 'display: none;', :id => "help-on-box-#{block.id}")
210 210 end
211 211  
212 212 content_tag('div', buttons.join("\n") + tag('br', :style => 'clear: left'), :class => 'button-bar')
... ...
app/helpers/thickbox_helper.rb
1 1 module ThickboxHelper
2   - def thickbox_inline_popup_link(title, id, options = {})
3   - link_to(title, "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => 'thickbox'}.merge(options))
  2 + def thickbox_inline_popup_link(title, url, id, options = {})
  3 + link_to(title, url_for(url) + "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => 'thickbox'}.merge(options))
4 4 end
5   - def thickbox_inline_popup_icon(type, title, id, options = {})
6   - icon_button(type, title, "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => "thickbox"}.merge(options))
  5 + def thickbox_inline_popup_icon(type, title, url, id, options = {})
  6 + icon_button(type, title, url_for(url) + "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => "thickbox"}.merge(options))
7 7 end
8 8 def thickbox_close_button(title)
9 9 button_to_function(:close, title, 'tb_remove();')
... ...
app/views/layouts/application-ng.rhtml
... ... @@ -67,7 +67,7 @@
67 67 <% end %>
68 68 <%= link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) %>
69 69 <% else %>
70   - <%= _('%s or %s') % [thickbox_inline_popup_link('<i class="icon-menu-login"></i><strong>' + _('Login') + '</strong>', 'inlineLoginBox', :id => 'link_login', :help => _('Click here to enter your username and password and be recognized by the system.')), link_to('<strong>' + _('Register') + '</strong>', :controller => 'account', :action => 'signup') ] %>
  70 + <%= _('%s or %s') % [thickbox_inline_popup_link('<i class="icon-menu-login"></i><strong>' + _('Login') + '</strong>', login_url, 'inlineLoginBox', :id => 'link_login', :help => _('Click here to enter your username and password and be recognized by the system.')), link_to('<strong>' + _('Register') + '</strong>', :controller => 'account', :action => 'signup') ] %>
71 71 <div id='inlineLoginBox' style='display: none;'>
72 72 <%= render :file => 'account/login' %>
73 73 <center><%= thickbox_close_button _('Close') %></center>
... ...
app/views/shared/user_menu.rhtml
... ... @@ -62,7 +62,7 @@
62 62 <% if theme_option( :menu_login ) == 'full_form' %>
63 63 <%= render :file => 'account/login_block' %>
64 64 <% else %>
65   - <%= thickbox_inline_popup_link('<span class="icon-menu-login"></span>'+ _('Login'), 'inlineLoginBox', :id => 'link_login', :help => _('Click here to enter your username and password and be recognized by the system.')) %>
  65 + <%= thickbox_inline_popup_link('<span class="icon-menu-login"></span>'+ _('Login'), 'inlineLoginBox', login_url, :id => 'link_login', :help => _('Click here to enter your username and password and be recognized by the system.')) %>
66 66 <div id='inlineLoginBox' style='display: none;'>
67 67 <%= render :file => 'account/login' %>
68 68 <center><%= thickbox_close_button _('Close') %></center>
... ...