From 980c46c63fdb1232e33f17ca73e8ab5df7ad253c Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Tue, 11 Sep 2018 11:22:54 +0100 Subject: [PATCH] Convert Spree view to HAML --- app/views/spree/admin/orders/index.html.haml | 91 ++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 app/views/spree/admin/orders/index.html.haml diff --git a/app/views/spree/admin/orders/index.html.haml b/app/views/spree/admin/orders/index.html.haml new file mode 100644 index 0000000000..0eb540f349 --- /dev/null +++ b/app/views/spree/admin/orders/index.html.haml @@ -0,0 +1,91 @@ +- content_for :page_title do + = t(:listing_orders) +- content_for :page_actions do + %li + = button_link_to t(:new_order), new_admin_order_url, :icon => 'icon-plus', :id => 'admin_new_order' +- content_for :table_filter_title do + = t(:search) +- content_for :table_filter do + %div{"data-hook" => "admin_orders_index_search"} + = search_form_for [:admin, @search] do |f| + .field-block.alpha.four.columns + .date-range-filter.field + = label_tag nil, t(:date_range) + .date-range-fields + = f.text_field :created_at_gt, :class => 'datepicker datepicker-from', :value => params[:q][:created_at_gt], :placeholder => t(:start) + %span.range-divider + %i.icon-arrow-right + = f.text_field :created_at_lt, :class => 'datepicker datepicker-to', :value => params[:q][:created_at_lt], :placeholder => t(:stop) + .field + = label_tag nil, t(:status) + = f.select :state_eq, Spree::Order.state_machines[:state].states.collect {|s| [t("order_state.#{s.name}"), s.value]}, {:include_blank => true}, :class => 'select2' + .four.columns + .field + = label_tag nil, t(:order_number) + = f.text_field :number_cont + .field + = label_tag nil, t(:email) + = f.email_field :email_cont + .four.columns + .field + = label_tag nil, t(:first_name_begins_with) + = f.text_field :bill_address_firstname_start, :size => 25 + .field + = label_tag nil, t(:last_name_begins_with) + = f.text_field :bill_address_lastname_start, :size => 25 + .omega.four.columns + .field.checkbox + %label + = f.check_box :completed_at_not_null, {:checked => @show_only_completed}, '1', '' + = t(:show_only_complete_orders) + .field.checkbox + %label + = f.check_box :inventory_units_shipment_id_null, { }, '1', '0' + = t(:show_only_unfulfilled_orders) + .clearfix + .actions.filter-actions + %div{"data-hook" => "admin_orders_index_search_buttons"} + = button t(:filter_results), 'icon-search' +- unless @orders.empty? + %table#listing_orders.index.responsive{"data-hook" => "", width: "100%"} + %colgroup + %col{style: "width: 16%;"} + %col{style: "width: 10%;"} + %col{style: "width: 13%;"} + %col{style: "width: 13%;"} + %col{style: "width: 13%;"} + %col{style: "width: 17%;"} + %col{style: "width: 10%;"} + %col{style: "width: 8%;"} + %thead + %tr{"data-hook" => "admin_orders_index_headers"} + - if @show_only_completed + %th= sort_link @search, :completed_at, t(:completed_at, :scope => 'activerecord.attributes.spree/order') + - else + %th= sort_link @search, :created_at, t(:created_at, :scope => 'activerecord.attributes.spree/order') + %th= sort_link @search, :number, t(:number, :scope => 'activerecord.attributes.spree/order') + %th= sort_link @search, :state, t(:state, :scope => 'activerecord.attributes.spree/order') + %th= sort_link @search, :payment_state, t(:payment_state, :scope => 'activerecord.attributes.spree/order') + %th= sort_link @search, :shipment_state, t(:shipment_state, :scope => 'activerecord.attributes.spree/order') + %th= sort_link @search, :email, t(:email, :scope => 'activerecord.attributes.spree/order') + %th= sort_link @search, :total, t(:total, :scope => 'activerecord.attributes.spree/order') + %th.actions{"data-hook" => "admin_orders_index_header_actions"} + %tbody + - @orders.each do |order| + %tr{class: "state-#{order.state.downcase} #{cycle('odd', 'even')}", "data-hook" => "admin_orders_index_rows"} + %td.align-center= l (@show_only_completed ? order.completed_at : order.created_at).to_date + %td= link_to order.number, admin_order_path(order) + %td.align-center + %span{class: "state #{order.state.downcase}"}= t("order_state.#{order.state.downcase}") + %td.align-center + %span{class: "state #{order.payment_state}"}= link_to t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) if order.payment_state + %td.align-center + %span{class: "state #{order.shipment_state}"}= link_to t("shipment_states.#{order.shipment_state}"), admin_order_shipments_path(order) if order.shipment_state + %td= mail_to order.email + %td.align-center= order.display_total.to_html + %td.actions.align-center{"data-hook" => "admin_orders_index_row_actions"} + = link_to_edit_url edit_admin_order_path(order), :title => "admin_edit_#{dom_id(order)}", :no_text => true +- else + .no-objects-found + = t(:no_orders_found) += paginate @orders \ No newline at end of file