Merge "Add a quote button to comments"

This commit is contained in:
Jenkins 2016-03-07 19:06:27 +00:00 committed by Gerrit Code Review
commit 13bf67d958
3 changed files with 34 additions and 3 deletions

View File

@ -22,7 +22,7 @@ angular.module('sb.story').controller('StoryDetailController',
Preference, TimelineEvent, Comment, TimelineEventTypes, story,
Story, creator, tasks, Task, DSCacheFactory, User,
storyboardApiBase, SubscriptionList, CurrentUser,
SessionModalService) {
SessionModalService, moment, $document) {
'use strict';
var pageSize = Preference.get('story_detail_page_size');
@ -265,6 +265,30 @@ angular.module('sb.story').controller('StoryDetailController',
}
};
/**
* Quote a comment
*/
$scope.quote = function(event) {
var timestamp = moment(event.created_at);
var reference = '<footer>'
+ event.author.full_name
+ ' on '
+ timestamp.format('YYYY-MM-DD [at] HH:mm:ss')
+ '</footer>';
var lines = event.comment.content.split('\n');
for (var i = 0; i < lines.length; i++) {
lines[i] = '> ' + lines[i];
}
lines.push('> ' + reference);
var quoted = lines.join('\n');
if ($scope.newComment.content) {
$scope.newComment.content += '\n\n' + quoted;
} else {
$scope.newComment.content = quoted;
}
$document[0].getElementById('comment').focus();
};
/**
* Add a comment
*/

View File

@ -1,7 +1,14 @@
<div class="discussion-comment" ng-if="display_events_user_comment">
<p class="discussion-comment-author">
{{ event.author.full_name }}
<span time-moment eventdate="event.created_at" class="pull-right"></span>
<span class="pull-right">
<span time-moment eventdate="event.created_at"></span>
&nbsp;
<button class="btn btn-default btn-xs" ng-click="quote(event)"
title="Quote">
<i class="fa fa-quote-left"></i>
</button>
</span>
</p>
<insert-markdown ng-show="event.comment.content"

View File

@ -37,7 +37,7 @@
padding-bottom: 0px;
margin: 0 10px;
> blockquote {
& blockquote {
margin: 0 0 10px;
font-size: 14px;
color: #555;