Basic issue edition

stable
Alejandro Alonso 2014-07-02 14:09:22 +02:00
parent ad8bc7d5c0
commit 347e2f5ea8
5 changed files with 57 additions and 42 deletions

View File

@ -29,7 +29,10 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide,
$routeProvider.when("/project/:pslug/issues", {templateUrl: "/partials/issues.html"}) $routeProvider.when("/project/:pslug/issues", {templateUrl: "/partials/issues.html"})
$routeProvider.when("/project/:pslug/search", {templateUrl: "/partials/search.html"}) $routeProvider.when("/project/:pslug/search", {templateUrl: "/partials/search.html"})
$routeProvider.when("/project/:pslug/issues/:issueref", $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("/login", {templateUrl: "/partials/login.html"})
$routeProvider.when("/register", {templateUrl: "/partials/register.html"}) $routeProvider.when("/register", {templateUrl: "/partials/register.html"})

View File

@ -165,7 +165,8 @@ urls = {
"project-taskboard": "/project/:project/taskboard/:sprint", "project-taskboard": "/project/:project/taskboard/:sprint",
"project-issues": "/project/:project/issues", "project-issues": "/project/:project/issues",
"project-search": "/project/:project/search", "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) -> init = ($log, $navurls) ->

View File

@ -90,17 +90,21 @@ module.controller("IssueDetailController", IssueDetailController)
## Issue Main Directive ## Issue Main Directive
############################################################################# #############################################################################
IssueDirective = ($log, $location) -> IssueDirective = ($tgrepo, $log, $location) ->
linkSidebar = ($scope, $el, $attrs, $ctrl) -> linkSidebar = ($scope, $el, $attrs, $ctrl) ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
$ctrl = $el.controller() $ctrl = $el.controller()
linkSidebar($scope, $el, $attrs, $ctrl) linkSidebar($scope, $el, $attrs, $ctrl)
$el.on "click", ".save-issue", (event) ->
$tgrepo.save($scope.issue).then ->
console.log "TODO"
return {link:link} return {link:link}
module.directive("tgIssueDetail", ["$log", "$tgLocation", IssueDirective]) module.directive("tgIssueDetail", ["$tgRepo", "$log", "$tgLocation", IssueDirective])
############################################################################# #############################################################################
@ -160,6 +164,19 @@ TagLineDirective = ($log) ->
$scope.$apply -> $scope.$apply ->
$model.$setViewValue(normalizeTags(tags)) $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 { return {
link:link, link:link,
@ -203,13 +220,13 @@ WatchersDirective = ($rootscope, $confirm) ->
</div>""") </div>""")
renderWatchers = ($scope, $el, watcherIds, editable) -> renderWatchers = ($scope, $el, watcherIds, editable) ->
console.log "renderWatchers", watcherIds
watchers = _.map(watcherIds, (watcherId) -> $scope.usersById[watcherId]) watchers = _.map(watcherIds, (watcherId) -> $scope.usersById[watcherId])
html = template({watchers: watchers, editable:editable}) html = template({watchers: watchers, editable:editable})
$el.html(html) $el.html(html)
link = ($scope, $el, $attrs, $model) -> link = ($scope, $el, $attrs, $model) ->
editable = $attrs.editable? editable = $attrs.editable?
watcherIds = []
$scope.$watch $attrs.ngModel, (watcherIds) -> $scope.$watch $attrs.ngModel, (watcherIds) ->
renderWatchers($scope, $el, watcherIds, editable) renderWatchers($scope, $el, watcherIds, editable)
@ -223,9 +240,9 @@ WatchersDirective = ($rootscope, $confirm) ->
title = "Remove watcher" title = "Remove watcher"
subtitle = $scope.usersById[watcherId].full_name_display subtitle = $scope.usersById[watcherId].full_name_display
$confirm.ask(title, subtitle).then => $confirm.ask(title, subtitle).then =>
watcherIds = _.clone($model.$modelValue, false)
watcherIds = _.pull(watcherIds, watcherId) watcherIds = _.pull(watcherIds, watcherId)
$attrs.ngModel = watcherIds $model.$setViewValue(watcherIds)
renderWatchers($scope, $el, watcherIds, editable)
$el.on "click", ".add-watcher", (event) -> $el.on "click", ".add-watcher", (event) ->
event.preventDefault() event.preventDefault()
@ -233,10 +250,11 @@ WatchersDirective = ($rootscope, $confirm) ->
$rootscope.$broadcast("watcher:add") $rootscope.$broadcast("watcher:add")
$scope.$on "watcher:added", (ctx, watcher) -> $scope.$on "watcher:added", (ctx, watcher) ->
watcherIds = _.clone($model.$modelValue, false)
watcherIds.push(watcher.id) watcherIds.push(watcher.id)
watcherIds = _.uniq(watcherIds) watcherIds = _.uniq(watcherIds)
$attrs.ngModel = watcherIds $scope.$apply ->
renderWatchers($scope, $el, watcherIds, editable) $model.$setViewValue(watcherIds)
return {link:link, require:"ngModel"} return {link:link, require:"ngModel"}

View File

@ -9,11 +9,11 @@ block content
div.main.us-detail div.main.us-detail
div.us-detail-header div.us-detail-header
include views/components/mainTitle 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 section.us-story-main-data
div.us-title div.us-title
// TODO Placeholder should be issue.subject input(type="text", ng-model="issue.subject")
input(type="text", placeholder="issue.subject")
// div.blocked-warning // div.blocked-warning
// span.icon.icon-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 // 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 // a.button.button-red.button-block(href="", title="Unblock US") Unblock
div.user-story-tags(tg-tag-line="editable", ng-model="issue.tags") div.user-story-tags(tg-tag-line, editable="true", 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...")
section.us-content section.us-content
// TODO Placeholder should be a WYSIWYG with issue.description // 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 // include views/modules/attachments
section.us-activity section.us-activity
@ -53,22 +48,22 @@ block content
span Open span Open
span.us-detail-status In progress span.us-detail-status In progress
div.us-detail-progress-bar div.issue-data
div.current-progress div.severity-data
span.tasks-completed 6/7 tasks completed span.level
span.severity-status Important
ul.points-per-role span.level-name severity
li.total div.priority-data
span.points 10 span.level
span.role total span.priority-status low
span.level-name priority
li(ng-repeat="role in roles track by role.id") div.status-data
span.points 10 span.level
span.role UX span.status-status new
span.level-name status
include views/components/assigned-to include views/components/assigned-to
section.watchers section.watchers(tg-watchers, ng-model="issue.watchers", editable="true")
include views/components/watchers
// NOTE: only for user story? // NOTE: only for user story?
// section.us-detail-settings // section.us-detail-settings
@ -76,8 +71,8 @@ block content
// a.button.button-gray(href="", title="Team requirement") Team requirement // a.button.button-gray(href="", title="Team requirement") Team requirement
// a.button.button-red(href="", title="Block") Block // a.button.button-red(href="", title="Block") Block
div.lightbox.lightbox_block.hidden div.lightbox.lightbox_block.hidden
include views/modules/lightbox_block include views/modules/lightbox_block
div.lightbox.lightbox_watchers.hidden div.lightbox.lightbox_watchers.hidden(tg-lb-add-watcher)
include views/modules/lightbox_watchers include views/modules/lightbox_watchers

View File

@ -1,4 +1,4 @@
extends dummy-layout extends layout
block head block head
title Taiga Project management web application with scrum in mind! title Taiga Project management web application with scrum in mind!
@ -9,7 +9,8 @@ block content
div.main.us-detail div.main.us-detail
div.us-detail-header div.us-detail-header
include views/components/mainTitle 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 section.us-story-main-data
div.us-title div.us-title
h2.us-title-text h2.us-title-text
@ -74,6 +75,3 @@ block content
div.lightbox.lightbox_block.hidden div.lightbox.lightbox_block.hidden
include views/modules/lightbox_block include views/modules/lightbox_block
div.lightbox.lightbox_watchers.hidden(tg-lb-add-watcher)
include views/modules/lightbox_watchers