- title :show, Cmtool::Directory
- content_for :onload_javascript do
  | $('.add-image-container').dialog({modal: true, autoOpen: false, width: 400})
#add-image-container.reveal-modal data-reveal=true
  .modal-header= t('cmtool.directory.add_file')
  = form_for [cmtool, Cmtool::Image.new(directory_id: @directory.id)], html: { multipart: true, id: 'add_image_form' } do |f|
    .modal-body
      = f.hidden_field :directory_id
      = f.file_field :file
    .modal-footer= f.submit t('cmtool.directory.add_image.label', image: Cmtool::Image.model_name.human), class: 'record-new-button'
  a.close-reveal-modal &#215;
.directory.caption= "/#{@directory.tree_path.map{|d| link_to(d.name, cmtool.directory_path(d))}.join('/')}".html_safe
table#directory-view.table.table-striped.table-hover
  thead
  tbody
    tr
      td.directory.parent= link_to '..', (@directory.parent ? cmtool.directory_path(@directory.parent) : cmtool.directories_path)
      td
      td
      td
    - for child in @directory.children
      tr
        td.directory.child= link_to child.name, cmtool.directory_path(child)
        td
        td
        td.action.destroy.directory= link_to link_to_destroy_content(child), cmtool.directory_path(child), method: :delete, confirm: are_you_sure(child)
    - for image in @directory.images
      = render 'image', image: image
- content_for :page_links do
  ul
    - if @directory.parent
      li= link_to '..', cmtool.directory_path(@directory.parent)
    li= link_to link_to_edit_content(@directory), cmtool.edit_directory_path(@directory), class: 'record-edit-button'
    li= link_to link_to_index_content(Cmtool::Directory), cmtool.directories_path, class: 'to-index-button'
    li= link_to t('cmtool.directory.add_file'), '#', class: 'record-new-button', data:  {'reveal-id' => 'add-image-container'}
