view.rhtml 2.33 KB
<% if @article %>
  <h2 id='article-full-path'>
    <%= icon('cms') %>
    <%= link_to profile.identifier, :action => 'index' %>
    <%= @article.hierarchy.map {|item| " / " + ((item == @article) ? item.name : link_to(item.name, :id => item.id)) } %>
  </h2>
<% else %>
  <h2>
    <%= icon('cms') %>
    <%= _('Content management') %>
  </h2>

  <% button_bar(:style => 'margin-bottom: 1em;') do %>
    <%= button('new', _('New article'), :action => 'new') %>
  <% end %>

<% end %>

<%# subitem %>
<% if !@subitems.empty? && @article %>
  <%= toggle_panel(_('Hide subitems'), _('Show subitems'), 'article-subitems') %>
<% end %>
  
<div id='article-subitems'>
  <div class='file-manager-title'><%= @article ? _('Subitems') : _('Articles') %></div>
  <div class='file-manager-small'>
    <% unless @subitems.empty? %>
      <ul>
        <% @subitems.each do |item| %>
          <li>
          <%= file_manager_button(item.name, "icons-mime/#{item.icon_name}", :action => 'view', :id => item.id) %>
          </li>
        <% end %>
      </ul>
    <% end %>

    <% if @article %>
      <% button_bar(:class => 'file-manager-controls') do %>
        <%= button('new',  _('New subitem'), :action => 'new', :parent_id => @article.id) %>
        <%= button('up', _('Go up one level'), :action => (@article.parent ? 'view' : 'index'), :id => @article.parent) %>
      <% end %>
    <% end %>
  </div>
</div> <!-- article-children -->

<%# display the article content %>
<div id='article-contents' style='clear: left;'>
  <% if @article %>
    <h2><%= @article.name %></h2>
    <% button_bar(:id => 'article-controls') do %>

      <ul>
        <li>
        <%= _('"%{article}", last changed by %{author}') % { :article => @article.name, :author => (@article.last_changed_by ? @article.last_changed_by.name : _('Unknown User')) } %>
        </li>
        <li>
        <%= _('Public address of this article: %s') % (@article.public_path) %>
        </li>
      </ul>

      <%= button('edit', _('Edit'), { :action => 'edit', :id => @article}) %>
      <%= button('home', _('Use as homepage'), { :action => 'set_home_page', :id => @article }, { :method => :post  }) %>
      <%= button('delete', _('Delete'), { :action => 'destroy', :id => @article }, :method => :post, :confirm => _('Are you sure you wan to remove this article?')) %>
    <% end %>
    <%= @article.to_html %>
  <% end %>
</div>