view_page.rhtml
4.55 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<div id="article">
<%
# AddThis Button
if block_given? and File.exists?( RAILS_ROOT + '/config/web2.0.yml')
opts = YAML.load_file( RAILS_ROOT + '/config/web2.0.yml' )
if opts['addthis']
opts = opts['addthis']
%>
<div id="addThis">
<script type="text/javascript">
addthis_brand = '<%= escape_javascript( @environment.name ) %>';
<%=
str = ''
opts.each { |k, v|
str += ' addthis_'+ k +' = "'+ escape_javascript( v ) +"\";\n"
}
str
%></script>
<a href="http://www.addthis.com/bookmark.php" id="bt_addThis" target="_blank" onmouseover="return addthis_open(this, '', '[URL]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="/images/bt-bookmark.gif" width="53" height="16" border="0" alt="" /></a><script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script>
</div>
<% end; end %>
<div>
<%= article_title(@page, :no_link => true) %>
<% if @page.allow_post_content?(user) %>
<div id="article-actions">
<% unless @page.blog? %>
<%= link_to content_tag( 'span', label_for_edit_article(@page) ),
profile.admin_url.merge({ :controller => 'cms', :action => 'edit', :id => @page.id }),
:class => 'button with-text icon-edit' %>
<% end %>
<% if !(profile.kind_of?(Enterprise) && environment.enabled?('disable_cms')) %>
<% if @page != profile.home_page && !@page.blog? %>
<%= link_to content_tag( 'span', _('Delete') ),
profile.admin_url.merge({ :controller => 'cms', :action => 'destroy', :id => @page }),
:class => 'button with-text icon-delete' %>
<% end %>
<% if profile.kind_of?(Person) && !environment.enabled?('disable_cms') && !@page.folder? %>
<%= link_to content_tag( 'span', _('Spread this') ),
profile.admin_url.merge({ :controller => 'cms', :action => 'publish', :id => @page }),
:class => 'button with-text icon-spread' %>
<% end %>
<% if !@page.display_as_gallery? %>
<%= lightbox_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)))) %>
<% end %>
<% if (@page.folder? && !@page.blog?) || (@page.parent && @page.parent.folder? && !@page.parent.blog?) %>
<%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) %>
<% end %>
<% end %>
<% if profile.kind_of?(Enterprise) && @page.display_as_gallery? %>
<%= button('upload-file', _('Upload files'), :controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent)) %>
<% end %>
</div>
<% end %>
</div>
<% if !@page.tags.empty? %>
<div id="article-tags">
<%= _("This article's tags:") %>
<%= @page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tag', :id => t.name ) }.join("\n") %>
</div>
<% end %>
<% if @page.display_hits? %>
<div id="article-hits">
<%= n_('Viewed one time', 'Viewed %{num} times', @page.hits) % { :num => @page.hits } %>
</div>
<% end %>
<% if @page.parent && !@page.parent.path.blank? %>
<div id="article-parent">
<%= link_to _('Go back'), @page.parent.url %>
</div>
<% end %>
<% if profile.enterprise? and !profile.enabled? and !profile.blocks.select {|b| b.class == DisabledEnterpriseMessageBlock}.any? %>
<div id='profile-disabled'>
<%= environment.message_for_disabled_enterprise %>
</div>
<% end %>
<% cache(@page.cache_key(params, user)) do %>
<div class="<%="article-body article-body-" + @page.css_class_name %>">
<%= article_to_html(@page) %>
<br style="clear:both" />
</div> <!-- end class="article-body" -->
<% end %>
<% if ! @page.categories.empty? %>
<div id="article-cat">
<h4><%= _('Categories') %></h4>
<%= @page.categories.map {|item| link_to_category(item, false) }.join(", ") %>
</div>
<% end %>
<% if ! @page.source.nil? and ! @page.source.empty?%>
<div id="article-source">
<%= _('Source: %s') % link_to(@page.source, @page.source) %>
</div>
<% end %>
<div class="comments">
<a name="comments_list"></a>
<% if @page.accept_comments? %>
<h3 <%= 'class="no-comments-yet"' if @comments.size == 0 %>>
<%= number_of_comments(@page) %>
</h3>
<%= render :partial => 'comment', :collection => @comments %>
<%= render :partial => 'comment_form' %>
<% end %>
</div><!-- end class="comments" -->
</div><!-- end id="article" -->