app/views/category/_categories.html.haml
%div#categories
%ul#sortable1
- @categories.each do |category|
%table.table.table-striped.table-bordered{ :id => "category_#{category.id}" }
%thead.bg-info
%tr
%th= link_to "#{category.name}", edit_category_path(category.id)
- if category.hidden?
%th
= button_to show_category_path(category.id), method: :get, class: 'btn btn-info btn-xs hidden-xs' do
%span.glyphicon.glyphicon-eye-open
Show #{category.name}
= button_to show_category_path(category.id), method: :get, class: 'btn btn-info visible-xs' do
%span.glyphicon.glyphicon-eye-open
- elsif category.documents.length != 0
%th
= button_to hide_category_path(category.id), method: :get, class: 'btn btn-warning btn-xs hidden-xs', data: { confirm: "There are documents in this category, are you sure you want to hide it?"} do
%span.glyphicon.glyphicon-eye-close
Hide #{category.name}
= button_to hide_category_path(category.id), method: :get, class: 'btn btn-warning visible-xs', data: { confirm: "There are documents in this category, are you sure you want to hide it?"} do
%span.glyphicon.glyphicon-eye-close
- else
%th
= button_to hide_category_path(category.id), method: :get, class: 'btn btn-warning btn-xs hidden-xs' do
%span.glyphicon.glyphicon-eye-close
Hide #{category.name}
= button_to hide_category_path(category.id), method: :get, class: 'btn btn-warning visible-xs' do
%span.glyphicon.glyphicon-eye-close
%th
= button_to delete_category_path(category.id), :method => :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger btn-xs hidden-xs' do
%span.glyphicon.glyphicon-remove
Delete #{category.name}
= button_to delete_category_path(category.id), :method => :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger visible-xs' do
%span.glyphicon.glyphicon-remove
%tbody
%tr
%td{colspan: 3}
%table.table.table-striped.table-bordered
%thead.bg-info
%tr
%th= check_box_tag 'check_all_docs', "#{category.id}", false, :id => "check_all"
%th= link_to "File name", category_index_path(:doc_order => {:category => category.id, :order => 'title'})
%th= link_to "Updated at", category_index_path(:doc_order => {:category => category.id, :order => 'updated_at'})
%th Read Status
= render :partial => "documents/documents", :locals => { :category => category, :curr_user => curr_user, :page => "categories" }