_article_toolbar.rhtml
3.46 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
<div<%= user && " class='logged-in'" %>>
<div id="article-actions">
<% if @page.allow_edit?(user) && !remove_content_button(:edit) %>
<% 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)%>
<% content = content_tag( 'span', _('Delete') ) %>
<% url = profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page}) %>
<% options = {:method => :post, :confirm => delete_article_message(@page)} %>
<%= expirable_button @page, :delete, content, url, options %>
<% end %>
<% if !@page.folder? && @page.allow_spread?(user) && !remove_content_button(:spread) %>
<% content = content_tag( 'span', _('Spread this') ) %>
<% url = nil %>
<% if profile.kind_of?(Person) %>
<% url = profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page }) %>
<% elsif profile.kind_of?(Community) && environment.portal_community %>
<% url = profile.admin_url.merge({ :controller => 'cms', :action => 'publish_on_portal_community', :id => @page }) %>
<% end %>
<%= expirable_button @page, :spread, content, url if url %>
<% end %>
<% if !@page.gallery? && @page.allow_create?(user) %>
<% if @page.translatable? && !@page.native_translation.language.blank? && !remove_content_button(:locale) %>
<% 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 %>
<%= colorbox_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) %>
<% 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)%>
<% end %>
<% if !@page.allow_create?(user) && profile.community? && (@page.blog? || @page.parent && @page.parent.blog?) && !remove_content_button(:suggest) %>
<% 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 %>
<%= 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 %>
<%= link_to(image_tag('icons-mime/rss-feed.png'), @page.feed.url, :class => 'blog-feed-link') if @page.has_posts? && @page.feed %>
<%= article_title(@page, :no_link => true) %>
<%= article_translations(@page) %>
</div>
</div>