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| %>