af83/chouette-core

View on GitHub
app/views/layouts/navigation/_page_header.html.slim

Summary

Maintainability
Test Coverage
- action_links = resource.action_links(params[:action]) rescue nil
- action_links ||= decorated_collection.action_links(params[:action]) rescue nil
- action_links = nil if response.status != 200
.page_header
  .container-fluid
    .row
      .col-lg-8.col-md-8.col-sm-12.col-xs-12
        - if defined?(resource_class)
          .page-icon class="page-icon-#{resource_class.model_name.name.underscore}"
            span.sb class="sb-#{resource_class.model_name.name.underscore}"
        .page-title
          - if content_for? :page_header_title
            - if content_for? :page_header_resource_name
              h3 = yield :page_header_resource_name
            h1 = yield :page_header_title
          - else
            - if defined?(resource_class)
              h1 = resource_class.t_action(params[:action])

      .col-lg-4.col-md-4.col-sm-12.col-xs-12.text-right
        .page-action
          - if content_for? :page_header_meta
            = yield :page_header_meta
          - if content_for? :page_header_actions
            = yield :page_header_actions
          - if action_links&.primary&.any?
            - action_links.primary.each do |link|
              = link.to_html do |l|
                - l.class "btn btn-default #{l.disabled ? "disabled" : ""}"

    - if action_links&.secondary&.any?
      .row.mb-sm
        .col-lg-12.text-right
          - action_links.secondary.each do |link|
            = link.to_html do |l|
              - l.class "btn btn-primary #{l.disabled ? "disabled" : ""}"
    - if content_for? :page_header_content
      = yield :page_header_content