Sha256: 87a9b4c1dea2d4dd77733a20c56c32d9e3dfe55f36c0927b4ca135a999d58314

Contents?: true

Size: 1.98 KB

Versions: 2

Compression:

Stored size: 1.98 KB

Contents

class @AntsAdminUsers
  constructor: (title='Administrators', apiPath='/admin') ->
    config =
      title: title
      showWithParent: true

      arrayStore: new RailsArrayStore({
        resource: 'admin_user'
        path: "#{ apiPath }/admin_users"
        sortBy: 'name'
        searchable:  true
      })

      formSchema:
        details_panel:
          type: 'group'
          groupClass: 'group-panel'
          title: 'Profile'
          inputs:
            name:
              type: 'string'
              required: true
              label: "Name"
              placeholder: 'Full name'
              onInitialize: (input) ->
                if input.object
                  input.$el.removeClass 'input-required'
                  input.config.disabled = true
                  input._add_disabled()

            email:
              type: 'string'
              required: true
              placeholder: 'Email'

              onInitialize: (input) ->
                if input.object
                  input.$el.removeClass 'input-required'
                  input.config.disabled = true
                  input._add_disabled()

                  input.$actions   =$ "<span class='input-actions'></span>"
                  input.$avatarBtn =$ "<a href='https://en.gravatar.com/' target='_blank'>Update avatar</a>"
                  input.$label.append input.$actions
                  input.$actions.append input.$avatarBtn

        password_panel:
          type: 'group'
          groupClass: 'group-panel'
          title: 'Password'
          inputs:
            password:
              type: 'password'
              required: true
              placeholder: 'Password'
              onInitialize: (input) ->
                if input.object
                  input.$el.removeClass 'input-required'
                  input.$label.html 'Change password'
                  input.config.placeholder = 'Enter new password here, then hit "Save"'
                  input._add_placeholder()

    return config

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ants-0.3.5 app/assets/javascripts/ants/admin_users.coffee
ants-0.3.4 app/assets/javascripts/ants/admin_users.coffee