Create Assigned to component

stable
Xavier Julián 2016-08-01 13:37:53 +02:00 committed by David Barragán Merino
parent 8e23148920
commit 3e5ab894a6
12 changed files with 143 additions and 23 deletions

View File

@ -0,0 +1,40 @@
###
# Copyright (C) 2014-2016 Taiga Agile LLC <taiga@taiga.io>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# File: assigned-to-selector.directive.coffee
###
AssignedToSelectorDirective = () ->
link = (scope, el, attrs) ->
console.log scope.assigned.toJS()
console.log scope.project.toJS()
return {
# controller: "AssignedToSelectorCtrl",
# controllerAs: "vm",
# bindToController: true,
templateUrl: "components/assigned-to/assigned-to-selector/assigned-to-selector.html",
scope: {
assigned: "=",
project: "="
},
link: link
}
AssignedToSelectorDirective.$inject = []
angular.module("taigaComponents").directive("tgAssignedToSelector", AssignedToSelectorDirective)

View File

@ -0,0 +1,4 @@
tg-lightbox-close
.assigned-to-container
h2.title(translate="COMMON.ASSIGNED_TO.TITLE_ACTION_EDIT_ASSIGNMENT")

View File

@ -0,0 +1,37 @@
###
# Copyright (C) 2014-2015 Taiga Agile LLC <taiga@taiga.io>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# File: attchment.controller.coffee
###
class AssignedToController
@.$inject = [
"tgLightboxFactory"
]
constructor: (@lightboxFactory) ->
onSelectAssignedTo: (assigned, project) ->
@lightboxFactory.create('tg-assigned-to-selector', {
"class": "lightbox lightbox-assigned-to-selector open"
"assigned": "assigned"
"project": "project"
}, {
"assigned": assigned
"project": project
})
angular.module('taigaComponents').controller('AssignedToCtrl', AssignedToController)

View File

@ -0,0 +1,35 @@
###
# Copyright (C) 2014-2016 Taiga Agile LLC <taiga@taiga.io>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# File: assigned-to.directive.coffee
###
AssignedToDirective = () ->
return {
controller: "AssignedToCtrl",
controllerAs: "vm",
bindToController: true,
templateUrl: "components/assigned-to/assigned-to.html",
scope: {
assignedTo: "="
project: "="
}
}
AssignedToDirective.$inject = []
angular.module("taigaComponents").directive("tgAssignedToComponent", AssignedToDirective)

View File

@ -0,0 +1,13 @@
img.assigned-to(
ng-if="vm.assignedTo"
tg-avatar="vm.assignedTo"
alt="{{vm.assignedTo.get('full_name_display')}}"
title="{{vm.assignedTo.get('full_name_display')}}"
ng-click="vm.onSelectAssignedTo(vm.assignedTo, vm.project)"
)
img.assigned-to(
ng-if="!vm.assignedTo"
src="/#{v}/images/unnamed.png"
alt="{{EPICS.DASHBOARD.UNASSIGNED | translate}}"
ng-click="vm.onSelectAssignedTo(vm.assignedTo, vm.project)"
)

View File

@ -6,6 +6,8 @@ tg-lightbox-close
ng-submit="vm.createEpic()"
)
fieldset
// TODO ADD COLOR SELECTOR
//- tg-color-selector(on-select-dropdown-color="vm.newEpic.color = color")
input(
type="text"
name="subject"

View File

@ -54,7 +54,6 @@ class EpicRowController
@.onUpdateEpicStatus()
onError = (data) =>
console.log data
@confirm.notify('error')
return @rs.epics.patch(id, patch).then(onSuccess, onError)

View File

@ -31,22 +31,10 @@
.sprint(
ng-if="vm.column.sprint"
)
.assigned(
ng-if="vm.column.assigned && vm.epic.get('assigned_to')"
ng-click="vm.onSelectAssignedTo()"
)
img(
tg-avatar="vm.epic.get('assigned_to_extra_info')"
alt="{{::vm.epic.getIn(['assigned_to_extra_info', 'full_name_display'])}}"
)
.assigned(
ng-if="vm.column.assigned && !vm.epic.get('assigned_to')"
ng-class="{'is-unassigned': !vm.epic.get('assigned_to')}"
ng-click="vm.onSelectAssignedTo()"
)
img(
src="/#{v}/images/unnamed.png"
alt="{{EPICS.DASHBOARD.UNASSIGNED | translate}}"
.assigned
tg-assigned-to-component(
assigned-to="vm.epic.get('assigned_to_extra_info')"
project="vm.project"
)
.status(
ng-if="vm.column.status && !vm.permissions.canEdit"

View File

@ -40,9 +40,9 @@ class EpicsDashboardController
if not project.is_epics_activated
@errorHandlingService.permissionDenied()
@.project = project
@._loadEpics()
@.loadEpics()
_loadEpics: () ->
loadEpics: () ->
projectId = @.project.id
return @resources.epics.list(projectId).then (epics) =>
@.epics = epics
@ -50,7 +50,7 @@ class EpicsDashboardController
_onCreateEpic: () ->
@lightboxService.closeAll()
@confirm.notify("success")
@._loadEpics()
@.loadEpics()
onCreateEpic: () ->
@lightboxFactory.create('tg-create-epic', {

View File

@ -18,6 +18,7 @@
ng-if="vm.project && vm.epics.size"
project="vm.project"
epics="vm.epics"
on-update-epic-status="vm.loadEpics()"
)
section.empty-epics(ng-if="!vm.epics.size")

View File

@ -27,8 +27,9 @@ EpicsTableDirective = () ->
controllerAs: "vm",
bindToController: true,
scope: {
epics: "="
project: "="
epics: "=",
project: "=",
onUpdateEpicStatus: "&"
}
}

View File

@ -94,6 +94,6 @@ mixin epicSwitch(name, model)
epic="epic"
project="vm.project"
column="vm.column"
on-update-epic-status="vm.loadEpics()"
on-update-epic-status="vm.onUpdateEpicStatus()"
permissions="vm.permissions"
)