Commit 02f4590433758a24fe61463d86eef7539789cdb7

Authored by Braulio Bhavamitra
2 parents 90378081 edcc1305

Merge branch 'fix-remaining-colorbox-uses' into 'master'

Replaces remaining colorbox in the code with modal

Colorbox was replaced with modal api, but we still had instances in the code of colorbox uses and they were broken so this patch is to fix those.

See merge request !689
app/helpers/application_helper.rb
... ... @@ -1316,7 +1316,12 @@ module ApplicationHelper
1316 1316 options[:class] = (options[:class] || '') + ' disabled'
1317 1317 content_tag('a', ' '+content_tag('span', content), options)
1318 1318 else
1319   - link_to content, url, options
  1319 + if options[:modal]
  1320 + options.delete(:modal)
  1321 + modal_link_to content, url, options
  1322 + else
  1323 + link_to content, url, options
  1324 + end
1320 1325 end
1321 1326 end
1322 1327  
... ...
app/helpers/cms_helper.rb
... ... @@ -30,7 +30,7 @@ module CmsHelper
30 30 end
31 31  
32 32 def display_spread_button(article)
33   - expirable_button article, :spread, _('Spread this'), {:action => 'publish', :id => article.id}, {:class => 'colorbox'}
  33 + expirable_button article, :spread, _('Spread this'), {:action => 'publish', :id => article.id}, {:class => 'colorbox', :modal => true}
34 34 end
35 35  
36 36 def display_delete_button(article)
... ...
app/views/cms/_published_media_items.html.erb
... ... @@ -4,7 +4,7 @@
4 4 <div class='section-title'>
5 5 <h3><%= header %></h3>
6 6 <% if @recent_files[key].total_pages > 1 %>
7   - <%= link_to(_('View all'), {:controller => 'cms', :action => 'view_all_media', :profile => profile.identifier, :key => key}, :class => 'view-all colorbox', 'data-key' => key) %>
  7 + <%= modal_link_to(_('View all'), {:controller => 'cms', :action => 'view_all_media', :profile => profile.identifier, :key => key}, { :class => 'view-all', 'data-key' => key }) %>
8 8 <% end %>
9 9 </div>
10 10 <%= render :partial => "cms/media_panel/list_published_media_items", :locals => { key: key, show_pagination_links: false } %>
... ...
app/views/content_viewer/_article_toolbar.html.erb
... ... @@ -18,7 +18,7 @@
18 18  
19 19 <% if @page.allow_spread?(user) && !remove_content_button(:spread, @page) %>
20 20 <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page.id }) %>
21   - <%= expirable_button @page, :spread, content_tag( 'span', _('Spread this') ), url, {:class => 'colorbox'} if url %>
  21 + <%= expirable_button @page, :spread, content_tag( 'span', _('Spread this') ), url, {:class => 'colorbox', :modal => true} if url %>
22 22 <% end %>
23 23  
24 24 <% if !@page.gallery? && (@page.allow_create?(user) || (@page.parent && @page.parent.allow_create?(user))) %>
... ...