digitalhelpersleague/asterism

View on GitHub
app/views/ivrs/_form.html.slim

Summary

Maintainability
Test Coverage
.ivr-form ng-show='ivr' ng-cloak=true
  h4.section-title ng-if='ivr.id'
    | Edit IVR
  h4.section-title ng-if='!ivr.id' New IVR
  = form_tag ivrs_path, method: :put, class: 'form-horizontal', role: 'form' do
    .form-group
      label.col-sm-4.control-label Name
      .col-sm-8
        input.form-control type='text' autofocus='true' autocomplete="on" ng-model='ivr.context'

    .form-group
      label.col-sm-4.control-label Media
      .col-sm-8
        .medium
          div ng-show='!ivr.id && ivr.medium.length'
            | {{ ivr.medium[0].name }}
            span.size
              | {{ ivr.medium[0].size | humanizeSize }}
          div ng-show='ivr.id && ivr.medium'
            | {{ ivr.medium }}
        span.btn.btn-primary.btn-lg.fileinput-button
          span Browse
          input type="file" ng-fileread='ivr.medium' ng-model='ivr.medium'
          //TODO: dashed border, caption drag here
          // or drag here

    .form-group
      .col-sm-4 Transitions
      .col-sm-8
        .transitions ng-repeat='transition in ivr.transitions'
          .form-group
            .input-group.input-group-sm
              input.form-control type='text' name='ivr[transition][][exten]' placeholder='_XXXX' autocomplete="on" ng-model='transition.exten'
              span.input-group-btn
                a.btn.btn-icon.btn-default.btn-transparent ng-click='ivr.remove_transition(transition)'
                  span.glyphicon.glyphicon-remove
        /TODO: select tag with all filterable extensions
        .form-group
          a href='javascript:;' ng-click='ivr.add_transition()'
            span.glyphicon.glyphicon-plus-sign
            |  Add

    .form-group.form-actions
      a.btn.btn-primary.btn-lg href='javascript:;' ng-click='create()' ng-if='!ivr.id' Create
      a.btn.btn-primary.btn-lg href='javascript:;' ng-click='update()' ng-if='ivr.id' Save
      a.btn.btn-lg href='#{ivrs_path(anchor: '/')}' Cancel