mirror of
https://github.com/discourse/discourse.git
synced 2025-03-24 06:31:13 +08:00
UX: Tweak about page
This commit is contained in:
parent
f4208ae83f
commit
c8767dc505
@ -1,5 +1,8 @@
|
||||
<div class='container'>
|
||||
<h2>{{i18n about.title}}</h2>
|
||||
<section class='about'>
|
||||
<h2>{{i18n about.title title=title}}</h2>
|
||||
<p>{{description}}</p>
|
||||
</section>
|
||||
|
||||
{{#if admins}}
|
||||
<section class='about admins'>
|
||||
@ -36,22 +39,26 @@
|
||||
<th>{{i18n about.stat.last_7_days}}</th>
|
||||
<tr>
|
||||
<td class='title'>{{i18n about.topic_count}}</td>
|
||||
<td>{{stats.topic_count}}</td>
|
||||
<td>{{stats.topics_7_days}}</td>
|
||||
<td>{{number stats.topic_count}}</td>
|
||||
<td>{{number stats.topics_7_days}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{i18n about.post_count}}</td>
|
||||
<td>{{stats.post_count}}</td>
|
||||
<td>{{stats.posts_7_days}}</td>
|
||||
<td>{{number stats.post_count}}</td>
|
||||
<td>{{number stats.posts_7_days}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{i18n about.user_count}}</td>
|
||||
<td>{{stats.user_count}}</td>
|
||||
<td>{{stats.users_7_days}}</td>
|
||||
<td>{{number stats.user_count}}</td>
|
||||
<td>{{number stats.users_7_days}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{i18n about.like_count}}</td>
|
||||
<td>{{number stats.like_count}}</td>
|
||||
<td>{{number stats.likes_7_days}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
@ -27,6 +27,9 @@
|
||||
<li>
|
||||
<a href="{{unbound faqUrl}}" class="faq-link">{{i18n faq}}</a>
|
||||
</li>
|
||||
<li>
|
||||
{{#link-to 'about'}}{{i18n about.simple_title}}{{/link-to}}
|
||||
</li>
|
||||
{{#if showMobileToggle}}
|
||||
<li><a href="#" class="mobile-toggle-link" {{action toggleMobileView}}>{{boundI18n mobileViewLinkTextKey}}</a></li>
|
||||
{{/if}}
|
||||
|
@ -17,6 +17,10 @@ section.about {
|
||||
|
||||
padding-bottom: 10px;
|
||||
|
||||
p {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
table {
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
|
@ -4,12 +4,30 @@ class About
|
||||
attr_accessor :moderators,
|
||||
:admins
|
||||
|
||||
def version
|
||||
Discourse::VERSION::STRING
|
||||
end
|
||||
|
||||
def title
|
||||
SiteSetting.title
|
||||
end
|
||||
|
||||
def locale
|
||||
SiteSetting.default_locale
|
||||
end
|
||||
|
||||
def description
|
||||
SiteSetting.site_description
|
||||
end
|
||||
|
||||
def moderators
|
||||
@moderators ||= User.where(moderator: true)
|
||||
.where.not(id: Discourse::SYSTEM_USER_ID)
|
||||
end
|
||||
|
||||
def admins
|
||||
@admins ||= User.where(admin: true)
|
||||
.where.not(id: Discourse::SYSTEM_USER_ID)
|
||||
end
|
||||
|
||||
def stats
|
||||
@ -19,7 +37,11 @@ class About
|
||||
user_count: User.count,
|
||||
topics_7_days: Topic.listable_topics.where('created_at > ?', 7.days.ago).count,
|
||||
posts_7_days: Post.where('created_at > ?', 7.days.ago).count,
|
||||
users_7_days: User.where('created_at > ?', 7.days.ago).count
|
||||
users_7_days: User.where('created_at > ?', 7.days.ago).count,
|
||||
like_count: UserAction.where(action_type: UserAction::LIKE).count,
|
||||
likes_7_days: UserAction.where(action_type: UserAction::LIKE)
|
||||
.where("created_at > ?", 7.days.ago)
|
||||
.count
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -2,5 +2,9 @@ class AboutSerializer < ApplicationSerializer
|
||||
has_many :moderators, serializer: BasicUserSerializer, embed: :objects
|
||||
has_many :admins, serializer: BasicUserSerializer, embed: :objects
|
||||
|
||||
attributes :stats
|
||||
attributes :stats,
|
||||
:description,
|
||||
:title,
|
||||
:locale,
|
||||
:version
|
||||
end
|
||||
|
@ -145,11 +145,13 @@ en:
|
||||
title: "Suggested Topics"
|
||||
|
||||
about:
|
||||
title: "About"
|
||||
simple_title: "About"
|
||||
title: "About %{title}"
|
||||
stats: "Site Statistics"
|
||||
stat:
|
||||
all_time: "All Time"
|
||||
last_7_days: "Last 7 Days"
|
||||
like_count: "Like Count"
|
||||
topic_count: "Topic Count"
|
||||
post_count: "Post Count"
|
||||
user_count: "User Count"
|
||||
|
Loading…
x
Reference in New Issue
Block a user