"),o.after(c),a=null,o.on("click",function(r){return r.preventDefault(),n=!n,a=e().target(c).start(),n?t.$broadcast("backlog:unload-closed-sprints"):t.$broadcast("backlog:load-closed-sprints")}),i.$on("$destroy",function(){return o.off()}),i.$on("closed-sprints:reloaded",function(t){return function(t,e){var n,i;return a.finish(),n=e.length>0?"BACKLOG.SPRINTS.ACTION_HIDE_CLOSED_SPRINTS":"BACKLOG.SPRINTS.ACTION_SHOW_CLOSED_SPRINTS",i=r.instant(n),o.find(".text").text(i)}}(this))},{link:i}},n.directive("tgBacklogToggleClosedSprintsVisualization",["$rootScope","$tgLoading","$translate",r])}.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("taigaTaskboard"),t=function(t){var e,r;return r=function(e,r){var n,i,o,s;return s=e.width(),e.height(240),i=_.map(r,function(t){return moment(new Date(t.day).getTime())}),n=[],n.unshift({data:_.zip(i,_.map(r,function(t){return t.optimal_points})),lines:{fillColor:"rgba(120,120,120,0.2)"}}),n.unshift({data:_.zip(i,_.map(r,function(t){return t.open_points})),lines:{fillColor:"rgba(102,153,51,0.3)"}}),o={grid:{borderWidth:{top:0,right:1,left:0,bottom:0},borderColor:"#ccc",hoverable:!0},xaxis:{tickSize:[1,"day"],min:i[0],max:_.last(i),mode:"time",daysNames:i,axisLabel:t.instant("TASKBOARD.CHARTS.XAXIS_LABEL"),axisLabelUseCanvas:!0,axisLabelFontSizePixels:12,axisLabelFontFamily:"Verdana, Arial, Helvetica, Tahoma, sans-serif",axisLabelPadding:5},yaxis:{min:0,axisLabel:t.instant("TASKBOARD.CHARTS.YAXIS_LABEL"),axisLabelUseCanvas:!0,axisLabelFontSizePixels:12,axisLabelFontFamily:"Verdana, Arial, Helvetica, Tahoma, sans-serif",axisLabelPadding:5},series:{shadowSize:0,lines:{show:!0,fill:!0},points:{show:!0,fill:!0,radius:4,lineWidth:2}},colors:["rgba(102,153,51,1)","rgba(120,120,120,0.2)"],tooltip:!0,tooltipOpts:{content:function(e,r,n,i){var o,s;return o=moment(r).format(t.instant("TASKBOARD.CHARTS.DATE")),s=Math.round(n),1===i.seriesIndex?t.instant("TASKBOARD.CHARTS.OPTIMAL",{formattedDate:o,roundedValue:s}):t.instant("TASKBOARD.CHARTS.REAL",{formattedDate:o,roundedValue:s})}}},e.empty(),e.plot(n,o).data("plot")},e=function(t,e,n){var i;return i=angular.element(e),t.$on("resize",function(){if(t.stats)return r(i,t.stats.days)}),t.$on("taskboard:graph:toggle-visibility",function(){return e.parent().toggleClass("open"),a(100,function(){if(t.stats)return r(i,t.stats.days)})}),t.$watch("stats",function(e){if(null!=t.stats)return r(i,t.stats.days)}),t.$on("$destroy",function(){return e.off()})},{link:e}},i.directive("tgSprintGraph",["$translate",t])}.call(this),function(){var t,e,r,n,i,o,s,a=[].indexOf||function(t){for(var e=0,r=this.length;e
1&&r<=1&&(this.zoomLoading=!0,this.loadTasks().then(function(t){return function(){return t.zoomLoading=!1,t.taskboardTasksService.resetFolds()}}(this))),"0"===this.zoomLevel?this.rootscope.$broadcast("sprint:zoom0"):void 0)},e.prototype.changeQ=function(t){return this.replaceFilter("q",t),this.loadTasks(),this.generateFilters()},e.prototype.removeFilter=function(t){return this.unselectFilter(t.dataType,t.id),this.loadTasks(),this.generateFilters()},e.prototype.addFilter=function(t){return this.selectFilter(t.category.dataType,t.filter.id),this.loadTasks(),this.generateFilters()},e.prototype.selectCustomFilter=function(t){return this.replaceAllFilters(t.filter),this.loadTasks(),this.generateFilters()},e.prototype.removeCustomFilter=function(t){return this.filterRemoteStorageService.getFilters(this.scope.projectId,"tasks-custom-filters").then(function(e){return function(r){return delete r[t.id],e.filterRemoteStorageService.storeFilters(e.scope.projectId,r,"tasks-custom-filters").then(e.generateFilters)}}(this))},e.prototype.isFilterDataTypeSelected=function(t){var e,r,n,i;for(i=this.selectedFilters,r=0,n=i.length;r0}),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}),a=_.map(o.roles,function(t){return t.id?t.id=t.id.toString():t.id="null",t.name=t.name||"Unassigned",t}),s=_.map(o.owners,function(t){return t.id=t.id.toString(),t.name=t.full_name,t}),e.selectedFilters=[],t.status&&(c=e.formatSelectedFilters("status",u,t.status),e.selectedFilters=e.selectedFilters.concat(c)),t.tags&&(c=e.formatSelectedFilters("tags",l,t.tags),e.selectedFilters=e.selectedFilters.concat(c)),t.assigned_to&&(c=e.formatSelectedFilters("assigned_to",n,t.assigned_to),e.selectedFilters=e.selectedFilters.concat(c)),t.owner&&(c=e.formatSelectedFilters("owner",s,t.owner),e.selectedFilters=e.selectedFilters.concat(c)),t.role&&(c=e.formatSelectedFilters("role",a,t.role),e.selectedFilters=e.selectedFilters.concat(c)),e.filterQ=t.q,e.filters=[{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.STATUS"),dataType:"status",content:u},{title:e.translate.instant("COMMON.FILTERS.CATEGORIES.TAGS"),dataType:"tags",content:l,hideEmpty:!0,totalTaggedElements:p.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:a},{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._setMeta=function(){var t,e,r;return e=this.translate.instant("BACKLOG.SPRINTS.DATE"),r=this.translate.instant("TASKBOARD.PAGE_TITLE",{projectName:this.scope.project.name,sprintName:this.scope.sprint.name}),t=this.translate.instant("TASKBOARD.PAGE_DESCRIPTION",{projectName:this.scope.project.name,sprintName:this.scope.sprint.name,startDate:moment(this.scope.sprint.estimated_start).format(e),endDate:moment(this.scope.sprint.estimated_finish).format(e),completedPercentage:this.scope.stats.completedPercentage||"0",completedPoints:this.scope.stats.completedPointsSum||"--",totalPoints:this.scope.stats.totalPointsSum||"--",openTasks:this.scope.stats.openTasks||"--",totalTasks:this.scope.stats.total_tasks||"--"}),this.appMetaService.setAll(r,t)},e.prototype.initializeEventHandlers=function(){return this.scope.$on("taskform:bulk:success",function(t){return function(e,r){return t.refreshTagsColors().then(function(){return t.taskboardTasksService.add(r)}),t.analytics.trackEvent("task","create","bulk create task on taskboard",1)}}(this)),this.scope.$on("taskform:new:success",function(t){return function(e,r){return t.refreshTagsColors().then(function(){return t.taskboardTasksService.add(r)}),t.analytics.trackEvent("task","create","create task on taskboard",1)}}(this)),this.scope.$on("taskform:edit:success",function(t){return function(e,r){return t.refreshTagsColors().then(function(){return t.taskboardTasksService.replaceModel(r)})}}(this)),this.scope.$on("taskboard:task:deleted",function(t){return function(e,r){return t.loadTasks()}}(this)),this.scope.$on("taskboard:task:move",this.taskMove),this.scope.$on("assigned-to:added",this.onAssignedToChanged)},e.prototype.onAssignedToChanged=function(t,e,r){return r.assigned_to=e,this.taskboardTasksService.replaceModel(r),this.repo.save(r).then(function(t){return function(){if(t.generateFilters(),t.isFilterDataTypeSelected("assigned_to")||t.isFilterDataTypeSelected("role"))return t.loadTasks()}}(this))},e.prototype.initializeSubscription=function(){var t,e;return t="changes.project."+this.scope.projectId+".tasks",this.events.subscribe(this.scope,t,o(500,function(t){return function(e){return t.loadTaskboard()}}(this))),e="changes.project."+this.scope.projectId+".userstories",this.events.subscribe(this.scope,e,function(t){return function(e){return t.refreshTagsColors(),t.loadSprintStats(),t.loadSprint()}}(this))},e.prototype.loadProject=function(){return this.rs.projects.get(this.scope.projectId).then(function(t){return function(e){return e.is_backlog_activated||t.errorHandlingService.permissionDenied(),t.scope.project=e,t.scope.pointsList=_.sortBy(e.points,"order"),t.scope.pointsById=s(e.points,function(t){return t.id}),t.scope.roleById=s(e.roles,function(t){return t.id}),t.scope.taskStatusList=_.sortBy(e.task_statuses,"order"),t.scope.usStatusList=_.sortBy(e.us_statuses,"order"),t.scope.usStatusById=s(e.us_statuses,function(t){return t.id}),t.scope.$emit("project:loaded",e),t.fillUsersAndRoles(e.members,e.roles),e}}(this))},e.prototype.loadSprintStats=function(){return this.rs.sprints.stats(this.scope.projectId,this.scope.sprintId).then(function(t){return function(e){var r,n,i,o;return o=_.reduce(_.values(e.total_points),function(t,e){return t+e},0),r=_.reduce(_.values(e.completed_points),function(t,e){return t+e},0),n=o-r,i=e.total_tasks-e.completed_tasks,t.scope.stats=e,t.scope.stats.totalPointsSum=o,t.scope.stats.completedPointsSum=r,t.scope.stats.remainingPointsSum=n,t.scope.stats.remainingTasks=i,e.totalPointsSum?t.scope.stats.completedPercentage=Math.round(100*e.completedPointsSum/e.totalPointsSum):t.scope.stats.completedPercentage=0,t.scope.stats.openTasks=e.total_tasks-e.completed_tasks,e}}(this))},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.loadSprint=function(){return this.rs.sprints.get(this.scope.projectId,this.scope.sprintId).then(function(t){return function(e){return t.scope.sprint=e,t.scope.userstories=_.sortBy(e.user_stories,"sprint_order"),t.taskboardTasksService.setUserstories(t.scope.userstories),e}}(this))},e.prototype.loadTasks=function(){var t;return t={},this.zoomLevel>1&&(t.include_attachments=1),t=_.merge(t,this.location.search()),this.rs.tasks.list(this.scope.projectId,this.scope.sprintId,null,t).then(function(t){return function(e){return t.taskboardTasksService.init(t.scope.project,t.scope.usersById),t.taskboardTasksService.set(e)}}(this))},e.prototype.loadTaskboard=function(){return this.q.all([this.refreshTagsColors(),this.loadSprintStats(),this.loadSprint().then(function(t){return function(){return t.loadTasks()}}(this))])},e.prototype.loadInitialData=function(){var t,e;return t={pslug:this.params.pslug,sslug:this.params.sslug},e=this.repo.resolve(t).then(function(t){return function(e){return t.scope.projectId=e.project,t.scope.sprintId=e.milestone,t.initializeSubscription(),e}}(this)),e.then(function(t){return function(){return t.loadProject()}}(this)).then(function(t){return function(){return t.generateFilters(),t.loadTaskboard().then(function(){return t.setRolePoints()})}}(this))},e.prototype.showPlaceHolder=function(t,e){return!(this.taskboardTasksService.tasksRaw.length||this.scope.taskStatusList[0].id!==t||this.scope.userstories.length&&this.scope.userstories[0].id!==e)},e.prototype.editTask=function(t){var e;return e=this.taskboardTasksService.getTask(t),e=e.set("loading-edit",!0),this.taskboardTasksService.replace(e),this.rs.tasks.getByRef(e.getIn(["model","project"]),e.getIn(["model","ref"])).then(function(t){return function(r){return t.rs2.attachments.list("task",e.get("id"),e.getIn(["model","project"])).then(function(n){return t.rootscope.$broadcast("taskform:edit",r,n.toJS()),e=e.set("loading",!1),t.taskboardTasksService.replace(e)})}}(this))},e.prototype.deleteTask=function(t){var e;return e=this.taskboardTasksService.getTask(t),e=e.set("loading-delete",!0),this.rs.tasks.getByRef(e.getIn(["model","project"]),e.getIn(["model","ref"])).then(function(t){return function(r){var n,i;return e=e.set("loading-delete",!1),i=t.translate.instant("TASK.TITLE_DELETE_ACTION"),n=r.subject,t.confirm.askOnDelete(i,n).then(function(e){var n;return n=t.repo.remove(r),n.then(function(){return t.scope.$broadcast("taskboard:task:deleted"),e.finish()}),n.then(null,function(){return e.finish(!1),this.confirm.notify("error")})})}}(this))},e.prototype.taskMove=function(t,e,r,n,i,o){var s,a,c,u;return e=this.taskboardTasksService.getTaskModel(e.get("id")),s=this.taskboardTasksService.move(e.id,n,i,o),c={status__is_archived:!1,include_attachments:!0},a={headers:{"set-orders":JSON.stringify(s.set_orders)}},u=this.repo.save(e,!0,c,a,!0).then(function(t){return function(e){var r;if(r=e[1],r&&r["taiga-info-order-updated"]&&(o=JSON.parse(r["taiga-info-order-updated"]),t.taskboardTasksService.assignOrders(o)),t.loadSprintStats(),t.generateFilters(),t.isFilterDataTypeSelected("status"))return t.loadTasks()}}(this))},e.prototype.addNewTask=function(t,e){switch(t){case"standard":return this.rootscope.$broadcast("taskform:new",this.scope.sprintId,null!=e?e.id:void 0);case"bulk":return this.rootscope.$broadcast("taskform:bulk",this.scope.sprintId,null!=e?e.id:void 0)}},e.prototype.toggleFold=function(t){return this.taskboardTasksService.toggleFold(t)},e.prototype.changeTaskAssignedTo=function(t){var e;return e=this.taskboardTasksService.getTaskModel(t),this.rootscope.$broadcast("assigned-to:add",e)},e.prototype.setRolePoints=function(){var t,e,r,n;return t=_.filter(this.scope.project.roles,"computable"),r=function(e){return function(e){return e=parseInt(e,10),_.find(t,function(t){return t.id===e})}}(this),e=function(t){return function(e){var r;return r=parseInt(e,10),_.find(t.scope.project.points,function(t){return t.id===e})}}(this),n=_.reduce(this.scope.userstories,function(t){return function(t,n,i){return _.forOwn(n.points,function(n,i){var o,s;return s=r(i),o=e(n),t[s.id]||(t[s.id]=s,t[s.id].points=0),t[s.id].points+=o.value}),t}}(this),{}),this.scope.pointsByRole=Object.keys(n).map(function(t){return n[t]})},e}(a(l.Controller,l.PageMixin,l.FiltersMixin)),c.controller("TaskboardController",t),e=function(t){var e;return e=function(e,r,n){var i,o;return i=r.controller(),r.on("click",".toggle-analytics-visibility",function(e){var r;return e.preventDefault(),r=angular.element(e.currentTarget),r.toggleClass("active"),t.$broadcast("taskboard:graph:toggle-visibility")}),o=r.find(".taskboard-table-body"),o.on("scroll",function(t){var e,n;return n=angular.element(t.currentTarget),e=r.find(".taskboard-table-header .taskboard-table-inner"),e.css("left",-1*n.scrollLeft())}),e.$on("$destroy",function(){return r.off()})},{link:e}},c.directive("tgTaskboard",["$rootScope",e]),r=function(t){var e,r,n;return e=40,n=300,r=function(r,i,o){var s,a,c,u,l;return r.$on("sprint:zoom0",function(t){return function(){return c()}}(this)),r.$on("sprint:task:moved",function(t){return function(){return c()}}(this)),r.$watch("usTasks",function(){if(r.project)return r.statusesFolded=t.tasks.getStatusColumnModes(r.project.id),r.usFolded=t.tasks.getUsRowModes(r.project.id,r.sprintId),c()}),r.foldStatus=function(e){return r.statusesFolded[e.id]=!r.statusesFolded[e.id],t.tasks.storeStatusColumnModes(r.projectId,r.statusesFolded),c()},r.foldUs=function(e){return e?r.usFolded[e.id]=!r.usFolded[e.id]:r.usFolded[null]=!r.usFolded[null],t.tasks.storeUsRowModes(r.projectId,r.sprintId,r.usFolded),c()},s=function(t){return function(t,n){var i,o,s;return i=t?r.usTasks.getIn([t.toString(),n.toString()]).size:r.usTasks.getIn(["null",n.toString()]).size,r.statusesFolded[n]?(i&&r.usFolded[t]?(o=Math.round(Math.sqrt(i)),s=e*o):s=e,s):0}}(this),l=function(t){return function(t,e){var o;return o=i.find(".squish-status-"+t),e?o.css("max-width",e):"0"===r.ctrl.zoomLevel?o.css("max-width",148):o.css("max-width",n)}}(this),u=function(t){return function(){var t,e,r;return t=[],e=i.find(".task-colum-name"),t=_.map(e,function(t){return $(t).outerWidth(!0)}),r=_.reduce(t,function(t,e){return t+e}),i.find(".taskboard-table-inner").css("width",r)}}(this),a=function(t){return function(t){var e;return e=s(null,t),_.forEach(r.userstories,function(r){var n;if(n=s(r.id,t),n>e)return e=n}),l(t,e)}}(this),c=function(t){return function(){_.forEach(r.taskStatusList,function(t){return a(t.id)}),u()}}(this)},{link:r}},c.directive("tgTaskboardSquishColumn",["$tgResources",r])}.call(this),function(){var t,e,r,n,i,o,s,a;s=this.taiga,n=this.taiga.mixOf,a=this.taiga.toggleText,o=this.taiga.scopeDefer,e=this.taiga.bindOnce,r=this.taiga.groupBy,i=angular.module("taigaBacklog"),t=function(t,e,r,n){var i;return i=function(t,e,i){var o;return o=t.$watch("usTasks",function(i){var s,a,c,u,l,p,h,f,d;if(i&&i.size&&(o(),t.project.my_permissions.indexOf("modify_task")>-1))return h=null,p=null,l=null,d=e,u=function(){var t;return t=n.instant("BACKLOG.SORTABLE_FILTER_ERROR"),$tgConfirm.notify("error",t)},a=function(t){return t.scope().$destroy(),t.off(),t.remove()},s=_.map(e.find(".task-column"),function(t){return t}),c=dragula(s,{copySortSource:!1,copy:!1,accepts:function(t,e){return!$(e).hasClass("taskboard-userstory-box")},moves:function(t){return $(t).is("tg-card")}}),c.on("drag",function(t){if(h=$(t).parent().scope(),e.hasClass("active-filters"))return u(),setTimeout(function(){return c.cancel(!0)},0),!1}),c.on("dragend",function(e){var n,i,o,s,c,u,f;return f=$(e).parent(),l=$(e),i=l.scope().task,n=l.index(),p=f.scope(),u=h.us?h.us.id:null,c=h.st.id,s=p.us?p.us.id:null,o=p.st.id,o===c&&s===u||a(l),t.$apply(function(){return r.$broadcast("taskboard:task:move",i,i.getIn(["model","status"]),s,o,n)})}),f=autoScroll([$(".taskboard-table-body")[0]],{margin:100,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&c.dragging}}),t.$on("$destroy",function(){return e.off(),c.destroy()})})},{link:i}},i.directive("tgTaskboardSortable",["$tgRepo","$tgResources","$rootScope","$translate",t])}.call(this),function(){var t,e,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;e=this.taiga.groupBy,t=function(t){function e(){this.reset()}return r(e,t),e.$inject=[],e.prototype.reset=function(){return this.tasksRaw=[],this.foldStatusChanged={},this.usTasks=Immutable.Map()},e.prototype.init=function(t,e){return this.project=t,this.usersById=e},e.prototype.resetFolds=function(){return this.foldStatusChanged={},this.refresh()},e.prototype.toggleFold=function(t){return this.foldStatusChanged[t]=!this.foldStatusChanged[t],this.refresh()},e.prototype.add=function(t){return this.tasksRaw=this.tasksRaw.concat(t),this.refresh()},e.prototype.set=function(t){return this.tasksRaw=t,this.refreshRawOrder(),this.refresh()},e.prototype.setUserstories=function(t){return this.userstories=t},e.prototype.refreshRawOrder=function(){var t,e,r,n,i;for(this.order={},r=this.tasksRaw,n=[],t=0,e=r.length;t1)for(s=0,l=f.length;s1)for(o=0,f=b.length;o1&&(k=_.map(b,function(t){return function(e){return{us_id:e.id,order:t.order[e.id]}}}(this)))}}else{for($=0,p=u=0,d=n.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),this.repo.save(r).then(function(t){return function(){if(t.generateFilters(),t.isFilterDataTypeSelected("assigned_users")||t.isFilterDataTypeSelected("role"))return t.filtersReloadContent()}}(this))},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,e;return e="changes.project."+this.scope.projectId+".userstories",
-t=f.randomInt(700,1e3),this.events.subscribe(this.scope,e,c(t,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(".card"),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 "}},a.directive("tgWikiWysiwyg",["$tgQueueModelTransformation","$rootScope","$tgConfirm","tgAttachmentsFullService","$tgQqueue","$tgRepo","$tgAnalytics","tgWikiHistoryService",r])}.call(this),function(){var t,e,r,n,i,o;o=this.taiga,n=this.taiga.mixOf,r=this.taiga.groupBy,e=this.taiga.bindOnce,i=angular.module("taigaWiki"),t=function(t,r,n,i,o,s,a,c,u){var l,p,h;return h=a.get("wiki/wiki-nav.html",!0),p=function(n,a,l){var p,f,d,g;return p=a.controller(),null==l.ngModel?r.error("WikiNavDirective: no ng-model attr is defined"):(f=n.project.my_permissions.indexOf("add_wiki_link")>-1,d=null,g=function(e){var r,l,m,v,y;return f=n.project.my_permissions.indexOf("add_wiki_link")>-1,r=n.project.my_permissions.indexOf("delete_wiki_link")>-1,l=h({wikiLinks:e,projectSlug:n.projectSlug,addWikiLinkPermission:f,deleteWikiLinkPermission:r}),l=c(l)(n),a.off(),f&&d&&d.destroy(),a.html(l),f&&(m=null,y=a.find(".sortable"),d=dragula([y[0]],{direction:"vertical",copySortSource:!1,copy:!1,mirrorContainer:y[0],moves:function(t){return $(t).is("li")}}),d.on("dragend",function(t){var e;return m=$(t),t=m.scope().link,e=m.index(),n.$emit("wiki:links:move",t,e)}),v=autoScroll(window,{margin:20,pixels:30,scrollWhenOutside:!0,autoScroll:function(){return this.down&&d.dragging}})),a.on("click",".add-button",function(t){return t.preventDefault(),a.find(".new").removeClass("hidden"),a.find(".new input").focus(),a.find(".add-button").hide()}),a.on("click",".js-delete-link",function(e){var r,o,s,a;return e.preventDefault(),e.stopPropagation(),s=angular.element(e.currentTarget),r=s.parents(".wiki-link").data("id"),a=u.instant("WIKI.DELETE_LINK_TITLE"),o=n.wikiLinks[r].title,i.askOnDelete(a,o).then(function(e){return function(e){var o;return o=t.remove(n.wikiLinks[r]),o.then(function(){return o=p.loadWikiLinks(),o.then(function(){return e.finish(),g(n.wikiLinks)}),o.then(null,function(){return e.finish()})}),o.then(null,function(){return e.finish(!1),i.notify("error")})}}(this))}),a.on("keyup",".new input",function(e){var r,c,u,l;return e.preventDefault(),13===e.keyCode?(l=angular.element(e.currentTarget),c=l.val(),r=s().target(a.find(".new")).start(),u=t.create("wiki-links",{project:n.projectId,title:c}),u.then(function(){var t;return o.trackEvent("wikilink","create","create wiki link",1),t=p.loadWikiLinks(),t.then(function(){return r.finish(),a.find(".new").addClass("hidden"),a.find(".new input").val(""),a.find(".add-button").show(),g(n.wikiLinks)}),t.then(null,function(){return r.finish(),a.find(".new").addClass("hidden"),a.find(".new input").val(""),a.find(".add-button").show(),i.notify("error","Error loading wiki links")})}),u.then(null,function(t){var e;return r.finish(),a.find(".new input").val(c),a.find(".new input").focus().select(),null!=(null!=t&&null!=(e=t.__all__)?e[0]:void 0)?i.notify("error","The link already exists"):i.notify("error")})):27===e.keyCode?(l=angular.element(e.currentTarget),a.find(".new").addClass("hidden"),a.find(".new input").val(""),a.find(".add-button").show()):void 0})},e(n,l.ngModel,g))},l=function(t,e,r){return p(t,e,r),t.$on("$destroy",function(){return e.off()})},{link:l}},i.directive("tgWikiNav",["$tgRepo","$log","$tgLocation","$tgConfirm","$tgAnalytics","$tgLoading","$tgTemplate","$compile","$translate",t])}.call(this),function(){var t,e,r,n,i=function(t,e){function r(){this.constructor=t}for(var n in e)o.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=this.taiga,e=this.taiga.mixOf,r=angular.module("taigaWiki"),t=function(t){function e(t,e,r,n,i,o,s,a,c,u,l){var p;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.navUrls=c,this.errorHandlingService=u,this.projectService=l,this.scope.projectSlug=this.params.pslug,this.scope.wikiSlug=this.params.slug,this.scope.sectionName="Wiki",this.scope.linksVisible=!1,p=this.loadInitialData(),p.then(null,this.onInitialDataError.bind(this))}return i(e,t),e.$inject=["$scope","$rootScope","$tgRepo","$tgModel","$tgConfirm","$tgResources","$routeParams","$q","$tgNavUrls","tgErrorHandlingService","tgProjectService"],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.loadWikiPages=function(){var t;return t=this.rs.wiki.list(this.scope.projectId).then(function(t){return function(e){return t.scope.wikipages=e}}(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