Skip to content

Commit

Permalink
Remove data-hook attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-Yorkley committed Apr 28, 2023
1 parent d2fbb0b commit b9431cd
Show file tree
Hide file tree
Showing 55 changed files with 133 additions and 145 deletions.
12 changes: 6 additions & 6 deletions app/assets/javascripts/admin/spree/orders/shipments.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $(document).ready(function() {
console.log(msg);
});
}
$('[data-hook=admin_order_edit_form] a.ship').click(handle_ship_click);
$('.admin-order-edit-form a.ship').click(handle_ship_click);

//handle shipping method edit click
$('a.edit-method').click(toggleMethodEdit);
Expand All @@ -37,7 +37,7 @@ $(document).ready(function() {
console.log(msg);
});
}
$('[data-hook=admin_order_edit_form] a.save-method').click(handle_shipping_method_save);
$('.admin-order-edit-form a.save-method').click(handle_shipping_method_save);

//handle tracking info edit/delete

Expand All @@ -64,8 +64,8 @@ $(document).ready(function() {
return Spree.url( Spree.routes.orders_api + "/" + order_number + "/shipments/" + shipmentNumber + ".json");
}

$('[data-hook=admin_order_edit_form] a.save-tracking').click(saveTrackingInfo);
$('[data-hook=admin_order_edit_form] a.delete-tracking').click(deleteTrackingInfo);
$('.admin-order-edit-form a.save-tracking').click(saveTrackingInfo);
$('.admin-order-edit-form a.delete-tracking').click(deleteTrackingInfo);

// handle note edit/delete

Expand Down Expand Up @@ -96,8 +96,8 @@ $(document).ready(function() {
});
}

$('[data-hook=admin_order_edit_form] a.save-note').click(saveNote);
$('[data-hook=admin_order_edit_form] a.delete-note').click(deleteNote);
$('.admin-order-edit-form a.save-note').click(saveNote);
$('.admin-order-edit-form a.delete-note').click(deleteNote);

// Makes API call for notes/tracking info
makeApiCall = function(url, params) {
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/contents/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
- @preference_sections.each do |preference_section|
= render 'fieldset', name: preference_section[:name], preferences: preference_section[:preferences]

.form-buttons.filter-actions.actions{"data-hook" => "buttons"}
.form-buttons.filter-actions.actions
= button t(:update), 'icon-refresh'
= link_to_with_icon 'icon-remove', t(:cancel), main_app.edit_admin_contents_path, class: 'button'
4 changes: 2 additions & 2 deletions app/views/admin/enterprises/_admin_index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
%col{style: "width: 18%;"}/
%col{style: "width: 25%;"}/
%thead
%tr{"data-hook" => "enterprises_header"}
%tr
%th= t('.name')
%th= t('.role')
- if spree_current_user.admin?
Expand All @@ -32,7 +32,7 @@
%td= enterprise_form.check_box :visible, {}, 'public', 'hidden'
- if spree_current_user.admin?
%td= enterprise_form.select :owner_id, enterprise.users.map{ |e| [ e.email, e.id ] }, {}, class: "select2 fullwidth"
%td{"data-hook" => "admin_users_index_row_actions"}
%td
= render 'actions', enterprise: enterprise
- if @enterprises.empty?
%tr
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/invoice_settings/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
= check_box_tag 'preferences[enterprise_number_required_on_invoices?]', '1', Spree::Config[:enterprise_number_required_on_invoices?]
= label_tag nil, t('.enterprise_number_required_on_invoices?')

.form-buttons{"data-hook" => "buttons"}
.form-buttons
= button t(:update), 'icon-refresh'
2 changes: 1 addition & 1 deletion app/views/admin/matomo_settings/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
= preference_field_tag("preferences[#{:matomo_tag_manager_url}]", Spree::Config[:matomo_tag_manager_url], type: Spree::Config.preference_type(:matomo_tag_manager_url))
.warning.note= t('.config_instructions_tag_manager_html')

.form-buttons{"data-hook" => "buttons"}
.form-buttons
= button t(:update), 'icon-refresh'
8 changes: 4 additions & 4 deletions app/views/admin/producer_properties/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
%fieldset.no-border-top
.add_producer_properties{"data-hook" => "add_producer_properties"}
.add_producer_properties
= image_pack_tag 'spinner.gif', :plugin => 'spree', :style => 'display:none;', :id => 'busy_indicator'
%table.index.sortable{"data-hook" => "", "data-sortable-link" => main_app.update_positions_admin_enterprise_producer_properties_url(@enterprise)}
%table.index.sortable{"data-sortable-link" => main_app.update_positions_admin_enterprise_producer_properties_url(@enterprise)}
%thead
%tr{"data-hook" => "producer_properties_header"}
%tr
%th{colspan: "2"}= t('admin.products.properties.property_name')
%th= t('admin.description')
%th.actions
%tbody#producer_properties{"data-hook" => ""}
%tbody#producer_properties
= f.fields_for :producer_properties do |pp_form|
= render 'admin/producer_properties/producer_property_fields', f: pp_form
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-# admin/admin.js.erb in spree requires id to start with "spree_" for sortable tables
%tr.product_property.fields{"data-hook" => "producer_property", id: "spree_#{dom_id(f.object)}"}
%tr.product_property.fields{id: "spree_#{dom_id(f.object)}"}
%td.no-border
%span.handle
= f.hidden_field :id
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/shared/_enterprises_sub_menu.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- content_for :sub_menu do
%ul#sub_nav.inline-menu{"data-hook" => "admin_enterprise_sub_tabs"}
%ul#sub_nav.inline-menu
= tab :enterprises, url: main_app.admin_enterprises_path
= tab :enterprise_relationships, url: main_app.admin_enterprise_relationships_path
- if ENV["OPENID_APP_ID"].present? && ENV["OPENID_APP_SECRET"].present?
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/shared/_users_sub_menu.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- content_for :sub_menu do
%ul#sub_nav.inline-menu{"data-hook" => "admin_user_sub_tabs"}
%ul#sub_nav.inline-menu
= tab :users, url: spree.admin_users_path
= tab :roles, url: main_app.admin_enterprise_roles_path, match_path: '/enterprise_roles'
2 changes: 1 addition & 1 deletion app/views/admin/stripe_connect_settings/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
= f.label :stripe_connect_enabled, t('.stripe_connect_enabled')
= f.check_box :stripe_connect_enabled, disabled: disabled
.row
.twelve.columns.alpha.omega.form-buttons{"data-hook" => "buttons"}
.twelve.columns.alpha.omega.form-buttons
= button t(:update), 'icon-refresh', value: "update"

%fieldset.no-border-bottom
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/subscriptions/_review.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@
%td.price.align-center {{ item.price_estimate | localizeCurrency }}
%td.quantity {{ item.quantity }}
%td.total.align-center {{ (item.price_estimate * item.quantity) | localizeCurrency }}
%tbody#subtotal.no-border-top{"data-hook" => "admin_order_form_subtotal"}
%tbody#subtotal.no-border-top
%tr#subtotal-row
%td{:colspan => "3"}
%b
= t(:subtotal)
\:
%td.total.align-center
%span {{ subscription.estimatedSubtotal() | localizeCurrency }}
%tbody#order-total.grand-total.no-border-top{"data-hook" => "admin_order_form_total"}
%tbody#order-total.grand-total.no-border-top
%tr
%td{:colspan => "3"}
%b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
%td.total.align-center {{ (item.price_estimate * item.quantity) | localizeCurrency }}
%td.actions
%a.delete-item.icon-trash.no-text{ ng: { click: 'removeSubscriptionLineItem(item)'}, :href => "javascript:void(0)" }
%tbody#subtotal.no-border-top{"data-hook" => "admin_order_form_subtotal"}
%tbody#subtotal.no-border-top
%tr#subtotal-row
%td{:colspan => "3"}
%b
Expand All @@ -43,7 +43,7 @@
%td.total.align-center
%span#order_fees {{ subscription.estimatedFees() | localizeCurrency }}
%td.actions
%tbody#order-total.grand-total.no-border-top{"data-hook" => "admin_order_form_total"}
%tbody#order-total.grand-total.no-border-top
%tr
%td{:colspan => "3"}
%b
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%table.index{"data-hook" => "adjustments"}
%thead{"data-hook" => "adjustmment_head"}
%table.index
%thead
%tr
%th= "#{t('spree.date')}/#{t('spree.time')}"
%th= t(:description)
Expand All @@ -15,7 +15,7 @@
- taxable = adjustment.adjustable_type == "Spree::Shipment" ? adjustment.adjustable : adjustment
- tr_class = cycle('odd', 'even')
- tr_id = spree_dom_id(adjustment)
%tr{:class => tr_class, "data-hook" => "adjustment_row", :id => tr_id}
%tr{:class => tr_class, :id => tr_id}
%td.align-center.created_at
= pretty_time(adjustment.created_at)
%td.align-center.label
Expand Down
2 changes: 1 addition & 1 deletion app/views/spree/admin/adjustments/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.row{"data-hook" => "admin_adjustment_form_fields"}
.row
- if @adjustment.new_record?
= render 'new_form', f: f
- else
Expand Down
2 changes: 1 addition & 1 deletion app/views/spree/admin/adjustments/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
= form_for @adjustment, :url => admin_order_adjustment_path(@order, @adjustment), :method => :put do |f|
%fieldset.no-border-top
= render :partial => 'form', :locals => { :f => f }
.filter-actions.actions{"data-hook" => "buttons"}
.filter-actions.actions
= button Spree.t(:continue), 'icon-arrow-right'
= link_to_with_icon 'icon-remove', Spree.t('actions.cancel'), admin_order_adjustments_url(@order), :class => 'button'
2 changes: 1 addition & 1 deletion app/views/spree/admin/adjustments/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
= form_for @adjustment, :url => admin_order_adjustments_path do |f|
%fieldset.no-border-top
= render :partial => 'form', :locals => { :f => f }
.filter-actions.actions{"data-hook" => "buttons"}
.filter-actions.actions
= button Spree.t(:continue), 'icon-arrow-right'
= button_link_to Spree.t('actions.cancel'), admin_order_adjustments_url(@order), :icon => 'icon-remove'
4 changes: 2 additions & 2 deletions app/views/spree/admin/general_settings/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
= Spree.t(:general_settings)

= form_tag admin_general_settings_path, :method => :put do
#preferences{"data-hook" => ""}
#preferences

%fieldset.general.no-border-top
- @preferences_general.each do |key|
Expand Down Expand Up @@ -85,6 +85,6 @@
= preference_field_tag("available_units[#{unit}]", selected, { type: :boolean, selected: selected })
= label_tag(unit, unit.downcase) + tag(:br)

.form-buttons.filter-actions.actions{"data-hook" => "buttons"}
.form-buttons.filter-actions.actions
= button Spree.t('actions.update'), 'icon-refresh'
= link_to_with_icon 'icon-remove', Spree.t('actions.cancel'), edit_admin_general_settings_url, :class => 'button'
4 changes: 2 additions & 2 deletions app/views/spree/admin/orders/_add_product.html.haml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
= render :partial => "spree/admin/variants/autocomplete", :formats => :js

#add-line-item{"data-hook" => ""}
#add-line-item
%fieldset.no-border-bottom
%legend{:align => "center"}= Spree.t(:add_product)

- if @order.canceled?
= t(".cannot_add_item_to_canceled_order")
- else
.field.nine.columns.alpha{"data-hook" => "add_product_name"}
.field.nine.columns.alpha
= label_tag :add_variant_id, Spree.t(:name_or_sku)
= hidden_field_tag :add_variant_id, "", :class => "variant_autocomplete fullwidth"
.five.columns.omega
Expand Down
2 changes: 1 addition & 1 deletion app/views/spree/admin/orders/_filters.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%div{"data-hook" => "admin_orders_index_search"}
%div.admin-orders-index-search
= form_tag spree.admin_orders_url, {name: "orders_form", "ng-submit" => "fetchResults()"} do
.field-block.alpha.four.columns
.date-range-filter.field
Expand Down
4 changes: 2 additions & 2 deletions app/views/spree/admin/orders/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%div{"data-hook" => "admin_order_form_fields"}
%div.admin-order-form-fields
- if @line_item.try(:errors).present?
= render :partial => 'spree/shared/error_messages', :locals => { :target => @line_item }

Expand All @@ -13,7 +13,7 @@
= render :partial => "spree/admin/orders/_form/adjustments", :locals => { :adjustments => order_adjustments_for_display(@order), :title => t(".order_adjustments")}

- if order.line_items.exists?
%fieldset#order-total.no-border-bottom{"data-hook" => "order_details_total"}
%fieldset#order-total.no-border-bottom.order-details-total
%legend{ align: 'center' }= t(".order_total")
%span.order-total= order.display_total

Expand Down
6 changes: 3 additions & 3 deletions app/views/spree/admin/orders/_shipment.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%div{ :id => "shipment_#{shipment.id}" }
%fieldset.no-border-bottom
%legend.stock-location{ :align => "center", "data-hook" => "stock-location" }
%legend.stock-location{ :align => "center" }
%span.shipment-number
= shipment.number
= "-"
Expand All @@ -10,7 +10,7 @@
= "-"
= link_to t(:ship), '#', :class => 'ship button icon-arrow-right', :data => { 'shipment-number' => shipment.number }

%table.stock-contents.index{ "data-hook" => "stock-contents" }
%table.stock-contents.index
%colgroup
%col{ :style => "width: 10%;" }
%col{ :style => "width: 30%;" }
Expand All @@ -28,7 +28,7 @@
= Spree.t(:quantity)
%th.force-rounded-right
= Spree.t(:total)
%th.orders-actions.actions{ "data-hook" => "admin_order_form_line_items_header_actions" }
%th.orders-actions.actions

%tbody{ "data-shipment-number" => "#{shipment.number}", "data-order-number" => "#{order.number}" }
= render 'spree/admin/orders/shipment_manifest', order: order, shipment: shipment
Expand Down
2 changes: 1 addition & 1 deletion app/views/spree/admin/orders/_shipment_manifest.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
%td.item-total.align-center
= line_item_shipment_price(line_item, item.quantity)

%td.cart-item-delete.actions{ "data-hook" => "cart_item_delete" }
%td.cart-item-delete.actions
- if shipment.can_modify? && can?(:update, shipment)
.flex
= link_to '', '#', :class => 'save-item icon_link icon-ok no-text with-tip', :data => {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'save'}, :title => t('actions.save'), :style => 'display: none'
Expand Down
12 changes: 6 additions & 6 deletions app/views/spree/admin/orders/customer_details/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
%fieldset.no-border-top{"data-hook" => "admin_customer_detail_form_fields"}
%fieldset.index.no-border-bottom{"data-hook" => "customer_guest"}
%fieldset.no-border-top
%fieldset.index.no-border-bottom
%legend{:align => "center"}= Spree.t(:account)
.row{"data-hook" => "customer_fields"}
.row
.alpha.eight.columns.fullwidth
.field
= f.label :email, Spree.t(:email) + ':'
= f.email_field :email, :class => 'fullwidth'

.alpha.eight.columns{"data-hook" => "bill_address_wrapper"}
.alpha.eight.columns
%fieldset.no-border-bottom
%legend{:align => "center"}= Spree.t(:billing_address)
= f.fields_for :bill_address do |ba_form|
= render :partial => 'address_form', :locals => { :f => ba_form, :name => Spree.t(:billing_address), :use_billing => false }

.omega.eight.columns{"data-hook" => "ship_address_wrapper"}
.omega.eight.columns
%fieldset.no-border-bottom
%legend{:align => "center"}= Spree.t(:shipping_address)
= f.fields_for :ship_address do |sa_form|
= render :partial => 'address_form', :locals => { :f => sa_form, :name => Spree.t(:shipping_address), :use_billing => true }

.clear

.form-buttons.filter-actions.actions{"data-hook" => "buttons"}
.form-buttons.filter-actions.actions
= button Spree.t('actions.update'), 'icon-refresh'

- content_for :head do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
%li= button_link_to Spree.t(:back_to_orders_list), admin_orders_path, :icon => 'icon-arrow-left'

- if @order.cart? || @order.address?
#select-customer{"data-hook" => ""}
#select-customer
%fieldset.no-border-bottom
%legend{:align => "center"}= Spree.t(:customer_search)
- content_for :main_ng_app_name do
Expand Down
4 changes: 2 additions & 2 deletions app/views/spree/admin/orders/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
= render partial: "spree/admin/shared/order_page_title"
= render partial: "spree/admin/shared/order_tabs", locals: { current: 'Order Details' }
%div{"data-hook" => "admin_order_edit_header"}
%div
-# Suppress errors when manually creating a new order - needs to proceed to edit page
-# without having line items (which otherwise gives a validation error)
- unless params["suppress_error_msg"]
Expand All @@ -31,5 +31,5 @@
.no-objects-found
= Spree.t(:your_order_is_empty_add_product)
%div{"data-hook" => "admin_order_edit_form"}
%div.admin-order-edit-form
= render :partial => 'form', :locals => { :order => @order }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%tr.product_property.fields{"data-hook" => "product_property", id: "spree_#{dom_id(f.object)}"}
%tr.product_property.fields{id: "spree_#{dom_id(f.object)}"}
%td.no-border
%span.handle
= f.hidden_field :id
Expand Down
2 changes: 1 addition & 1 deletion app/views/spree/admin/products/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%div{"data-hook" => "admin_product_form_fields"}
%div.admin-product-form-fields
.left.twelve.columns.alpha
= f.field_container :name do
= f.label :name, raw(t(:name) + content_tag(:span, ' *', :class => 'required'))
Expand Down
2 changes: 1 addition & 1 deletion app/views/spree/admin/products/_seo_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.row{"data-hook" => "admin_product_meta_form"}
.row
.alpha.eleven.columns
= f.field_container :meta_keywords do
= f.label :meta_keywords, t('admin.products.seo.product_search_keywords')
Expand Down
2 changes: 1 addition & 1 deletion app/views/spree/admin/products/index/_header.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
= t('.title')

- content_for :page_actions do
%div{ :class => "toolbar", 'data-hook' => "toolbar" }
%div{ :class => "toolbar" }
%ul{ :class => "actions header-action-links inline-menu" }
%li#new_product_link
= button_link_to t(:new_product), new_object_url, { :icon => 'icon-plus', :id => 'admin_new_product' }
Expand Down
6 changes: 3 additions & 3 deletions app/views/spree/admin/shipping_categories/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
%div{"data-hook" => "admin_shipping_category_form_fields"}
.field.align-center{"data-hook" => "name"}
%div
.field.align-center
= label_tag Spree.t(:name)
%br/
= f.text_field :name

.field.align-center{"data-hook" => "name"}
.field.align-center
= f.label :temperature_controlled, t(:temperature_controlled)
= f.check_box :temperature_controlled

0 comments on commit b9431cd

Please sign in to comment.