pushtype/push_type

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

Summary

Maintainability
Test Coverage
- if @parent
  - if @parent.child_nodes.size == 1
    = link_to ficon(:page_add, "New #{ @parent.child_nodes.first.humanize.downcase }"), push_type_admin.new_node_node_path(kind: @parent.child_nodes.first), class: 'button radius success'
  - elsif @parent.child_nodes.size > 1
    = link_to ficon(:page_add, 'New content'), push_type_admin.new_node_node_path(kind: @parent.child_nodes.first), class: 'button radius success dropdown', data: { dropdown: 'new-node' }
    %ul#new-node.f-dropdown
      - for kind in @parent.child_nodes
        %li= link_to "New #{ kind.humanize.downcase }", push_type_admin.new_node_node_path(kind: kind)

- else
  - if PushType.root_nodes.size == 1
    = link_to ficon(:page_add, "New #{ PushType.root_nodes.first.humanize.downcase }"), push_type_admin.new_node_path(kind: PushType.root_nodes.first), class: 'button radius success'
  - elsif PushType.root_nodes.size > 1
    = link_to ficon(:page_add, 'New content'), push_type_admin.new_node_path(kind: PushType.root_nodes.first), class: 'button radius success dropdown', data: { dropdown: 'new-node' }
    %ul#new-node.f-dropdown
      - for kind in PushType.root_nodes
        %li= link_to "New #{ kind.humanize.downcase }", push_type_admin.new_node_path(kind: kind)