From 6348bd3eee050326c7955e49604b91821ecccb26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Juli=C3=A1n?= Date: Thu, 3 Jul 2014 13:57:23 +0200 Subject: [PATCH] Refactorized assigned to template --- app/coffee/modules/issues/detail.coffee | 14 ++++---- app/partials/issues-detail-edit.jade | 2 +- app/partials/issues-detail.jade | 2 +- app/partials/us-detail.jade | 8 +---- .../views/components/assigned-to.jade | 2 +- app/styles/components/assigned-to.scss | 31 ++++++++++++++++++ app/styles/layout/us-detail.scss | 32 ------------------- app/styles/main.scss | 1 + 8 files changed, 44 insertions(+), 48 deletions(-) create mode 100644 app/styles/components/assigned-to.scss diff --git a/app/coffee/modules/issues/detail.coffee b/app/coffee/modules/issues/detail.coffee index cf92f358..9ae3f10c 100644 --- a/app/coffee/modules/issues/detail.coffee +++ b/app/coffee/modules/issues/detail.coffee @@ -270,16 +270,18 @@ AssignedToDirective = ($rootscope, $confirm) -> <% } %>
Assigned to - + <% if (assignedTo) { %> - <%= assignedTo.full_name_display %> + <%= assignedTo.full_name_display %> <% } else { %> - Not assigned + Not assigned <% } %> - + <% if (editable) { %> + + <% } %> + <% if (editable) { %> - <% } %>
""") @@ -293,7 +295,7 @@ AssignedToDirective = ($rootscope, $confirm) -> html = template({assignedTo: assignedTo, editable:editable}) $el.html(html) - $el.on "click", ".icon-edit", (event) -> + $el.on "click", ".user-assigned", (event) -> event.preventDefault() $rootscope.$broadcast("assigned-to:add") diff --git a/app/partials/issues-detail-edit.jade b/app/partials/issues-detail-edit.jade index 936d3a0f..e3933eb9 100644 --- a/app/partials/issues-detail-edit.jade +++ b/app/partials/issues-detail-edit.jade @@ -60,7 +60,7 @@ block content span.status-status new span.level-name status - section.us-detail-assigned-to(tg-assigned-to, ng-model="issue.assigned_to", editable="true") + section.us-assigned-to(tg-assigned-to, ng-model="issue.assigned_to", editable="true") section.watchers(tg-watchers, ng-model="issue.watchers", editable="true") section.us-detail-settings diff --git a/app/partials/issues-detail.jade b/app/partials/issues-detail.jade index 7d7f34da..c4c08aa0 100644 --- a/app/partials/issues-detail.jade +++ b/app/partials/issues-detail.jade @@ -63,7 +63,7 @@ block content span.status-status new span.level-name status - section.us-detail-assigned-to(tg-assigned-to, ng-model="issue.assigned_to") + section.us-assigned-to(tg-assigned-to, ng-model="issue.assigned_to") section.watchers(tg-watchers, ng-model="issue.watchers") section.us-detail-settings diff --git a/app/partials/us-detail.jade b/app/partials/us-detail.jade index cd9da6e2..611532ed 100644 --- a/app/partials/us-detail.jade +++ b/app/partials/us-detail.jade @@ -62,13 +62,7 @@ block content li.total span.points 10 span.role UX - section.us-detail-assigned-to - div.user-avatar - a.avatar(href="", title="Assigned to") - img(src="http://thecodeplayer.com/u/uifaces/18.jpg", alt="username") - div.assigned-to - span.assigned-title Assigned to - span.user-assigned Anler Hernández + include views/components/assigned-to section.watchers div.watchers-header span.title watchers diff --git a/app/partials/views/components/assigned-to.jade b/app/partials/views/components/assigned-to.jade index efeefd42..7a84e49a 100644 --- a/app/partials/views/components/assigned-to.jade +++ b/app/partials/views/components/assigned-to.jade @@ -1,4 +1,4 @@ -section.us-detail-assigned-to +section.us-assigned-to div.user-avatar a.avatar(href="", title="Assigned to") img(src="http://thecodeplayer.com/u/uifaces/18.jpg", alt="username") diff --git a/app/styles/components/assigned-to.scss b/app/styles/components/assigned-to.scss new file mode 100644 index 00000000..031c4bd2 --- /dev/null +++ b/app/styles/components/assigned-to.scss @@ -0,0 +1,31 @@ +.us-assigned-to { + @include table-flex(); + margin-top: 2rem; + position: relative; + .user-avatar { + @include table-flex-child(1, 0); + } + .assigned-to { + @include table-flex-child(3, 0); + margin-left: 1rem; + margin-top: 15px; + .assigned-title { + color: $gray-light; + display: block; + } + .user-assigned { + @extend %large; + color: $green-taiga; + } + .icon-delete { + color: $gray-light; + opacity: 1; + position: absolute; + right: 1rem; + top: 1rem; + &:hover { + color: $green-taiga; + } + } + } +} diff --git a/app/styles/layout/us-detail.scss b/app/styles/layout/us-detail.scss index 37718257..ce0fb77a 100644 --- a/app/styles/layout/us-detail.scss +++ b/app/styles/layout/us-detail.scss @@ -217,38 +217,6 @@ } } -.us-detail-assigned-to { - @include table-flex(); - margin-top: 2rem; - position: relative; - .user-avatar { - @include table-flex-child(1, 0); - } - .assigned-to { - @include table-flex-child(3, 0); - margin-left: 1rem; - margin-top: 15px; - .assigned-title { - color: $gray-light; - display: block; - } - .user-assigned { - @extend %large; - color: $green-taiga; - } - .icon-edit { - color: $gray-light; - opacity: 1; - position: absolute; - right: 1rem; - top: 1rem; - &:hover { - color: $green-taiga; - } - } - } -} - .watchers { margin-top: 2rem; .watchers-header { diff --git a/app/styles/main.scss b/app/styles/main.scss index 259dbced..99ec72a8 100755 --- a/app/styles/main.scss +++ b/app/styles/main.scss @@ -31,6 +31,7 @@ $prefix-for-spec: true; @import 'components/paginator'; @import 'components/watchers'; @import 'components/level'; +@import 'components/assigned-to'; //Modules @import 'modules/nav';