fablabbcn/fablabs

View on GitHub
app/views/backstage/labs/edit.html.haml

Summary

Maintainability
Test Coverage
= render "backstage/header"

.container
  = title "Editing #{@lab}"
  = simple_form_for [:backstage, @lab] do |f|
    = render "form_errors", resource: @lab

    %fieldset
      .text-large Basic Details
      %h5
        Name, description and slug of your Lab
      = f.input :name
      = f.input :blurb
      = f.input :description
      = f.input :slug
      %h5
        Kind of Lab
      .hint
        What kind of Fab Lab is your Lab?
        .row
        - Lab::kinds.each do |value, index|
          .col-lg-2
            %span.form-check.mb-0.mt-3
              %div.form-check-input.mt-0
                = f.radio_button :kind, value
              %label.radio.form-check-label{style: "width: 160px;"}
                = value.humanize.titleize

    %fieldset
      .text-large
        Approval process
      %h5
        Referee Labs
        .hint.px-0
          These are your Referee Labs. Please contact them in case you have any question regarding your approval process.
          .selections.referees
            - @lab.referee_approval_processes.each do |c|
              - if c.referee_lab.present? and c.id
                .col-lg-4
                  %p
                    = image_tag c.referee_lab.avatar.thumb('90x90#').url, class: 'avatar tiny center-block'
                  %p
                    = link_to link_to c.referee_lab, c.referee_lab


    %fieldset
      .text-large Status and history of your Lab
      %h5
        Current status of your Lab
        .hint.px-0
          Is this Lab already open, planned or closed?

          .row
          - Lab::ACTIVITY_STATUS.each do |status|
            .col-lg-2
              %span.form-check.mb-0.mt-3
                %div.form-check-input.mt-0
                  = f.radio_button :activity_status, status, class: 'activity-status-radio'
                %label.form-check-label.radio{style: "width: 160px;"}
                  = status.humanize.titleize


          %h5.mt-2
            History of your Lab
          .hint.px-0
            Please indicate these important dates in the history of your Lab:
          .row.pl-0.mx-0
            = f.input :activity_start_at, label: 'When did you start designing and planning your Lab?', as: 'string', input_html: {class: 'flatpickr' }
          .row.pl-0.mx-0
            = f.input :activity_inaugurated_at, label: 'When was the Lab officially inaugurated?', as: 'string', input_html: {class: 'flatpickr' }
          .row.pl-0.mx-0
            = f.input :activity_closed_at, label: 'When was the Lab closed?', as: 'string', input_html: {class: 'flatpickr' }

    %fieldset
      .text-large Location
      = f.input :address_1
      = f.input :address_2
      = f.input :city
      = f.input :county
      = f.input :postal_code
      = f.input :country_code, as: 'country', label: 'Country', iso_codes: true
      = f.input :latitude
      = f.input :longitude
      = f.input :zoom
      = f.input :address_notes

    %fieldset
      .text-large Capabilities
      = f.input :tools_list

    %fieldset
      .text-large Contact information
      = f.input :phone
      = f.input :email

    %fieldset
      .text-large Notes
      = f.input :application_notes

    %fieldset
      .text-large Referee status
      .form-check
        = f.input :is_referee, input_html: { class: 'form-check-input' }

    = f.submit 'Save', class: 'btn btn-primary btn-lg mt-4'