= page_header - res_collection = instance_variable_get("@#{collection}") - if res_collection.any? %table.list-v2{list_table_options} %colgroup %col.list-v2__col - column_names.each do |column| %col.list-v2__col %col.list-v2__col._del %col.list-v2__col %thead %tr %th.list-v2__head - column_names.each_with_index do |column, index| %th.list-v2__head{ class: 'list-v2__head_first' }= model_name.human_attribute_name(column) unless ['position', 'visible'].include? column %th.list-v2__head._del %th.list-v2__head - res_collection.each do |item| %tr{sort_table_options(item), 'data-href' => url_for([:edit, :admin, item])} %td.list-v2__cell - column_names.each do |column| - case column - when 'position' %td.list-v2__cell._handle{ class: 'list-v2__cell_first' } - when 'visible' %td.list-v2__cell._eye{ class: 'list-v2__cell_first' } = link_to '', send("admin_#{record}_path", item, record => { visible: !item.visible} ), class: ['list-v2__eye', ('_disactive' if !item.visible)], data: { method: 'put' } - else %td.list-v2__cell{ class: 'list-v2__cell_first' }= link_to item.send(column), url_for([:edit, :admin, item]) %td.list-v2__cell= link_to '', [:admin, item], method: :delete, data: { confirm: 'Точно Удалить?' }, class: 'list-v2__del' %td.list-v2__cell = paginate res_collection, theme: 'redde' - else %h3 Ни одной #{tplural(model_name)} не найдено -# unless @<%= controller_name %>.empty? %table.list<%= ".sortable{ 'data-sortable' => true }" if column_names.include?('position') %> %colgroup <%- columns.each do |column| -%> %col<%= '.w1' if ['position', 'visible'].include? column.name %> <%- end -%> %col.w1 %thead %tr <%- columns.each do |column| -%> %th<%- unless ['position', 'visible'].include? column.name %>= <%= model_name.demodulize %>.human_attribute_name('<%= column.name %>')<% end %> <%- end -%> %th - @<%= plural_resource_name %>.each do |<%= resource_name %>| <%- if column_names.include?('position') -%> %tr{ id: "pos_#{<%= resource_name %>.id}" } <%- else -%> %tr <%- end -%> <%- columns.each do |column| -%> <%- if column.name == 'position' -%> %td.handle= image_tag 'admin/move_handler.png' <%- elsif column.name == 'visible' -%> %td.show= link_to '', admin_<%= singular_controller_routing_path %>_path(<%= resource_name %>, <%= resource_name %>: { visible: !<%= resource_name %>.visible} ), class: <%= resource_name %>.visible ? nil : 'not-show', data: { method: 'put' } <%- else -%> %td= link_to <%= resource_name %>.<%= column.name %>, [:edit, :admin, <%= resource_name %>] <%- end -%> <%- end -%> %td= link_to 'Удалить', [:admin, <%= resource_name %>], method: :delete, data: { confirm: 'Точно Удалить?' }, class: :del