add view_count

This commit is contained in:
JiangRu 2015-04-13 14:13:41 +08:00
parent 06fd820095
commit 180c91e81a
4 changed files with 10 additions and 0 deletions

View File

@ -5,6 +5,8 @@ class PageContentsController < OrbitAdminController
url_to_edit = OrbitHelper.user_can_edit?(page) ? "/admin/page_contents/new?page_id=#{page.id.to_s}" : "" url_to_edit = OrbitHelper.user_can_edit?(page) ? "/admin/page_contents/new?page_id=#{page.id.to_s}" : ""
{ {
"html" => (page.page_contexts.last.content rescue ""), "html" => (page.page_contexts.last.content rescue ""),
"view_count" => (page.page_contexts.last.view_count rescue ""),
"view-count-head" =>t('page_content.view_count'),
"url_to_edit" => url_to_edit "url_to_edit" => url_to_edit
} }
end end

View File

@ -1,4 +1,10 @@
<% data = action_data %> <% data = action_data %>
<div class="view_count pull-right">
<i class="fa fa-eye"><%= data["view-count-head"] %>:</i>
<span class="view-count"><%= data["view_count"] %></span>
</div>
<%= data["html"].html_safe %> <%= data["html"].html_safe %>
<% if !data["url_to_edit"].blank? %> <% if !data["url_to_edit"].blank? %>

View File

@ -2,6 +2,7 @@ en:
page_content: page_content:
page: Page content page: Page content
view_count: View count
save: Save save: Save
all: All all: All
create_page_content_success: Page content was successfully created create_page_content_success: Page content was successfully created

View File

@ -2,6 +2,7 @@ zh_tw:
page_content: page_content:
context: 內文 context: 內文
view_count: 瀏覽人次
create_page_content_success: 建立頁面內容成功 create_page_content_success: 建立頁面內容成功
editing_page_content: 編輯頁面內容 editing_page_content: 編輯頁面內容
all: All all: All