fix view count for wiki page

This commit is contained in:
邱博亞 2021-11-23 11:53:23 +08:00
parent 76867812ed
commit d60851d28c
2 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,8 @@ class PageContentsController < OrbitAdminController
params = OrbitHelper.params
if params["wiki"].present?
page = WikiPage.where(:uid => params["wiki"]).first
page.view_count += 1
page.save
name = page.title rescue ""
html = page.content rescue ""
url_to_edit = OrbitHelper.user_can_edit?(page) ? "/admin/wiki_pages/#{page.id}/edit?page_id=#{page.page.id.to_s}" : ""

View File

@ -2,7 +2,7 @@
<% if data["view_count"].to_i > 0 %>
<div class="view_count pull-right">
<i class="fa fa-eye"><%= data["view-count-head"] %>:</i>
<span class="view-count"><%= data["view_count"] %></span>
<span class="view-count"><%= data["view_count"]+(Site.first.view_count_start||0 rescue 0) %></span>
</div>
<% end %>
<style>