From 98f90f91cf2fe3d170deabc6f164cf5b58087294 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Mon, 4 Aug 2014 11:36:42 +0200 Subject: [PATCH] tg-bo-bind --- app/coffee/modules/base/bind.coffee | 9 +++++++++ app/partials/invitation.jade | 2 +- app/partials/issues-detail.jade | 2 +- app/partials/kanban.jade | 4 ++-- app/partials/project.jade | 12 ++++++------ app/partials/projects.jade | 6 +++--- app/partials/task-detail.jade | 2 +- app/partials/taskboard.jade | 4 ++-- app/partials/us-detail.jade | 2 +- app/partials/views/components/mainTitle.jade | 4 ++-- app/partials/views/modules/activity.jade | 8 ++++---- app/partials/views/modules/attachments.jade | 4 ++-- app/partials/views/modules/comment-activity.jade | 8 ++++---- app/partials/views/modules/comments.jade | 2 +- app/partials/views/modules/issues-table.jade | 2 +- app/partials/views/modules/kanban-table.jade | 2 +- app/partials/views/modules/projects-nav.jade | 2 +- app/partials/views/modules/search-result-table.jade | 8 ++++---- app/partials/views/modules/sprints.jade | 4 ++-- app/partials/views/modules/taskboard-table.jade | 2 +- app/partials/views/modules/wiki-summary.jade | 4 ++-- app/partials/wiki-edit.jade | 4 ++-- app/partials/wiki.jade | 4 ++-- 23 files changed, 55 insertions(+), 46 deletions(-) diff --git a/app/coffee/modules/base/bind.coffee b/app/coffee/modules/base/bind.coffee index 920ca7da..59e8c92a 100644 --- a/app/coffee/modules/base/bind.coffee +++ b/app/coffee/modules/base/bind.coffee @@ -21,6 +21,14 @@ bindOnce = @.taiga.bindOnce +# Escape Html bind once directive +BindOnceBindDirective = -> + link = ($scope, $el, $attrs) -> + bindOnce $scope, $attrs.tgBoBind, (val) -> + $el.text(val) + + return {link:link} + # Html bind once directive BindOnceHtmlDirective = -> link = ($scope, $el, $attrs) -> @@ -79,6 +87,7 @@ BindHtmlDirective = -> return {link:link} module = angular.module("taigaBase") +module.directive("tgBoBind", BindOnceBindDirective) module.directive("tgBoHtml", BindOnceHtmlDirective) module.directive("tgBoRef", BindOnceRefDirective) module.directive("tgBoSrc", BindOnceSrcDirective) diff --git a/app/partials/invitation.jade b/app/partials/invitation.jade index 78519da9..bc31862b 100644 --- a/app/partials/invitation.jade +++ b/app/partials/invitation.jade @@ -13,7 +13,7 @@ block content alt="{{ invitation.invited_by.full_name_display }}") | {{ invitation.invited_by.full_name_display }} p.invitation-text has sent you an invitation to join to the taiga project - span.project-name(tg-bo-html="invitation.project_name") + span.project-name(tg-bo-bind="invitation.project_name") div.invitation-form include views/modules/invitation-login-form diff --git a/app/partials/issues-detail.jade b/app/partials/issues-detail.jade index bc85f7d4..5d7752a5 100644 --- a/app/partials/issues-detail.jade +++ b/app/partials/issues-detail.jade @@ -14,7 +14,7 @@ block content section.us-story-main-data div.us-title(ng-class="{blocked: issue.is_blocked}") h2.us-title-text - span.us-number(tg-bo-html="issue.ref") + span.us-number(tg-bo-bind="issue.ref") span.us-name(ng-bind="issue.subject") p.block-desc-container(ng-show="issue.is_blocked") span.block-description-title Blocked diff --git a/app/partials/kanban.jade b/app/partials/kanban.jade index c1056aa6..55b738dd 100644 --- a/app/partials/kanban.jade +++ b/app/partials/kanban.jade @@ -9,8 +9,8 @@ block content section.main.kanban div.kanban-detail-header h1 - span(tg-bo-html="project.name") - span.green(tg-bo-html="sectionName") + span(tg-bo-bind="project.name") + span.green(tg-bo-bind="sectionName") div.kanban-settings // a.button.button-trans(href="", title="Filter") // span.icon.icon-filter diff --git a/app/partials/project.jade b/app/partials/project.jade index d8f48298..5a7f52f2 100644 --- a/app/partials/project.jade +++ b/app/partials/project.jade @@ -7,23 +7,23 @@ block content div.wrapper(ng-controller="ProjectController as ctrl") section.main.single-project h1 - span.green(tg-bo-html="project.name") + span.green(tg-bo-bind="project.name") div.summary ul.home-project-info-list li - span.info-num(tg-bo-html="stats.total_points") + span.info-num(tg-bo-bind="stats.total_points") span.info-text project
points li - span.info-num(tg-bo-html="stats.defined_points") + span.info-num(tg-bo-bind="stats.defined_points") span.info-text defined
points li - span.info-num(tg-bo-html="stats.assigned_points") + span.info-num(tg-bo-bind="stats.assigned_points") span.info-text assigned
points li - span.info-num(tg-bo-html="stats.closed_points") + span.info-num(tg-bo-bind="stats.closed_points") span.info-text closed
points div.project-data-container - p.description(tg-bo-html="project.description") + p.description(tg-bo-bind="project.description") ul li(ng-repeat="member in project.active_memberships") figure.avatar diff --git a/app/partials/projects.jade b/app/partials/projects.jade index 1a09d4b4..f7c56b1e 100644 --- a/app/partials/projects.jade +++ b/app/partials/projects.jade @@ -9,8 +9,8 @@ block content ul.recent-projects li(ng-repeat="project in ctrl.projects.recents") .project-content - h2(tg-bo-html="project.name") - p(tg-bo-html="project.description") + h2(tg-bo-bind="project.name") + p(tg-bo-bind="project.description") .project-link a.button.button-gray(href="", tg-nav="project:project=project.slug") Go to project @@ -19,7 +19,7 @@ block content div(tg-projects-pagination, active="ctrl.projects.all.length") ul li(ng-repeat="project in ctrl.projects.all") - a.button(href="", tg-bo-html="project.name", tg-nav="project:project=project.slug") + a.button(href="", tg-bo-bind="project.name", tg-nav="project:project=project.slug") .create-project-button-wrapper a.button.button-green(href="", ng-click="ctrl.newProject()") Create project \ No newline at end of file diff --git a/app/partials/task-detail.jade b/app/partials/task-detail.jade index bd7dae91..1cd7ef53 100644 --- a/app/partials/task-detail.jade +++ b/app/partials/task-detail.jade @@ -14,7 +14,7 @@ block content section.us-story-main-data div.us-title(ng-class="{blocked: task.is_blocked}") h2.us-title-text - span.us-number(tg-bo-html="task.ref") + span.us-number(tg-bo-bind="task.ref") span.us-name(ng-bind="task.subject") p.block-desc-container(ng-show="task.is_blocked") span.block-description-title Blocked diff --git a/app/partials/taskboard.jade b/app/partials/taskboard.jade index 764bb412..c4fda74e 100644 --- a/app/partials/taskboard.jade +++ b/app/partials/taskboard.jade @@ -8,8 +8,8 @@ block content ng-init="section='backlog'") section.main.taskboard h1 - span(tg-bo-html="project.name") - span.green(tg-bo-html="sprint.name") + span(tg-bo-bind="project.name") + span.green(tg-bo-bind="sprint.name") span.date(tg-date-range="sprint.estimated_start,sprint.estimated_finish") include views/components/sprint-summary diff --git a/app/partials/us-detail.jade b/app/partials/us-detail.jade index 1099a4a5..82469d24 100644 --- a/app/partials/us-detail.jade +++ b/app/partials/us-detail.jade @@ -14,7 +14,7 @@ block content section.us-story-main-data div.us-title(ng-class="{blocked: us.is_blocked}") h2.us-title-text - span.us-number(tg-bo-html="us.ref") + span.us-number(tg-bo-bind="us.ref") span.us-name(ng-bind="us.subject") p.block-desc-container(ng-show="us.is_blocked") diff --git a/app/partials/views/components/mainTitle.jade b/app/partials/views/components/mainTitle.jade index a9654a07..2e55f6ba 100644 --- a/app/partials/views/components/mainTitle.jade +++ b/app/partials/views/components/mainTitle.jade @@ -1,4 +1,4 @@ header h1 - span(tg-bo-html="project.name") - span.green(tg-bo-html="sectionName") + span(tg-bo-bind="project.name") + span.green(tg-bo-bind="sectionName") diff --git a/app/partials/views/modules/activity.jade b/app/partials/views/modules/activity.jade index ce898a17..c89a0e3f 100644 --- a/app/partials/views/modules/activity.jade +++ b/app/partials/views/modules/activity.jade @@ -6,19 +6,19 @@ section.us-activity.hidden div.activity-content div.activity-username - a.username(href="TODO", tg-bo-title="ctrl.getUserFullName(change.user.pk)" tg-bo-html="ctrl.getUserFullName(change.user.pk)") + a.username(href="TODO", tg-bo-title="ctrl.getUserFullName(change.user.pk)" tg-bo-bind="ctrl.getUserFullName(change.user.pk)") span.date {{ change.created_at | date:'yyyy-MM-dd HH:mm' }} div.activity-inner(ng-repeat="(key, change) in change.values_diff") div.activity-changed - span(tg-bo-html="key") + span(tg-bo-bind="key") div.activity-fromto p strong from
- span(tg-bo-html="ctrl.getChangeText(change[0])") + span(tg-bo-bind="ctrl.getChangeText(change[0])") p strong to
- span(tg-bo-html="ctrl.getChangeText(change[1])") + span(tg-bo-bind="ctrl.getChangeText(change[1])") //a.more-activity(href="", title="show more comments") // span show previous activity diff --git a/app/partials/views/modules/attachments.jade b/app/partials/views/modules/attachments.jade index 2fe6a51e..8cd2cb60 100644 --- a/app/partials/views/modules/attachments.jade +++ b/app/partials/views/modules/attachments.jade @@ -19,9 +19,9 @@ section.attachments(tg-attachments, ng-model=attachModel, ng-if="#{attachModel}. div.single-attachment(ng-repeat="file in uploadingFiles") div.attachment-name - a(href="", tg-bo-title="file.name", tg-bo-html="file.name") + a(href="", tg-bo-title="file.name", tg-bo-bind="file.name") div.attachment-size - span.attachment-size(tg-bo-html="file.size") + span.attachment-size(tg-bo-bind="file.size") div.attachment-comments span(ng-bind="file.progressMessage") div.percentage(ng-style="{'width': file.progressPercent}") diff --git a/app/partials/views/modules/comment-activity.jade b/app/partials/views/modules/comment-activity.jade index dca7e845..45e8f601 100644 --- a/app/partials/views/modules/comment-activity.jade +++ b/app/partials/views/modules/comment-activity.jade @@ -1,16 +1,16 @@ div.us-activity a.activity-title(ng-show="ctrl.countChanges(comment)", href="", title="Show activity") - span(tg-bo-html="ctrl.buildChangesText(comment)") + span(tg-bo-bind="ctrl.buildChangesText(comment)") span.icon.icon-arrow-up div.activity-inner(ng-repeat="(key, change) in comment.values_diff") div.activity-changed - span(tg-bo-html="key") + span(tg-bo-bind="key") div.activity-fromto p strong from
- span(tg-bo-html="ctrl.getChangeText(change[0])") + span(tg-bo-bind="ctrl.getChangeText(change[0])") p strong to
- span(tg-bo-html="ctrl.getChangeText(change[1])") + span(tg-bo-bind="ctrl.getChangeText(change[1])") diff --git a/app/partials/views/modules/comments.jade b/app/partials/views/modules/comments.jade index d8a5e9b4..1dc99587 100644 --- a/app/partials/views/modules/comments.jade +++ b/app/partials/views/modules/comments.jade @@ -8,7 +8,7 @@ section.us-comments a.avatar(href="", tg-bo-title="ctrl.getUserFullName(comment.user.pk)") img(tg-bo-src="ctrl.getUserAvatar(comment.user.pk)", tg-bo-alt="ctrl.getUserFullName(comment.user.pk)") div.comment-content - a.username(href="TODO", tg-bo-title="ctrl.getUserFullName(comment.user.pk)" tg-bo-html="ctrl.getUserFullName(comment.user.pk)") + a.username(href="TODO", tg-bo-title="ctrl.getUserFullName(comment.user.pk)" tg-bo-bind="ctrl.getUserFullName(comment.user.pk)") //- includes module activity include comment-activity p.comment {{ comment.comment }} diff --git a/app/partials/views/modules/issues-table.jade b/app/partials/views/modules/issues-table.jade index fa00f11b..1d066654 100644 --- a/app/partials/views/modules/issues-table.jade +++ b/app/partials/views/modules/issues-table.jade @@ -10,6 +10,6 @@ section.issues-table.basic-table div.level-field(tg-listitem-priority="issue") div.subject a(href="", tg-nav="project-issues-detail:project=project.slug,ref=issue.ref", - tg-bo-html="issue.subject") + tg-bo-bind="issue.subject") div.issue-field(tg-listitem-issue-status="issue") div.assigned-field(tg-listitem-assignedto="issue") diff --git a/app/partials/views/modules/kanban-table.jade b/app/partials/views/modules/kanban-table.jade index 2537c046..ed8341fb 100644 --- a/app/partials/views/modules/kanban-table.jade +++ b/app/partials/views/modules/kanban-table.jade @@ -3,7 +3,7 @@ div.kanban-table div.kanban-table-inner(tg-kanban-row-size-fixer) h2.task-colum_name(ng-repeat="s in usStatusList track by s.id", ng-style="{'border-top-color':s.color}") - span(tg-bo-html="s.name") + span(tg-bo-bind="s.name") a.icon.icon-plus(href="", title="Add New task", ng-click="ctrl.addNewUs('standard', s.id)") a.icon.icon-bulk(href="", title="Add New bulk", ng-click="ctrl.addNewUs('bulk', s.id)") diff --git a/app/partials/views/modules/projects-nav.jade b/app/partials/views/modules/projects-nav.jade index fc18c0a6..d2167986 100644 --- a/app/partials/views/modules/projects-nav.jade +++ b/app/partials/views/modules/projects-nav.jade @@ -19,5 +19,5 @@ nav.projects-nav(ng-controller="ProjectNavController as ctrl", tg-projects-nav) div.projects-pagination(tg-projects-pagination, active="projects.length && !projectsSearch.$.length") ul.projects-list li(ng-repeat="project in projects|filter:projectsSearch:strict track by project.id") - a(href="", tg-bo-html="project.name", tg-nav="project:project=project.slug") + a(href="", tg-bo-bind="project.name", tg-nav="project:project=project.slug") span.icon.icon-arrow-right diff --git a/app/partials/views/modules/search-result-table.jade b/app/partials/views/modules/search-result-table.jade index 48cf992a..9f0235bb 100644 --- a/app/partials/views/modules/search-result-table.jade +++ b/app/partials/views/modules/search-result-table.jade @@ -10,7 +10,7 @@ script(type="text/ng-template", id="search-issues") div.row.table-main(ng-repeat="issue in issues track by issue.id") div.user-stories.width-6 div.user-story-name - a(href="", tg-bo-html="issue.subject") + a(href="", tg-bo-bind="issue.subject") div.status.width-2(tg-listitem-issue-status="issue") div.points.width-1(tg-listitem-assignedto="issue") @@ -24,9 +24,9 @@ script(type="text/ng-template", id="search-userstories") div.row.table-main(ng-repeat="us in userstories track by us.id") div.user-stories.width-4 div.user-story-name - a(href="", tg-bo-html="us.subject") + a(href="", tg-bo-bind="us.subject") div.status.width-2(tg-listitem-us-status="us") - div.points.width-1(tg-bo-html="us.total_points") + div.points.width-1(tg-bo-bind="us.total_points") script(type="text/ng-template", id="search-tasks") div.search-result-table-header @@ -38,6 +38,6 @@ script(type="text/ng-template", id="search-tasks") div.row.table-main(ng-repeat="task in tasks track by task.id") div.user-stories.width-4 div.user-story-name - a(href="", tg-bo-html="task.subject") + a(href="", tg-bo-bind="task.subject") div.status.width-2(tg-listitem-task-status="task") div.points.width-1(tg-listitem-assignedto="task") diff --git a/app/partials/views/modules/sprints.jade b/app/partials/views/modules/sprints.jade index 1e718fc3..5f5b6e03 100644 --- a/app/partials/views/modules/sprints.jade +++ b/app/partials/views/modules/sprints.jade @@ -33,8 +33,8 @@ section.sprints div.column-us.width-8 a.us-name.clickable(tg-nav="project-userstories-detail:project=project.slug,ref=us.ref", title="") span(tg-bo-ref="us.ref") - span(tg-bo-html="us.subject") - div.column-points.width-1(tg-bo-html="us.total_points") + span(tg-bo-bind="us.subject") + div.column-points.width-1(tg-bo-bind="us.total_points") a.button.button-gray(href="", tg-nav="project-taskboard:project=project.slug,sprint=sprint.id", title="Current Sprint Taskboard") span Sprint Taskboard diff --git a/app/partials/views/modules/taskboard-table.jade b/app/partials/views/modules/taskboard-table.jade index c04f9c91..b67d21f9 100644 --- a/app/partials/views/modules/taskboard-table.jade +++ b/app/partials/views/modules/taskboard-table.jade @@ -4,7 +4,7 @@ div.taskboard-table h2.task-colum_name "User story" h2.task-colum_name(ng-repeat="s in taskStatusList track by s.id", ng-style="{'border-top-color':s.color}") - span(tg-bo-html="s.name") + span(tg-bo-bind="s.name") div.taskboard-table-body div.taskboard-table-inner(tg-taskboard-row-size-fixer) diff --git a/app/partials/views/modules/wiki-summary.jade b/app/partials/views/modules/wiki-summary.jade index 0b7ce122..c7c637b3 100644 --- a/app/partials/views/modules/wiki-summary.jade +++ b/app/partials/views/modules/wiki-summary.jade @@ -1,9 +1,9 @@ div.summary.wiki-summary ul li - span.number(tg-bo-html="wiki.editions") + span.number(tg-bo-bind="wiki.editions") span.description times
edited li - span.number(tg-bo-html="wiki.modified_date|date:'dd/MM/yyyy HH:mm'") + span.number(tg-bo-bind="wiki.modified_date|date:'dd/MM/yyyy HH:mm'") span.description last
edit li.username-edition(tg-wiki-user-info, ng-model='wiki') diff --git a/app/partials/wiki-edit.jade b/app/partials/wiki-edit.jade index f74cd9ac..e9d5b249 100644 --- a/app/partials/wiki-edit.jade +++ b/app/partials/wiki-edit.jade @@ -12,9 +12,9 @@ block content //Include views/components/mainTitle header h1 - span(tg-bo-html="project.name") + span(tg-bo-bind="project.name") span.green Wiki - span.wiki-title(tg-bo-html='wikiSlug|unslugify') + span.wiki-title(tg-bo-bind='wikiSlug|unslugify') .action-buttons a.button.button-green.save-wiki(href="", title="Save", ng-click="ctrl.save()") Save diff --git a/app/partials/wiki.jade b/app/partials/wiki.jade index e073f26a..05be3fbc 100644 --- a/app/partials/wiki.jade +++ b/app/partials/wiki.jade @@ -11,9 +11,9 @@ block content section.main.wiki header h1 - span(tg-bo-html="project.name") + span(tg-bo-bind="project.name") span.green Wiki - span.wiki-title(tg-bo-html='wiki.slug|unslugify') + span.wiki-title(tg-bo-bind='wiki.slug|unslugify') .action-buttons a.button.button-red.delete-wiki(href="", title="Delete", ng-click="ctrl.delete()") Delete a.button.button-green.edit-wiki(href="", title="Edit", ng-click="ctrl.edit()") Edit