From c554d26d2244034c1d42b6b2874eba0f501c994a Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 8 Jul 2014 09:22:46 +0200 Subject: [PATCH] Adding notificacion when saving issue --- app/coffee/modules/base/confirm.coffee | 9 +++++++-- app/coffee/modules/issues/detail.coffee | 5 +++-- app/partials/views/modules/activity.jade | 12 ++++++------ app/partials/views/modules/comments.jade | 1 + 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/coffee/modules/base/confirm.coffee b/app/coffee/modules/base/confirm.coffee index d3d11284..68fb1a4b 100644 --- a/app/coffee/modules/base/confirm.coffee +++ b/app/coffee/modules/base/confirm.coffee @@ -81,17 +81,22 @@ class ConfirmService extends taiga.Service # Types: error, success selector = ".notification-message-#{type}" + @.el = angular.element(selector) body = angular.element("body") body.find(".notification-message").addClass("hidden") body.find(selector).removeClass("hidden") if @.tsem - cancelTimeout(@.tsem) + clearTimeout(@.tsem) @.tsem = timeout 4000, => body.find(selector).addClass("hidden") - delete @.sem + delete @.tsem + + @.el.on "click", ".icon-delete", (event) => + body.find(selector).addClass("hidden") + module = angular.module("taigaBase") module.service("$tgConfirm", ["$q", ConfirmService]) diff --git a/app/coffee/modules/issues/detail.coffee b/app/coffee/modules/issues/detail.coffee index d5186c75..4f3e73e7 100644 --- a/app/coffee/modules/issues/detail.coffee +++ b/app/coffee/modules/issues/detail.coffee @@ -137,7 +137,7 @@ module.controller("IssueDetailController", IssueDetailController) ## Issue Main Directive ############################################################################# -IssueDirective = ($tgrepo, $log, $location) -> +IssueDirective = ($tgrepo, $log, $location, $confirm) -> linkSidebar = ($scope, $el, $attrs, $ctrl) -> link = ($scope, $el, $attrs) -> @@ -146,6 +146,7 @@ IssueDirective = ($tgrepo, $log, $location) -> $el.on "click", ".save-issue", (event) -> $tgrepo.save($scope.issue).then -> + $confirm.notify("success") $location.path("/project/#{$scope.project.slug}/issues/#{$scope.issue.ref}") $el.on "click", ".add-comment a.button-green", (event) -> @@ -159,7 +160,7 @@ IssueDirective = ($tgrepo, $log, $location) -> return {link:link} -module.directive("tgIssueDetail", ["$tgRepo", "$log", "$tgLocation", IssueDirective]) +module.directive("tgIssueDetail", ["$tgRepo", "$log", "$tgLocation", "$tgConfirm", IssueDirective]) ############################################################################# diff --git a/app/partials/views/modules/activity.jade b/app/partials/views/modules/activity.jade index 448b910b..d896cf29 100644 --- a/app/partials/views/modules/activity.jade +++ b/app/partials/views/modules/activity.jade @@ -1,15 +1,15 @@ section.us-activity.hidden - div.activity-single(tg-comment, ng-repeat="comment in comments") + div.activity-single(tg-comment, ng-repeat="change in history") div.activity-user - a.avatar(href="", tg-bo-title="ctrl.getUserFullName(comment.user.pk)") - img(tg-bo-src="ctrl.getUserAvatar(comment.user.pk)", tg-bo-alt="ctrl.getUserFullName(comment.user.pk)") + a.avatar(href="", tg-bo-title="ctrl.getUserFullName(change.user.pk)") + img(tg-bo-src="ctrl.getUserAvatar(change.user.pk)", tg-bo-alt="ctrl.getUserFullName(change.user.pk)") div.activity-content div.activity-username - a.username(href="TODO", tg-bo-title="ctrl.getUserFullName(comment.user.pk)" tg-bo-html="ctrl.getUserFullName(comment.user.pk)") - span.date {{ comment.created_at | date:'yyyy-MM-dd HH:mm' }} + a.username(href="TODO", tg-bo-title="ctrl.getUserFullName(change.user.pk)" tg-bo-html="ctrl.getUserFullName(change.user.pk)") + span.date {{ change.created_at | date:'yyyy-MM-dd HH:mm' }} - div.activity-inner(ng-repeat="(key, change) in comment.values_diff") + div.activity-inner(ng-repeat="(key, change) in change.values_diff") div.activity-changed span(tg-bo-html="key") div.activity-fromto diff --git a/app/partials/views/modules/comments.jade b/app/partials/views/modules/comments.jade index 918dcf72..76e7255b 100644 --- a/app/partials/views/modules/comments.jade +++ b/app/partials/views/modules/comments.jade @@ -13,6 +13,7 @@ section.us-comments include comment-activity p.comment {{ comment.comment }} p.date {{ comment.created_at | date:'yyyy-MM-dd HH:mm' }} + //a.delete-comment.icon.icon-delete(href="", title="delete comment") //a.more-comments(href="", title="show more comments")