mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Decouple login modal opening from Angular
This commit is contained in:
@@ -3,17 +3,17 @@
|
||||
.small-12.columns.text-center
|
||||
%h3.pad-top
|
||||
= t :checkout_headline
|
||||
.row.pad-top
|
||||
-if guest_checkout_allowed?
|
||||
.row.pad-top{ "data-controller": "login-modal" }
|
||||
- if guest_checkout_allowed?
|
||||
.small-5.columns.text-center
|
||||
%button.primary.expand{"auth" => "login"}
|
||||
%button.primary.expand{ "data-action": "click->login-modal#call" }
|
||||
= t :label_login
|
||||
.small-2.columns.text-center
|
||||
%p.pad-top= "#{t :action_or}"
|
||||
.small-5.columns.text-center
|
||||
%button.neutral-btn.dark.expand{"ng-click" => "enabled = true"}
|
||||
= t :checkout_as_guest
|
||||
-else
|
||||
- else
|
||||
.small-6.columns.small-centered
|
||||
%button.primary.expand{"auth" => "login"}
|
||||
%button.primary.expand{ "data-action": "click->login-modal#call" }
|
||||
= t :label_login
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%li#login-link
|
||||
%a{"auth" => "login"}
|
||||
%li#login-link{ "data-controller": "login-modal" }
|
||||
%a{"auth": "login", "data-action": "click->login-modal#call" }
|
||||
%img{ src: image_pack_path("menu/icn-login.svg") }
|
||||
%span
|
||||
= t 'label_login'
|
||||
|
||||
8
app/webpacker/controllers/login_modal_controller.js
Normal file
8
app/webpacker/controllers/login_modal_controller.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Controller } from "stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
call(event) {
|
||||
event.preventDefault()
|
||||
window.dispatchEvent(new Event("login:modal:open"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user