appirits/comable

View on GitHub
backend/app/views/comable/admin/users/edit.slim

Summary

Maintainability
Test Coverage
.comable-page
  .comable-main-fixed-top
    .comable-page-heading
      ul.pull-right.list-inline
        li
          = link_to_save

      h1.page-header
        ol.breadcrumb
          li>
            = link_to Comable.t('admin.nav.user'), comable.admin_users_path
          li>
            = link_to @user.human_id, comable.admin_user_path(@user)
          li.active
            = Comable.t('admin.actions.edit')

  .comable-page-body
    section
      = error_messages_for @user

      = form_for @user, url: comable.admin_user_path(@user) do |f|
        .hidden
          = f.submit

        fieldset
          .col-md-3
            legend
              = Comable.t('admin.general')
            .help-block

          .col-md-9
            .form-group
              = f.label :role
              = f.select :role, @user.class.role.options, {}, disabled: (@user == current_comable_user)

            .form-group
              = f.label :email
              = f.text_field :email

            .form-group
              = f.label :password
              = f.password_field :password

        - if @user.bill_address
          fieldset
            .col-md-3
              legend
                = f.object.class.human_attribute_name(:bill_address)
              .help-block

            .col-md-9
              = f.fields_for :bill_address do |ff|
                = render 'comable/admin/shared/address_form', f: ff