From 3fcbb1a5fe216305c0e0bd99275c804fa9155f7d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Fri, 12 Mar 2021 15:38:56 +0100 Subject: [PATCH] Move files from darkswarm to shared - As this directive is now used by Darkswarm and admin, move files in shared/ folders - Needs some css variable in admin part : as question-mark-with-tooltip is used in admin part, it needs some css variable - Add own scss variables file with all needed variables for question-mark-icon. Some duplication, but now really independant and shared between both darkswarm and admin. - Remove strange border around the button, rendered by chrome when button is focused. --- .../directives/question_mark_tooltip.js.coffee | 11 ++++++----- .../question_mark_with_tooltip.html.haml | 0 .../question_mark_with_tooltip_icon.html.haml | 0 app/assets/stylesheets/admin/all.scss | 2 ++ .../{darkswarm => shared}/question-mark-icon.scss | 6 ++++++ .../stylesheets/shared/variables/variables.scss | 14 ++++++++++++++ 6 files changed, 28 insertions(+), 5 deletions(-) rename app/assets/javascripts/{darkswarm => shared}/directives/question_mark_tooltip.js.coffee (61%) rename app/assets/javascripts/templates/{ => shared}/question_mark_with_tooltip.html.haml (100%) rename app/assets/javascripts/templates/{ => shared}/question_mark_with_tooltip_icon.html.haml (100%) rename app/assets/stylesheets/{darkswarm => shared}/question-mark-icon.scss (96%) create mode 100644 app/assets/stylesheets/shared/variables/variables.scss diff --git a/app/assets/javascripts/darkswarm/directives/question_mark_tooltip.js.coffee b/app/assets/javascripts/shared/directives/question_mark_tooltip.js.coffee similarity index 61% rename from app/assets/javascripts/darkswarm/directives/question_mark_tooltip.js.coffee rename to app/assets/javascripts/shared/directives/question_mark_tooltip.js.coffee index e93a9779fe..d6f2c87178 100644 --- a/app/assets/javascripts/darkswarm/directives/question_mark_tooltip.js.coffee +++ b/app/assets/javascripts/shared/directives/question_mark_tooltip.js.coffee @@ -1,17 +1,18 @@ -Darkswarm.directive "questionMarkWithTooltip", ($tooltip)-> + +OFNShared.directive "questionMarkWithTooltip", ($tooltip)-> # We use the $tooltip service from Angular foundation to give us boilerplate # Subsequently we patch the scope, template and restrictions tooltip = $tooltip 'questionMarkWithTooltip', 'questionMarkWithTooltip', 'click' tooltip.scope = - context: "=" - tooltip.templateUrl = "question_mark_with_tooltip_icon.html" + variant: "=" + tooltip.templateUrl = "shared/question_mark_with_tooltip_icon.html" tooltip.replace = true tooltip.restrict = 'E' tooltip # This is automatically referenced via naming convention in $tooltip -Darkswarm.directive 'questionMarkWithTooltipPopup', -> +OFNShared.directive 'questionMarkWithTooltipPopup', -> restrict: 'EA' replace: true - templateUrl: 'question_mark_with_tooltip.html' + templateUrl: 'shared/question_mark_with_tooltip.html' scope: false diff --git a/app/assets/javascripts/templates/question_mark_with_tooltip.html.haml b/app/assets/javascripts/templates/shared/question_mark_with_tooltip.html.haml similarity index 100% rename from app/assets/javascripts/templates/question_mark_with_tooltip.html.haml rename to app/assets/javascripts/templates/shared/question_mark_with_tooltip.html.haml diff --git a/app/assets/javascripts/templates/question_mark_with_tooltip_icon.html.haml b/app/assets/javascripts/templates/shared/question_mark_with_tooltip_icon.html.haml similarity index 100% rename from app/assets/javascripts/templates/question_mark_with_tooltip_icon.html.haml rename to app/assets/javascripts/templates/shared/question_mark_with_tooltip_icon.html.haml diff --git a/app/assets/stylesheets/admin/all.scss b/app/assets/stylesheets/admin/all.scss index 12635372f3..bcd049a94f 100644 --- a/app/assets/stylesheets/admin/all.scss +++ b/app/assets/stylesheets/admin/all.scss @@ -48,3 +48,5 @@ @import 'components/*'; @import 'pages/*'; @import '*'; + +@import "../shared/question-mark-icon"; diff --git a/app/assets/stylesheets/darkswarm/question-mark-icon.scss b/app/assets/stylesheets/shared/question-mark-icon.scss similarity index 96% rename from app/assets/stylesheets/darkswarm/question-mark-icon.scss rename to app/assets/stylesheets/shared/question-mark-icon.scss index 82728f2ea2..6de5315c4f 100644 --- a/app/assets/stylesheets/darkswarm/question-mark-icon.scss +++ b/app/assets/stylesheets/shared/question-mark-icon.scss @@ -1,3 +1,5 @@ +@import "variables/variables"; + .unit-price { display: flex; align-items: center; @@ -26,6 +28,10 @@ background-image: none; background-color: $teal-500; + &:focus { + outline: 0; + } + &::before { @include icon-font; content: ""; diff --git a/app/assets/stylesheets/shared/variables/variables.scss b/app/assets/stylesheets/shared/variables/variables.scss new file mode 100644 index 0000000000..04e2d9eae5 --- /dev/null +++ b/app/assets/stylesheets/shared/variables/variables.scss @@ -0,0 +1,14 @@ +$padding-small: 0.5rem; +$radius-small: 0.25em; +$white: #fff; +$dynamic-blue: #3d8dd1; +$teal-500: #0096ad; +@import "../../darkswarm/style"; // Import "OFN" font +@mixin icon-font { + font-family: "OFN"; + display: inline-block; + font-weight: normal; + font-style: normal; + font-variant: normal; + text-transform: none; +} \ No newline at end of file