diff --git a/vendor/built_in_modules/announcement/app/assets/stylesheets/announcement/bulletins_and_web_links.css b/vendor/built_in_modules/announcement/app/assets/stylesheets/announcement/bulletins_and_web_links.css new file mode 100644 index 000000000..ecd28219e --- /dev/null +++ b/vendor/built_in_modules/announcement/app/assets/stylesheets/announcement/bulletins_and_web_links.css @@ -0,0 +1,78 @@ + +.mega_tab_block { + clear: both; + position: relative; +} + +.mega_tab_block h3 { + font: 22px/100% 'arial',sans-serif; + margin: 0 0 10px; + padding: 0; +} + +.mega_tab_block .pagination { + float: left; + height: auto; + margin: 10px 0 0; + width: auto; +} +.mega_tab_block .pagination a { + background: none repeat scroll 0 0 #EEEEEE; + display: block; + float: left; + margin: 0 5px 0 0; + padding: 10px; +} + + +.tag_block { + clear: both; + margin: 0 0 20px; + position: relative; +} +.mega_tab_block .tag_list { + background: none repeat scroll 0 0 #EEEEEE; + margin: 0; + overflow: hidden; + padding: 0 0 0 5px; +} +.mega_tab_block .tag_list li { + float: left; + list-style: none outside none; +} +.mega_tab_block .tag_list li a { + background: none repeat scroll 0 0 #DDDDDD; + float: left; + margin: 0 5px 0 0; + padding: 10px; +} + +.news_block { + clear: both; + margin: 0 0 20px; + overflow: hidden; + position: relative; +} +.mega_tab_block .news_list { + margin: 0; + padding: 0; +} +.mega_tab_block .news_list li { + list-style: none outside none; + padding: 5px 0; +} + + +.links_block { + clear: both; + overflow: hidden; + position: relative; +} +.mega_tab_block .links_list { + margin: 0; + padding: 0; +} +.mega_tab_block .links_list li { + list-style: none outside none; + padding: 5px 0; +} \ No newline at end of file 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 2867205ed..45bb60cc3 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 @@ -66,14 +66,75 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController end + def bulletins_and_web_links + + @part = PagePart.find(params[:part_id]) if !params[:part_id].blank? + + @title = @part.title_translations[I18n.locale.to_s] + + if !@part.blank? and @part.widget_data_count + @page_num = @part.widget_data_count + else + @page_num = 5 + end + + date_now = Time.now + + if !params[:tag_id].blank? + @tags = Tag.any_in(:_id => params[:tag_id]).asc(:created_at) + elsif params[:tag_id].blank? and !@part.tag.blank? + @tags = Tag.any_in(:_id => @part.tag).asc(:created_at) + else + @ModuleApp_b = ModuleApp.first(:conditions => {:key=>'announcement'}) + @tags = Tag.where(:module_tag_id => @ModuleApp_b.id).asc(:created_at) + end + + @selected_tag = Tag.find(params[:id]).first rescue @tags[0] + + @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => @selected_tag.id.to_s, :is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, :postdate).page(params[:page]).per(@page_num) rescue nil + + if @part.widget_style == 'bulletins_and_web_links' + @ModuleApp_w = ModuleApp.first(:conditions => {:key=>'web_resource'}) + @link_selected_tag = Tag.first(:conditions => {:name => @selected_tag.name, :module_tag_id => @ModuleApp_w.id}) + @web_links = WebLink.where(:tagged_ids => @link_selected_tag.id.to_s, :is_hidden => false).desc(:is_top,:created_at).available_for_lang(I18n.locale).page(params[:page]).per(@page_num) rescue nil + end + + end + def reload_bulletins - @selected_tag = Tag.find(params[:tag_id]) - @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => params[:tag_id]).where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort).page(params[:page]).per(5) rescue nil + + @part = PagePart.find(params[:part_id]) if !params[:part_id].blank? + + @title = @part.title_translations[I18n.locale.to_s] + + if !@part.blank? and @part.widget_data_count + @page_num = @part.widget_data_count + else + @page_num = 5 + end + + date_now = Time.now + + @selected_tag = Tag.find(params[:tag_id]).first + @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => @selected_tag.id.to_s, :is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, :postdate).page(params[:page]).per(@page_num) rescue nil end def reload_web_links - @selected_tag = Tag.find(params[:tag_id]) - @web_links = WebLink.where(:name => @selected_tag.name).where(:is_hidden => false).desc(:is_top, sort).available_for_lang(I18n.locale).page(params[:page]).per(5) rescue nil + + @part = PagePart.find(params[:part_id]) if !params[:part_id].blank? + + if !@part.blank? and @part.widget_data_count + @page_num = @part.widget_data_count + else + @page_num = 5 + end + + date_now = Time.now + + @selected_tag = Tag.find(params[:tag_id]).first + @ModuleApp = ModuleApp.first(:conditions => {:key=>'web_resource'}) + @link_selected_tag = Tag.first(:conditions => {:name => @selected_tag.name, :module_tag_id => @ModuleApp.id}) + @web_links = WebLink.where(:tagged_ids => @link_selected_tag.id.to_s, :is_hidden => false).desc(:is_top,:created_at).available_for_lang(I18n.locale).page(params[:page]).per(@page_num) rescue nil end def bulletins_side_bar diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb index 97067fb36..c1e9407ed 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb @@ -1,10 +1,10 @@ <% @bulletins.each do |bulletin| %>
  • - <%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.category_id , :tag_id => @selected_tag.id ) %> + <%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.category_id, :part_id => params[:part_id] , :tag_id => @selected_tag.id ) %>
  • <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_tag.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_tag.html.erb index 6188bfe92..e7b87179f 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_tag.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_tag.html.erb @@ -1,3 +1,3 @@
  • - <%= link_to tag.name, panel_announcement_widget_bulletins_and_web_links_path(:id => tag.id), :remote => true, :class => ('active' if tag.eql?(@selected_tag)) %> + <%= link_to tag.name, panel_announcement_widget_bulletins_and_web_links_path(:inner=>true, :id => [tag.id], :part_id=>params[:part_id]), :remote => true, :class => ('active' if tag.eql?(@selected_tag)) %>
  • \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb index a1b8f4dba..928326c00 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_web_links.html.erb @@ -5,6 +5,6 @@ <% end %> \ 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 new file mode 100644 index 000000000..483042ee1 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.html.erb @@ -0,0 +1,36 @@ +
    + +
    + +
    + +
    +

    + <%#= link_to t("announcement.bulletins"), panel_announcement_front_end_bulletins_path, :class => 'more' %> + <%= link_to @title, panel_announcement_front_end_bulletins_path, :class => 'more' %> +

    + +
    + + <% if @part.widget_style == 'bulletins_and_web_links' %> + + + + <% end %> + +
    + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "news_link" %> +<% end %> + +<%= stylesheet_link_tag "announcement/bulletins_and_web_links" %> \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.js.erb new file mode 100644 index 000000000..9439ce4df --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/bulletins_and_web_links.js.erb @@ -0,0 +1,3 @@ +$('#bulletins_web_links_tags').html("<%= j render :partial => 'tag', :collection => @tags %>") +$('#bulletins_web_links_bulletins').html("<%= j render 'bulletins' if @bulletins %>") +$('#bulletins_web_links_web_links').html("<%= j render 'web_links' if @web_links %>") \ 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 00c740796..6f204af95 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -32,6 +32,6 @@ en: update_bulletin_category_success: Update Category Successfully url: URL widget: - bulletins_and_web_links: Bulletins and Web Resources + bulletins_and_web_links: Differential Nav. index: Index search: Search 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 04d1fe257..21ca4e8c1 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -34,6 +34,6 @@ zh_tw: update_bulletin_category_success: 更新類別成功 url: 連結位置 widget: - bulletins_and_web_links: 索引 + bulletins_and_web_links: 分眾頁籤 index: 索引 search: 搜尋 \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb index 001176eff..0c55fda34 100644 --- a/vendor/built_in_modules/announcement/init.rb +++ b/vendor/built_in_modules/announcement/init.rb @@ -53,6 +53,11 @@ module Announcement widget_i18n "announcement.widget.search" end + customize_widget "bulletins_and_web_links" do + widget_i18n "announcement.widget.bulletins_and_web_links" + style ["bulletins_and_links","bulletins_only"] + end + # item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"] # item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links" end