Merge branch 'nccu_master' into demo_site
Conflicts: Gemfile app/assets/javascripts/tinymce_orbit.js.erb app/assets/stylesheets/style.css.erb app/controllers/admin/assets_controller.rb app/controllers/admin/module_apps_new_interface_controller.rb app/controllers/admin/page_parts_controller.rb app/jobs/sync_db.rb app/models/page.rb app/models/page_part.rb app/models/user/user.rb app/uploaders/image_uploader.rb app/views/admin/assets/create.js.erb app/views/admin/module_apps/reload_frontend_pages.js.erb app/views/layouts/_orbit_bar.html.erb app/views/layouts/_side_bar.html.erb app/views/layouts/_users_checkbox_ary.html.erb app/views/shared/_privilege_user.html.erb config/mongoid.yml lib/parsers/parser_common.rb vendor/built_in_modules/announcement/announcement.json vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form_bulletin_link.html.erb vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/_privilege_user.html.erb vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb
This commit is contained in:
commit
7d5531bf01
432 files changed
+8773
-17035
No files matched your search
@@ -17,7 +17,7 @@ module ParserBackEnd
|
||||
# item = Item.first(:conditions => { :path => tag.attr['name'] })
|
||||
# ret = ''
|
||||
# ret << "<a href='"
|
||||
# ret << eval("admin_#{item._type.downcase}_path(item.id)")
|
||||
# ret << eval("admin_#{item.class.to_s.downcase}_path(item.id)")
|
||||
# ret << "' class='nav'>"
|
||||
# ret << item.i18n_variable[I18n.locale]
|
||||
# ret << "</a>"
|
||||
|
||||
@@ -9,13 +9,14 @@ module ParserCommon
|
||||
res << "'>"
|
||||
i = nil
|
||||
i = 1 if menu.values["li_incremental_#{current}"]
|
||||
if menu.values['home'] && current == 1
|
||||
res << menu_li(page, current_page, current, menu, i, edit)
|
||||
end
|
||||
page.visible_children.each do |child|
|
||||
children = current == 1 ? page.visible_children.reverse : page.visible_children
|
||||
children.each do |child|
|
||||
res << menu_li(child, current_page, current, menu, i, edit)
|
||||
i += 1 if i
|
||||
end
|
||||
if menu.values['home'] && current == 1
|
||||
res << menu_li(page, current_page, current, menu, i, edit)
|
||||
end
|
||||
res << "</ul>"
|
||||
end
|
||||
res
|
||||
@@ -28,8 +29,8 @@ module ParserCommon
|
||||
res << " active" if (current_page.id.eql?(page.id) || current_page.descendant_of?(page))
|
||||
res << "'>"
|
||||
root = "/"
|
||||
res << "<a href='#{edit ? root + admin_page_path(page.id) : (page._type.eql?('Page') ? root + page.path : page.url)}'><span>#{page.i18n_variable[I18n.locale]}</span></a>"
|
||||
if page.visible_children.size > 0 && current <= menu.levels
|
||||
res << "<a href='#{edit ? root + admin_page_path(page.id) : (page.class.to_s.eql?('Page') ? root + page.path : page.url)}'><span>#{page.title}</span></a>"
|
||||
if page.visible_children.size > 0 && current < menu.levels
|
||||
res << "<span class='dot'></span>"
|
||||
res << menu_level(page, current_page, current + 1, menu, edit)
|
||||
end unless (page.root? rescue nil)
|
||||
@@ -43,20 +44,26 @@ module ParserCommon
|
||||
ad_banner = AdBanner.find(banner["id"]) rescue nil
|
||||
if ad_banner
|
||||
res << "<script type='text/javascript'>
|
||||
$(document).ready(function(){
|
||||
$('#slideshow-#{ad_banner.title.dehumanize}').cycle({
|
||||
delay: -1000,
|
||||
fx: '#{ad_banner.ad_fx.nil? ? 'fade': ad_banner.ad_fx}',
|
||||
timeoutFn: getTimeout,
|
||||
pager: '#banner_nav',
|
||||
pagerAnchorBuilder: function(idx, slide) {
|
||||
return \"<li><a href='#'>sfdsfsf</a></li>\";
|
||||
}
|
||||
jQuery(function( $ ){
|
||||
$.preload( '#slideshow-#{ad_banner.title.dehumanize} img', {
|
||||
onFinish:finish,
|
||||
threshold: 2 //'2' is the default, how many at a time, to load.
|
||||
});
|
||||
function finish(){
|
||||
$('#slideshow-#{ad_banner.title.dehumanize}').cycle({
|
||||
delay: -1000,
|
||||
fx: '#{ad_banner.ad_fx.nil? ? 'fade': ad_banner.ad_fx}',
|
||||
timeoutFn: getTimeout,
|
||||
pager: '#banner_nav',
|
||||
pagerAnchorBuilder: function(idx, slide) {
|
||||
return \"<li><a href='#'></a></li>\";
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
</script>"
|
||||
res << "<ul id='banner_nav' class='clear'></ul>"
|
||||
res << "<div id='slideshow-#{ad_banner.title.dehumanize}'>"
|
||||
res << "<div id='slideshow-#{ad_banner.title.dehumanize}' class='slideshow'>"
|
||||
printable_ad_images = []
|
||||
ad_banner.ad_images.each do |ad_image|
|
||||
if ad_image.display?
|
||||
@@ -66,13 +73,15 @@ module ParserCommon
|
||||
end
|
||||
end
|
||||
printable_ad_images.shuffle!
|
||||
hide = printable_ad_images.size > 1
|
||||
printable_ad_images.each do |ad_image| #TODO Need Reflact
|
||||
res << "<img src='#{ad_image.file}' "
|
||||
res << "alt='#{ad_image.title[I18n.locale] || ' '}' "
|
||||
res << "alt='#{ad_image.title || ' '}' "
|
||||
res << "time_to_next='#{ad_banner.transition_msec}' "
|
||||
res << "link_open='#{ad_image.link_open}' "
|
||||
# res << "link_url='#{(ad_image.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' "
|
||||
res << "link_url='#{(ad_image.out_link || ad_banner.context || ' ')}' "
|
||||
res << "link_url='#{(ad_image.out_link)}' "
|
||||
res << "style='#{'display:none;' if hide} #{'cursor:pointer;' if !ad_image.out_link.blank?}'"
|
||||
res << "/>"
|
||||
end
|
||||
res << "</div>"
|
||||
@@ -116,12 +125,12 @@ module ParserCommon
|
||||
res = ''
|
||||
if menu_page && menu_page.visible_children.size > 0
|
||||
res << "<div class='category_list'>"
|
||||
res << "<h3 class='h3'>#{menu_page.i18n_variable[I18n.locale]}</h3>"
|
||||
res << "<h3 class='h3'>#{menu_page.title}</h3>"
|
||||
res << "<ul class='list'>"
|
||||
menu_page.visible_children.each do |child|
|
||||
res << "<li class='#{page.id.eql?(child.id) ? 'active' : nil}'>"
|
||||
root = "/"
|
||||
res << "<a href='#{edit ? root + admin_page_path(child.id) : (child._type.eql?('Page') ? root + child.path : child.url)}'>#{child.i18n_variable[I18n.locale]}</a>"
|
||||
res << "<a href='#{edit ? root + admin_page_path(child.id) : (child.class.to_s.eql?('Page') ? root + child.path : child.url)}'>#{child.title}</a>"
|
||||
res << "</li>"
|
||||
end
|
||||
res << "</ul>"
|
||||
@@ -138,7 +147,7 @@ module ParserCommon
|
||||
page_footer = body.css('.page_footer').first
|
||||
if page_footer
|
||||
res = "<div id='#{page_footer['id']}', class='#{page_footer['class']}'>"
|
||||
res << @site.footer[I18n.locale] rescue nil
|
||||
res << @site.footer rescue nil
|
||||
res << "</div>"
|
||||
fragment = Nokogiri::HTML::DocumentFragment.new(body ,res)
|
||||
page_footer.swap(fragment) rescue nil
|
||||
@@ -152,7 +161,7 @@ module ParserCommon
|
||||
page_sub_menu = body.css('.page_sub_menu').first
|
||||
if page_sub_menu
|
||||
res = "<div id='#{page_sub_menu['id']}', class='#{page_sub_menu['class']}'>"
|
||||
res << @site.sub_menu[I18n.locale] rescue nil
|
||||
res << @site.sub_menu rescue nil
|
||||
res << "</div>"
|
||||
fragment = Nokogiri::HTML::DocumentFragment.new(body ,res)
|
||||
page_sub_menu.swap(fragment) rescue nil
|
||||
@@ -161,6 +170,15 @@ module ParserCommon
|
||||
end
|
||||
end
|
||||
|
||||
# sitemap
|
||||
def parse_sitemaps(body = nil, page = nil, edit=nil)
|
||||
sitemap = body.css('sitemap').first
|
||||
url = admin_site_sitemap_frontend_path(@site)
|
||||
options = "?inner=true"
|
||||
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load' path='#{url + options}'></div>")
|
||||
sitemap.swap(fragment)
|
||||
end
|
||||
|
||||
# page_contents
|
||||
def parse_contents(body, page, edit=nil)
|
||||
public_r_tags = []
|
||||
@@ -171,11 +189,11 @@ module ParserCommon
|
||||
if (content["main"] == "true" && !page.module_app.nil?)
|
||||
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
|
||||
ret << "/#{params[:id]}" if params[:id] && !params[:id].eql?(page.id.to_s)
|
||||
ret << "?inner=true&page_id=#{page.id}&category_id=#{category}&tag_id=#{tag}&preview=#{params[:preview]}&page_main=#{params[:page_main]}"
|
||||
ret << "?inner=true&page_id=#{page.id}&category_id=#{category}&tag_id=#{tag}&preview=#{params[:preview]}&page_main=#{params[:page_main]}&search_query=#{params[:search_query]}&name=#{params[:name]}"
|
||||
ret << "'></div>"
|
||||
else
|
||||
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
|
||||
part_title = part.title[I18n.locale] rescue nil
|
||||
part_title = part.title rescue nil
|
||||
if edit
|
||||
ret << "<div id='#{content['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>" if part
|
||||
ret << "<div class='edit_link' style='display:none'>"
|
||||
@@ -184,11 +202,11 @@ module ParserCommon
|
||||
end
|
||||
case part.kind
|
||||
when 'text'
|
||||
ret << part.i18n_variable[I18n.locale] rescue ''
|
||||
ret << part.content rescue ''
|
||||
when 'module_widget'
|
||||
url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true"
|
||||
options = "&category_id=#{!part[:category].blank? ? part[:category] : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&part_id=#{part.id}"
|
||||
ret << "<div class='dymanic_load' path='#{url + options}'></div>"
|
||||
options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&part_id=#{part.id}"
|
||||
ret << "<div class='dymanic_load widget' path='#{url + options}'></div>"
|
||||
when 'public_r_tag'
|
||||
ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"
|
||||
public_r_tags << part.public_r_tag
|
||||
|
||||
Reference in new issue
Block a user