mberlanda/cheidelacoriera

View on GitHub
app/views/crud/users/new.html.haml

Summary

Maintainability
Test Coverage
- @title ||= ti(:title, model: models_label(false))
- content_for(:actions, index_action_link)

= simple_form_for(@user, method: :post, url: users_path) do |f|
  = f.error_notification
  .form-inputs
    = f.input :first_name
    = f.input :last_name
    = f.input :phone_number
    = f.input :date_of_birth, as: :string, input_html: { type: :date }
    = f.input :place_of_birth
    = f.input :email
    = f.input :role, collection: User::ROLES, include_blank: false
    = f.input :status, collection: User::STATUSES, include_blank: false
    = f.input :password, required: false
    = f.input :password_confirmation, required: false
  .btn-group{ role: :group }
    = f.button :submit, t('simple_form.buttons.save'), class: 'btn-primary'
    = link_to(t('simple_form.buttons.back'), users_path, class: 'btn btn-default')

:javascript
  $(function(){
    $('input[type=time]').timepicker({
        timeFormat: 'HH:mm',
        interval: 15,
        minTime: '00:00',
        maxTime: '23:59',
        startTime: '00:00',
        dynamic: false,
        dropdown: true,
        scrollbar: true
    }).attr('type','string');
    $('input[type=date]').datepicker({
      language: '#{I18n.locale}',
      format: 'yyyy-mm-dd',
      startDate: '1907-10-17',
      endDate: '2100-12-31',
      todayBtn: true
    }).attr('type','string');
    nicEditors.allTextAreas();
  })