Add page counter
This commit is contained in:
parent
1c07224694
commit
ec96a2e0e7
|
@ -12,6 +12,6 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<%= f.submit t(:update) %> <%= link_back %>
|
<%= f.submit t(:update_) %> <%= link_back %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -389,6 +389,7 @@ zh_tw:
|
||||||
paper: Paper was successfully updated.
|
paper: Paper was successfully updated.
|
||||||
user: User was successfully updated.
|
user: User was successfully updated.
|
||||||
success_: S使用者已更新成功
|
success_: S使用者已更新成功
|
||||||
|
update_: 更新
|
||||||
update_at: 最後更新時間
|
update_at: 最後更新時間
|
||||||
url: 網址
|
url: 網址
|
||||||
use_status: ''
|
use_status: ''
|
||||||
|
|
|
@ -30,6 +30,7 @@ module ParserBackEnd
|
||||||
parse_images_edit(body, page)
|
parse_images_edit(body, page)
|
||||||
parse_footer_edit(body, page)
|
parse_footer_edit(body, page)
|
||||||
parse_sub_menu_edit(body, page)
|
parse_sub_menu_edit(body, page)
|
||||||
|
parse_counter_edit(body)
|
||||||
public_r_tags.each do |tag|
|
public_r_tags.each do |tag|
|
||||||
send("parse_#{tag}s_edit", body, page, true)
|
send("parse_#{tag}s_edit", body, page, true)
|
||||||
end
|
end
|
||||||
|
|
|
@ -233,7 +233,7 @@ module ParserCommon
|
||||||
end
|
end
|
||||||
|
|
||||||
# page_counter
|
# page_counter
|
||||||
def parse_counter(body = nil, page = nil, edit=nil)
|
def parse_counter_edit(body = nil)
|
||||||
body.css('.page_counter').each do |counter|
|
body.css('.page_counter').each do |counter|
|
||||||
res = ''
|
res = ''
|
||||||
case counter['option']
|
case counter['option']
|
||||||
|
|
|
@ -11,6 +11,7 @@ module ParserFrontEnd
|
||||||
parse_images(body, page)
|
parse_images(body, page)
|
||||||
parse_menu(body, page)
|
parse_menu(body, page)
|
||||||
parse_sub_menu(body, page, site)
|
parse_sub_menu(body, page, site)
|
||||||
|
parse_counter(body)
|
||||||
i18n.merge!({locale => body.to_html})
|
i18n.merge!({locale => body.to_html})
|
||||||
end
|
end
|
||||||
i18n
|
i18n
|
||||||
|
@ -21,10 +22,14 @@ module ParserFrontEnd
|
||||||
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
|
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
|
||||||
body = Nokogiri::HTML(page.content)
|
body = Nokogiri::HTML(page.content)
|
||||||
body.css('orbit_front').each do |front|
|
body.css('orbit_front').each do |front|
|
||||||
ret = ''
|
if front['class'] && front['class'].include?('dymanic_load')
|
||||||
part = PagePart.find(front['part_id']) if front['part_id']
|
ret = ''
|
||||||
ret << eval("\"#{front['path']}\"") rescue ''
|
part = PagePart.find(front['part_id']) if front['part_id']
|
||||||
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
|
ret << eval("\"#{front['path']}\"") rescue ''
|
||||||
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
|
||||||
|
else
|
||||||
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, eval("#{front['value']}").to_s)
|
||||||
|
end
|
||||||
front.swap(fragment)
|
front.swap(fragment)
|
||||||
end
|
end
|
||||||
body.to_html
|
body.to_html
|
||||||
|
@ -131,6 +136,26 @@ module ParserFrontEnd
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def parse_counter(body = nil)
|
||||||
|
body.css('.page_counter').each do |counter|
|
||||||
|
ret = ''
|
||||||
|
case counter['option']
|
||||||
|
when 'all'
|
||||||
|
ret << "display_visitors"
|
||||||
|
when 'today'
|
||||||
|
ret << "display_visitors_today"
|
||||||
|
when 'this_week'
|
||||||
|
ret << "display_visitors_this_week"
|
||||||
|
when 'this_month'
|
||||||
|
ret << "display_visitors_this_month"
|
||||||
|
when 'this_year'
|
||||||
|
ret << "display_visitors_this_year"
|
||||||
|
end
|
||||||
|
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<orbit_front id='#{counter['id']}' class='#{counter['class']}' value='#{ret}'></orbit_front>")
|
||||||
|
counter.swap(fragment)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# ad_banners
|
# ad_banners
|
||||||
def generate_ad_banners(*args)
|
def generate_ad_banners(*args)
|
||||||
"<div class='dymanic_load' path='#{front_show_banner_path(args[0])}'></div>"
|
"<div class='dymanic_load' path='#{front_show_banner_path(args[0])}'></div>"
|
||||||
|
|
Reference in New Issue