Improved action descriptions/links on user stream items

This commit is contained in:
tms 2013-02-17 01:38:20 -05:00
parent 921c3f016f
commit fb5710b5d6
5 changed files with 45 additions and 4 deletions

View File

@ -3,9 +3,18 @@ window.Discourse.UserAction = Discourse.Model.extend
Discourse.Utilities.postUrl(@get('slug'), @get('topic_id'), @get('post_number')) Discourse.Utilities.postUrl(@get('slug'), @get('topic_id'), @get('post_number'))
).property() ).property()
replyUrl: (->
Discourse.Utilities.postUrl(@get('slug'), @get('topic_id'), @get('reply_to_post_number'))
).property()
isPM: (-> isPM: (->
a = @get('action_type') a = @get('action_type')
a == UserAction.NEW_PRIVATE_MESSAGE || UserAction.GOT_PRIVATE_MESSAGE a == Discourse.UserAction.NEW_PRIVATE_MESSAGE || a == Discourse.UserAction.GOT_PRIVATE_MESSAGE
).property()
isPostAction: (->
a = @get('action_type')
a == Discourse.UserAction.RESPONSE || a == Discourse.UserAction.POST || a == Discourse.UserAction.NEW_TOPIC
).property() ).property()
addChild: (action)-> addChild: (action)->

View File

@ -5,9 +5,31 @@
<a href="/users/{{unbound username}}" class='avatar-link'><div class='avatar-wrapper'>{{avatar this imageSize="large" extraClasses="actor" avatarTemplatePath="avatar_template" ignoreTitle="true"}}</div></a> <a href="/users/{{unbound username}}" class='avatar-link'><div class='avatar-wrapper'>{{avatar this imageSize="large" extraClasses="actor" avatarTemplatePath="avatar_template" ignoreTitle="true"}}</div></a>
<span class='time'>{{date path="created_at" leaveAgo="true"}}</span> <span class='time'>{{date path="created_at" leaveAgo="true"}}</span>
<a class="title" href="{{unbound postUrl}}">{{unbound title}}</a><br> <a class="title" href="{{unbound postUrl}}">{{unbound title}}</a><br>
{{#unless description}}
<span class="type">
{{#if isPM}}
<i class="icon icon-lock" title="{{i18n user.stream.private_message}}"></i>
{{i18n user.stream.sent_by}}
{{else}}
{{i18n user.stream.posted_by}}
{{/if}}
</span>
{{/unless}}
<a class='name' href="/users/{{unbound username}}">{{personalizedName name usernamePath="username"}}</a> <a class='name' href="/users/{{unbound username}}">{{personalizedName name usernamePath="username"}}</a>
{{#if description}}
<span class='type'>{{unbound description}}</span> <span class='type'>{{unbound description}}</span>
<a class="post-number" href="{{unbound postUrl}}">#{{unbound post_number}}</a> {{#if isPostAction}}
<a class="post-number" href="{{unbound replyUrl}}">
{{#if reply_to_post_number}}
#{{unbound reply_to_post_number}}
{{else}}
{{i18n user.stream.the_topic}}
{{/if}}
</a>
{{else}}
<span class="name">{{personalizedName view.parentView.parentView.user.name usernamePath="view.parentView.parentView.user.username"}}</span>
{{/if}}
{{/if}}
</div> </div>
<p class='excerpt'> <p class='excerpt'>
{{{unbound excerpt}}} {{{unbound excerpt}}}

View File

@ -258,6 +258,9 @@
.type { .type {
color: lighten($black, 40%); color: lighten($black, 40%);
} }
span.name {
color: lighten($black, 40%);
}
.time { .time {
display: block; display: block;
float: right; float: right;

View File

@ -79,6 +79,7 @@ class UserAction < ActiveRecord::Base
SELECT SELECT
t.title, a.action_type, a.created_at, t.id topic_id, t.title, a.action_type, a.created_at, t.id topic_id,
coalesce(p.post_number, 1) post_number, coalesce(p.post_number, 1) post_number,
p.reply_to_post_number,
pu.email ,pu.username, pu.name, pu.id user_id, pu.email ,pu.username, pu.name, pu.id user_id,
u.email acting_email, u.username acting_username, u.name acting_name, u.id acting_user_id, u.email acting_email, u.username acting_username, u.name acting_name, u.id acting_user_id,
coalesce(p.cooked, p2.cooked) cooked coalesce(p.cooked, p2.cooked) cooked

View File

@ -170,6 +170,12 @@ en:
filters: filters:
all: "All" all: "All"
stream:
posted_by: "Posted by"
sent_by: "Sent by"
private_message: "private message"
the_topic: "the topic"
loading: "Loading..." loading: "Loading..."
close: "Close" close: "Close"
learn_more: "learn more..." learn_more: "learn more..."