diff --git a/vendor/built_in_modules/news/app/assets/javascripts/module_widget.js b/app/assets/javascripts/module.js.erb similarity index 95% rename from vendor/built_in_modules/news/app/assets/javascripts/module_widget.js rename to app/assets/javascripts/module.js.erb index aea46d72..fc19b8e6 100644 --- a/vendor/built_in_modules/news/app/assets/javascripts/module_widget.js +++ b/app/assets/javascripts/module.js.erb @@ -6,4 +6,3 @@ // //= require jquery //= require jquery_ujs -//= require news_link \ No newline at end of file diff --git a/app/assets/javascripts/page_edit.js b/app/assets/javascripts/page_edit.js.erb similarity index 63% rename from app/assets/javascripts/page_edit.js rename to app/assets/javascripts/page_edit.js.erb index a889f5b2..7c0f6923 100644 --- a/app/assets/javascripts/page_edit.js +++ b/app/assets/javascripts/page_edit.js.erb @@ -32,3 +32,24 @@ $('.part_kind').live('click', function() { $('.part_kind_partial').hide(); $('#part_' + $(this).attr('value')).show(); }); + +$(document).ready(function(){ + $('ol.sortable').nestedSortable({ + disableNesting: 'no-nest', + forcePlaceholderSize: true, + handle: 'i', + helper: 'clone', + items: 'li', + maxLevels: 3, + opacity: .5, + placeholder: 'placeholder', + revert: 250, + tabSize: 25, + tolerance: 'pointer', + toleranceElement: '> div', + + stop: function(event, ui) { + $.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: ui.item.parent().closest('li').attr('id'), position: ui.item.index() } ); + } + }); +}); \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 494b497e..4d8d6d48 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -95,9 +95,9 @@ class ApplicationController < ActionController::Base end # Render the page - def render_page(param={}) + def render_page if @item - render :text => process_page(@item, param[:id], param), :layout => 'page_layout' + render :text => parse_page_noko(@item), :layout => 'page_layout' else render :text => '404 Not Found' end diff --git a/app/controllers/orbit_frontend_component_controller.rb b/app/controllers/orbit_frontend_component_controller.rb index 185dbce6..09621e5f 100644 --- a/app/controllers/orbit_frontend_component_controller.rb +++ b/app/controllers/orbit_frontend_component_controller.rb @@ -1,7 +1,7 @@ class OrbitFrontendComponentController< ApplicationController before_filter :setup_vars before_filter {|c| c.front_end_available(@app_title)} - layout :false + layout "module_widget" def setup_vars @app_title = request.fullpath.split('/')[2] diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index b781f202..45299450 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -19,7 +19,7 @@ class PagesController < ApplicationController if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) case @item._type when 'Page' - render_page(params) + render_page when 'Link' redirect_to "http://#{@item[:url]}" end @@ -32,17 +32,19 @@ class PagesController < ApplicationController end def index_from_link - if params[:page] - redirect_to "/#{@item.path}?page=#{params[:page]}&category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}" - else - redirect_to "/#{@item.path}?category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}" - end + url = "/#{@item.path}" + options = '' + options << "?page_main=#{params[:page_main]}" unless params[:page_main].blank? + options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank? + options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank? + redirect_to url + options end def show_from_link - # debugger - # a=1 - redirect_to "/#{@item.path}?id=#{params[:id]}&preview=#{params[:preview]}" + url = "/#{@item.path}?id=#{params[:id]}" + options = '' + options << "&preview=#{params[:preview]}" unless params[:preview].blank? + redirect_to url + options end def load_orbit_bar diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 37c2d0d2..32800d80 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -89,11 +89,7 @@ module ApplicationHelper def active_for_action(controller_name, action_name) ((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil end - - def process_page(page, id, params) - parse_page_noko(page, id, params) - end - + def page_metas(page) tmp_meta = {} metas = '' diff --git a/app/models/page_part.rb b/app/models/page_part.rb index 8bb1bc72..52eafdf3 100644 --- a/app/models/page_part.rb +++ b/app/models/page_part.rb @@ -11,9 +11,27 @@ class PagePart field :public_r_tag_option, :default => nil field :widget_path - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + has_one :i18n_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy belongs_to :page belongs_to :module_app + before_save :set_key + + def i18n_variable + @i18n_variable ||= I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => self.id, :language_value_type => self.class}) rescue nil + end + + def title + @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil + end + + protected + + def set_key + title.key = 'title' if title && (title.key.blank? rescue true) + i18n_variable.key = 'i18n_variable' if i18n_variable && (i18n_variable.key.blank? rescue true) + end + end \ No newline at end of file diff --git a/app/views/admin/items/_site_map_left_bar.html.erb b/app/views/admin/items/_site_map_left_bar.html.erb index b33023b4..8d32365f 100644 --- a/app/views/admin/items/_site_map_left_bar.html.erb +++ b/app/views/admin/items/_site_map_left_bar.html.erb @@ -1,25 +1 @@ <%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %> - - - \ No newline at end of file diff --git a/app/views/admin/page_parts/_edit.html.erb b/app/views/admin/page_parts/_edit.html.erb index ec99c555..eaee4d8f 100644 --- a/app/views/admin/page_parts/_edit.html.erb +++ b/app/views/admin/page_parts/_edit.html.erb @@ -2,7 +2,7 @@ <% LIST[:page_part_kinds].each do |kind| %> <%= f.radio_button :kind, kind, :class => 'part_kind' %> - <%= t(kind) %> + <%= t(kind, :scope => 'admin.page_part_kinds') %> <% end %> <% LIST[:page_part_kinds].each do |kind| %> diff --git a/app/views/admin/page_parts/_module_widget.html.erb b/app/views/admin/page_parts/_module_widget.html.erb index 3f81a5ae..1a1dd63c 100644 --- a/app/views/admin/page_parts/_module_widget.html.erb +++ b/app/views/admin/page_parts/_module_widget.html.erb @@ -1,3 +1,14 @@ +
+ <%= f.fields_for :title, @part.title do |f| %> + <% @site_valid_locales.each do |locale| %> +

+ <%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}" %> + <%= f.text_field locale %> +

+ <% end %> +<% end %> +
+ <%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :title, :selected => @module_app.id), {}, {:rel => admin_page_parts_path} %> diff --git a/app/views/admin/page_parts/_text.html.erb b/app/views/admin/page_parts/_text.html.erb index 4193cf50..529773e3 100644 --- a/app/views/admin/page_parts/_text.html.erb +++ b/app/views/admin/page_parts/_text.html.erb @@ -8,5 +8,7 @@ <% end %> diff --git a/app/views/admin/pages/_edit.html.erb b/app/views/admin/pages/_edit.html.erb index b2da28d0..81d40ed6 100644 --- a/app/views/admin/pages/_edit.html.erb +++ b/app/views/admin/pages/_edit.html.erb @@ -2,10 +2,10 @@

<%= t('admin.editing_page') %>

<%= form_for @item, :url => admin_page_path(@item), :html => { :class => 'form-horizontal edit_page' } do |f| %> - <%= render :partial => "form", :locals => { :f => f } %> -
- <%= f.submit t('update'), :class => 'btn btn-primary' %> - <%= link_to t('cancel'), get_go_back, :class=>"btn" %> -
+ <%= render :partial => "form", :locals => { :f => f } %> +
+ <%= f.submit t('update'), :class => 'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
+ <% end %>
-<% end %> \ No newline at end of file diff --git a/app/views/admin/pages/_form.html.erb b/app/views/admin/pages/_form.html.erb index 94632b57..36e6e008 100644 --- a/app/views/admin/pages/_form.html.erb +++ b/app/views/admin/pages/_form.html.erb @@ -5,7 +5,7 @@ <%= f.label :name, t('admin.name'), :class => 'control-label' %>
<%= f.text_field :name, :class => 'text input-xlarge' %> -

In addition to freeform text, any HTML5 text-based input appears like so.

+
@@ -15,7 +15,7 @@ <%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<%= f.text_field locale, :class => 'text input-xlarge' %> -

In addition to freeform text, any HTML5 text-based input appears like so.

+
<% end %> @@ -25,14 +25,14 @@ <%= f.label :name, t('admin.design_name'), :class => 'control-label' %>
<%= f.collection_select :design, @designs, :id, :title, {:selected => @design.id}, {:rel => admin_pages_path} %> -

In addition to freeform text, any HTML5 text-based input appears like so.

+
<%= f.label :name, t('admin.theme'), :class => 'control-label' %>
<%= f.select :theme_id, @design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %> -

In addition to freeform text, any HTML5 text-based input appears like so.

+
@@ -45,7 +45,7 @@ <%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%> -

In addition to freeform text, any HTML5 text-based input appears like so.

+
@@ -59,7 +59,7 @@ <%= f.radio_button :is_published, false %> No -

In addition to freeform text, any HTML5 text-based input appears like so.

+
@@ -72,7 +72,7 @@ <% end %> <%= hidden_field_tag 'page[menu_enabled_for][]', '' %> -

In addition to freeform text, any HTML5 text-based input appears like so.

+
@@ -86,7 +86,7 @@ <% end %> <%= hidden_field_tag 'page[enabled_for][]', '' %> -

In addition to freeform text, any HTML5 text-based input appears like so.

+ diff --git a/app/views/admin/pages/_new.html.erb b/app/views/admin/pages/_new.html.erb index a2991bec..d3190e0e 100644 --- a/app/views/admin/pages/_new.html.erb +++ b/app/views/admin/pages/_new.html.erb @@ -1,13 +1,11 @@ -

<%= t('admin.new_page') %>

- <%= flash_messages %> - -<%= form_for @item, :url => admin_pages_path, :html => { :class => 'form' } do |f| %> - - <%= render :partial => "form", :locals => { :f => f } %> - -

- <%= f.submit t('create') %> <%= link_back %> -

- -<% end %> \ No newline at end of file +
+

<%= t('admin.new_page') %>

+ <%= form_for @item, :url => admin_page_path, :html => { :class => 'form-horizontal edit_page' } do |f| %> + <%= render :partial => "form", :locals => { :f => f } %> +
+ <%= f.submit t('update'), :class => 'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
+ <% end %> +
\ No newline at end of file diff --git a/app/views/layouts/module_widget.html.erb b/app/views/layouts/module_widget.html.erb index 44a2be85..793f7370 100644 --- a/app/views/layouts/module_widget.html.erb +++ b/app/views/layouts/module_widget.html.erb @@ -5,7 +5,9 @@ <%= javascript_include_tag "html5" %> <%#= stylesheet_link_tag "module_widget" %> - <%= javascript_include_tag "module_widget" %> + <%= javascript_include_tag "module" %> + <%#= javascript_include_tag "#{@app_title}/module_widget" %> + <%= yield :page_specific_javascript %> <%= csrf_meta_tag %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 07bfe189..0d0707cc 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -200,6 +200,10 @@ en: options: Options orig_upload_file: Original filename page: Page + page_part_kinds: + text: Text Area + public_r_tag: System Widget + module_widget: Plug-in Module Widget position: Position published?: Published? purchase: Purchase diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index ae1b92f3..b4d644c7 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -195,6 +195,10 @@ zh_tw: options: 選項 orig_upload_file: 原上傳檔名 page: 頁面管理 + page_part_kinds: + text: 文字區塊 + public_r_tag: 系統模塊 + module_widget: 外掛模塊 position: 位置 published?: 發布? purchase: 購買 diff --git a/lib/parsers/parser_back_end.rb b/lib/parsers/parser_back_end.rb index 03141df2..aed8f36b 100644 --- a/lib/parsers/parser_back_end.rb +++ b/lib/parsers/parser_back_end.rb @@ -23,67 +23,19 @@ module ParserBackEnd # ret << "" # end - def parse_page_edit_noko(page, id = nil) + def parse_page_edit_noko(page) body = Nokogiri::HTML(page.design.layout.body) parse_menu(body, page, true) - public_r_tags = parse_content_edits(body, page, id) + public_r_tags = parse_contents(body, page, true) parse_images(body, page) - parse_footer(body, page, true) - parse_sub_menu(body, page, true) - + parse_footer(body, page) + parse_sub_menu(body, page) public_r_tags.each do |tag| - send("parse_#{tag}s", body, page, id, true) + send("parse_#{tag}s", body, page, true) end - body.to_html end - # page_contents - def parse_content_edits(body, page, id) - public_r_tags = [] - body.css('.page_content').each do |content| - ret = '' - if (content["main"] == "true" && !page.module_app.nil?) - ret << "
" - else - part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil - ret << "
" if part - ret << "' - case part.kind - when 'text' - ret << part.i18n_variable[I18n.locale] rescue '' - when 'module_widget' - if !part[:category].blank? - ret << "
" - elsif !part[:tag].blank? - ret << "
" - else - ret << "
" - end - when 'public_r_tag' - ret << "" - public_r_tags << part.public_r_tag - else - '' - end if part - end - scope = "<#{content.name}" - content.attributes.each_pair do |key, value| - scope << " #{key}='#{value}'" - end - scope << ">#{ret}" - fragment = Nokogiri::HTML::DocumentFragment.new(body, scope) - content.swap(fragment) - end - public_r_tags.uniq - end - - def self.included(base) base.send :helper_method, :parse_page_edit_noko if base.respond_to? :helper_method end diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index 59bd85b3..4afa586c 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -36,7 +36,7 @@ module ParserCommon end # ad_banners - def parse_ad_banners(body = nil, page = nil, id = nil, edit=nil) + def parse_ad_banners(body = nil, page = nil, edit=nil) body.css('ad_banner').each do |banner| res = '' ad_banner = AdBanner.find(banner["id"]) rescue nil @@ -82,7 +82,7 @@ module ParserCommon end # page_images - def parse_images(body, page, id = nil, edit=nil) + def parse_images(body, page, edit=nil) body.css('.page_image').each do |page_image| # image = page.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } # image = page.design.custom_images.detect{|image| image.name.eql?(tag.attr['name']) } unless image @@ -109,7 +109,7 @@ module ParserCommon end # sub_menus - def parse_sub_menus(body = nil, page = nil, id = nil, edit=nil) + def parse_sub_menus(body = nil, page = nil, edit=nil) body.css('sub_menu').each do |sub_menu| menu_page = Page.find(sub_menu['id']) rescue nil res = '' @@ -132,7 +132,7 @@ module ParserCommon end # page_footer - def parse_footer(body, page, edit=nil) + def parse_footer(body, page) page_footer = body.css('.page_footer').first if page_footer res = "
" @@ -146,7 +146,7 @@ module ParserCommon end # page_sub_menu - def parse_sub_menu(body, page, edit=nil) + def parse_sub_menu(body, page) page_sub_menu = body.css('.page_sub_menu').first if page_sub_menu res = "
" @@ -159,4 +159,48 @@ module ParserCommon end end + # page_contents + def parse_contents(body, page, edit=nil) + public_r_tags = [] + body.css('.page_content').each do |content| + ret = '' + if (content["main"] == "true" && !page.module_app.nil?) + ret << "
" + 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 + if edit + ret << "
" if part + ret << "' + end + case part.kind + when 'text' + ret << part.i18n_variable[I18n.locale] rescue '' + when 'module_widget' + url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" + options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : params[:category_id]}&tag_id=#{!part[:tag].blank? ? part[:tag] : params[:tag_id]}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}" + ret << "
" + when 'public_r_tag' + ret << "" + public_r_tags << part.public_r_tag + else + '' + end if part + end + scope = "<#{content.name}" + content.attributes.each_pair do |key, value| + scope << " #{key}='#{value}'" + end + scope << ">#{ret}" + fragment = Nokogiri::HTML::DocumentFragment.new(body, scope) + content.swap(fragment) + end + public_r_tags.uniq + end + end diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index 6320f808..3d39bd5f 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -21,69 +21,18 @@ module ParserFrontEnd require 'nokogiri' - def parse_page_noko(page, id = nil,params) + def parse_page_noko(page) body = Nokogiri::HTML(page.design.layout.body) parse_menu(body, page) - public_r_tags = parse_contents(body, page, id,params[:preview]) + public_r_tags = parse_contents(body, page) parse_images(body, page) parse_footer(body, page) parse_sub_menu(body, page) - public_r_tags.each do |tag| - send("parse_#{tag}s", body, page,id) + send("parse_#{tag}s", body, page) end body.to_html end - - # page_contents - def parse_contents(body, page, id,preview = false) - public_r_tags = [] - body.css('.page_content').each do |content| - ret = '' - if (content["main"] == "true" && !page.module_app.nil?) - ret << "
" - else - part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil - case part.kind - when 'text' - ret << part.i18n_variable[I18n.locale] rescue '' - when 'module_widget' - # if part[:category] - # ret << "
" - # else - # ret << "
" - # end - if !part[:category].blank? - ret << "
" - elsif !part[:tag].blank? - ret << "
" - else - ret << "
" - end - when 'public_r_tag' - ret << "" - public_r_tags << part.public_r_tag - else - '' - end if part - end - scope = "<#{content.name}" - content.attributes.each_pair do |key, value| - scope << " #{key}='#{value}'" - end - scope << ">#{ret}" - fragment = Nokogiri::HTML::DocumentFragment.new(body, scope) - content.swap(fragment) - end - public_r_tags.uniq - end end diff --git a/vendor/built_in_modules/announcement/app/assets/javascripts/module_widget.js b/vendor/built_in_modules/announcement/app/assets/javascripts/module_widget.js deleted file mode 100644 index 9c429aac..00000000 --- a/vendor/built_in_modules/announcement/app/assets/javascripts/module_widget.js +++ /dev/null @@ -1,9 +0,0 @@ -// This is a manifest file that'll be compiled into including all the files listed below. -// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically -// be included in the compiled file accessible from http://example.com/assets/application.js -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -//= require jquery -//= require jquery_ujs -//= require announcement_link \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index 725ffac9..56cbb312 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -12,14 +12,14 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController date_now = Time.now if !params[:category_id].blank? - @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) + @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil elsif !params[:tag_id].blank? @tag = AnnouncementTag.find(params[:tag_id]) rescue nil @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag - @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) + @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) else - @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) + @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) end end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb index 57295cc7..316a715b 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb @@ -9,7 +9,7 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController # GET /bulletins.xml def index - + @title = params[:part_title] date_now = Time.now if !params[:category_id].blank? @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) @@ -31,7 +31,6 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController @selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0] @bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil - render :layout => 'module_widget' end def reload_bulletins diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb index 086794b9..16ac7d8b 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb @@ -3,9 +3,9 @@ <%= flash_messages %> <% if @current_category %> -

<%= @current_category.i18n_variable[I18n.locale] + t('announcement.bulletin.list_lower') %>

+

<%= @current_category.i18n_variable[I18n.locale] %>

<% else %> -

<%= t('announcement.list_announcement') %>

+

<%= t('announcement.announcement') %>

<% end %> @@ -29,5 +29,5 @@ -<%= paginate @bulletins, :params => {:inner => 'false'} %> +<%= paginate @bulletins, :param_name => :page_main, :params => {:inner => 'false'} %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb new file mode 100644 index 00000000..c0fe606f --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb @@ -0,0 +1,25 @@ +<% if @title %> +

<%= @title %>

+<% end %> + + + + + + + + + +<% @bulletins.each do |post| %> + + + + + + +<% end %> + +
<%= t('announcement.bulletin.category') %><%= t('announcement.bulletin.title') %><%= t('announcement.bulletin.postdate') %>
<%= post.bulletin_category.i18n_variable[I18n.locale] %><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> + <%= post.postdate %>
+ +<%= paginate @bulletins, :params => {:inner => 'true'}, :remote => true %> \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.html.erb index 3e628120..50ae0674 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.html.erb @@ -16,4 +16,8 @@ -
\ No newline at end of file +
+ +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "news_link" %> +<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb index c885488f..dacb9eaf 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb @@ -1,29 +1,3 @@ -<% if @current_category %> -

<%= @current_category.i18n_variable[I18n.locale] + t('announcement.bulletin.list_lower') %>

-<% elsif @tag %> -

<%= @tag[I18n.locale] + t('announcement.bulletin.list_lower') %>

-<% else %> -

<%= t('announcement.list_announcement') %>

-<% end %> - - - - - - - - - -<% @bulletins.each do |post| %> - - - - - - -<% end %> - -
<%= t('announcement.bulletin.category') %><%= t('announcement.bulletin.title') %><%= t('announcement.bulletin.postdate') %>
<%= post.bulletin_category.i18n_variable[I18n.locale] %><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> - <%= post.postdate %>
- -<%= paginate @bulletins, :params => {:inner => 'false'} %> \ No newline at end of file +
+ <%= render 'index' %> +
\ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.js.erb new file mode 100644 index 00000000..e1be79eb --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.js.erb @@ -0,0 +1 @@ +$('#bulletin_widget').html("<%= j render 'index' %>") \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml index 5a1d2f13..4d4d426d 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -58,6 +58,7 @@ en: announcement: all_articles: List add_new: Add + announcement: Announcement categories: Categories error: no_avilb_cate_for_posting: You need a category to submit your post,please contact admin @@ -66,7 +67,6 @@ en: more: more+ bulletins: Bulletins related_links: Related Links - list_announcement: List Announcement bulletin: submit_user_list: Submit User category: Category diff --git a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml index 5e559b6a..4fb22bb9 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -37,6 +37,7 @@ zh_tw: announcement: add_new: 新增 all_articles: 列表 + announcement: 公告 error: no_avilb_cate_for_posting: 您目前沒有分類可以刊登公告,請聯絡系統管理員為您開通分類 tags: 標籤 @@ -47,7 +48,6 @@ zh_tw: more: 更多+ bulletins: 公告訊息 related_links: 相關連結 - list_announcement: 公告列表 bulletin: category: 分類 submit_user_list: 張貼人 diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb index 263d1cf2..57ff9e0a 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb @@ -11,13 +11,13 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController def index date_now = Time.now if !params[:category_id].blank? - @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) + @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) elsif !params[:tag_id].blank? tmp = NewsTag.find(params[:tag_id]) rescue nil tmp = NewsTag.where(key: params[:tag_id])[0] unless tmp - @news_bulletins = tmp.news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) rescue nil + @news_bulletins = tmp.news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) rescue nil else - @news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) + @news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) end get_categorys diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/widget/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/widget/news_bulletins_controller.rb index a6d20ca7..dad3c781 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/widget/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/widget/news_bulletins_controller.rb @@ -9,16 +9,17 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController # GET /news_bulletins.xml def index + @title = params[:part_title] date_now = Time.now if !params[:category_id].blank? - @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) + @news_bulletins = NewsBulletin.can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5) @current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil elsif !params[:tag_id].blank? @tag = NewsTag.find(params[:tag_id]) rescue nil @tag = NewsTag.where(key: params[:tag_id])[0] unless @tag - @news_bulletins = @tag.news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) rescue nil + @news_bulletins = @tag.news_bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5) rescue nil else - @news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) + @news_bulletins = NewsBulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5) end end @@ -28,7 +29,6 @@ class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController @selected_tag = NewsTag.find(params[:id]) rescue @tags[0] @news_bulletins = @selected_tag.get_visible_news_bulletins.can_display.page(params[:page]).per(5) rescue nil @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil - render :layout => 'module_widget' end def reload_news_bulletins diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb index 9fc3f129..4c2292a6 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb @@ -3,9 +3,9 @@ <%= flash_messages %> <% if @current_category %> -

<%= @current_category.i18n_variable[I18n.locale] + t('news.news_bulletin.list_lower') %>

+

<%= @current_category.i18n_variable[I18n.locale] %>

<% else %> -

<%= t('news.list_news') %>

+

<%= t('news.news') %>

<% end %> @@ -28,5 +28,5 @@
-<%= paginate @news_bulletins, :params => {:inner => 'false'} %> +<%= paginate @news_bulletins, :param_name => :page_main, :params => {:inner => 'false'} %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb new file mode 100644 index 00000000..d345f037 --- /dev/null +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb @@ -0,0 +1,27 @@ +<% # encoding: utf-8 %> + +<% if @title %> +

<%= @title %>

+<% end %> + + + + + + + + + <% @news_bulletins.each do |post| %> + + + + + + <% end %> + +
<%= t('news.news_bulletin.image') %><%= t('news.news_bulletin.title') %><%= t('news.news_bulletin.postdate') %>
<%= image_tag post.image %> + <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %> + <%= post.subtitle[I18n.locale].html_safe %> + <%= post.postdate %>
+ +<%= paginate @news_bulletins, :params => {:inner => 'true'}, :remote => true %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb index bb2ff639..1b59c3f9 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb @@ -1,33 +1,3 @@ -<% # encoding: utf-8 %> - -<%= flash_messages %> - -<% if @current_category %> -

<%= @current_category.i18n_variable[I18n.locale] + t('news.news_bulletin.list_lower') %>

-<% elsif @tag %> -

<%= @tag[I18n.locale] + t('news.news_bulletin.list_lower') %>

-<% else %> -

<%= t('news.list_news') %>

-<% end %> - - - - - - - - - <% @news_bulletins.each do |post| %> - - - - - - <% end %> - -
<%= t('news.news_bulletin.image') %><%= t('news.news_bulletin.title') %><%= t('news.news_bulletin.postdate') %>
<%= image_tag post.image %> - <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %> - <%= post.subtitle[I18n.locale].html_safe %> - <%= post.postdate %>
- -<%= paginate @news_bulletins, :params => {:inner => 'false'} %> +
+ <%= render 'index' %> +
\ No newline at end of file diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.js.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.js.erb new file mode 100644 index 00000000..d4862b87 --- /dev/null +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.js.erb @@ -0,0 +1 @@ +$('#news_bulletin_widget').html("<%= j render 'index' %>") \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_and_web_links.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_and_web_links.html.erb index 9e8ae742..b71f26f9 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_and_web_links.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_and_web_links.html.erb @@ -16,4 +16,8 @@ -
\ No newline at end of file +
+ +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "announcement_link" %> +<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/news/config/locales/en.yml b/vendor/built_in_modules/news/config/locales/en.yml index 557a643b..37f06ea4 100644 --- a/vendor/built_in_modules/news/config/locales/en.yml +++ b/vendor/built_in_modules/news/config/locales/en.yml @@ -63,7 +63,7 @@ en: more: more+ news_bulletins: NewsBulletins related_links: Related Links - list_news: List News + news: News news_bulletin: category: Category list_lower: " list" diff --git a/vendor/built_in_modules/news/config/locales/zh_tw.yml b/vendor/built_in_modules/news/config/locales/zh_tw.yml index afbca2b0..290df5e6 100644 --- a/vendor/built_in_modules/news/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/news/config/locales/zh_tw.yml @@ -43,9 +43,9 @@ zh_tw: sure?: 確定嗎? campus_news: 校園新聞 more: 更多+ - news_bulletins: 公告訊息 + news_bulletins: 新聞訊息 related_links: 相關連結 - list_news: 公告列表 + news: 新聞 news_bulletin: category: 分類 list_lower: 列表 diff --git a/vendor/built_in_modules/news/news.json b/vendor/built_in_modules/news/news.json index 74b2bfcc..e1b5c95e 100644 --- a/vendor/built_in_modules/news/news.json +++ b/vendor/built_in_modules/news/news.json @@ -7,6 +7,6 @@ "update_info": "Some info", "create_date": "11-11-2011", "app_pages": ["news_bulletins"], - "widgets": ["news_bulletins", "news_bulletins_and_web_links", "home_banner"], + "widgets": ["news_bulletins", "home_banner"], "enable_frontend": true } diff --git a/vendor/built_in_modules/web_resource/app/assets/javascripts/web_resource/.gitkeep b/vendor/built_in_modules/web_resource/app/assets/javascripts/web_resource/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/front_end/web_links_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/front_end/web_links_controller.rb index 82804979..e605c768 100644 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/front_end/web_links_controller.rb +++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/front_end/web_links_controller.rb @@ -12,7 +12,7 @@ class Panel::WebResource::FrontEnd::WebLinksController < OrbitWidgetController date_now = Time.now - @web_links = WebLink.where( :is_hidden => false ).desc(:is_top, :name).page( params[:page]).per(20) + @web_links = WebLink.where( :is_hidden => false ).desc(:is_top, :name).page(params[:page]).per(10) get_categorys end diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb index ec57451c..504e82e1 100644 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb +++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb @@ -25,6 +25,7 @@ class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController def home_list + @title = params[:part_title] # deadline diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.html.erb index 2c30da53..2c32f800 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.html.erb @@ -2,7 +2,7 @@ <%= flash_messages %> -<%= paginate @web_links %> +<%= paginate @web_links, :params => {:inner => false}%>

<%= t('web_link.list_web_resource') %>

diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.js.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.js.erb new file mode 100644 index 00000000..c5efda63 --- /dev/null +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.js.erb @@ -0,0 +1 @@ +alert('bob'); \ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/home_list.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/home_list.html.erb index 5be53041..1f9fd304 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/home_list.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/home_list.html.erb @@ -1,5 +1,7 @@