mirror of
https://github.com/discourse/discourse.git
synced 2025-06-10 18:03:44 +08:00
Minor refactoring to help with Tags RSS
This commit is contained in:
@ -2,30 +2,11 @@
|
|||||||
This mixin provides a `currentUser` property that can be used to retrieve information
|
This mixin provides a `currentUser` property that can be used to retrieve information
|
||||||
about the currently logged in user. It is mostly useful to controllers so it can be
|
about the currently logged in user. It is mostly useful to controllers so it can be
|
||||||
exposted to templates.
|
exposted to templates.
|
||||||
|
|
||||||
Outside of templates, code should probably use `Discourse.User.current()` instead of
|
|
||||||
this property.
|
|
||||||
|
|
||||||
@class Discourse.HasCurrentUser
|
|
||||||
@extends Ember.Mixin
|
|
||||||
@namespace Discourse
|
|
||||||
@module HasCurrentUser
|
|
||||||
**/
|
**/
|
||||||
Discourse.HasCurrentUser = Em.Mixin.create({
|
Discourse.HasCurrentUser = Em.Mixin.create({
|
||||||
|
|
||||||
/**
|
|
||||||
Returns a reference to the currently logged in user.
|
|
||||||
|
|
||||||
@method currentUser
|
|
||||||
@return {Discourse.User} the currently logged in user if present.
|
|
||||||
*/
|
|
||||||
currentUser: function() {
|
currentUser: function() {
|
||||||
return Discourse.User.current();
|
return Discourse.User.current();
|
||||||
}.property().volatile()
|
}.property().volatile()
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<% if @list.topics.length > 0 %>
|
<% if @list.topics.length > 0 && @list.more_topics_url %>
|
||||||
<p>
|
<p>
|
||||||
<% if params[:page].to_i > 0 %>
|
<% if params[:page].to_i > 0 %>
|
||||||
<a href="<%= @list.prev_topics_url.sub('.json?','?') %>" rel="prev"><%= t 'prev_page'%></a>
|
<a href="<%= @list.prev_topics_url.sub('.json?','?') %>" rel="prev"><%= t 'prev_page'%></a>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<author><%= "no-reply@example.com (@#{topic.user.username}#{" #{topic.user.name}" if (topic.user.name.present? && SiteSetting.enable_names?)})" -%></author>
|
<author><%= "no-reply@example.com (@#{topic.user.username}#{" #{topic.user.name}" if (topic.user.name.present? && SiteSetting.enable_names?)})" -%></author>
|
||||||
<category><%= topic.category.name %></category>
|
<category><%= topic.category.name %></category>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
<p><%= t('author_wrote', author: link_to("@#{topic.user.username}", user_url(topic.user.username_lower))).html_safe %></p>
|
<p><%= t('author_wrote', author: link_to("@#{topic.user.username}", "#{Discourse.base_url}/users/#{topic.user.username_lower}")).html_safe %></p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<%= topic.posts.first.cooked.html_safe %>
|
<%= topic.posts.first.cooked.html_safe %>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
@ -12,7 +12,7 @@ module TopicListResponder
|
|||||||
format.html do
|
format.html do
|
||||||
@list = list
|
@list = list
|
||||||
store_preloaded(list.preload_key, MultiJson.dump(TopicListSerializer.new(list, scope: guardian)))
|
store_preloaded(list.preload_key, MultiJson.dump(TopicListSerializer.new(list, scope: guardian)))
|
||||||
render 'list'
|
render 'list/list'
|
||||||
end
|
end
|
||||||
format.json do
|
format.json do
|
||||||
render_serialized(list, TopicListSerializer)
|
render_serialized(list, TopicListSerializer)
|
||||||
|
Reference in New Issue
Block a user