view_page.rhtml 3.09 KB
<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]', '<%= 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>
</div>
<% end; end %>

<div onmouseover="showArticleActions(true)"
     onmouseout="showArticleActions(false)">
  <h1><%= @page.title %></h1>
  <script type="text/javascript">
    function showArticleActions( show ) {
      var act = $("article-actions");
      if ( act ) act.className = ( show ? "show" : "hidden" );
    }
  </script>
  <% if logged_in?  && current_user.person.has_permission?('post_content', profile) %>
    <div id="article-actions" class="hidden">
      <%= link_to content_tag( 'span', _('Edit') ),
          { :controller => 'cms', :action => 'edit', :id => @page },
          :class => 'button with-text icon-edit' %>
      <% if profile.kind_of?(Person) %>
        <%= link_to content_tag( 'span', _('Spread this') ),
            { :controller => 'cms', :action => 'publish', :id => @page },
            :class => 'button with-text icon-spread' %>
      <% end %>
      <%= lightbox_button(:new, _('New publication'), :controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : nil)) %>
    </div>
  <% end %>
</div>

<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>

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

<% if profile.enterprise? and !profile.enabled? %>
  <div id='profile-disabled'>
    <%= environment.message_for_disabled_enterprise %>
  </div>
<% end %>

<%= @page.to_html %>

<br style="clear:both" />

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

    <h3>
        <%= @comments.size == 0 ? _('No comments yet') : (n_('One comment', '%{comments} comments', @comments.size)) % { :comments => @comments.size} %>
    </h3>
    <%= render :partial => 'comment', :collection => @comments %>
<% if !@page.accept_comments? %>
    <h3><%= _('This article does not accept comments')%></h3>
<% else %>
    <%= render :partial => 'comment_form' %>
<% end %>

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