From 76d7629a35ec735d7339dacef927476aeb005ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Wed, 27 Aug 2014 13:37:45 +0200 Subject: [PATCH] Bug #776: Added generic notions lightbox, and create the first one for Admin//Project Values//US Points --- app/coffee/modules/common/lightboxes.coffee | 38 +++++++++++++++++++ .../admin-project-values-us-points.jade | 8 +++- .../views/components/help-notion-button.jade | 12 ++++++ app/partials/views/components/help.jade | 2 - .../help-notions/lightbox-generic-notion.jade | 12 ++++++ ...notion-admin-project-values-us-points.jade | 12 ++++++ .../{help.scss => help-notion-button.scss} | 0 app/styles/main.scss | 2 +- 8 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 app/partials/views/components/help-notion-button.jade delete mode 100644 app/partials/views/components/help.jade create mode 100644 app/partials/views/modules/help-notions/lightbox-generic-notion.jade create mode 100644 app/partials/views/modules/help-notions/lightbox-notion-admin-project-values-us-points.jade rename app/styles/components/{help.scss => help-notion-button.scss} (100%) diff --git a/app/coffee/modules/common/lightboxes.coffee b/app/coffee/modules/common/lightboxes.coffee index 2118d100..19c02622 100644 --- a/app/coffee/modules/common/lightboxes.coffee +++ b/app/coffee/modules/common/lightboxes.coffee @@ -513,3 +513,41 @@ WatchersLightboxDirective = ($repo, lightboxService, lightboxListNavigationServi } module.directive("tgLbWatchers", ["$tgRepo", "lightboxService", "lightboxListNavigationService", WatchersLightboxDirective]) + +############################################################################# +## Notion Lightbox Directive +############################################################################# + +# Lightbox +NotionLightboxDirective = (lightboxService) -> + link = ($scope, $el, $attrs, $model) -> + $scope.$on "notion:open", (event, lightboxId) -> + if $el.attr("id") == lightboxId + lightboxService.open($el) + + $el.on "click", ".button-green", (event) -> + lightboxService.close($el) + + $scope.$on "$destroy", -> + $el.off() + + return {link:link} + +module.directive("tgLbNotion", ["lightboxService", NotionLightboxDirective]) + + +# Button +NotionButtonDirective = ($log, $rootScope) -> + link = ($scope, $el, $attrs, $model) -> + if not $attrs.tgLbNotionButton? + return $log.error "NotionButtonDirective: the directive need the id of the notion lightbox" + + $el.on "click", -> + $rootScope.$broadcast("notion:open", $attrs.tgLbNotionButton) + + $scope.$on "$destroy", -> + $el.off() + + return {link:link} + +module.directive("tgLbNotionButton", ["$log", "$rootScope", NotionButtonDirective]) diff --git a/app/partials/admin-project-values-us-points.jade b/app/partials/admin-project-values-us-points.jade index 85b2931d..a92b4de9 100644 --- a/app/partials/admin-project-values-us-points.jade +++ b/app/partials/admin-project-values-us-points.jade @@ -16,11 +16,15 @@ block content section.main.admin-roles header include views/components/mainTitle - - var helpText = "About User Story (US) Points: Most people start off with 1 point = 1 man day of effort. If you're new to scrum & agile start there. After the first week if you and your team expected to accomplish 25 points (i.e. 5 people 5 full days) and only got half done, learn from your findings, and adjust expectations for the following week. By doing so you'll learn your teams true 'velocity.'" - include views/components/help + + - var helpLightboxId = "notion-admin-project-values-us-points" + include views/components/help-notion-button div.project-values-options a.button.button-green.show-add-new(href="", title="Add New") span Add new point include views/modules/admin/project-points + + div.hidden.lightbox.lightbox-generic-notion(id="notion-admin-project-values-us-points", tg-lb-notion) + include views/modules/help-notions/lightbox-notion-admin-project-values-us-points diff --git a/app/partials/views/components/help-notion-button.jade b/app/partials/views/components/help-notion-button.jade new file mode 100644 index 00000000..510a7fbd --- /dev/null +++ b/app/partials/views/components/help-notion-button.jade @@ -0,0 +1,12 @@ +//- NOTE: - Add a lightbox-notion at the end of parent template. Ex: +//- +//- div.hide.lightbox.lightbox-generic-notion(id="notion-admin-project-values-us-points", +//- tg-lb-notion) +//- include views/modules/help-notions/lightbox-notion-admin-project-values-us-points +//- +//- - Defined variable 'helpLightboxId' in parent template. Ex: +//- +//- - var helpLightboxId = "admin-project-values-us-points" +//- include views/components/help + +a.icon.icon-idea.help(href="", title="You need some help?", tg-lb-notion-button=helpLightboxId) diff --git a/app/partials/views/components/help.jade b/app/partials/views/components/help.jade deleted file mode 100644 index 8359abec..00000000 --- a/app/partials/views/components/help.jade +++ /dev/null @@ -1,2 +0,0 @@ -//Defined variable 'helpText' in parent template -a.icon.icon-idea.help(href="", title=helpText) diff --git a/app/partials/views/modules/help-notions/lightbox-generic-notion.jade b/app/partials/views/modules/help-notions/lightbox-generic-notion.jade new file mode 100644 index 00000000..6e4222e7 --- /dev/null +++ b/app/partials/views/modules/help-notions/lightbox-generic-notion.jade @@ -0,0 +1,12 @@ +a.close(href="", title="close") + span.icon.icon-delete + +section + h2.title + block title + + block content + + div.delete-options + a.button.button-green(href="", title="Accept") + span Accept diff --git a/app/partials/views/modules/help-notions/lightbox-notion-admin-project-values-us-points.jade b/app/partials/views/modules/help-notions/lightbox-notion-admin-project-values-us-points.jade new file mode 100644 index 00000000..e8e70206 --- /dev/null +++ b/app/partials/views/modules/help-notions/lightbox-notion-admin-project-values-us-points.jade @@ -0,0 +1,12 @@ +extends lightbox-generic-notion + +block title + About User Story (US) Points: + +block content + p + | Most people start off with 1 point = 1 man day of effort. If you're new to scrum & agile start there. + p + | After the first week if you and your team expected to accomplish 25 points (i.e. 5 people 5 full days) + | and only got half done, learn from your findings, and adjust expectations for the following week. + | By doing so you'll learn your teams true 'velocity.' diff --git a/app/styles/components/help.scss b/app/styles/components/help-notion-button.scss similarity index 100% rename from app/styles/components/help.scss rename to app/styles/components/help-notion-button.scss diff --git a/app/styles/main.scss b/app/styles/main.scss index 63a1effa..565e5497 100755 --- a/app/styles/main.scss +++ b/app/styles/main.scss @@ -44,7 +44,7 @@ $prefix-for-spec: true; @import 'components/select-color'; @import 'components/loader'; @import 'components/spinner'; -@import 'components/help'; +@import 'components/help-notion-button'; //################################################# // Modules