mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Handle old jquery_ujs buttons
This commit is contained in:
@@ -4,7 +4,16 @@
|
||||
{{ 'admin.actions' | t }}
|
||||
%i{ 'ng-class' => "expanded && 'icon-caret-up' || !expanded && 'icon-caret-down'" }
|
||||
%div.menu{ 'ng-show' => "expanded" }
|
||||
%a.menu_item{ 'ng-repeat' => "link in links", href: '{{link.url}}', target: "{{link.target || '_self'}}", data: { method: "{{ link.method || 'get' }}", confirm: "{{link.confirm}}" } }
|
||||
%span
|
||||
%i{ ng: { class: "link.icon" } }
|
||||
%span {{ link.name }}
|
||||
%div{ 'ng-repeat' => "link in links" }
|
||||
%a.menu_item{ 'ng-if': "link.method", href: '{{link.url}}', target: "{{link.target || '_self'}}", data: { method: "{{ link.method }}", "ujs-navigate": "false", confirm: "{{link.confirm}}" } }
|
||||
%span
|
||||
%i{ ng: { class: "link.icon" } }
|
||||
%span {{ link.name }}
|
||||
%a.menu_item{ 'ng-if': "link.confirm && !link.method", href: '{{link.url}}', target: "{{link.target || '_self'}}", "data-confirm": "{{link.confirm}}" }
|
||||
%span
|
||||
%i{ ng: { class: "link.icon" } }
|
||||
%span {{ link.name }}
|
||||
%a.menu_item{ 'ng-if': "!link.confirm && !link.method", href: '{{link.url}}', target: "{{link.target || '_self'}}" }
|
||||
%span
|
||||
%i{ ng: { class: "link.icon" } }
|
||||
%span {{ link.name }}
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
.row
|
||||
= t('.stripe_account_connected')
|
||||
.row
|
||||
=link_to t('.disconnect'), main_app.admin_stripe_account_path(@stripe_account), method: :delete, class: 'button'
|
||||
|
||||
=link_to t('.disconnect'), main_app.admin_stripe_account_path(@stripe_account), data: { method: :delete, "ujs-navigate": "false"}, class: 'button'
|
||||
- else
|
||||
.row.stripe-info
|
||||
.six.columns.alpha
|
||||
|
||||
@@ -22,4 +22,4 @@
|
||||
%br
|
||||
= button_to t(".link_account_button"),
|
||||
Spree::Core::Engine.routes.url_helpers.spree_user_openid_connect_omniauth_authorize_path(auth_type: "login"),
|
||||
method: :post
|
||||
data: { method: :post, "ujs-navigate": "false" }
|
||||
|
||||
@@ -36,4 +36,4 @@
|
||||
%td.actions{ ng: { if: 'orderCycle.viewing_as_coordinator' } }
|
||||
%a.clone-order-cycle.icon-copy.no-text{ ng: { href: '{{orderCycle.clone_path}}'}, 'ofn-with-tip' => t(:clone) }
|
||||
%td.actions{ ng: { if: 'orderCycle.deletable && orderCycle.viewing_as_coordinator' }}
|
||||
%a.delete-order-cycle.icon-trash.no-text{ ng: { href: '{{orderCycle.delete_path}}'}, data: { method: 'delete', confirm: t(:are_you_sure) }, 'ofn-with-tip' => t(:remove) }
|
||||
%a.delete-order-cycle.icon-trash.no-text{ ng: { href: '{{orderCycle.delete_path}}'}, data: { method: 'delete', confirm: t(:are_you_sure), "ujs-navigate": "false" }, 'ofn-with-tip' => t(:remove) }
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
- mails_sent = @order_cycle.mails_sent?
|
||||
- url = main_app.notify_producers_admin_order_cycle_path
|
||||
- confirm_msg = "#{t('.notify_producers_tip')} #{t(:are_you_sure)}"
|
||||
%a.button.icon-email.with-tip{ href: url, data: { method: 'post', confirm: confirm_msg }, 'data-powertip': t('.notify_producers_tip') }
|
||||
|
||||
%a.button.icon-email.with-tip{ href: url, data: { method: :post, "ujs-navigate": "false", confirm: confirm_msg }, 'data-powertip': t('.notify_producers_tip') }
|
||||
= mails_sent ? t('.re_notify_producers') : t(:notify_producers)
|
||||
- if mails_sent
|
||||
.badge.icon-ok.success
|
||||
|
||||
@@ -16,5 +16,5 @@
|
||||
%input#add_quantity.fullwidth{ type: 'number', min: 1, ng: { model: 'newItem.quantity' } }
|
||||
%td
|
||||
.actions
|
||||
%a.icon-plus.button.fullwidth{ href: 'javascript:void(0)', method: :post, ng: { click: 'addSubscriptionLineItem()' } }
|
||||
%a.icon-plus.button.fullwidth{ href: 'javascript:void(0)', ng: { click: 'addSubscriptionLineItem()' } }
|
||||
= t('.add')
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
.admin-current-terms-of-service
|
||||
- if @current_file
|
||||
%p= t(".current_terms_html", tos_link: link_to(t(".terms_of_service"), @current_file.attachment), datetime: @current_file.updated_at)
|
||||
%p= link_to t(".delete"), main_app.admin_terms_of_service_files_path, method: "delete", data: { confirm: t(".confirm_delete") }
|
||||
%p= link_to t(".delete"), main_app.admin_terms_of_service_files_path, data: { method: :delete, "ujs-navigate": "false", confirm: t(".confirm_delete") }
|
||||
- else
|
||||
%p
|
||||
= t(".no_files")
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
- content_for :page_actions do
|
||||
%li
|
||||
= link_to_with_icon 'icon-envelope-alt', t("spree.admin.mail_methods.send_testmail"), testmail_admin_mail_methods_path, method: :post, title: t("spree.admin.mail_methods.send_testmail"), class: 'send_mail button no-text'
|
||||
= link_to_with_icon 'icon-envelope-alt', t("spree.admin.mail_methods.send_testmail"), testmail_admin_mail_methods_path,
|
||||
data: { method: :post, "ujs-navigate": "false" }, title: t("spree.admin.mail_methods.send_testmail"), class: 'send_mail button no-text'
|
||||
|
||||
= render partial: 'spree/shared/error_messages', locals: { target: @mail_method }
|
||||
|
||||
|
||||
@@ -16,4 +16,5 @@
|
||||
%span{class: "state #{payment.state}"}= t(payment.state, scope: "spree.payment_states", default: payment.state.capitalize)
|
||||
%td.actions
|
||||
- payment.actions.each do |action|
|
||||
= link_to_with_icon "icon-#{action}", Spree.t(action), fire_admin_order_payment_path(@order, payment, e: action), method: :put, no_text: true, data: {action: action, disable_with: ""}
|
||||
= link_to_with_icon "icon-#{action}", Spree.t(action), fire_admin_order_payment_path(@order, payment, e: action),
|
||||
no_text: true, data: { method: :put, "ujs-navigate": "false", action: action, disable_with: "" }
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
- content_for :page_actions do
|
||||
%li
|
||||
- if @return_authorization.can_receive?
|
||||
= button_link_to t('.receive'), fire_admin_order_return_authorization_url(@order, @return_authorization, e: 'receive'), method: :put, data: { confirm: t('.are_you_sure') }, icon: 'icon-download-alt'
|
||||
= button_link_to t('.receive'), fire_admin_order_return_authorization_url(@order, @return_authorization, e: 'receive'),
|
||||
data: { method: :put, "ujs-navigate": "false", confirm: t('.are_you_sure') }, icon: 'icon-download-alt'
|
||||
%li
|
||||
- if @return_authorization.can_cancel?
|
||||
= button_link_to t('actions.cancel'), fire_admin_order_return_authorization_url(@order, @return_authorization, e: 'cancel'), method: :put, data: { confirm: t('.are_you_sure') }, icon: 'icon-remove'
|
||||
= button_link_to t('actions.cancel'), fire_admin_order_return_authorization_url(@order, @return_authorization, e: 'cancel'),
|
||||
data: { method: :put, "ujs-navigate": "false", confirm: t('.are_you_sure') }, icon: 'icon-remove'
|
||||
|
||||
= render partial: 'spree/admin/shared/order_page_title'
|
||||
= render partial: 'spree/admin/shared/order_tabs', locals: { current: 'Return Authorizations' }
|
||||
|
||||
@@ -6,6 +6,17 @@ mrujs.start({
|
||||
plugins: [new CableCar(CableReady, { mimeType: "text/vnd.cable-ready.json" })],
|
||||
});
|
||||
|
||||
// Handle legacy jquery ujs buttons
|
||||
document.addEventListener("ajax:beforeNavigation", (event) => {
|
||||
if (event.detail.element.dataset.ujsNavigate !== "false") return;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if (event.detail.fetchResponse.response.redirected) {
|
||||
document.location.href = event.detail.fetchResponse.response.url;
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("ajax:beforeSend", (event) => {
|
||||
window.Turbo.navigator.adapter.progressBar.setValue(0);
|
||||
window.Turbo.navigator.adapter.progressBar.show();
|
||||
|
||||
Reference in New Issue
Block a user