-
-
Notifications
You must be signed in to change notification settings - Fork 729
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch help modals from angular templates to use ViewComponent and St…
…imulusJs
- Loading branch information
Showing
23 changed files
with
299 additions
and
140 deletions.
There are no files selected for viewing
20 changes: 0 additions & 20 deletions
20
app/assets/javascripts/admin/utils/directives/help-modal.js.coffee
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
app/assets/javascripts/darkswarm/directives/help_modal.js.coffee
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
app/assets/javascripts/templates/admin/modals/business_address_info.html.haml
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
app/assets/javascripts/templates/admin/modals/invite_manager.html.haml
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
app/assets/javascripts/templates/admin/modals/tag_rule_help.html.haml
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
app/assets/javascripts/templates/admin/modals/terms_and_conditions_info.html.haml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
class HelpModalComponent < ViewComponent::Base | ||
def initialize(id:, close_button: true) | ||
@id = id | ||
@close_button = close_button | ||
end | ||
|
||
private | ||
|
||
def close_button_class | ||
if namespace == "admin" | ||
"red" | ||
else | ||
"primary" | ||
end | ||
end | ||
|
||
def close_button? | ||
!!@close_button | ||
end | ||
|
||
def namespace | ||
helpers.controller_path.split("/").first | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
app/components/help_modal_component/help_modal_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
%div{ id: @id, "data-controller": "help-modal", "data-action": "keyup@document->help-modal#closeIfEscapeKey" } | ||
.reveal-modal-bg.fade{ "data-help-modal-target": "background", "data-action": "click->help-modal#close" } | ||
.reveal-modal.fade.small.help-modal{ "data-help-modal-target": "modal" } | ||
= content | ||
|
||
- if close_button? | ||
.text-center | ||
%input{ class: "button icon-plus #{close_button_class}", type: 'button', value: t('js.admin.modals.got_it'), "data-action": "click->help-modal#close" } |
10 changes: 10 additions & 0 deletions
10
app/components/help_modal_component/help_modal_component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.help-modal { | ||
visibility: visible; | ||
position: fixed; | ||
top: 3em; | ||
} | ||
|
||
/* prevent arrow on selected admin menu item appearing above modal */ | ||
body.modal-open #admin-menu li.selected a::after { | ||
z-index: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 21 additions & 22 deletions
43
app/views/admin/enterprises/form/stripe_connect/_confirm_modal.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
%script{ type: "text/ng-template", id: "admin/modals/stripe_connect_confirm.html" } | ||
-# Recommended info to impart (from Stripe Connect docs): | ||
-# indicate to the user what you’re responsible for and what they’ll be expected to do. It’s particularly important to communicate: | ||
-# That they’ll need to create and maintain their Stripe account. | ||
-# That they’ll need to handle chargebacks and all customer service issues. | ||
-# Who is responsible for paying the Stripe fees. | ||
-# What, if any, fees the platform charges. | ||
-# Recommended info to impart (from Stripe Connect docs): | ||
-# indicate to the user what you’re responsible for and what they’ll be expected to do. It’s particularly important to communicate: | ||
-# That they’ll need to create and maintain their Stripe account. | ||
-# That they’ll need to handle chargebacks and all customer service issues. | ||
-# Who is responsible for paying the Stripe fees. | ||
-# What, if any, fees the platform charges. | ||
#stripe-connect-confirm | ||
.margin-bottom-30.text-center | ||
.text-big | ||
= t('.title') | ||
#stripe-connect-confirm | ||
.margin-bottom-30.text-center | ||
.text-big | ||
= t('.title') | ||
|
||
.margin-bottom-30 | ||
%p= t('.part1') | ||
.margin-bottom-30 | ||
%p= t('.part1') | ||
|
||
.margin-bottom-30 | ||
%p= t('.part2') | ||
.margin-bottom-30 | ||
%p= t('.part2') | ||
|
||
.margin-bottom-30 | ||
%p= t('.part3') | ||
.margin-bottom-30 | ||
%p= t('.part3') | ||
|
||
.text-center | ||
%a.button.icon-ok{ href: main_app.connect_admin_stripe_accounts_path(enterprise_id: @enterprise) } | ||
= t('.i_agree') | ||
%a.button.red.icon-remove{ href: 'javascript:void(0)', ng: { click: 'close()' } } | ||
= t('.cancel') | ||
.text-center | ||
%a.button.icon-ok{ href: main_app.connect_admin_stripe_accounts_path(enterprise_id: @enterprise) } | ||
= t('.i_agree') | ||
%a.button.red.icon-remove{ "data-action": "click->help-modal#close" } | ||
= t('.cancel') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Controller } from "stimulus" | ||
|
||
export default class extends Controller { | ||
static targets = ["background", "modal"] | ||
|
||
open() { | ||
this.backgroundTarget.style.display = "block" | ||
this.modalTarget.style.display = "block" | ||
|
||
setTimeout(() => { | ||
this.modalTarget.classList.add("in") | ||
this.backgroundTarget.classList.add("in") | ||
document.querySelector("body").classList.add("modal-open") | ||
}) | ||
} | ||
|
||
close() { | ||
this.modalTarget.classList.remove("in") | ||
this.backgroundTarget.classList.remove("in") | ||
document.querySelector("body").classList.remove("modal-open") | ||
|
||
setTimeout(() => { | ||
this.backgroundTarget.style.display = "none" | ||
this.modalTarget.style.display = "none" | ||
}, 200) | ||
} | ||
|
||
closeIfEscapeKey(e) { | ||
if (e.code == "Escape") { | ||
this.close() | ||
} | ||
} | ||
} |
Oops, something went wrong.