cortex-cms/cortex

View on GitHub
app/views/cortex/partials/_flash.html.haml

Summary

Maintainability
Test Coverage
- flash.each do |key, value|
  - unless value == 'You need to sign in or sign up before continuing.'
    - if flash['warning']
      .mdl-snackbar.snackbar__error.mdl-snackbar--active.flash--warning{ 'aria-atomic' => 'true', 'aria-live' => 'assertive', 'aria-relevant' => 'text' }
        %i.mdl-snackbar__close.material-icons close
        .mdl-snackbar__text
          %p.flash--header__text
            Oops! Please review the following fields for errors:
          %ul
          - value.each do |err|
            %li
              %i.material-icons error_outline
              = err
        %button.mdl-snackbar__action{ type: 'button' }
    - elsif flash['success']
      .mdl-snackbar.mdl-js-snackbar.snackbar__message.mdl-snackbar--active.flash--success{ 'aria-atomic' => 'true', 'aria-live' => 'assertive', 'aria-relevant' => 'text' }
        .mdl-snackbar__text
          %i.material-icons check
          = value
        %button.mdl-snackbar__action{ type: 'button' }
    - else
      .mdl-snackbar.mdl-js-snackbar.mdl-snackbar--active{ 'aria-atomic' => 'true', 'aria-live' => 'assertive', 'aria-relevant' => 'text' }
        .mdl-snackbar__text
          = value
        %button.mdl-snackbar__action{ type: 'button' }