diff --git a/app/coffee/app.coffee b/app/coffee/app.coffee index 2dec2bcc..2e6311fc 100644 --- a/app/coffee/app.coffee +++ b/app/coffee/app.coffee @@ -36,7 +36,7 @@ taiga.generateUniqueSessionIdentifier = -> taiga.sessionId = taiga.generateUniqueSessionIdentifier() -configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEventsProvider, tgLoaderProvider) -> +configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEventsProvider, tgLoaderProvider, $compileProvider) -> $routeProvider.when("/", {templateUrl: "project/projects.html", resolve: {loader: tgLoaderProvider.add()}}) @@ -224,6 +224,8 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven linewidth: "The subject must have a maximum size of %s" }) + $compileProvider.debugInfoEnabled(window.taigaConfig.debugInfo) + init = ($log, $i18n, $config, $rootscope, $auth, $events, $analytics) -> $i18n.initialize($config.get("defaultLanguage")) $log.debug("Initialize application") @@ -281,6 +283,7 @@ module.config([ "$provide", "$tgEventsProvider", "tgLoaderProvider", + "$compileProvider", configure ]) diff --git a/app/coffee/modules/backlog/main.coffee b/app/coffee/modules/backlog/main.coffee index 681e1ddb..5904bce5 100644 --- a/app/coffee/modules/backlog/main.coffee +++ b/app/coffee/modules/backlog/main.coffee @@ -520,7 +520,6 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F module.controller("BacklogController", BacklogController) - ############################################################################# ## Backlog Directive ############################################################################# @@ -537,29 +536,25 @@ BacklogDirective = ($repo, $rootscope) -> if $scope.stats? removeDoomlineDom() - elements = getUsItems() stats = $scope.stats total_points = stats.total_points current_sum = stats.assigned_points - for element in elements - scope = element.scope() - - if not scope.us? - continue - - current_sum += scope.us.total_points + for us, i in $scope.visibleUserstories + current_sum += us.total_points if current_sum > total_points - addDoomLineDom(element) + domElement = $el.find('.backlog-table-body .us-item-row')[i] + addDoomLineDom(domElement) + break removeDoomlineDom = -> $el.find(".doom-line").remove() addDoomLineDom = (element) -> - element?.before(doomLineTemplate({})) + $(element).before(doomLineTemplate({})) getUsItems = -> rowElements = $el.find('.backlog-table-body .us-item-row') diff --git a/app/coffee/modules/common/bind-scope.coffee b/app/coffee/modules/common/bind-scope.coffee new file mode 100644 index 00000000..ed500d80 --- /dev/null +++ b/app/coffee/modules/common/bind-scope.coffee @@ -0,0 +1,13 @@ +module = angular.module("taigaCommon") + +BindScope = (config) -> + if !config.debugInfo + jQuery.fn.scope = () -> this.data('scope') + + link = ($scope, $el) -> + if !config.debugInfo + $el.data('scope', $scope) + + return {link: link} + +module.directive("tgBindScope", ["$tgConfig", BindScope]) diff --git a/app/partials/attachment/attachments.jade b/app/partials/attachment/attachments.jade index 363b71a8..bc025b6c 100644 --- a/app/partials/attachment/attachments.jade +++ b/app/partials/attachment/attachments.jade @@ -11,7 +11,7 @@ section.attachments input(id="add-attach", type="file", multiple="multiple") .attachment-body.sortable - .single-attachment(ng-repeat="attach in ctrl.attachments|filter:ctrl.filterAttachments track by attach.id" tg-attachment="attach") + .single-attachment(ng-repeat="attach in ctrl.attachments|filter:ctrl.filterAttachments track by attach.id" tg-attachment="attach", tg-bind-scope) .single-attachment(ng-repeat="file in ctrl.uploadingAttachments") .attachment-name diff --git a/app/partials/includes/components/backlog-row.jade b/app/partials/includes/components/backlog-row.jade index 7fbe7dbe..5a0dbf87 100644 --- a/app/partials/includes/components/backlog-row.jade +++ b/app/partials/includes/components/backlog-row.jade @@ -1,4 +1,4 @@ -div.row.us-item-row(ng-repeat="us in visibleUserstories track by us.id", tg-draggable, ng-class="{blocked: us.is_blocked}") +div.row.us-item-row(ng-repeat="us in visibleUserstories track by us.id", tg-bind-scope, ng-class="{blocked: us.is_blocked}") div.user-stories div.tags-block(tg-colorize-tags="us.tags", tg-colorize-tags-type="backlog") div.user-story-name diff --git a/app/partials/includes/modules/admin/admin-custom-attributes.jade b/app/partials/includes/modules/admin/admin-custom-attributes.jade index cc9a3f35..4b550b9b 100644 --- a/app/partials/includes/modules/admin/admin-custom-attributes.jade +++ b/app/partials/includes/modules/admin/admin-custom-attributes.jade @@ -14,7 +14,7 @@ section.custom-fields-table.basic-table div.table-body div.js-sortable - form.js-form(ng-repeat="attr in customAttributes track by attr.id") + form.js-form(ng-repeat="attr in customAttributes track by attr.id", tg-bind-scope) div.row.single-custom-field.js-view-custom-field span.icon.icon-drag-v div.custom-name diff --git a/app/partials/includes/modules/admin/project-points.jade b/app/partials/includes/modules/admin/project-points.jade index 2e8eb8f0..e23b531b 100644 --- a/app/partials/includes/modules/admin/project-points.jade +++ b/app/partials/includes/modules/admin/project-points.jade @@ -15,7 +15,7 @@ section.project-values-table div.project-values-body div.sortable - form(ng-repeat="value in values") + form(ng-repeat="value in values", tg-bind-scope) div.project-values-row.row.table-main.visualization span.icon.icon-drag-v diff --git a/app/partials/includes/modules/admin/project-status.jade b/app/partials/includes/modules/admin/project-status.jade index 00c0df30..ba9c2117 100644 --- a/app/partials/includes/modules/admin/project-status.jade +++ b/app/partials/includes/modules/admin/project-status.jade @@ -14,7 +14,7 @@ section.colors-table.admin-status-table div.table-main div.sortable - form(ng-repeat="value in values") + form(ng-repeat="value in values", tg-bind-scope) div.row.table-main.visualization span.icon.icon-drag-v div.color-column diff --git a/app/partials/includes/modules/admin/project-types.jade b/app/partials/includes/modules/admin/project-types.jade index df8843f2..6d02b520 100644 --- a/app/partials/includes/modules/admin/project-types.jade +++ b/app/partials/includes/modules/admin/project-types.jade @@ -13,7 +13,7 @@ section.colors-table div.table-main div.sortable - form(ng-repeat="value in values") + form(ng-repeat="value in values", tg-bind-scope) div.row.table-main.visualization span.icon.icon-drag-v diff --git a/app/partials/includes/modules/admin/project-us-status.jade b/app/partials/includes/modules/admin/project-us-status.jade index 8b443369..a0954c6b 100644 --- a/app/partials/includes/modules/admin/project-us-status.jade +++ b/app/partials/includes/modules/admin/project-us-status.jade @@ -18,7 +18,7 @@ section.project-us-status div.table-main div.sortable - form(ng-repeat="value in values") + form(ng-repeat="value in values", tg-bind-scope) div.row.table-main.visualization span.icon.icon-drag-v diff --git a/app/partials/includes/modules/kanban-table.jade b/app/partials/includes/modules/kanban-table.jade index 25f32625..4152d5f6 100644 --- a/app/partials/includes/modules/kanban-table.jade +++ b/app/partials/includes/modules/kanban-table.jade @@ -37,10 +37,11 @@ div.kanban-table(tg-kanban-squish-column) ng-repeat="s in usStatusList track by s.id", tg-kanban-sortable, tg-kanban-wip-limit="s.wip_limit", - tg-kanban-column-height-fixer) + tg-kanban-column-height-fixer, + tg-bind-scope) div.kanban-task(ng-repeat="us in usByStatus[s.id] track by us.id", - tg-kanban-userstory, ng-model="us", + tg-kanban-userstory, ng-model="us", tg-bind-scope, ng-class="ctrl.getCardClass(s.id)") div.kanban-column-intro(ng-if="s.is_archived", tg-kanban-archived-status-intro="s") diff --git a/app/partials/includes/modules/search-result-table.jade b/app/partials/includes/modules/search-result-table.jade index b259828c..c22f92a5 100644 --- a/app/partials/includes/modules/search-result-table.jade +++ b/app/partials/includes/modules/search-result-table.jade @@ -1,7 +1,7 @@ section.search-result-table script(type="text/ng-template", id="search-issues") - div.search-result-table-container(ng-class="{'hidden': !issues.length}") + div.search-result-table-container(ng-class="{'hidden': !issues.length}", tg-bind-scope) div.search-result-table-header div.row.title div.user-stories Issues @@ -23,7 +23,7 @@ script(type="text/ng-template", id="search-issues") script(type="text/ng-template", id="search-userstories") - div.search-result-table-container(ng-class="{'hidden': !userstories.length}") + div.search-result-table-container(ng-class="{'hidden': !userstories.length}", tg-bind-scope) div.search-result-table-header div.row.title div.user-stories User Stories @@ -44,7 +44,7 @@ script(type="text/ng-template", id="search-userstories") span Maybe try one of the tabs above or search again script(type="text/ng-template", id="search-tasks") - div.search-result-table-container(ng-class="{'hidden': !tasks.length}") + div.search-result-table-container(ng-class="{'hidden': !tasks.length}", tg-bind-scope) div.search-result-table-header div.row.title div.user-stories Task @@ -65,7 +65,7 @@ script(type="text/ng-template", id="search-tasks") span Maybe try one of the tabs above or search again script(type="text/ng-template", id="search-wikipages") - div.search-result-table-container(ng-class="{'hidden': !wikipages.length}") + div.search-result-table-container(ng-class="{'hidden': !wikipages.length}", tg-bind-scope) div.search-result-table-header div.row.title div.user-stories Wiki page @@ -80,4 +80,3 @@ script(type="text/ng-template", id="search-wikipages") span.icon.icon-issues span.title It looks like nothing was found with your search criteria. span Maybe try one of the tabs above or search again - diff --git a/app/partials/includes/modules/sprint.jade b/app/partials/includes/modules/sprint.jade index 6ceb219f..80b1e024 100644 --- a/app/partials/includes/modules/sprint.jade +++ b/app/partials/includes/modules/sprint.jade @@ -3,7 +3,7 @@ header(tg-backlog-sprint-header, ng-model="sprint") div.sprint-progress-bar(tg-progress-bar="100 * sprint.closed_points / sprint.total_points") div.sprint-table - div.row.milestone-us-item-row(ng-repeat="us in sprint.user_stories track by us.id") + div.row.milestone-us-item-row(ng-repeat="us in sprint.user_stories track by us.id", tg-bind-scope) div.column-us a.us-name.clickable(tg-nav="project-userstories-detail:project=project.slug,ref=us.ref", tg-bo-title="'#' + us.ref + ' ' + us.subject", diff --git a/app/partials/includes/modules/taskboard-table.jade b/app/partials/includes/modules/taskboard-table.jade index 9621b44e..17478b62 100644 --- a/app/partials/includes/modules/taskboard-table.jade +++ b/app/partials/includes/modules/taskboard-table.jade @@ -22,9 +22,9 @@ div.taskboard-table(tg-taskboard-squish-column) span(ng-bind="us.total_points") span points include ../components/addnewtask - div.taskboard-tasks-box.task-column(ng-repeat="st in taskStatusList track by st.id", tg-taskboard-sortable, class="squish-status-{{st.id}}", ng-class="{'column-fold':statusesFolded[st.id]}") + div.taskboard-tasks-box.task-column(ng-repeat="st in taskStatusList track by st.id", tg-taskboard-sortable, class="squish-status-{{st.id}}", ng-class="{'column-fold':statusesFolded[st.id]}", tg-bind-scope) div.taskboard-task(ng-repeat="task in usTasks[us.id][st.id] track by task.id", - tg-taskboard-task) + tg-taskboard-task, tg-bind-scope) include ../components/taskboard-task div.task-row(ng-init="us = null", ng-class="{'row-fold':usFolded[null]}") @@ -34,7 +34,7 @@ div.taskboard-table(tg-taskboard-squish-column) h3.us-title span Unassigned tasks include ../components/addnewtask.jade - div.taskboard-tasks-box.task-column(ng-repeat="st in taskStatusList track by st.id", tg-taskboard-sortable, class="squish-status-{{st.id}}", ng-class="{'column-fold':statusesFolded[st.id]}") + div.taskboard-tasks-box.task-column(ng-repeat="st in taskStatusList track by st.id", tg-taskboard-sortable, class="squish-status-{{st.id}}", ng-class="{'column-fold':statusesFolded[st.id]}", tg-bind-scope) div.taskboard-task(ng-repeat="task in usTasks[null][st.id] track by task.id", - tg-taskboard-task) + tg-taskboard-task, tg-bind-scope) include ../components/taskboard-task diff --git a/conf/conf.example.json b/conf/conf.example.json index bd6340a9..ec7a8285 100644 --- a/conf/conf.example.json +++ b/conf/conf.example.json @@ -8,5 +8,6 @@ "termsOfServiceUrl": null, "maxUploadFileSize": null, "gitHubClientId": null, - "contribPlugins": [] + "contribPlugins": [], + "debugInfo": false }