2016-04-07 22:28:31 +08:00
|
|
|
<% if crawler_layout? %>
|
|
|
|
|
2016-03-08 04:28:02 +08:00
|
|
|
<section itemscope itemtype="https://schema.org/AboutPage">
|
|
|
|
<h1 itemprop="name">
|
2021-09-27 20:45:05 +08:00
|
|
|
<%=t "js.about.title", **{title: @about.title} %>
|
2016-03-08 04:28:02 +08:00
|
|
|
</h1>
|
|
|
|
|
|
|
|
<div itemprop="text">
|
|
|
|
<%= @about.description %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h2><%=t "js.about.our_admins" %></h2>
|
|
|
|
|
|
|
|
<div class='admins-list' itemscope itemtype='http://schema.org/ItemList'>
|
|
|
|
<% @about.admins.each do |user| %>
|
|
|
|
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
|
2024-05-16 23:11:24 +08:00
|
|
|
<meta itemprop='url' content='<%= user_path(user.encoded_username(lower: true)) %>'>
|
|
|
|
<a href='<%= user_path(user.encoded_username(lower: true)) %>' itemprop='item'>
|
2016-03-08 04:28:02 +08:00
|
|
|
<span itemprop='image'>
|
|
|
|
<img width="45" height="45" class="avatar" src="<%= user.small_avatar_url %>">
|
|
|
|
</span>
|
|
|
|
<span itemprop='name'>
|
|
|
|
<%= user.username %>
|
2016-09-27 03:31:39 +08:00
|
|
|
<% if user.name.present? && SiteSetting.enable_names %>
|
2016-03-08 04:28:02 +08:00
|
|
|
- <%= user.name %>
|
|
|
|
<% end %>
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% if @about.moderators.count > 0 %>
|
|
|
|
<h2><%=t "js.about.our_moderators" %></h2>
|
|
|
|
<div class='moderators-list' itemscope itemtype='http://schema.org/ItemList'>
|
|
|
|
<% @about.moderators.each do |user| %>
|
|
|
|
<div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'>
|
2024-05-16 23:11:24 +08:00
|
|
|
<meta itemprop='url' content='<%= user_path(user.encoded_username(lower: true)) %>'>
|
|
|
|
<a href='<%= user_path(user.encoded_username(lower: true)) %>' itemprop='item'>
|
2016-03-08 04:28:02 +08:00
|
|
|
<span itemprop='image'>
|
|
|
|
<img width="45" height="45" class="avatar" src="<%= user.small_avatar_url %>">
|
|
|
|
</span>
|
|
|
|
<span itemprop='name'>
|
|
|
|
<%= user.username %>
|
2016-09-27 03:31:39 +08:00
|
|
|
<% if user.name.present? && SiteSetting.enable_names %>
|
2016-03-08 04:28:02 +08:00
|
|
|
- <%= user.name %>
|
|
|
|
<% end %>
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
2016-04-07 22:28:31 +08:00
|
|
|
<%- stats = About.fetch_cached_stats %>
|
|
|
|
|
2016-03-08 04:28:02 +08:00
|
|
|
<section class='about stats'>
|
|
|
|
<h2><%=t 'js.about.stats' %></h2>
|
|
|
|
|
|
|
|
<table class='table'>
|
|
|
|
<tr>
|
|
|
|
<th> </th>
|
|
|
|
<th><%=t 'js.about.stat.all_time' %></th>
|
2021-04-12 10:50:33 +08:00
|
|
|
<th><%=t 'js.about.stat.last_day' %></th>
|
2016-03-08 04:28:02 +08:00
|
|
|
<th><%=t 'js.about.stat.last_7_days' %></th>
|
|
|
|
<th><%=t 'js.about.stat.last_30_days' %></th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='title'><%=t 'js.about.topic_count' %></td>
|
2016-04-07 22:28:31 +08:00
|
|
|
<td><%= stats["topic_count"] %></td>
|
2021-04-12 10:50:33 +08:00
|
|
|
<td><%= stats["topics_last_day"] %></td>
|
2016-04-07 22:28:31 +08:00
|
|
|
<td><%= stats["topics_7_days"] %></td>
|
|
|
|
<td><%= stats["topics_30_days"] %></td>
|
2016-03-08 04:28:02 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><%=t 'js.about.post_count' %></td>
|
2016-04-07 22:28:31 +08:00
|
|
|
<td><%= stats["post_count"] %></td>
|
2021-04-12 10:50:33 +08:00
|
|
|
<td><%= stats["posts_last_day"] %></td>
|
2016-04-07 22:28:31 +08:00
|
|
|
<td><%= stats["posts_7_days"] %></td>
|
|
|
|
<td><%= stats["posts_30_days"] %></td>
|
2016-03-08 04:28:02 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><%=t 'js.about.user_count' %></td>
|
2016-04-07 22:28:31 +08:00
|
|
|
<td><%= stats["user_count"] %></td>
|
2021-04-12 10:50:33 +08:00
|
|
|
<td><%= stats["users_last_day"] %></td>
|
2016-04-07 22:28:31 +08:00
|
|
|
<td><%= stats["users_7_days"] %></td>
|
|
|
|
<td><%= stats["users_30_days"] %></td>
|
2016-03-08 04:28:02 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><%=t 'js.about.active_user_count' %></td>
|
|
|
|
<td>—</td>
|
2021-04-12 10:50:33 +08:00
|
|
|
<td><%= stats["active_users_last_day"] %></td>
|
2016-04-07 22:28:31 +08:00
|
|
|
<td><%= stats["active_users_7_days"] %></td>
|
|
|
|
<td><%= stats["active_users_30_days"] %></td>
|
2016-03-08 04:28:02 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><%=t 'js.about.like_count' %></td>
|
2016-04-07 22:28:31 +08:00
|
|
|
<td><%= stats["like_count"] %></td>
|
2021-04-12 10:50:33 +08:00
|
|
|
<td><%= stats["likes_last_day"] %></td>
|
2016-04-07 22:28:31 +08:00
|
|
|
<td><%= stats["likes_7_days"] %></td>
|
|
|
|
<td><%= stats["likes_30_days"] %></td>
|
2016-03-08 04:28:02 +08:00
|
|
|
</tr>
|
FEATURE: Add plugin API to register About stat group (#17442)
This commit introduces a new plugin API to register
a group of stats that will be included in about.json
and also conditionally in the site about UI at /about.
The usage is like this:
```ruby
register_about_stat_group("chat_messages", show_in_ui: true) do
{
last_day: 1,
"7_days" => 10,
"30_days" => 100,
count: 1000,
previous_30_days: 120
}
end
```
In reality the stats will be generated any way the implementer
chooses within the plugin. The `last_day`, `7_days`, `30_days,` and `count`
keys must be present but apart from that additional stats may be added.
Only those core 4 stat keys will be shown in the UI, but everything will be shown
in about.json.
The stat group name is used to prefix the stats in about.json like so:
```json
"chat_messages_last_day": 2322,
"chat_messages_7_days": 2322,
"chat_messages_30_days": 2322,
"chat_messages_count": 2322,
```
The `show_in_ui` option (default false) is used to determine whether the
group of stats is shown on the site About page in the Site Statistics
table. Some stats may be needed purely for reporting purposes and thus
do not need to be shown in the UI to admins/users. An extension to the Site
serializer, `displayed_about_plugin_stat_groups`, has been added so this
can be inspected on the client-side.
2022-07-15 11:16:00 +08:00
|
|
|
<% About.displayed_plugin_stat_groups.each do |stat_group_name| %>
|
|
|
|
<tr>
|
|
|
|
<td><%=t "js.about.#{stat_group_name}_count" %></td>
|
|
|
|
<td><%= stats["#{stat_group_name}_count"] %></td>
|
|
|
|
<td><%= stats["#{stat_group_name}_last_day"] %></td>
|
|
|
|
<td><%= stats["#{stat_group_name}_7_days"] %></td>
|
|
|
|
<td><%= stats["#{stat_group_name}_30_days"] %></td>
|
|
|
|
</tr>
|
|
|
|
<% end %>
|
2016-03-08 04:28:02 +08:00
|
|
|
</table>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
<br/>
|
2016-04-07 22:28:31 +08:00
|
|
|
<br/>
|
|
|
|
|
|
|
|
<% end %>
|
2016-08-19 19:34:43 +08:00
|
|
|
|
2018-11-28 00:19:59 +08:00
|
|
|
<% if @title %>
|
|
|
|
<% content_for :title do %><%= @title %><% end %>
|
|
|
|
<% content_for :head do %>
|
|
|
|
<%= raw crawlable_meta_data(title: @title, description: SiteSetting.site_description) %>
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<% content_for :head do %>
|
|
|
|
<%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %>
|
|
|
|
<% end %>
|
2016-08-19 19:34:43 +08:00
|
|
|
<% end %>
|