_article_toolbar.html.erb
4.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<div<%= user && " class='logged-in'" %>>
<div id="article-actions">
<%= fullscreen_buttons('#article') %>
<% if @page.allow_edit?(user) && !remove_content_button(:edit, @page) %>
<% content = content_tag('span', label_for_edit_article(@page)) %>
<% url = profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id }) %>
<%= expirable_button @page, :edit, content, url %>
<% end %>
<% if @page != profile.home_page && !@page.has_posts? && @page.allow_delete?(user) && !remove_content_button(:delete, @page)%>
<% content = content_tag( 'span', _('Delete') ) %>
<% url = profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page.id}) %>
<% options = {:method => :post, :confirm => delete_article_message(@page)} %>
<%= expirable_button @page, :delete, content, url, options %>
<% end %>
<% if @page.allow_spread?(user) && !remove_content_button(:spread, @page) %>
<% url = profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page.id }) %>
<%= expirable_button @page, :spread, content_tag( 'span', _('Spread this') ), url, {:class => 'colorbox'} if url %>
<% end %>
<% if !@page.gallery? && (@page.allow_create?(user) || (@page.parent && @page.parent.allow_create?(user))) %>
<% if @page.translatable? && !@page.native_translation.language.blank? && !remove_content_button(:locale, @page) %>
<% content = _('Add translation') %>
<% parent_id = (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)) %>
<% url = profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => parent_id, :type => @page.type, :article => { :translation_of_id => @page.native_translation.id })%>
<%= expirable_button @page, :locale, content, url %>
<% end %>
<%= modal_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) unless remove_content_button(:new, @page) %>
<% content = content_tag('span', label_for_clone_article(@page)) %>
<% url = profile.admin_url.merge({ :controller => 'cms', :action => 'new', :id => @page.id, :clone => true, :type => @page.class }) %>
<%= expirable_button @page, :clone, content, url %>
<% end %>
<% if @page.accept_uploads? && @page.allow_create?(user) %>
<%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) unless remove_content_button(:upload, @page)%>
<% end %>
<% if !@page.allow_create?(user) && profile.organization? && (@page.blog? || @page.parent && @page.parent.blog?) && !remove_content_button(:suggest, @page) %>
<% content = content_tag( 'span', _('Suggest an article') ) %>
<% url = profile.admin_url.merge({ :controller => 'cms', :action => 'suggest_an_article'}) %>
<% options = {:id => 'suggest-article-link'} %>
<%= expirable_button @page, :suggest, content, url, options %>
<% end %>
<% if @page.display_versions? %>
<%= button(:clock, _('All versions'), {:controller => 'content_viewer', :profile => profile.identifier, :action => 'article_versions'}, :id => 'article-versions-link') %>
<% end %>
<% plugins_toolbar_actions_for_article(@page).each do |plugin_button| %>
<%= button plugin_button[:icon], plugin_button[:title], plugin_button[:url], plugin_button[:html_options] %>
<% end %>
<%= report_abuse(profile, :link, @page) %>
</div>
<div id="article-header">
<% if @page.blog? and !@page.image.nil? %>
<div class="blog-cover"><%= image_tag(@page.image.public_filename())%></div>
<% end %>
<%= button_without_text(:feed, _('RSS feed'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %>
<%= @plugins.dispatch(:article_header_extra_contents, @page).collect { |content| instance_exec(&content) }.join("") %>
<%= render :partial => 'article_title', :locals => {:no_link => true} %>
<%= article_translations(@page) %>
</div>
</div>