denkGroot/Spina

View on GitHub
app/views/spina/admin/users/_form.html.haml

Summary

Maintainability
Test Coverage
= form_for [spina, :admin, @user] do |f|
  %header#header
    = render partial: 'spina/admin/shared/breadcrumbs'

    #header_actions
      %button.button.button-primary{type: 'submit'}
        = icon('check')
        =t('spina.users.save')

      = link_to t('spina.cancel'), spina.admin_users_path, class: 'button'

  - if @user.errors.any?
    - content_for :notification_alert do
      .notification.notification-error{data: {icon: 'm'}}
        %p 
          = Spina::User.human_attribute_name :cannot_be_created
          %small
            - @user.errors.full_messages.each do |msg|
              = msg
              %br/

  .well
    .horizontal-form
      .horizontal-form-group
        .horizontal-form-label
          = Spina::User.human_attribute_name :name
        .horizontal-form-content
          = f.text_field :name, placeholder: Spina::User.human_attribute_name(:name_placeholder), class: 'large'

      .horizontal-form-group
        .horizontal-form-label
          = Spina::User.human_attribute_name :email
          %small= Spina::User.human_attribute_name :email_description
        .horizontal-form-content
          = f.text_field :email, placeholder: Spina::User.human_attribute_name(:email)

      .horizontal-form-group
        .horizontal-form-label
          = Spina::User.human_attribute_name :password
          %small= Spina::User.human_attribute_name :password_description
        .horizontal-form-content
          = f.password_field :password, placeholder: Spina::User.human_attribute_name(:password)

      .horizontal-form-group
        .horizontal-form-label
          = Spina::User.human_attribute_name :password_confirmation
        .horizontal-form-content
          = f.password_field :password_confirmation, placeholder: Spina::User.human_attribute_name(:password_confirmation)

      .horizontal-form-group
        .horizontal-form-label
          #{Spina::User.human_attribute_name :admin}?
          %small= Spina::User.human_attribute_name :admin_description
        .horizontal-form-content
          = f.check_box :admin, data: {switch: 'true'}

  - unless @user.new_record? || @user == current_spina_user
    .pull-right= link_to t('spina.permanently_delete'), spina.admin_user_path(@user), method: :delete, data: {confirm: t('spina.users.delete_confirmation', user: @user)}, class: 'button button-link button-danger'