From 32622c77bceae8cca405e6224ad0edffba9d88df Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Fri, 22 Jun 2018 13:57:21 +1000 Subject: [PATCH] Add basic help modal directive Useful for showing help text that is too long for a tool tip --- .../darkswarm/directives/help_modal.js.coffee | 10 ++++++++++ app/assets/javascripts/templates/help-modal.html.haml | 9 +++++++++ app/assets/stylesheets/darkswarm/help-modal.css.scss | 9 +++++++++ 3 files changed, 28 insertions(+) create mode 100644 app/assets/javascripts/darkswarm/directives/help_modal.js.coffee create mode 100644 app/assets/javascripts/templates/help-modal.html.haml create mode 100644 app/assets/stylesheets/darkswarm/help-modal.css.scss diff --git a/app/assets/javascripts/darkswarm/directives/help_modal.js.coffee b/app/assets/javascripts/darkswarm/directives/help_modal.js.coffee new file mode 100644 index 0000000000..6aef4f481b --- /dev/null +++ b/app/assets/javascripts/darkswarm/directives/help_modal.js.coffee @@ -0,0 +1,10 @@ +Darkswarm.directive "helpModal", ($modal, $compile, $templateCache)-> + restrict: 'A' + scope: + helpText: "@helpModal" + + link: (scope, elem, attrs, ctrl)-> + compiled = $compile($templateCache.get('help-modal.html'))(scope) + + elem.on "click", => + $modal.open(controller: ctrl, template: compiled, scope: scope, windowClass: 'help-modal small') diff --git a/app/assets/javascripts/templates/help-modal.html.haml b/app/assets/javascripts/templates/help-modal.html.haml new file mode 100644 index 0000000000..f87abd8fd4 --- /dev/null +++ b/app/assets/javascripts/templates/help-modal.html.haml @@ -0,0 +1,9 @@ +.row.help-icon + .small-12.text-center + %i.ofn-i_013-help +.row.help-text + .small-12.columns.text-center + {{ helpText }} +.row.text-center + %button.primary.small{ ng: { click: '$close()' } } + = t(:ok) diff --git a/app/assets/stylesheets/darkswarm/help-modal.css.scss b/app/assets/stylesheets/darkswarm/help-modal.css.scss new file mode 100644 index 0000000000..c26b17edc2 --- /dev/null +++ b/app/assets/stylesheets/darkswarm/help-modal.css.scss @@ -0,0 +1,9 @@ +.help-modal { + .help-text { + font-size: 1rem; + margin: 20px 0px; + } + .help-icon { + font-size: 4rem; + } +}