dice-cyfronet/atmosphere

View on GitHub
app/views/atmosphere/admin/endpoints/_edit.html.haml

Summary

Maintainability
Test Coverage
- pmt = @port_mapping_template

%tr(data-endpoint-id="#{@endpoint.id}")
  %td(colspan=5)
    = simple_form_for [:admin, pmt.appliance_type, pmt, @endpoint], remote: true,
        data: {target: '#endpoints'},
        html: {class: 'form-inline'},
        defaults: {label_html: {class: 'sr-only'}, input_html: {class: 'input-sm'}} do |f|
      - if request[:action] == 'new'
        = f.input :port_mapping_template_id, as: :hidden, input_html: {value: pmt.id}
      = f.input :name, include_blank: false
      = f.input :description, input_html: {cols: 40}
      = f.input :descriptor, input_html: {cols: 40}
      = f.input :invocation_path, include_blank: false
      = f.input :endpoint_type, include_blank: false

  %td
    .btn-group.pull-right

      - form_id = (request[:action] == 'new' ? '#new_endpoint' : "#edit_endpoint_#{@endpoint.id}")

      = button_tag class: 'btn btn-success btn-xs', onclick: "$('#{form_id}').submit()" do
        =icon 'save'

      = link_to [:admin, pmt.appliance_type, pmt, Atmosphere::Endpoint], remote: true,
          class: 'btn btn-default btn-xs', title: 'Cancel', data: {target: '#endpoints'} do
        =icon 'undo'