mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-10 03:30:22 +00:00
Create a ConfirmModalComponent
- Inherits from ModalComponent - Has a close button - Accept `confirm_actions` to trigger reflexes - Accept `controller` to encapsulate stimulus reflexe controllers
This commit is contained in:
15
app/components/confirm_modal_component.rb
Normal file
15
app/components/confirm_modal_component.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ConfirmModalComponent < ModalComponent
|
||||
def initialize(id:, confirm_actions: nil, controllers: nil)
|
||||
super(id: id, close_button: true)
|
||||
@confirm_actions = confirm_actions
|
||||
@controllers = controllers
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def close_button_class
|
||||
"secondary"
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
%div{ id: @id, "data-controller": "modal #{@controllers}", "data-action": "keyup@document->modal#closeIfEscapeKey" }
|
||||
.reveal-modal-bg.fade{ "data-modal-target": "background", "data-action": "click->modal#close" }
|
||||
.reveal-modal.fade.tiny.help-modal{ "data-modal-target": "modal" }
|
||||
= content
|
||||
|
||||
.modal-actions
|
||||
%input{ class: "button icon-plus #{close_button_class}", type: 'button', value: t('js.admin.modals.cancel'), "data-action": "click->modal#close" }
|
||||
%input{ class: "button icon-plus primary", type: 'button', value: t('js.admin.modals.confirm'), "data-action": @confirm_actions }
|
||||
@@ -0,0 +1,4 @@
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
@@ -127,3 +127,4 @@
|
||||
@import "app/components/pagination_component/pagination_component";
|
||||
@import "app/components/table_header_component/table_header_component";
|
||||
@import "app/components/search_input_component/search_input_component";
|
||||
@import 'app/components/confirm_modal_component/confirm_modal_component';
|
||||
|
||||
@@ -77,3 +77,4 @@ ofn-modal {
|
||||
@import '../admin/shared/scroll_bar';
|
||||
|
||||
@import 'app/components/help_modal_component/help_modal_component';
|
||||
@import 'app/components/confirm_modal_component/confirm_modal_component';
|
||||
|
||||
@@ -3036,8 +3036,10 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
deleting_item_will_cancel_order: "This operation will result in one or more empty orders, which will be cancelled. Do you wish to proceed?"
|
||||
modals:
|
||||
got_it: "Got it"
|
||||
confirm: "Confirm"
|
||||
close: "Close"
|
||||
continue: "Continue"
|
||||
cancel: "Cancel"
|
||||
invite: "Invite"
|
||||
invite_title: "Invite an unregistered user"
|
||||
tag_rule_help:
|
||||
|
||||
Reference in New Issue
Block a user