spielhoelle/zelos

View on GitHub
app/views/admin/bills/edit.html.haml

Summary

Maintainability
Test Coverage
- if ["new", "clone"].include?(action_name)
  - path = admin_bills_path
- elsif action_name == "edit"
  - path = admin_bill_path(@bill)
%section.container.row.full-width.no-max-width
  .col.s12
    = form_for(@bill, url: path) do |f|

      .section.row

        .col.m6.s12
          .form-group
            - unless action_name == "new"
              .position-relative
                = image_tag(@bill.image.url, class: "materialboxed w-100")
            - else
              %img.materialboxed.w-100
            #image_result.absolute-cover
            %h5.mt-3 Upload file for text recognition
            .file-field.input-field
              .btn
                %span File
                = f.file_field :image
              .file-path-wrapper
                %input.file-path.validate{:type => "text"}/
          .text-center.w-100
            %h5#image_text.text-grey Upload image to see preview
            #image_loader.progress.fade-in
              .determinate{:style => "width: 0%"}



        .col.m6.s12
          .row
            .input-field.col.s12
              = f.label :price, class: "active"
              = f.number_field :price, step: 0.01, :required => true, class: "validate mb-0"

          .row
            .input-field.col.s12.pb-1
              = f.label :bill_date, class: "active"
              = f.date_field :bill_date, class: "validate datepicker mb-0"
          .row
            .input-field.col.s12
              %h5
                = f.label :title, class: action_name == "edit" ? "active" : ""
              = f.text_field :title, class: "validate", :autofocus => true, :required => true




      .fixed-action-btn
        = f.button :submit, class: "pulse tooltipped btn btn-floating btn-large ", "data-delay": 10, "data-position":"left", "data-tooltip": "Save" do
          %i.material-icons done