view_page.html.erb 3.72 KB
<%
  if @page.parent && @page.parent.has_posts? && @page.parent.feed
    add_rss_feed_to_head(@page.parent.name, @page.parent.feed.url)
  end
%>

<div id="article" class="<%= @page.css_class_name %>">

<%= render :partial => 'confirm_unfollow' %>

<script type="text/javascript">
    window.ONE_COMMENT = "<%= _('One comment') %>";
    window.COMMENT_PLURAL = "<%= _('comments') %>";
    window.NO_COMMENT_YET = "<%= _('No comments yet') %>";
</script>

<% if @page.parent && !@page.parent.path.blank? %>
  <div id="article-parent">
    <%= button(:back, _('Go back to %s') % @page.parent.short_title, @page.parent.url) %>
  </div>
<% end %>

<div id="article-toolbar">
  <%= render :partial => 'article_toolbar' %>
</div>

<% if NOOSFERO_CONF['addthis_enabled'] and @page.public? %>
  <%= render :partial => 'addthis' %>
<% end %>

<% cache(@page.cache_key(params, user, language)) do %>
  <div class="<%="article-body article-body-" + @page.css_class_name %>">
    <% options = @page.image? ? {:gallery_view => true} : {} %>
    <% if @page.image.present? && !@page.event? && !@page.blog? %>
      <div class="article-body-img">
        <%= image_tag(@page.image.public_filename) %>
        <p><%= @page.image.label%></p>
      </div>
    <% end %>
    <%= article_to_html(@page, options) %>
    <br style="clear:both" />
  </div> <!-- end class="article-body" -->
<% end %>

<% if ! @page.categories.empty? %>
<div id="article-cat">
  <h4><%= _('Categories') %></h4>
    <%= safe_join(@page.categories.map {|item| link_to_category(item, false) }, ", ") %>
</div>
<% end %>

<% if !@page.tags.empty? %>
  <div id="article-tags">
    <%= _("This article's tags:").html_safe %>
    <%= safe_join(@page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tags', :id => t.name ) }, "\n") %>
  </div>
<% end %>

<%= display_source_info(@page) %>

<%= safe_join(@plugins.dispatch(:article_extra_contents, @page).collect { |content| instance_exec(&content) }, "") %>

<% if @page.accept_comments? || @comments_count > 0 %>
  <div class="comments" id="comments_list">
    <h3 <%= 'class="no-comments-yet"'.html_safe if @comments_count == 0 %>>
      <%= display_number_of_comments(@comments_count) %>
    </h3>

    <% if @comments.present? && @comments.count > 1 %>
      <%= link_to(_('Post a comment'), '#', :class => 'display-comment-form', :id => 'top-post-comment-button', :onclick => "jQuery('#page-comment-form .display-comment-form').first().click();") if @page.accept_comments? %>

      <%= hidden_field_tag("page_url", url_for(:controller=>'content_viewer', :action=>'view_page', :profile=>profile.identifier, :page => @page.explode_path)) %>
      <%= javascript_include_tag "comment_order.js" %>
      <div class="comment-order">
        <%= form_tag({:controller=>'content_viewer' , :action=>'view_page'}, {:method=>'get', :id=>"form_order"}) do %>
          <%= select_tag 'comment_order', options_for_select({_('Oldest first')=>'oldest', _('Newest first')=>'newest'}, @comment_order) %>
        <% end %>
      </div>
    <% end %>

    <ul class="article-comments-list">
      <% if @comments.present? %>
        <%= render :partial => 'comment/comment', :collection => @comments %>
        <%= pagination_links @comments, :param_name => 'comment_page', :params => { :comment_order => @comment_order } %>
      <% end %>
    </ul>

    <% if !@page.archived? && @page.accept_comments? %>
      <div id='page-comment-form' class='page-comment-form'><%= render :partial => 'comment/comment_form', :locals =>{:url => {:controller => :comment, :action => :create}, :display_link => true, :cancel_triggers_hide => true}%></div>
    <% end %>
  </div><!-- end class="comments" -->
<% end %>

</div><!-- end id="article" -->
<%= add_zoom_to_article_images %>