pushtype/push_type

View on GitHub
admin/app/views/push_type/admin/nodes/index.html.haml

Summary

Maintainability
Test Coverage
- title 'Content'

- if @parent
  - for node in @parent.self_and_ancestors.reverse
    - breadcrumbs.add node.title, push_type_admin.node_nodes_path(node)

.large-8.columns
  %section.container
    .head
      - if @parent
        .left.btn= link_to ficon(:previous), @parent.root? ? push_type_admin.nodes_path : push_type_admin.node_nodes_path(@parent.parent)
        .title= @parent.title
      - else
        .title Content
        
    .body
      - if @nodes.empty?
        .empty-default
          %h2 No content
          - if !@parent
            %p A website without any content makes for a pretty poor user experience. Better sort this one out now and create your first piece of content.
          - else
            %p There is no content in this section yet.
      - else
        %ul.node-list{ class: ('sortable' if sortable?(@parent)) }
          - for node in @nodes.all
            %li.node-list-item{ class: ('descendable' if node.descendable?), data: { id: node.id } }
              = link_to push_type_admin.edit_node_path(node) do
                .title= node.title
                .meta
                  %span.label.secondary.radius= node.type.to_s.underscore.humanize
                  - unless node.exposed?
                    %span.label.warning.radius Unexposed
                  %span.label.radius{ class: node.published? ? 'success' : 'warning' }= node.status.titlecase
                  - if node.published?
                    %time Published #{ l node.published_at.to_date, format: :short }
                    \-
                  %time Updated #{ time_ago_in_words node.updated_at } ago
              - if node.descendable?
                .descendants
                  = link_to push_type_admin.node_nodes_path(node) do
                    .icon= ficon(:folder)
                    .meta= pluralize node.children.not_trash.count, 'child'
              - if sortable? @parent
                .handle

.large-4.columns
  .side-panel{ :'side-panel' => true }
    .padded
      .pagination-centered
        .pagination-stats
          = pluralize @nodes.total_count, 'item'
          - unless @nodes.total_count == 0
            \- Page #{ @nodes.current_page } of #{ @nodes.total_pages }
        = paginate @nodes
    .cta.text-center
      = render 'new_node_button'
      - if @nodes.current_page == 1
        .text-button
          = link_to ficon(:trash, 'Trash bin'), push_type_admin.trash_nodes_path