view_page.rhtml 2.07 KB
<div class="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']
%>
<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" class="bt_addthis" target="_blank" onmouseover="return addthis_open(this, '', '[URL]', '<%= escape_javascript( @environment.name()+' :: '+@page.title ) %>')" 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>
<% end; end %>

<h2><%= @page.title %></h2>

<% if logged_in?  && current_user.person.has_permission?('post_content', profile) %>
<div class="article-actions">
  <%= link_to content_tag( 'span', _('Edit') ),
      { :controller => 'cms', :action => 'edit', :id => @page },
      :class => 'button with-text icon-edit' %>
</div>
<% end %>

<div class="article-tags">
<%= @page.tags.map { |t| link_to(t, tag_url(:tag => t.name)) }.join("\n") %>
</div>

<% if @page.parent && !@page.parent.path.blank? %>
<div class="article-parent">
  <%= link_to_document(@page.parent, _('Up')) %>
</div>
<% end %>

<%= @page.to_html %>

<!--
<% unless @page.children.empty? %>
  <hr/>
  <ul>
  <% @page.children.each do |item| %>
    <li><%= link_to_document(item) %></li>
  <% end %>
<% end %>
-->

<div class="article-cat">
  <h3><%= _('Categories') %></h3>
  <%= @page.categories.map {|item| link_to_category(item) }.join(', ') %>
</div>

<h3><%= @comments.size == 0 ? _('No comments yet') : (n_('One comment', '%{comments} comments', @comments.size)) % { :comments => @comments.size} %></h3>
<%= render :partial => 'comment', :collection => @comments %>
<%= render :partial => 'comment_form' %>

</div><!-- end class="article" -->