view_page.rhtml 4.17 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"></div>

<script type="text/javascript">
  <%= remote_function :update => "article-toolbar", :url => @page.url.merge({ :toolbar => true, :only_path => true }) %>
</script>

<% if @page.display_hits? || @page.license.present? %>
  <div id='article-sub-header'>
    <% if @page.display_hits? %>
      <div id="article-hits">
        <%= n_('Viewed one time', 'Viewed %{num} times', @page.hits) % { :num => @page.hits } %>
      </div>
    <% end %>

    <% if @page.license.present? %>
      <div id="article-license">
        <%= _('Licensed under %s') % (@page.license.url.present? ? link_to(@page.license.name, @page.license.url, :target => '_blank') : @page.license.name) %>
      </div>
    <% end %>
  </div>
<% end %>

<% 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 => 'tags', :id => t.name ) }.join("\n") %>
  </div>
<% end %>


<%= render :partial => 'shared/disabled_enterprise' %>

<% if NOOSFERO_CONF['addthis_enabled'] %>
<div id="addThis">
<script type="text/javascript">
  addthis_pub = '<%= escape_javascript( NOOSFERO_CONF['addthis_pub'] ) %>';
  addthis_logo = '<%= escape_javascript( NOOSFERO_CONF['addthis_logo'] ) %>';
  addthis_config = {
    services_custom: {
      name: 'Facebook',
      url: '<%= addthis_facebook_url(@page) %>',
      icon: 'http://cache.addthiscdn.com/icons/v1/thumbs/facebook.gif'
    }
  };
  addthis_options = '<%= escape_javascript( NOOSFERO_CONF['addthis_options'] ) %>';
</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()"><%= addthis_image_tag %></a>
</div>
<% 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} : {} %>
    <%= 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>
    <%= @page.categories.map {|item| link_to_category(item, false) }.join(", ") %>
</div>
<% end %>

<div id="article-versions">
  <%= @page.versions.map {|v| link_to("r#{v.version}", @page.url.merge(:rev => v.version))} %>
</div>

<%= display_source_info(@page) %>

<div class="comments" id="comments_list">

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

  <% if @page.accept_comments? && @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();") %>
  <% end %>

  <ul class="article-comments-list">
    <%= render :partial => 'comment/comment', :collection => @comments %>
    <%= pagination_links @comments, :param_name => 'comment_page' %>
  </ul>

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

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