view.rhtml 2.4 KB
<h1>
  <%= icon('cms') %>
  <%= _('Content management') %>
</h1>

<% if @article %>
  <h1 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)) } %>
  </h1>
<% end %>

<% button_bar(:style => 'margin-bottom: 1em;') do %>
  <% parent_id = ((@article && @article.allow_children?) ? @article : nil) %>
  <%= button :add, _('New folder'), :action => 'new', :type => 'Folder', :parent_id => parent_id %>
  <%= lightbox_button('new', _('New article'), :action => 'new', :parent_id => parent_id) %>
<% end %>

<table class='cms-articles'>

  <%# header %>
  <tr>
    <th><%= _('Name') %></th>
    <th><%= _('Type') %></th>
    <th><%= _('Actions') %></th>
  </tr>

  <%# folders %>
  <% for folder in @folders %>
    <tr>
      <td>
        <%= image_tag(icon_for_article(folder)) %>
        <%= link_to folder.name, :action => 'view', :id => folder.id %>
      </td>
      <td>
        <%= folder.class.short_description %>
      </td>
      <td>
        <%= link_to _('Properties'), :action => 'edit', :id => folder.id %>
        <%= link_to _('Public view'), folder.url %>
        <%= link_to _('Delete'), { :action => 'destroy', :id => folder.id }, :method => :post, :confirm => _('Are you sure that you want to remove this folder? Note that all the items inside it will also be removed!') %>
      </td>
    </tr>
  <% end %>

  <%# non-folder subitems %>
  <% unless @folders.empty? %>
    <tr>
      <td colspan='3'>
        &nbsp;
      </td>
    </tr>
  <% end %>
  <% for item in @subitems %>
    <tr>
      <td>
        <%= image_tag(icon_for_article(item)) %>
        <%= link_to item.name, :action => 'edit', :id => item.id %>
      </td>
      <td>
        <%= item.class.short_description %>
      </td>
      <td>
        <%= link_to _('Edit'), :action => 'edit', :id => item.id %>
        <%= link_to _('Public view'), item.url %>
        <%= link_to _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %>
        <%= link_to _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %>
      </td>
    </tr>
  <% end %>

  <% if @subitems.empty? || @folders.empty? %>
    <tr><td colspan='3' align='center'><em><%= _('None') %></em></td></tr>
  <% end %>


</table>