fix view count for wiki page
This commit is contained in:
parent
76867812ed
commit
d60851d28c
|
@ -3,6 +3,8 @@ class PageContentsController < OrbitAdminController
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
if params["wiki"].present?
|
if params["wiki"].present?
|
||||||
page = WikiPage.where(:uid => params["wiki"]).first
|
page = WikiPage.where(:uid => params["wiki"]).first
|
||||||
|
page.view_count += 1
|
||||||
|
page.save
|
||||||
name = page.title rescue ""
|
name = page.title rescue ""
|
||||||
html = page.content 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}" : ""
|
url_to_edit = OrbitHelper.user_can_edit?(page) ? "/admin/wiki_pages/#{page.id}/edit?page_id=#{page.page.id.to_s}" : ""
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<% if data["view_count"].to_i > 0 %>
|
<% if data["view_count"].to_i > 0 %>
|
||||||
<div class="view_count pull-right">
|
<div class="view_count pull-right">
|
||||||
<i class="fa fa-eye"><%= data["view-count-head"] %>:</i>
|
<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>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<style>
|
<style>
|
||||||
|
|
Loading…
Reference in New Issue