diff --git a/app/coffee/app.coffee b/app/coffee/app.coffee index f27ed304..a35ad503 100644 --- a/app/coffee/app.coffee +++ b/app/coffee/app.coffee @@ -29,7 +29,10 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $routeProvider.when("/project/:pslug/issues", {templateUrl: "/partials/issues.html"}) $routeProvider.when("/project/:pslug/search", {templateUrl: "/partials/search.html"}) $routeProvider.when("/project/:pslug/issues/:issueref", - {templateUrl: "/partials/issues-detail.html"}) + {templateUrl: "/partials/issues-detail.html"}) + + $routeProvider.when("/project/:pslug/issues/:issueref/edit", + {templateUrl: "/partials/issues-detail-edit.html"}) $routeProvider.when("/login", {templateUrl: "/partials/login.html"}) $routeProvider.when("/register", {templateUrl: "/partials/register.html"}) diff --git a/app/coffee/modules/base.coffee b/app/coffee/modules/base.coffee index 1945988a..eea2f275 100644 --- a/app/coffee/modules/base.coffee +++ b/app/coffee/modules/base.coffee @@ -165,7 +165,8 @@ urls = { "project-taskboard": "/project/:project/taskboard/:sprint", "project-issues": "/project/:project/issues", "project-search": "/project/:project/search", - "project-issues-detail": "/project/:project/issues/:ref" + "project-issues-detail": "/project/:project/issues/:ref", + "project-issues-detail-edit": "/project/:project/issues/:ref/edit" } init = ($log, $navurls) -> diff --git a/app/coffee/modules/issues/detail.coffee b/app/coffee/modules/issues/detail.coffee index f5377157..160af403 100644 --- a/app/coffee/modules/issues/detail.coffee +++ b/app/coffee/modules/issues/detail.coffee @@ -90,17 +90,21 @@ module.controller("IssueDetailController", IssueDetailController) ## Issue Main Directive ############################################################################# -IssueDirective = ($log, $location) -> +IssueDirective = ($tgrepo, $log, $location) -> linkSidebar = ($scope, $el, $attrs, $ctrl) -> link = ($scope, $el, $attrs) -> $ctrl = $el.controller() linkSidebar($scope, $el, $attrs, $ctrl) + $el.on "click", ".save-issue", (event) -> + $tgrepo.save($scope.issue).then -> + console.log "TODO" + return {link:link} -module.directive("tgIssueDetail", ["$log", "$tgLocation", IssueDirective]) +module.directive("tgIssueDetail", ["$tgRepo", "$log", "$tgLocation", IssueDirective]) ############################################################################# @@ -160,6 +164,19 @@ TagLineDirective = ($log) -> $scope.$apply -> $model.$setViewValue(normalizeTags(tags)) + $el.on "click", ".icon-delete", (event) -> + event.preventDefault() + target = angular.element(event.currentTarget) + value = trim(target.siblings(".tag-name").text()) + + if value.length <= 0 + return + + tags = _.clone($model.$modelValue, false) + tags = _.pull(tags, value) + + $scope.$apply -> + $model.$setViewValue(normalizeTags(tags)) return { link:link, @@ -203,13 +220,13 @@ WatchersDirective = ($rootscope, $confirm) -> """) renderWatchers = ($scope, $el, watcherIds, editable) -> + console.log "renderWatchers", watcherIds watchers = _.map(watcherIds, (watcherId) -> $scope.usersById[watcherId]) html = template({watchers: watchers, editable:editable}) $el.html(html) link = ($scope, $el, $attrs, $model) -> editable = $attrs.editable? - watcherIds = [] $scope.$watch $attrs.ngModel, (watcherIds) -> renderWatchers($scope, $el, watcherIds, editable) @@ -223,9 +240,9 @@ WatchersDirective = ($rootscope, $confirm) -> title = "Remove watcher" subtitle = $scope.usersById[watcherId].full_name_display $confirm.ask(title, subtitle).then => + watcherIds = _.clone($model.$modelValue, false) watcherIds = _.pull(watcherIds, watcherId) - $attrs.ngModel = watcherIds - renderWatchers($scope, $el, watcherIds, editable) + $model.$setViewValue(watcherIds) $el.on "click", ".add-watcher", (event) -> event.preventDefault() @@ -233,10 +250,11 @@ WatchersDirective = ($rootscope, $confirm) -> $rootscope.$broadcast("watcher:add") $scope.$on "watcher:added", (ctx, watcher) -> + watcherIds = _.clone($model.$modelValue, false) watcherIds.push(watcher.id) watcherIds = _.uniq(watcherIds) - $attrs.ngModel = watcherIds - renderWatchers($scope, $el, watcherIds, editable) + $scope.$apply -> + $model.$setViewValue(watcherIds) return {link:link, require:"ngModel"} diff --git a/app/partials/issues-detail-edit.jade b/app/partials/issues-detail-edit.jade index 0b8be0a2..3351772b 100644 --- a/app/partials/issues-detail-edit.jade +++ b/app/partials/issues-detail-edit.jade @@ -9,11 +9,11 @@ block content div.main.us-detail div.us-detail-header include views/components/mainTitle - a.button.button-green(href="", title="Edit") Edit + a.button.button-green.save-issue(href="", title="Save") Save + section.us-story-main-data div.us-title - // TODO Placeholder should be issue.subject - input(type="text", placeholder="issue.subject") + input(type="text", ng-model="issue.subject") // div.blocked-warning // span.icon.icon-warning @@ -21,16 +21,11 @@ block content // p We need Pilar to make a prototype out of this or we are not sure // a.button.button-red.button-block(href="", title="Unblock US") Unblock - div.user-story-tags(tg-tag-line="editable", ng-model="issue.tags") - div.tags-container - div.tag - span.tag-name attachments - a.icon.icon-delete.hidden(href="", title="delete tag") - input.hidden(type="text", placeholder="Write tag...") + div.user-story-tags(tg-tag-line, editable="true", ng-model="issue.tags") section.us-content // TODO Placeholder should be a WYSIWYG with issue.description - textarea(placeholder="Write a description of your issue") + textarea(placeholder="Write a description of your issue", ng-model="issue.description") // include views/modules/attachments section.us-activity @@ -53,22 +48,22 @@ block content span Open span.us-detail-status In progress - div.us-detail-progress-bar - div.current-progress - span.tasks-completed 6/7 tasks completed - - ul.points-per-role - li.total - span.points 10 - span.role total - - li(ng-repeat="role in roles track by role.id") - span.points 10 - span.role UX + div.issue-data + div.severity-data + span.level + span.severity-status Important + span.level-name severity + div.priority-data + span.level + span.priority-status low + span.level-name priority + div.status-data + span.level + span.status-status new + span.level-name status include views/components/assigned-to - section.watchers - include views/components/watchers + section.watchers(tg-watchers, ng-model="issue.watchers", editable="true") // NOTE: only for user story? // section.us-detail-settings @@ -76,8 +71,8 @@ block content // a.button.button-gray(href="", title="Team requirement") Team requirement // a.button.button-red(href="", title="Block") Block - div.lightbox.lightbox_block.hidden - include views/modules/lightbox_block + div.lightbox.lightbox_block.hidden + include views/modules/lightbox_block - div.lightbox.lightbox_watchers.hidden - include views/modules/lightbox_watchers + div.lightbox.lightbox_watchers.hidden(tg-lb-add-watcher) + include views/modules/lightbox_watchers diff --git a/app/partials/issues-detail.jade b/app/partials/issues-detail.jade index 88155452..6fea35b8 100644 --- a/app/partials/issues-detail.jade +++ b/app/partials/issues-detail.jade @@ -1,4 +1,4 @@ -extends dummy-layout +extends layout block head title Taiga Project management web application with scrum in mind! @@ -9,7 +9,8 @@ block content div.main.us-detail div.us-detail-header include views/components/mainTitle - a.button.button-green(href="", title="Edit") Edit + a.button.button-green(href="", title="Edit", tg-nav="project-issues-detail-edit:project=project.slug,ref=issue.ref") Edit + section.us-story-main-data div.us-title h2.us-title-text @@ -74,6 +75,3 @@ block content div.lightbox.lightbox_block.hidden include views/modules/lightbox_block - - div.lightbox.lightbox_watchers.hidden(tg-lb-add-watcher) - include views/modules/lightbox_watchers