1)for(o=0,p=m.length;o1&&(b=_.map(m,function(t){return function(e){return{us_id:e.id,order:t.order[e.id]}}}(this)))}}else S=0;for(l=u=0,f=t.length;u1&&r<=1?(this.zoomLoading=!0,this.loadUserstories().then(function(t){return function(){return t.zoomLoading=!1,t.kanbanUserstoriesService.resetFolds()}}(this))):void 0)},e.prototype.filtersReloadContent=function(){return this.loadUserstories().then(function(t){return function(){var e,r,n,i,o;if(n=_.difference(t.kanbanUserstoriesService.archivedStatus,t.kanbanUserstoriesService.statusHide),n.length){for(i=[],e=0,r=n.length;e0&&(r.assigned_to=n[0]),0===n.length&&(r.assigned_to=null),this.kanbanUserstoriesService.replaceModel(r),i=this.repo.save(r),i.then(null,function(){return console.log("FAIL")})},e.prototype.refreshTagsColors=function(){return this.rs.projects.tagsColors(this.scope.projectId).then(function(t){return function(e){return t.scope.project.tags_colors=e._attrs}}(this))},e.prototype.loadUserstories=function(){var t,e;return t={status__is_archived:!1},this.zoomLevel>1&&(t.include_attachments=1,t.include_tasks=1),t=_.merge(t,this.location.search()),e=this.rs.userstories.listAll(this.scope.projectId,t).then(function(t){return function(e){return t.kanbanUserstoriesService.init(t.scope.project,t.scope.usersById),t.kanbanUserstoriesService.set(e),h(t.scope,function(){return t.scope.$broadcast("userstories:loaded",e)}),e}}(this)),e.then(function(t){return function(){return t.scope.$broadcast("redraw:wip")}}(this)),e},e.prototype.loadUserStoriesForStatus=function(t,e){var r,n;if(r=this.location.search().status,!r||(r=r.split(",").map(function(t){return parseInt(t,10)}),r.indexOf(e)!==-1))return n={status:e,include_attachments:!0,include_tasks:!0},n=_.merge(n,this.location.search()),this.rs.userstories.listAll(this.scope.projectId,n).then(function(t){return function(r){return t.scope.$broadcast("kanban:shown-userstories-for-status",e,r),r}}(this))},e.prototype.hideUserStoriesForStatus=function(t,e){return this.scope.$broadcast("kanban:hidden-userstories-for-status",e)},e.prototype.loadKanban=function(){return this.q.all([this.refreshTagsColors(),this.loadUserstories()])},e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),t.is_kanban_activated||this.errorHandlingService.permissionDenied(),this.scope.projectId=t.id,this.scope.project=t,this.scope.projectId=t.id,this.scope.points=_.sortBy(t.points,"order"),this.scope.pointsById=u(t.points,function(t){return t.id}),this.scope.usStatusById=u(t.us_statuses,function(t){return t.id}),this.scope.usStatusList=_.sortBy(t.us_statuses,"order"),this.scope.$emit("project:loaded",t),t},e.prototype.initializeSubscription=function(){var t;return t="changes.project."+this.scope.projectId+".userstories",this.events.subscribe(this.scope,t,c(500,function(t){return function(e){return t.loadUserstories()}}(this)))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),this.fillUsersAndRoles(t.members,t.roles),this.initializeSubscription(),this.loadKanban(),this.generateFilters()},e.prototype.prepareBulkUpdateData=function(t,e){return null==e&&(e="kanban_order"),_.map(t,function(t){return{us_id:t.id,order:t[e]}})},e.prototype.moveUs=function(t,e,r,n){var i,o;return this.cleanSelectedUss(),e=_.map(e,function(t){return function(e){return t.kanbanUserstoriesService.getUsModel(e.id)}}(this)),i=this.kanbanUserstoriesService.move(e,r,n),o=this.rs.userstories.bulkUpdateKanbanOrder(this.scope.projectId,r,i.bulkOrders),o.then(function(t){return function(){var r,n,s;return r={headers:{"set-orders":JSON.stringify(i.setOrders)}},n={include_attachments:!0,include_tasks:!0},s=_.map(e,function(e){return t.repo.save(e,!0,n,r,!0)}),o=t.q.all(s),o.then(function(e){var r,n;
return r=e[1],r&&r["taiga-info-order-updated"]&&(n=JSON.parse(r["taiga-info-order-updated"]),t.kanbanUserstoriesService.assignOrders(n)),t.scope.$broadcast("redraw:wip"),t.generateFilters(),t.isFilterDataTypeSelected("status")&&t.filtersReloadContent(),o})}}(this))},e}(l(f.Controller,f.PageMixin,f.FiltersMixin,f.UsFiltersMixin)),p.controller("KanbanController",r),n=function(t,e){var r;return r=function(t,e,r){var n;return n=e.find(".kanban-table-body"),n.on("scroll",function(t){var r,n;return n=angular.element(t.currentTarget),r=e.find(".kanban-table-header .kanban-table-inner"),r.css("left",-1*n.scrollLeft())}),t.$on("$destroy",function(){return e.off()})},{link:r}},p.directive("tgKanban",["$tgRepo","$rootScope",n]),t=function(t,e,r){var n,i,o;return o=e.instant("KANBAN.ACTION_SHOW_ARCHIVED"),n=e.instant("KANBAN.ACTION_HIDE_ARCHIVED"),i=function(e,i,s){var a,c;return c=e.$eval(s.tgKanbanArchivedStatusHeader),a=!0,r.addArchivedStatus(c.id),r.hideStatus(c.id),e["class"]="icon-watch",e.title=o,i.on("click",function(i){return a=!a,e.$apply(function(){return a?(e["class"]="icon-watch",e.title=o,t.$broadcast("kanban:hide-userstories-for-status",c.id),r.hideStatus(c.id)):(e["class"]="icon-unwatch",e.title=n,t.$broadcast("kanban:show-userstories-for-status",c.id),r.showStatus(c.id))})}),e.$on("$destroy",function(){return i.off()})},{link:i}},p.directive("tgKanbanArchivedStatusHeader",["$rootScope","$translate","tgKanbanUserstories",t]),e=function(t,e){var r,n;return n=[],r=function(r,n,i){var o,s,a;return o=t.instant("KANBAN.HIDDEN_USER_STORIES"),s=r.$eval(i.tgKanbanArchivedStatusIntro),n.text(o),a=function(t){return t?n.text(""):n.text(o)},r.$on("kanban:us:move",function(t,r,n,i,o){var s;return s=!!e.getStatus(i).length,a(s)}),r.$on("kanban:shown-userstories-for-status",function(t,r,n){var i;if(r===s.id)return e.deleteStatus(r),e.add(n),i=!!e.getStatus(r).length,a(i)}),r.$on("kanban:hidden-userstories-for-status",function(t,e){if(e===s.id)return a(!1)}),r.$on("$destroy",function(){return n.off()})},{link:r}},p.directive("tgKanbanArchivedStatusIntro",["$translate","tgKanbanUserstories",e]),i=function(t,e){var r;return r=function(r,n,i){var o,s;return r.foldStatus=function(e){r.folds[e.id]=!r.folds[e.id],t.kanban.storeStatusColumnModes(r.projectId,r.folds),s()},s=function(){var t,e;return t=_.map(r.usStatusList,function(t){return r.folds[t.id]?40:310}),e=_.reduce(t,function(t,e){return t+e}),n.find(".kanban-table-inner").css("width",e)},o=r.$watch("usByStatus",function(n){if(n.size)return r.folds=t.kanban.getStatusColumnModes(e.project.get("id")),s(),o()})},{link:r}},p.directive("tgKanbanSquishColumn",["$tgResources","tgProjectService",i]),o=function(t){var e;return e=function(e,r,n){var i,o;return o=e.$eval(n.tgKanbanWipLimit),i=function(e){return function(){return r.find(".kanban-wip-limit").remove(),t(function(){var t;if(t=r.find("tg-card")[o.wip_limit])return angular.element(t).before("")})}}(this),o&&!o.is_archived&&(e.$on("redraw:wip",i),e.$on("kanban:us:move",i),e.$on("usform:new:success",i),e.$on("usform:bulk:success",i)),e.$on("$destroy",function(){return r.off()})},{link:e}},p.directive("tgKanbanWipLimit",["$timeout",o])}.call(this),function(){var t,e,r,n,i,o,s,a,c;s=this.taiga,n=this.taiga.mixOf,c=this.taiga.toggleText,o=this.taiga.scopeDefer,e=this.taiga.bindOnce,r=this.taiga.groupBy,a=this.taiga.timeout,i=angular.module("taigaKanban"),t=function(t,e,r){var n;return n=function(t,e,n){var i;return i=t.$watch("usByStatus",function(n){var o,s,a,c,u,l,p;if(n&&n.size&&(i(),t.project.my_permissions.indexOf("modify_us")>-1))return u=null,c=null,p=e,s=function(t){return t.scope().$destroy(),t.off(),t.remove()},o=_.map(e.find(".task-column"),function(t){return t}),a=dragula(o,{copySortSource:!1,copy:!1,moves:function(t){return $(t).is("tg-card")}}),a.on("drag",function(t){return window.dragMultiple.start(t,o)}),a.on("cloned",function(t,e){return $(t).addClass("multiple-drag-mirror")}),a.on("dragend",function(e){var n,i,o,a,l,p,h,f;return h=$(e).parent(),u=h.scope(),p=u.s.id,n=window.dragMultiple.stop(),n.length||(n=[e]),o=n[0],a=$(o).index(),l=u.s.id,f=_.map(n,function(t){return $(t).scope().us}),i=_.map(f,function(t){return{id:t.get("id"),oldStatusId:t.getIn(["model","status"])}}),t.$apply(function(){return _.each(f,function(t){return function(t,e){var r,i;if(r=t.getIn(["model","status"]),i=l===r,!i)return c=$(n[e]),s(c)}}(this)),r.$broadcast("kanban:us:move",i,l,a)})}),l=autoScroll(o,{margin:100,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&a.dragging}}),t.$on("$destroy",function(){return e.off(),a.destroy()})})},{link:n}},i.directive("tgKanbanSortable",["$tgRepo","$tgResources","$rootScope",t])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;u=this.taiga,a=this.taiga.mixOf,l=this.taiga.toString,s=this.taiga.joinStr,o=this.taiga.groupBy,i=this.taiga.bindOnce,n=this.taiga.bindMethods,c=angular.module("taigaEpics"),t=function(t){function e(t,e,r,i,o,s,a,c,u,l,p,h,f,d,g,m,v){var y;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=i,this.rs=o,this.rs2=s,this.params=a,this.q=c,this.location=u,this.log=l,this.appMetaService=p,this.analytics=h,this.navUrls=f,this.translate=d,this.modelTransform=g,this.errorHandlingService=m,this.projectService=v,n(this),this.scope.epicRef=this.params.epicref,this.scope.sectionName=this.translate.instant("EPIC.SECTION_NAME"),this.initializeEventHandlers(),y=this.loadInitialData(),y.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),y.then(null,this.onInitialDataError.bind(this))}return p(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgAnalytics","$tgNavUrls","$translate","$tgQueueModelTransformation","tgErrorHandlingService","tgProjectService"],e.prototype._setMeta=function(){var t,e,r;return r=this.translate.instant("EPIC.PAGE_TITLE",{epicRef:"#"+this.scope.epic.ref,epicSubject:this.scope.epic.subject,projectName:this.scope.project.name}),t=this.translate.instant("EPIC.PAGE_DESCRIPTION",{epicStatus:(null!=(e=this.scope.statusById[this.scope.epic.status])?e.name:void 0)||"--",epicDescription:angular.element(this.scope.epic.description_html||"").text()}),this.appMetaService.setAll(r,t)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("attachment:create",function(t){return function(){return t.analytics.trackEvent("attachment","create","create attachment on epic",1)}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadEpic()}}(this)),this.scope.$on("custom-attributes-values:edit",function(t){return function(){return t.rootscope.$broadcast("object:updated")}}(this))},e.prototype.initializeOnDeleteGoToUrl=function(){var t;return t={project:this.scope.project.slug},this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-epics",t)},e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.immutableProject=this.projectService.project,this.scope.$emit("project:loaded",t),this.scope.statusList=t.epic_statuses,this.scope.statusById=o(t.epic_statuses,function(t){return t.id}),t},e.prototype.loadEpic=function(){return this.rs.epics.getByRef(this.scope.projectId,this.params.epicref).then(function(t){return function(e){var r,n,i;if(t.scope.epic=e,t.scope.immutableEpic=Immutable.fromJS(e._attrs),t.scope.epicId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"epic"),null!=(null!=(n=t.scope.epic.neighbors.previous)?n.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.epic.neighbors.previous.ref},t.scope.previousUrl=t.navUrls.resolve("project-epics-detail",r)),null!=(null!=(i=t.scope.epic.neighbors.next)?i.ref:void 0))return r={project:t.scope.project.slug,ref:t.scope.epic.neighbors.next.ref},t.scope.nextUrl=t.navUrls.resolve("project-epics-detail",r)}}(this))},e.prototype.loadUserstories=function(){return this.rs2.userstories.listInEpic(this.scope.epicId).then(function(t){return function(e){return t.scope.userstories=e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),this.fillUsersAndRoles(t.members,t.roles),this.loadEpic().then(function(t){return function(){return t.loadUserstories()}}(this))},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.upvote(this.scope.epicId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.downvote(this.scope.epicId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.watch(this.scope.epicId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadEpic(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.epics.unwatch(this.scope.epicId).then(e,t)},e.prototype.onSelectColor=function(t){var e,r,n;return r=function(t){return function(){return t.rootscope.$broadcast("object:updated"),t.confirm.notify("success")}}(this),e=function(t){return function(){return t.confirm.notify("error")}}(this),n=this.modelTransform.save(function(e){return e.color=t,e}),n.then(r,e)},e}(a(u.Controller,u.PageMixin)),c.controller("EpicDetailController",t),r=function(t,e){var r,n;return n=t.get("common/components/status-display.html",!0),r=function(t,r,i){var o;return o=function(i){var o,s;return s=t.statusById[i.status],o=n({is_closed:s.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){if(null!=t)return o(t)}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},c.directive("tgEpicStatusDisplay",["$tgTemplate","$compile",r]),e=function(t,e,r,n,i,o,s,a){var c,u;return u=a.get("common/components/status-button.html",!0),c=function(e,s,a,c){var l,p,h;return l=function(){return e.project.my_permissions.indexOf("modify_epic")!==-1},p=function(t){return function(t){var r,n;return n=e.statusById[t.status],r=o(u({status:n,statuses:e.statusList,editable:l()}))(e),s.html(r)}}(this),h=function(e){var o,a,c,u;return o=n().target(s).start(),u=i.save(function(t){return t.status=e,t}),c=function(){return t.$broadcast("object:updated"),o.finish()},a=function(){return r.notify("error"),o.finish()},u.then(c,a)},s.on("click",".js-edit-status",function(t){if(t.preventDefault(),t.stopPropagation(),l())return s.find(".pop-status").popover().open()}),s.on("click",".status",function(t){var e;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),$.fn.popover().closeAll(),h(e.data("status-id"))}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.status:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return s.off()})},{link:c,restrict:"EA",require:"ngModel"}},c.directive("tgEpicStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$compile","$translate","$tgTemplate",e])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p,h,f,d,g=function(t,e){function r(){this.constructor=t}for(var n in e)m.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},m={}.hasOwnProperty;f=this.taiga,p=this.taiga.mixOf,d=this.taiga.toString,l=this.taiga.joinStr,u=this.taiga.groupBy,c=this.taiga.bindOnce,a=this.taiga.bindMethods,h=angular.module("taigaIssues"),t=function(t){function e(t,e,r,n,i,o,s,c,u,l,p,h,f,d,g,m){var v;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=o,this.q=s,this.location=c,this.log=u,this.appMetaService=l,this.analytics=p,this.navUrls=h,this.translate=f,this.modelTransform=d,this.errorHandlingService=g,this.projectService=m,a(this),this.scope.issueRef=this.params.issueref,this.scope.sectionName=this.translate.instant("ISSUES.SECTION_NAME"),this.initializeEventHandlers(),v=this.loadInitialData(),v.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),v.then(null,this.onInitialDataError.bind(this))}return g(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgAnalytics","$tgNavUrls","$translate","$tgQueueModelTransformation","tgErrorHandlingService","tgProjectService"],e.prototype._setMeta=function(){var t,e,r,n,i,o;return o=this.translate.instant("ISSUE.PAGE_TITLE",{issueRef:"#"+this.scope.issue.ref,issueSubject:this.scope.issue.subject,projectName:this.scope.project.name}),t=this.translate.instant("ISSUE.PAGE_DESCRIPTION",{issueStatus:(null!=(e=this.scope.statusById[this.scope.issue.status])?e.name:void 0)||"--",issueType:(null!=(r=this.scope.typeById[this.scope.issue.type])?r.name:void 0)||"--",issueSeverity:(null!=(n=this.scope.severityById[this.scope.issue.severity])?n.name:void 0)||"--",issuePriority:(null!=(i=this.scope.priorityById[this.scope.issue.priority])?i.name:void 0)||"--",issueDescription:angular.element(this.scope.issue.description_html||"").text()}),this.appMetaService.setAll(o,t)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("attachment:create",function(t){return function(){return t.analytics.trackEvent("attachment","create","create attachment on issue",1)}}(this)),this.scope.$on("promote-issue-to-us:success",function(t){return function(){return t.analytics.trackEvent("issue","promoteToUserstory","promote issue to userstory",1),t.rootscope.$broadcast("object:updated"),t.loadIssue()}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadIssue()}}(this)),this.scope.$on("custom-attributes-values:edit",function(t){return function(){return t.rootscope.$broadcast("object:updated")}}(this))},e.prototype.initializeOnDeleteGoToUrl=function(){var t;return t={project:this.scope.project.slug},this.scope.project.is_issues_activated?this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-issues",t):this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",t)},e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),this.scope.statusList=t.issue_statuses,this.scope.statusById=u(t.issue_statuses,function(t){return t.id}),this.scope.typeById=u(t.issue_types,function(t){return t.id}),this.scope.typeList=_.sortBy(t.issue_types,"order"),this.scope.severityList=t.severities,this.scope.severityById=u(t.severities,function(t){return t.id}),this.scope.priorityList=t.priorities,this.scope.priorityById=u(t.priorities,function(t){return t.id}),t},e.prototype.loadIssue=function(){return this.rs.issues.getByRef(this.scope.projectId,this.params.issueref).then(function(t){return function(e){var r,n,i;if(t.scope.issue=e,t.scope.issueId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"issue"),null!=(null!=(n=t.scope.issue.neighbors.previous)?n.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.issue.neighbors.previous.ref},t.scope.previousUrl=t.navUrls.resolve("project-issues-detail",r)),null!=(null!=(i=t.scope.issue.neighbors.next)?i.ref:void 0))return r={project:t.scope.project.slug,ref:t.scope.issue.neighbors.next.ref},t.scope.nextUrl=t.navUrls.resolve("project-issues-detail",r)}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),this.fillUsersAndRoles(t.members,t.roles),this.loadIssue()},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.upvote(this.scope.issueId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.downvote(this.scope.issueId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.watch(this.scope.issueId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadIssue(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.issues.unwatch(this.scope.issueId).then(e,t)},e}(p(f.Controller,f.PageMixin)),h.controller("IssueDetailController",t),i=function(t,e){var r,n;return n=t.get("common/components/status-display.html",!0),r=function(t,r,i){var o;return o=function(i){var o,s;return s=t.statusById[i.status],o=n({is_closed:s.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){if(null!=t)return o(t)}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},h.directive("tgIssueStatusDisplay",["$tgTemplate","$compile",i]),n=function(t,e,r,n,i,o,s){var a,c;return c=o.get("common/components/status-button.html",!0),a=function(e,o,a,u){var l,p,h;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},p=function(t){return function(t){var r,n;return n=e.statusById[t.status],r=c({status:n,statuses:e.statusList,editable:l()}),r=s(r)(e),o.html(r)}}(this),h=function(e){var s,a,c,u;return $.fn.popover().closeAll(),s=n().target(o).start(),u=i.save(function(t){return t.status=e,t}),c=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},u.then(c,a)},o.on("click",".js-edit-status",function(t){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-status").popover().open()}),o.on("click",".status",function(t){var e;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),h(e.data("status-id"))}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.status:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},h.directive("tgIssueStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",n]),o=function(t,e,r,n,i,o,s){var a,c;return c=o.get("issue/issue-type-button.html",!0),a=function(e,o,a,u){var l,p,h;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},p=function(t){return function(t){var r,n;return n=e.typeById[t.type],r=c({type:n,typees:e.typeList,editable:l()}),r=s(r)(e),o.html(r)}}(this),h=function(e){var s,a,c,u;return $.fn.popover().closeAll(),s=n().target(o.find(".level-name")).start(),u=i.save(function(t){return t.type=e,t}),c=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},u.then(c,a)},o.on("click",".type-data",function(t){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-type").popover().open()}),o.on("click",".type",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),r=e.data("type-id"),h(r)}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.type:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},h.directive("tgIssueTypeButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",o]),r=function(t,e,r,n,i,o,s){var a,c;return c=o.get("issue/issue-severity-button.html",!0),a=function(e,o,a,u){var l,p,h;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},p=function(t){return function(t){var r,n;return n=e.severityById[t.severity],r=c({severity:n,severityes:e.severityList,editable:l()}),r=s(r)(e),o.html(r)}}(this),h=function(e){var s,a,c,u;return $.fn.popover().closeAll(),s=n().target(o.find(".level-name")).start(),u=i.save(function(t){return t.severity=e,t}),c=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},u.then(c,a)},o.on("click",".severity-data",function(t){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-severity").popover().open()}),o.on("click",".severity",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return r=angular.element(t.currentTarget),e=r.data("severity-id"),h(e)}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.severity:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},h.directive("tgIssueSeverityButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",r]),e=function(t,e,r,n,i,o,s){var a,c;return c=o.get("issue/issue-priority-button.html",!0),a=function(e,o,a,u){var l,p,h;return l=function(){return e.project.my_permissions.indexOf("modify_issue")!==-1},p=function(t){return function(t){var r,n;return n=e.priorityById[t.priority],r=c({priority:n,priorityes:e.priorityList,editable:l()}),r=s(r)(e),o.html(r)}}(this),h=function(e){var s,a,c,u;return $.fn.popover().closeAll(),s=n().target(o.find(".level-name")).start(),u=i.save(function(t){return t.priority=e,t}),c=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},u.then(c,a)},o.on("click",".priority-data",function(t){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-priority").popover().open()}),o.on("click",".priority",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return r=angular.element(t.currentTarget),e=r.data("priority-id"),h(e)}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.priority:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},h.directive("tgIssuePriorityButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",e]),s=function(t,e,r,n){var i;return i=function(i,o,s,a){var c;return c=function(n){return function(n,i){var o,s,a;return o={generated_from_issue:n.id,project:n.project,subject:n.subject,description:n.description,tags:n.tags,is_blocked:n.is_blocked,blocked_note:n.blocked_note,due_date:n.due_date},a=function(){return i.finish(),r.notify("success"),t.$broadcast("promote-issue-to-us:success")},s=function(){return i.finish(),r.notify("error")},e.create("userstories",o).then(a,s)}}(this),o.on("click","a",function(t){var e,i,o,s;return t.preventDefault(),e=a.$modelValue,s=n.instant("ISSUES.CONFIRM_PROMOTE.TITLE"),i=n.instant("ISSUES.CONFIRM_PROMOTE.MESSAGE"),o=e.subject,r.ask(s,o,i).then(function(t){return function(t){return c(e,t)}}(this))}),i.$on("$destroy",function(){return o.off()})},{restrict:"AE",require:"ngModel",templateUrl:"issue/promote-issue-to-us-button.html",link:i}},h.directive("tgPromoteIssueToUsButton",["$rootScope","$tgRepo","$tgConfirm","$translate",s])}.call(this),function(){var t,e,r,n,i,o,s,a=[].indexOf||function(t){for(var e=0,r=this.length;e0}),n=_.map(o.assigned_to,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.full_name||"Unassigned",t}),s=_.map(o.owners,function(t){return t.id=t.id.toString(),t.name=t.full_name,t}),c=_.map(o.roles,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.name||"Unassigned",t}),e.selectedFilters=[],t.status&&(u=e.formatSelectedFilters("status",p,t.status),e.selectedFilters=e.selectedFilters.concat(u)),t.tags&&(u=e.formatSelectedFilters("tags",h,t.tags),e.selectedFilters=e.selectedFilters.concat(u)),t.assigned_to&&(u=e.formatSelectedFilters("assigned_to",n,t.assigned_to),
e.selectedFilters=e.selectedFilters.concat(u)),t.owner&&(u=e.formatSelectedFilters("owner",s,t.owner),e.selectedFilters=e.selectedFilters.concat(u)),t.type&&(u=e.formatSelectedFilters("type",d,t.type),e.selectedFilters=e.selectedFilters.concat(u)),t.severity&&(u=e.formatSelectedFilters("severity",l,t.severity),e.selectedFilters=e.selectedFilters.concat(u)),t.priority&&(u=e.formatSelectedFilters("priority",a,t.priority),e.selectedFilters=e.selectedFilters.concat(u)),t.role&&(u=e.formatSelectedFilters("role",c,t.role),e.selectedFilters=e.selectedFilters.concat(u)),e.filterQ=t.q,e.filters=[{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.TYPE"),dataType:"type",content:d},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.SEVERITY"),dataType:"severity",content:l},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.PRIORITIES"),dataType:"priority",content:a},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.STATUS"),dataType:"status",content:p},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"),dataType:"tags",content:h,hideEmpty:!0,totalTaggedElements:f.length},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"),dataType:"assigned_to",content:n},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.ROLE"),dataType:"role",content:c},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.CREATED_BY"),dataType:"owner",content:s}],e.customFilters=[],_.forOwn(i,function(t,r){return e.customFilters.push({id:r,name:r,filter:t})})}}(this))},e.prototype.initializeSubscription=function(){var t;return t="changes.project."+this.scope.projectId+".issues",this.events.subscribe(this.scope,t,s(500,function(t){return function(e){return t.loadIssues()}}(this)))},e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),t.is_issues_activated||this.errorHandlingService.permissionDenied(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),this.scope.issueStatusById=a(t.issue_statuses,function(t){return t.id}),this.scope.issueStatusList=_.sortBy(t.issue_statuses,"order"),this.scope.severityById=a(t.severities,function(t){return t.id}),this.scope.severityList=_.sortBy(t.severities,"order"),this.scope.priorityById=a(t.priorities,function(t){return t.id}),this.scope.priorityList=_.sortBy(t.priorities,"order"),this.scope.issueTypes=_.sortBy(t.issue_types,"order"),this.scope.issueTypeById=a(t.issue_types,function(t){return t.id}),t},e.prototype.loadIssuesRequests=0,e.prototype.loadIssues=function(){var t,e;return t=this.location.search(),e=this.rs.issues.list(this.scope.projectId,t),this.loadIssuesRequests+=1,e.index=this.loadIssuesRequests,e.then(function(t){return function(r){return e.index===t.loadIssuesRequests&&(t.scope.issues=r.models,t.scope.page=r.current,t.scope.count=r.count,t.scope.paginatedBy=r.paginatedBy),r}}(this)),e},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),this.fillUsersAndRoles(t.members,t.roles),this.initializeSubscription(),this.generateFilters(),this.loadIssues()},e.prototype.addNewIssue=function(){return this.rootscope.$broadcast("issueform:new",this.scope.project)},e.prototype.addIssuesInBulk=function(){return this.rootscope.$broadcast("issueform:bulk",this.scope.projectId)},e.prototype.upVoteIssue=function(t){var e,r;return this.voting=t,r=function(t){return function(){return t.loadIssues(),t.voting=null}}(this),e=function(t){return function(){return t.confirm.notify("error"),t.voting=null}}(this),this.rs.issues.upvote(t).then(r,e)},e.prototype.downVoteIssue=function(t){var e,r;return this.voting=t,r=function(t){return function(){return t.loadIssues(),t.voting=null}}(this),e=function(t){return function(){return t.confirm.notify("error"),t.voting=null}}(this),this.rs.issues.downvote(t).then(r,e)},e.prototype.getOrderBy=function(){return _.isString(this.location.search().order_by)?this.location.search().order_by:"created_date"},e}(u(h.Controller,h.PageMixin,h.FiltersMixin)),l.controller("IssuesController",r),n=function(t,e,r,n){var i,o,s,a;return a=r.get("issue/issue-paginator.html",!0),s=function(t,e,r,i){var o,s,c,u,l,p,h;return s=2,l=4,c=2,u=2,o=e.find(".issues-paginator"),p=function(){var e;return e=t.count/t.paginatedBy,e=parseInt(e,10)1,d.showNext=!(t.page===f),e=t.page,i=h=1,m=f;1<=m?h<=m:h>=m;i=1<=m?++h:--h)i===e+s&&f>e+s+u?g.push({classes:"dots",type:"dots"}):i===e-l&&e>c+l?g.push({classes:"dots",type:"dots"}):i>e+s&&i<=f-u||ic||(i===e?g.push({classes:"active",num:i,type:"page-active"}):g.push({classes:"page",num:i,type:"page"}));return r=a(d),r=n(r)(t),o.html(r)},t.$watch("issues",function(t){if(t)return h()}),e.on("click",".issues-paginator a.next",function(e){return e.preventDefault(),t.$apply(function(){return i.selectFilter("page",t.page+1),i.loadIssues()})}),e.on("click",".issues-paginator a.previous",function(e){return e.preventDefault(),t.$apply(function(){return i.selectFilter("page",t.page-1),i.loadIssues()})}),e.on("click",".issues-paginator li.page > a",function(e){var r,n;return e.preventDefault(),n=angular.element(e.currentTarget),r=n.data("pagenum"),t.$apply(function(){return i.selectFilter("page",r),i.loadIssues()})})},o=function(t,r,i,o){var s,a,c,u;return a=o.getOrderBy(),a&&(c=p(a,"-")?"icon-arrow-up":"icon-arrow-down",s=r.find(".row.title > div[data-fieldname='"+d(a,"-")+"']"),u=$("").attr("svg-icon",c),s.append(u),n(s.contents())(t)),r.on("click",".row.title > div",function(i){var s,l,h;return h=angular.element(i.currentTarget),a=o.getOrderBy(),l=h.data("fieldname"),"total_voters"===l&&"-total_voters"!==a&&(a="total_voters"),s=a===l?"-"+l:l,t.$apply(function(){return o.replaceFilter("order_by",s),o.storeFilters(o.params.pslug,e.search(),o.filtersHashSuffix),o.loadIssues().then(function(){return r.find(".row.title > div > tg-svg").remove(),c=p(s,"-")?"icon-arrow-up":"icon-arrow-down",u=$("").attr("svg-icon",c),h.append(u),n(h.contents())(t)})})})},i=function(t,e,r){var n;return n=e.controller(),o(t,e,r,n),s(t,e,r,n),t.$on("$destroy",function(){return e.off()})},{link:i}},l.directive("tgIssues",["$log","$tgLocation","$tgTemplate","$compile",n]),e=function(t,e,r){var n,i,o;return i=e.get("issue/issue-status-inline-edition-selection.html",!0),o=function(t,e,r){var n,i,o;if(i=t.find(".issue-status"),n=t.find(".issue-status .issue-status-bind"),o=r[e.status])return n.text(o.name),n.prop("title",o.name),i.css("color",o.color)},n=function(e,r,n){var s,a;return s=r.controller(),a=e.$eval(n.tgIssueStatusInlineEdition),r.on("click",".issue-status",function(t){return t.preventDefault(),t.stopPropagation(),r.find(".pop-status").popover().open()}),r.on("click",".status",function(n){var i;return n.preventDefault(),n.stopPropagation(),i=angular.element(n.currentTarget),a.status=i.data("status-id"),r.find(".pop-status").popover().close(),o(r,a,e.issueStatusById),e.$apply(function(){return t.save(a).then(function(){if(s.generateFilters(),s.isFilterDataTypeSelected("status"))return s.loadIssues()})})}),h.bindOnce(e,"project",function(t){if(r.append(i({statuses:t.issue_statuses})),o(r,a,e.issueStatusById),t.my_permissions.indexOf("modify_issue")===-1)return r.unbind("click"),r.find("a").addClass("not-clickable")}),e.$watch(n.tgIssueStatusInlineEdition,function(t){return function(t){return o(r,t,e.issueStatusById)}}(this)),e.$on("$destroy",function(){return r.off()})},{link:n}},l.directive("tgIssueStatusInlineEdition",["$tgRepo","$tgTemplate","$rootScope",e]),t=function(t,e,r,n){var i,o;return o=_.template('
\n<%- name %>'),i=function(i,s,a){var c,u,l;return l=function(t){var e,a,c;return a={name:r.instant("COMMON.ASSIGNED_TO.NOT_ASSIGNED"),imgurl:"/"+window._version+"/images/unnamed.png"},c=i.usersById[t.assigned_to],e=n.getAvatar(c),a.imgurl=e.url,a.bg=null,c&&(a.name=c.full_name_display,a.bg=e.bg),s.find(".avatar").html(o(a)),s.find(".issue-assignedto").attr("title",a.name)},c=s.controller(),u=i.$eval(a.tgIssueAssignedToInlineEdition),l(u),s.on("click",".issue-assignedto",function(t){return e.$broadcast("assigned-to:add",u)}),h.bindOnce(i,"project",function(t){if(t.my_permissions.indexOf("modify_issue")===-1)return s.unbind("click"),s.find("a").addClass("not-clickable")}),i.$on("assigned-to:added",function(e,r,n){if(n.id===u.id)return n.assigned_to=r,t.save(u).then(function(){if(l(n),c.generateFilters(),c.isFilterDataTypeSelected("assigned_to")||c.isFilterDataTypeSelected("role"))return c.loadIssues()})}),i.$watch(a.tgIssueAssignedToInlineEdition,function(t){return l(t)}),i.$on("$destroy",function(){return s.off()})},{link:i}},l.directive("tgIssueAssignedToInlineEdition",["$tgRepo","$rootScope","$translate","tgAvatarService",t])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l,p=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;l=this.taiga,c=this.taiga.mixOf,a=this.taiga.groupBy,s=this.taiga.bindOnce,o=this.taiga.bindMethods,u=angular.module("taigaUserStories"),i=function(t){function e(t,e,r,n,i,s,a,c,u,l,p,h,f,d,g,m,v,y){var _;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=i,this.params=s,this.q=a,this.location=c,this.log=u,this.appMetaService=l,this.navUrls=p,this.analytics=h,this.translate=f,this.modelTransform=d,this.errorHandlingService=g,this.configService=m,this.projectService=v,this.wysiwigService=y,o(this),this.scope.usRef=this.params.usref,this.scope.sectionName=this.translate.instant("US.SECTION_NAME"),this.scope.tribeEnabled=this.configService.config.tribeHost,this.initializeEventHandlers(),_=this.loadInitialData(),_.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),_.then(null,this.onInitialDataError.bind(this))}return p(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate","$tgQueueModelTransformation","tgErrorHandlingService","$tgConfig","tgProjectService","tgWysiwygService"],e.prototype._setMeta=function(){var t,e,r,n,i,o;return o=this.scope.tasks.length,t=_.filter(this.scope.tasks,function(t){return function(e){return t.scope.taskStatusById[e.status].is_closed}}(this)).length,r=o>0?Math.round(100*t/o):0,i=this.translate.instant("US.PAGE_TITLE",{userStoryRef:"#"+this.scope.us.ref,userStorySubject:this.scope.us.subject,projectName:this.scope.project.name}),e=this.translate.instant("US.PAGE_DESCRIPTION",{userStoryStatus:(null!=(n=this.scope.statusById[this.scope.us.status])?n.name:void 0)||"--",userStoryPoints:this.scope.us.total_points,userStoryDescription:angular.element(this.wysiwigService.getHTML(this.scope.us.description)||"").text(),userStoryClosedTasks:t,userStoryTotalTasks:o,userStoryProgressPercentage:r}),this.appMetaService.setAll(i,e)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("related-tasks:update",function(t){return function(){var e;if(t.scope.tasks=_.clone(t.scope.tasks,!1),e=_.every(t.scope.tasks,function(t){return t.is_closed}),t.scope.us.is_closed!==e)return t.loadUs()}}(this)),this.scope.$on("attachment:create",function(t){return function(){return t.analytics.trackEvent("attachment","create","create attachment on userstory",1)}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadUs()}}(this))},e.prototype.initializeOnDeleteGoToUrl=function(){var t;return t={project:this.scope.project.slug},this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",t),this.scope.project.is_backlog_activated?this.scope.us.milestone?(t.sprint=this.scope.sprint.slug,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-taskboard",t)):this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-backlog",t):this.scope.project.is_kanban_activated?this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-kanban",t):void 0},e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),this.scope.statusList=t.us_statuses,this.scope.statusById=a(t.us_statuses,function(t){return t.id}),this.scope.taskStatusById=a(t.task_statuses,function(t){return t.id}),this.scope.pointsList=_.sortBy(t.points,"order"),this.scope.pointsById=a(this.scope.pointsList,function(t){return t.id}),t},e.prototype.loadUs=function(){var t,e,r,n;return t=_.pick(this.location.search(),"milestone","no-milestone","kanban-status"),r=t.milestone,r&&this.rs.userstories.storeQueryParams(this.scope.projectId,{milestone:r,order_by:"sprint_order"}),n=t["no-milestone"],n&&this.rs.userstories.storeQueryParams(this.scope.projectId,{milestone:"null",order_by:"backlog_order"}),e=t["kanban-status"],e&&this.rs.userstories.storeQueryParams(this.scope.projectId,{status:e,order_by:"kanban_order"}),this.rs.userstories.getByRef(this.scope.projectId,this.params.usref).then(function(t){return function(e){return t.scope.us=e,t.scope.usId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"us"),e}}(this))},e.prototype.loadSprint=function(){if(this.scope.us.milestone)return this.rs.sprints.get(this.scope.us.project,this.scope.us.milestone).then(function(t){return function(e){return t.scope.sprint=e,e}}(this))},e.prototype.loadTasks=function(){return this.rs.tasks.list(this.scope.projectId,null,this.scope.usId).then(function(t){return function(e){return t.scope.tasks=e,e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),this.fillUsersAndRoles(t.members,t.roles),this.loadUs().then(function(t){return function(){return t.q.all([t.loadSprint(),t.loadTasks()])}}(this))},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.upvote(this.scope.usId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.downvote(this.scope.usId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.watch(this.scope.usId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadUs(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.userstories.unwatch(this.scope.usId).then(e,t)},e.prototype.onTribeInfo=function(){var t,e,r,n;return r=this.translate.instant("US.TRIBE.PUBLISH_MORE_INFO_TITLE"),t=$("
").attr({src:"/"+window._version+"/images/monster-fight.png",alt:this.translate.instant("US.TRIBE.PUBLISH_MORE_INFO_TITLE")}),n=this.translate.instant("US.TRIBE.PUBLISH_MORE_INFO_TEXT"),e=$("").append(t).append(n),this.confirm.success(r,e)},e}(c(l.Controller,l.PageMixin)),u.controller("UserStoryDetailController",i),r=function(t,e){var r,n;return n=t.get("common/components/status-display.html",!0),r=function(t,r,i){var o;return o=function(i){var o,s;return s=t.statusById[i.status],o=n({is_closed:i.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){if(null!=t)return o(t)}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},u.directive("tgUsStatusDisplay",["$tgTemplate","$compile",r]),e=function(t,e,r,n,i,o,s){var a,c;return c=o.get("common/components/status-button.html",!0),a=function(e,o,a,u){var l,p,h;return l=function(){return e.project.my_permissions.indexOf("modify_us")!==-1},p=function(t){return function(t){var r,n;return n=e.statusById[t.status],r=c({status:n,statuses:e.statusList,editable:l()}),o.html(r),s(o.contents())(e)}}(this),h=function(e){return function(e){var s,a,c,u;return o.find(".pop-status").popover().close(),s=n().target(o.find(".js-edit-status")).start(),u=i.save(function(t){return t.status=e,t}),c=function(){return t.$broadcast("object:updated"),s.finish()},a=function(){return r.notify("error"),s.finish()},u.then(c,a)}}(this),o.on("click",".js-edit-status",function(t){if(t.preventDefault(),t.stopPropagation(),l())return o.find(".pop-status").popover().open()}),o.on("click",".status",function(t){var e,r;if(t.preventDefault(),t.stopPropagation(),l())return r=angular.element(t.currentTarget),e=r.data("status-id"),h(e)}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.status:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},u.directive("tgUsStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",e]),n=function(t,e,r,n,i,o,s){var a,c;return c=o.get("us/us-team-requirement-button.html",!0),a=function(e,o,a,u){var l,p,h;return l=function(){return e.project.my_permissions.indexOf("modify_us")!==-1},p=function(t){var r,n;return r={canEdit:l(),isRequired:t.team_requirement},n=c(r),n=s(n)(e),o.html(n)},h=function(e){var s,a;return s=n().target(o.find("label")).start(),a=i.save(function(t){return t.team_requirement=e,t}),a.then(function(e){return function(){return s.finish(),t.$broadcast("object:updated")}}(this)),a.then(null,function(){return s.finish(),r.notify("error")})},o.on("click",".team-requirement",function(t){var e;if(l())return e=!u.$modelValue.team_requirement,h(e)}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.team_requirement:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},u.directive("tgUsTeamRequirementButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",n]),t=function(t,e,r,n,i,o,s){var a,c;return c=o.get("us/us-client-requirement-button.html",!0),a=function(e,o,a,u){var l,p,h;return l=function(){return e.project.my_permissions.indexOf("modify_us")!==-1},p=function(t){var r,n;return r={canEdit:l(),isRequired:t.client_requirement},n=s(c(r))(e),o.html(n)},h=function(e){var s,a;return s=n().target(o.find("label")).start(),a=i.save(function(t){return t.client_requirement=e,t}),a.then(function(e){return function(){return s.finish(),t.$broadcast("object:updated")}}(this)),a.then(null,function(){return r.notify("error")})},o.on("click",".client-requirement",function(t){var e;if(l())return e=!u.$modelValue.client_requirement,h(e)}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.client_requirement:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return o.off()})},{link:a,restrict:"EA",require:"ngModel"}},u.directive("tgUsClientRequirementButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$tgTemplate","$compile",t])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;c=this.taiga,s=this.taiga.mixOf,o=this.taiga.groupBy,i=this.taiga.bindMethods,a=angular.module("taigaTasks"),t=function(t){function e(t,e,r,n,o,s,a,c,u,l,p,h,f,d,g,m){var v;this.scope=t,this.rootscope=e,this.repo=r,this.confirm=n,this.rs=o,this.params=s,this.q=a,this.location=c,this.log=u,this.appMetaService=l,this.navUrls=p,this.analytics=h,this.translate=f,this.modelTransform=d,this.errorHandlingService=g,this.projectService=m,i(this),this.scope.taskRef=this.params.taskref,this.scope.sectionName=this.translate.instant("TASK.SECTION_NAME"),this.initializeEventHandlers(),v=this.loadInitialData(),v.then(function(t){return function(){return t._setMeta(),t.initializeOnDeleteGoToUrl()}}(this)),v.then(null,this.onInitialDataError.bind(this))}return u(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate","$tgQueueModelTransformation","tgErrorHandlingService","tgProjectService"],e.prototype._setMeta=function(){var t,e,r;return r=this.translate.instant("TASK.PAGE_TITLE",{taskRef:"#"+this.scope.task.ref,taskSubject:this.scope.task.subject,projectName:this.scope.project.name}),t=this.translate.instant("TASK.PAGE_DESCRIPTION",{taskStatus:(null!=(e=this.scope.statusById[this.scope.task.status])?e.name:void 0)||"--",taskDescription:angular.element(this.scope.task.description_html||"").text()}),this.appMetaService.setAll(r,t)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("attachment:create",function(t){return function(){return t.analytics.trackEvent("attachment","create","create attachment on task",1)}}(this)),this.scope.$on("custom-attributes-values:edit",function(t){return function(){return t.rootscope.$broadcast("object:updated")}}(this)),this.scope.$on("comment:new",function(t){return function(){return t.loadTask()}}(this))},e.prototype.initializeOnDeleteGoToUrl=function(){var t;if(t={project:this.scope.project.slug},this.scope.onDeleteGoToUrl=this.navUrls.resolve("project",t),this.scope.project.is_backlog_activated){if(this.scope.task.milestone)return t.sprint=this.scope.sprint.slug,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-taskboard",t);if(this.scope.task.us)return t.ref=this.scope.us.ref,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-userstories-detail",t)}else if(this.scope.project.is_kanban_activated&&this.scope.us)return t.ref=this.scope.us.ref,this.scope.onDeleteGoToUrl=this.navUrls.resolve("project-userstories-detail",t)},e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),this.scope.statusList=t.task_statuses,this.scope.statusById=o(t.task_statuses,function(t){return t.id}),t},e.prototype.loadTask=function(){return this.rs.tasks.getByRef(this.scope.projectId,this.params.taskref).then(function(t){return function(e){var r,n,i;return t.scope.task=e,t.scope.taskId=e.id,t.scope.commentModel=e,t.modelTransform.setObject(t.scope,"task"),null!=(null!=(n=t.scope.task.neighbors.previous)?n.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.task.neighbors.previous.ref},t.scope.previousUrl=t.navUrls.resolve("project-tasks-detail",r)),null!=(null!=(i=t.scope.task.neighbors.next)?i.ref:void 0)&&(r={project:t.scope.project.slug,ref:t.scope.task.neighbors.next.ref},t.scope.nextUrl=t.navUrls.resolve("project-tasks-detail",r)),e}}(this))},e.prototype.loadSprint=function(){if(this.scope.task.milestone)return this.rs.sprints.get(this.scope.task.project,this.scope.task.milestone).then(function(t){return function(e){return t.scope.sprint=e,e}}(this))},e.prototype.loadUserStory=function(){if(this.scope.task.user_story)return this.rs.userstories.get(this.scope.task.project,this.scope.task.user_story).then(function(t){return function(e){return t.scope.us=e,e}}(this))},e.prototype.loadInitialData=function(){var t;return t=this.loadProject(),this.fillUsersAndRoles(t.members,t.roles),this.loadTask().then(function(t){return function(){return t.q.all([t.loadSprint(),t.loadUserStory()])}}(this))},e.prototype.onUpvote=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.upvote(this.scope.taskId).then(e,t)},e.prototype.onDownvote=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.downvote(this.scope.taskId).then(e,t)},e.prototype.onWatch=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.watch(this.scope.taskId).then(e,t)},e.prototype.onUnwatch=function(){var t,e;return e=function(t){return function(){return t.loadTask(),t.rootscope.$broadcast("object:updated")}}(this),t=function(t){return function(){return t.confirm.notify("error")}}(this),this.rs.tasks.unwatch(this.scope.taskId).then(e,t)},e}(s(c.Controller,c.PageMixin)),a.controller("TaskDetailController",t),n=function(t,e){var r,n;return n=t.get("common/components/status-display.html",!0),r=function(t,r,i){var o;return o=function(i){var o,s;return s=t.statusById[i.status],o=n({is_closed:s.is_closed,status:s}),o=e(o)(t),r.html(o)},t.$watch(i.ngModel,function(t){if(null!=t)return o(t)}),t.$on("$destroy",function(){return r.off()})},{link:r,restrict:"EA",require:"ngModel"}},a.directive("tgTaskStatusDisplay",["$tgTemplate","$compile",n]),r=function(t,e,r,n,i,o,s,a){var c,u;return u=a.get("common/components/status-button.html",!0),c=function(e,s,a,c){var l,p,h;return l=function(){return e.project.my_permissions.indexOf("modify_task")!==-1},p=function(t){return function(t){var r,n;return n=e.statusById[t.status],r=o(u({status:n,statuses:e.statusList,editable:l()}))(e),s.html(r)}}(this),h=function(e){var o,a,c,u;return o=n().target(s).start(),u=i.save(function(t){return t.status=e,t}),c=function(){return t.$broadcast("object:updated"),o.finish()},a=function(){return r.notify("error"),o.finish()},u.then(c,a)},s.on("click",".js-edit-status",function(t){if(t.preventDefault(),t.stopPropagation(),l())return s.find(".pop-status").popover().open()}),s.on("click",".status",function(t){var e;if(t.preventDefault(),t.stopPropagation(),l())return e=angular.element(t.currentTarget),$.fn.popover().closeAll(),h(e.data("status-id"))}),e.$watch(function(){var t;return null!=(t=c.$modelValue)?t.status:void 0},function(){var t;if(t=c.$modelValue)return p(t)}),e.$on("$destroy",function(){return s.off()})},{link:c,restrict:"EA",require:"ngModel"}},a.directive("tgTaskStatusButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$compile","$translate","$tgTemplate",r]),e=function(t,e,r,n,i,o,s){var a,c;return c=s.get("issue/iocaine-button.html",!0),a=function(e,s,a,u){var l,p,h;return l=function(){return e.project.my_permissions.indexOf("modify_task")!==-1},p=function(t){var r,n;return l()||t.is_iocaine?(r={isIocaine:t.is_iocaine,isEditable:l()},n=o(c(r))(e),s.html(n)):void s.html("")},h=function(e){var o,a;return o=n().target(s.find("label")).start(),a=i.save(function(t){return t.is_iocaine=e,t}),a.then(function(){return t.$broadcast("object:updated")}),a.then(null,function(){return r.notify("error")}),a["finally"](function(){return o.finish()})},s.on("click",".is-iocaine",function(t){var e;if(l())return e=!u.$modelValue.is_iocaine,h(e)}),e.$watch(function(){var t;return null!=(t=u.$modelValue)?t.is_iocaine:void 0},function(){var t;if(t=u.$modelValue)return p(t)}),e.$on("$destroy",function(){return s.off()})},{link:a,restrict:"EA",require:"ngModel"}},a.directive("tgTaskIsIocaineButton",["$rootScope","$tgRepo","$tgConfirm","$tgLoading","$tgQueueModelTransformation","$compile","$tgTemplate",e])}.call(this),function(){var t,e,r,n,i,o,s,a,c,u,l=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;u=this.taiga,a=this.taiga.mixOf,c=angular.module("taigaTeam"),e=function(t){function e(t,e,r,n,i,o,s,a,c,u,l,p,h){var f;this.scope=t,this.rootscope=e,this.repo=r,this.rs=n,this.params=i,this.q=o,this.location=s,this.navUrls=a,this.appMetaService=c,this.auth=u,this.translate=l,this.projectService=p,this.errorHandlingService=h,this.scope.sectionName="TEAM.SECTION_NAME",f=this.loadInitialData(),f.then(function(t){return function(){var e,r;return r=t.translate.instant("TEAM.PAGE_TITLE",{projectName:t.scope.project.name}),e=t.translate.instant("TEAM.PAGE_DESCRIPTION",{projectName:t.scope.project.name,projectDescription:t.scope.project.description}),t.appMetaService.setAll(r,e)}}(this)),f.then(null,this.onInitialDataError.bind(this))}return l(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgResources","$routeParams","$q","$location","$tgNavUrls","tgAppMetaService","$tgAuth","$translate","tgProjectService","tgErrorHandlingService"],e.prototype.setRole=function(t){return t?this.scope.filtersRole=t:this.scope.filtersRole=null},e.prototype.loadMembers=function(){var t,e,r,n,i;for(i=this.auth.getUser(),this.scope.totals={},n=this.scope.activeUsers,t=0,e=n.length;t=0)})}},c.filter("membersFilter",s)}.call(this),function(){var t,e,r,n,i,o,s,a,c,u=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;c=this.taiga,s=this.taiga.mixOf,o=this.taiga.groupBy,n=this.taiga.bindOnce,i=this.taiga.debounce,a=angular.module("taigaWiki"),t=function(t){function e(t,e,r,n,i,o,s,a,c,l,p,h,f,d,g,m,v){var y;this.scope=t,this.rootscope=e,this.repo=r,this.model=n,this.confirm=i,this.rs=o,this.params=s,this.q=a,this.location=c,this.filter=l,this.log=p,this.appMetaService=h,this.navUrls=f,this.analytics=d,this.translate=g,this.errorHandlingService=m,this.projectService=v,this.moveLink=u(this.moveLink,this),this.loadWiki=u(this.loadWiki,this),this.scope.$on("wiki:links:move",this.moveLink),this.scope.$on("wikipage:add",this.loadWiki),this.scope.projectSlug=this.params.pslug,this.scope.wikiSlug=this.params.slug,this.scope.sectionName="Wiki",this.scope.linksVisible=!1,y=this.loadInitialData(),y.then(function(t){return function(){return t._setMeta()}}(this)),y.then(null,this.onInitialDataError.bind(this))}return l(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgModel","$tgConfirm","$tgResources","$routeParams","$q","$tgLocation","$filter","$log","tgAppMetaService","$tgNavUrls","$tgAnalytics","$translate","tgErrorHandlingService","tgProjectService"],e.prototype._setMeta=function(){var t,e,r,n,i;return i=this.translate.instant("WIKI.PAGE_TITLE",{wikiPageName:this.scope.wikiSlug,projectName:this.scope.project.name}),t=this.translate.instant("WIKI.PAGE_DESCRIPTION",{wikiPageContent:angular.element((null!=(e=this.scope.wiki)?e.html:void 0)||"").text(),totalEditions:(null!=(r=this.scope.wiki)?r.editions:void 0)||0,lastModifiedDate:moment(null!=(n=this.scope.wiki)?n.modified_date:void 0).format(this.translate.instant("WIKI.DATETIME"))}),this.appMetaService.setAll(i,t)},e.prototype.loadProject=function(){var t;return t=this.projectService.project.toJS(),t.is_wiki_activated||this.errorHandlingService.permissionDenied(),this.scope.projectId=t.id,this.scope.project=t,this.scope.$emit("project:loaded",t),t},e.prototype.loadWiki=function(){var t;return t=this.rs.wiki.getBySlug(this.scope.projectId,this.params.slug),t.then(function(t){return function(e){return t.scope.wiki=e,t.scope.wikiId=e.id,t.scope.wiki}}(this)),t.then(null,function(t){return function(e){var r;return t.scope.wikiId=null,t.scope.project.my_permissions.indexOf("add_wiki_page")===-1?null:(r={project:t.scope.projectId,slug:t.scope.wikiSlug,content:""},t.scope.wiki=t.model.make_model("wiki",r),t.scope.wiki)}}(this))},e.prototype.loadWikiLinks=function(){return this.rs.wiki.listLinks(this.scope.projectId).then(function(t){return function(e){var r,n,i,o,s;for(t.scope.wikiLinks=e,o=t.scope.wikiLinks,r=0,n=o.length;r\n \n \n\n \n\n \n {{'COMMON.DESCRIPTION.NO_DESCRIPTION' | translate}}\n
\n