<% sidebar = ConcertoPlugin.render_view_hook self, :content_sidebar, locals: { content: @content } %>

<%
   # Hide details sidebar when there is nothing to show
   content_span = 9
   sidebar_span = 3
   if sidebar.blank?
     content_span = 12
     sidebar_span = 0
   end
%>

<div class="row-fluid">
  <div class="span<%= content_span %>">

    <section class="viewblock">
      <header class="viewblock-header">
        <div class="viewblock-header_right">
          <div class="button-padding">
            <% if can?(:update, @content) && @content.parent_id.blank? %>
              <%= link_to t(:edit_model, model: Content.model_name.human), edit_content_path(@content), class: "btn" %>
            <% end %>
            <% if can? :delete, @content %>
              <%= link_to t(:destroy_model, model: Content.model_name.human), @content, data: { confirm: t(:are_you_sure_delete_model_key, model: Content.model_name.human, key: @content.name) }, method: :delete, class: "btn" %>
            <% end %>
          </div>
        </div>

        <div class="default-padding">
          <h1>
            <%= link_to possessive(@content.user.name.strip) + " " + Content.model_name.human(count: 42), @content.user %> &gt;
            <%= @content.name %>
          </h1>
        </div>
      </header>
      <div class="viewblock-cont">

        <div class="row-fluid">
          <div class="span2 content-details">
            <div class="default-padding">
              <%= render partial: "show_details", locals: { content: @content, user: @user } %>

              <%= render partial: 'dynamic_content_tools', locals: { content: @content } if @content.is_a?(DynamicContent) && can?(:edit, @content) %>
            </div>
          </div>

          <div class="span10">
            <div class="default-padding">
              <%= render_content(@content) %>
            </div>
          </div>

        </div>
      </div>
    </section>
  </div>
  <% if !sidebar.blank? %>
    <div class="span<%= sidebar_span %>">
        <%= sidebar %>
    </div>
  <% end %>
</div>
