Created
July 9, 2018 10:00
-
-
Save ereboucas/e1862b326ddec3de4fd56362b7228463 to your computer and use it in GitHub Desktop.
mayo _test_method_form.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= form_with(model: [:settings, @test_method]) do |f| | |
.row | |
.col-sm-12 | |
- if @test_method.errors.any? | |
.alert.alert-danger{:role => "alert"} | |
= pluralize(@test_method.errors.count, "error") | |
prohibited this test method from being saved: | |
%ul | |
- @test_method.errors.full_messages.each do |message| | |
%li.font-weight-bold | |
= message | |
.card-body | |
.form-group.row | |
.col-sm-7 | |
%label Category | |
= f.select(:category_id, @categories.collect { |category| [ category.name, category.id ] }, { include_blank: "Select Category" }, { :class => 'form-control select2', style: 'width: 100%;' }) | |
.col-sm-5 | |
.form-group.row | |
.col-sm-7 | |
%label Test Method | |
= f.text_field :name, autofocus: true, placeholder: 'Enter Test Method', class: 'form-control' | |
.col-sm-5 | |
.form-group.row | |
.col-sm-7 | |
%label Test Method Code | |
= f.text_field :code, placeholder: 'Enter Test Method Code', class: 'form-control' | |
.col-sm-5 | |
.form-group.row | |
.col-sm-7 | |
%label Description | |
= f.text_area :description, placeholder: 'Enter Description ...', :rows => "3", class: 'form-control' | |
.col-sm-5 | |
.form-group.row | |
.col-sm-7 | |
%label.mb-0 Upload Report Header | |
%br | |
%small | |
Header image will be automatically resized to fit the dimension of 953x128 | |
%a{:href => "http://ndt.nordvest.no/assets/ultrasonic2.jpg", :target => "_blank"} Ex: header_image | |
.input-group.mt-2 | |
.custom-file | |
= f.file_field :report_header, class: "custom-file-input" | |
%label.custom-file-label Choose file | |
.col-sm-5 | |
.form-group.row | |
.col-sm-12 | |
- if @test_method.report_header.attached? | |
= image_tag @test_method.report_header, style:"width: 953px; height: 128px;" | |
- else | |
%img#preview-report-header{src: '', width:'953', height:'128', style:"display:none;"} | |
.form-group.row | |
.col-sm-7 | |
%label.mb-0 Upload Report Footer | |
%br | |
%small | |
Footer image will be automatically resized to fit the dimension of 953x128 | |
%a{:href => "http://ndt.nordvest.no/assets/ultrasonic2.jpg", :target => "_blank"} Ex: footer_image | |
.input-group.mt-2 | |
.custom-file | |
= f.file_field :report_footer, class: "custom-file-input" | |
%label.custom-file-label Choose file | |
.form-group.row | |
.col-sm-12 | |
- if @test_method.report_footer.attached? | |
= image_tag @test_method.report_footer, style:"width: 953px; height: 128px;" | |
- else | |
%img#preview-report-footer{src: '', width:'953', height:'128', style:"display:none;"} | |
.form-group.row | |
.col-sm-7 | |
%label Procedures | |
= f.collection_select :procedure_ids, @procedures, :id, :name, { selected: @test_method.procedure_ids, include_blank: "Select Procedure(s)" }, { class: "form-control select2 multi-select2", multiple: "multiple" } | |
.col-sm-5 | |
%label Choose Default | |
= f.select(:procedure_id, @procedures.collect { |procedure| [ procedure.name, procedure.id ] }, { include_blank: "Select Procedure" }, { :class => 'form-control select2', style: 'width: 100%;' }) | |
.form-group.row | |
.col-sm-7 | |
%label Reference Standards | |
= f.collection_select :ref_standard_ids, @ref_standards, :id, :name, { selected: @test_method.ref_standard_ids, include_blank: "Select Reference Standard(s)" }, { class: "form-control select2 multi-select2", multiple: "multiple" } | |
.col-sm-5 | |
%label Choose Default | |
= f.select(:ref_standard_id, @ref_standards.collect { |ref_standard| [ ref_standard.name, ref_standard.id ] }, { include_blank: "Select Reference Standard" }, { :class => 'form-control select2', style: 'width: 100%;' }) | |
.form-group.row | |
.col-sm-7 | |
%label Acceptance Criterias | |
= f.collection_select :acceptance_criterium_ids, @acceptance_criteria, :id, :name, { selected: @test_method.acceptance_criterium_ids, include_blank: "Select Acceptance Criteria" }, { class: "form-control select2 multi-select2", multiple: "multiple" } | |
.col-sm-5 | |
%label Choose Default | |
= f.select(:acceptance_criterium_id, @acceptance_criteria.collect { |acceptance_criterium| [ acceptance_criterium.name, acceptance_criterium.id ] }, { include_blank: "Select Acceptance Criteria" }, { :class => 'form-control select2', style: 'width: 100%;' }) | |
-# .form-group.row | |
-# .col-sm-7 | |
-# %label Certificates | |
-# = f.collection_select :certificate_ids, @certificates, :id, :name, { selected: @test_method.certificate_ids, include_blank: "Select Certificate" }, { class: "form-control select2 multi-select2", multiple: "multiple" } | |
-# .col-sm-5 | |
-# %label Choose Default | |
-# = f.select(:certificate_id, @certificates.collect { |certificate| [ certificate.name, certificate.id ] }, { include_blank: "Select Certificate" }, { :class => 'form-control select2', style: 'width: 100%;' }) | |
.container-fluid | |
.alert.alert-primary{:role => "alert"} | |
Add Equipment and Test Specific Report Fields | |
.row | |
.col-md-12 | |
.card-body | |
.form-group.form-item.row | |
.col-sm-3 | |
%label Add Equipment | |
%select.form-control{:style => "width: 100%;"} | |
%option Single | |
%option Multiple | |
.col-sm-3 | |
%label Report Heading | |
%input.form-control{:placeholder => "Enter Report Heading", :type => "text"} | |
.col-sm-4 | |
%label Equipment Type | |
%select.form-control.select2{:style => "width: 100%;"} | |
%option Type 1 | |
%option Type 2 | |
%option Type 3 | |
%option Type 4 | |
%option Type 5 | |
%option Type 6 | |
%option Type 7 | |
%option Type 8 | |
.col-sm-2 | |
.icon.text-center | |
%i.fa.fa-plus-circle.add-icon | |
.table-responsive.mt-5 | |
%table.table.table-hover.table-valign-middle | |
%thead | |
%tr | |
%th Equipment Amount | |
%th Heading | |
%th Equipment Type | |
%th Actions | |
%tbody | |
%tr | |
%td Single | |
%td Test Heading | |
%td Test Type | |
%td | |
%a | |
%i.fa.fa-pencil.text-secondary{"aria-hidden" => "true", "data-toggle"=>"tooltip", "title"=>"Edit"} | |
%a | |
%i.fa.fa-trash-o.text-info{"aria-hidden" => "true", "data-toggle"=>"tooltip", "title"=>"Delete"} | |
.alert.alert-primary{:role => "alert"} | |
Add Method Specific Variables | |
.row | |
.col-md-12 | |
.card-body | |
.form-group.form-item.row | |
.col-sm-5 | |
%label Report Heading | |
%input.form-control{:placeholder => "Enter Report Heading", :type => "text"} | |
.col-sm-5 | |
%label Standard Value | |
%input.form-control{:placeholder => "Enter Standard Value", :type => "text"} | |
.col-sm-2 | |
.icon.text-center | |
%i.fa.fa-plus-circle.add-icon | |
.table-responsive.mt-5 | |
%table.table.table-hover.table-valign-middle | |
%thead | |
%tr | |
%th Heading | |
%th Standard Value | |
%th Actions | |
%tbody | |
%tr | |
%td Test Heading | |
%td Test Type | |
%td | |
%a | |
%i.fa.fa-pencil.text-secondary{"aria-hidden" => "true", "data-toggle"=>"tooltip", "title"=>"Edit"} | |
%a | |
%i.fa.fa-trash-o.text-info{"aria-hidden" => "true", "data-toggle"=>"tooltip", "title"=>"Delete"} | |
.text-center.pb-4 | |
= f.submit class: "btn btn-primary mr-1" | |
%button.btn.btn-primary.ml-1.btn-width{:type => "submit"} Back |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment