Permalink
Browse files

AC: Add QA initials to story summary, hide metadata labels from story…

… summary
  • Loading branch information...
1 parent 856c60d commit f9543013e8a20ca13ff9da04f823c546ecccd0ba @andrewchilds andrewchilds committed Mar 20, 2013
@@ -765,6 +765,24 @@ body.has-modal-dialog {
display: none;
}
+.story .summary .story-owner,
+.story .summary .story-pair {
+ color: #00335c;
+}
+
+.story .summary .story-owner:hover,
+.story .summary .story-pair:hover {
+ color: #00223d;
+}
+
+.story .summary .story-qa {
+ color: #0d9c00;
+}
+
+.story .summary .story-qa:hover {
+ color: #075700;
+}
+
.story .details {
margin: 0 -2px 0 -32px;
}
@@ -300,7 +300,8 @@ TT.Init = (function () {
if (filter.type === 'user') {
filter.fn = function (story) {
return story.owned_by === filter.name || story.requested_by === filter.name ||
- TT.Model.Story.hasTag(story, '[pair=' + name.toLowerCase() + ']');
+ TT.Model.Story.hasTag(story, '[pair=' + name.toLowerCase() + ']') ||
+ TT.Model.Story.hasTag(story, '[qa=' + name.toLowerCase() + ']');
};
TT.Model.Filter.add(filter);
} else if (filter.type === 'tag') {
@@ -309,23 +309,22 @@ TT.Model = (function () {
};
pub.Story.decorateStoryWithMetadata = function (story) {
- var qa = pub.Story.getMetadata(story, 'qa');
- qa = pub.User.get(function (user) {
- return user.name.toLowerCase() === qa;
- });
- if (qa) {
- story.qa = qa.name;
- }
+ function decorate(story, key) {
+ var metadata = pub.Story.getMetadata(story, key);
+ var user = pub.User.get(function (user) {
+ return user.name.toLowerCase() === metadata;
+ });
+ if (user) {
+ story[key] = user.name;
+ story[key + '_initials'] = user.initials;
+ }
- var pair = pub.Story.getMetadata(story, 'pair');
- pair = pub.User.get(function (user) {
- return user.name.toLowerCase() === pair;
- });
- if (pair) {
- story.pair = pair.name;
- story.pair_initials = pair.initials;
+ return story;
}
+ story = decorate(story, 'qa');
+ story = decorate(story, 'pair');
+
return story;
};
@@ -118,7 +118,8 @@ TT.UI = (function () {
type: 'user',
fn: function (story) {
return story.owned_by === name || story.requested_by === name ||
- TT.Model.Story.hasTag(story, '[pair=' + name.toLowerCase() + ']');
+ TT.Model.Story.hasTag(story, '[pair=' + name.toLowerCase() + ']') ||
+ TT.Model.Story.hasTag(story, '[qa=' + name.toLowerCase() + ']');
}
});
TT.View.drawStories();
@@ -713,28 +714,28 @@ TT.UI = (function () {
return false;
};
- pub.storyProjectTooltip = function (e) {
- if (!TT.Tooltip.isActive()) {
- TT.Tooltip.open({
- target: this,
- delay: 300,
- html: TT.View.render('tooltipContents', {
- title: $(this).data('project-name')
- })
- });
- }
+ pub.storyProjectTooltip = function () {
+ return pub.genericStoryTooltip(this, 'Project: ' + $(this).data('project-name'));
+ };
- return false;
+ pub.storyOwnerTooltip = function () {
+ return pub.genericStoryTooltip(this, 'Owner: ' + $(this).data('username'));
+ };
+
+ pub.storyPairTooltip = function () {
+ return pub.genericStoryTooltip(this, 'Pair: ' + $(this).data('username'));
};
- pub.storyOwnerTooltip = function (e) {
+ pub.storyQATooltip = function () {
+ return pub.genericStoryTooltip(this, 'QA: ' + $(this).data('username'));
+ };
+
+ pub.genericStoryTooltip = function (context, title) {
if (!TT.Tooltip.isActive()) {
TT.Tooltip.open({
- target: this,
- delay: 300,
- html: TT.View.render('tooltipContents', {
- title: $(this).data('username')
- })
+ target: context,
+ delay: 500,
+ html: TT.View.render('tooltipContents', { title: title })
});
}
@@ -284,18 +284,21 @@ TT.View = (function () {
};
pub.drawStory = function (story, column) {
- return drawStoryHelper(story, '.' + column.class_name + ' .column-bucket');
+ return pub.drawStoryHelper(story, '.' + column.class_name + ' .column-bucket');
};
pub.redrawStory = function (story) {
$('#columns .story-' + story.id).each(function () {
- drawStoryHelper(story, this, 'insertAfter');
+ pub.drawStoryHelper(story, this, 'insertAfter');
$(this).remove();
});
};
- function drawStoryHelper(story, target, insertMethod) {
+ pub.drawStoryHelper = function (story, target, insertMethod) {
+ var label_backup = story.labels;
+ story.labels = pub.labels_without_metadata(story.labels);
var html = pub.render('story', story);
+ story.labels = label_backup;
var element = pub.attach(html, target, insertMethod);
var specialLabels = ['blocked'];
@@ -308,7 +311,17 @@ TT.View = (function () {
pub.restoreStoryState(element, story);
return element;
- }
+ };
+
+ pub.labels_without_metadata = function (labels) {
+ var output = [];
+ $.each(labels, function (index, label) {
+ if (!/^\[.+\=.+\]$/.test(label)) {
+ output[output.length] = label;
+ }
+ });
+ return output;
+ };
pub.drawStoryDetails = function (storyElement) {
var story = TT.Model.Story.get({ id: storyElement.data('id') });
@@ -10,8 +10,11 @@
<a href="#" class="story-owner" data-username="{{owned_by}}" data-click-handler="TT.UI.filterByUser" data-hover-handler="TT.UI.storyOwnerTooltip">{{initials}}</a>
{{/initials}}
{{#pair}}
- / <a href="#" class="story-pair" data-username="{{pair}}" data-click-handler="TT.UI.filterByUser" data-hover-handler="TT.UI.storyOwnerTooltip">{{pair_initials}}</a>
+ / <a href="#" class="story-pair" data-username="{{pair}}" data-click-handler="TT.UI.filterByUser" data-hover-handler="TT.UI.storyPairTooltip">{{pair_initials}}</a>
{{/pair}}
+ {{#qa}}
+ / <a href="#" class="story-qa" data-username="{{qa}}" data-click-handler="TT.UI.filterByUser" data-hover-handler="TT.UI.storyQATooltip">{{qa_initials}}</a>
+ {{/qa}}
{{#labels}}
<div class="tag" data-click-handler="TT.UI.filterByTag">{{.}}</div>
{{/labels}}
@@ -149,6 +149,9 @@ describe "Story UI Interactions", ->
beforeEach ->
$('.story-' + id + ' .toggle-arrow').click()
+ it "should not show the pair initials in the summary labels", ->
+ expect($('.story-' + id + ' .summary').html()).not.toContain '[pair='
+
it "should show the pair initials in the story summary", ->
expect($('.story-' + id + ' .summary .story-pair').text()).toBe 'DVL'
@@ -231,6 +234,9 @@ describe "Story UI Interactions", ->
beforeEach ->
$('.story-' + id + ' .toggle-arrow').click()
+ it "should not show the QA initials in the summary labels", ->
+ expect($('.story-' + id + ' .summary').html()).not.toContain '[qa='
+
also "I re-open the story", ->
beforeEach ->
$('.story-' + id + ' .toggle-arrow').click()

0 comments on commit f954301

Please sign in to comment.