announcement add new widget bulletins_and_links
This commit is contained in:
parent
36e7e3d3e8
commit
b3366b48a1
|
@ -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;
|
||||||
|
}
|
|
@ -66,14 +66,75 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
||||||
|
|
||||||
end
|
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
|
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
|
end
|
||||||
|
|
||||||
def reload_web_links
|
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
|
end
|
||||||
|
|
||||||
def bulletins_side_bar
|
def bulletins_side_bar
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<% @bulletins.each do |bulletin| %>
|
<% @bulletins.each do |bulletin| %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id , :tag_id => @selected_tag.id ) %>
|
<%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category_id , :part_id => params[:part_id], :tag_id => [@selected_tag.id] ) %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class='pagination'>
|
<div class='pagination'>
|
||||||
<%= link_to_previous_page @bulletins, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :tag_id => @selected_tag.id}, :remote => true, :class => 'previous' %>
|
<%= link_to_previous_page @bulletins, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :part_id => params[:part_id], :tag_id => [@selected_tag.id]}, :remote => true, :class => 'previous' %>
|
||||||
<%= link_to_next_page @bulletins, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :tag_id => @selected_tag.id}, :remote => true, :class => 'next' %>
|
<%= link_to_next_page @bulletins, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_bulletins', :part_id => params[:part_id], :tag_id => [@selected_tag.id]}, :remote => true, :class => 'next' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<li>
|
<li>
|
||||||
<%= 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)) %>
|
||||||
</li>
|
</li>
|
|
@ -5,6 +5,6 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class='pagination'>
|
<div class='pagination'>
|
||||||
<%= link_to_previous_page @web_links, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :tag_id => @selected_tag.id}, :remote => true, :class => 'previous' %>
|
<%= link_to_previous_page @web_links, 'Previous Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :part_id => params[:part_id], :tag_id => @selected_tag.id}, :remote => true, :class => 'previous' %>
|
||||||
<%= link_to_next_page @web_links, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :tag_id => @selected_tag.id}, :remote => true, :class => 'next' %>
|
<%= link_to_next_page @web_links, 'Next Page', :params => {:controller => 'widget/bulletins', :action => 'reload_web_links', :part_id => params[:part_id], :tag_id => @selected_tag.id}, :remote => true, :class => 'next' %>
|
||||||
</div>
|
</div>
|
|
@ -0,0 +1,36 @@
|
||||||
|
<div class="mega_tab_block">
|
||||||
|
|
||||||
|
<div class="tag_block">
|
||||||
|
<ul id='bulletins_web_links_tags' class="tag_list">
|
||||||
|
<%= render :partial => 'tag', :collection => @tags %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="news_block">
|
||||||
|
<h3 class="news_title2">
|
||||||
|
<%#= link_to t("announcement.bulletins"), panel_announcement_front_end_bulletins_path, :class => 'more' %>
|
||||||
|
<%= link_to @title, panel_announcement_front_end_bulletins_path, :class => 'more' %>
|
||||||
|
</h3>
|
||||||
|
<ul id='bulletins_web_links_bulletins' class="news_list">
|
||||||
|
<%= render 'bulletins' if @bulletins %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% if @part.widget_style == 'bulletins_and_web_links' %>
|
||||||
|
|
||||||
|
<div class="links_block">
|
||||||
|
<h3 class="links_title"><%= t(:related_links) %></h3>
|
||||||
|
<ul id='bulletins_web_links_web_links' class="links_list">
|
||||||
|
<%= render 'web_links' if @web_links %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "news_link" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= stylesheet_link_tag "announcement/bulletins_and_web_links" %>
|
|
@ -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 %>")
|
|
@ -35,6 +35,6 @@ en:
|
||||||
update_bulletin_category_success: Update Category Successfully
|
update_bulletin_category_success: Update Category Successfully
|
||||||
url: URL
|
url: URL
|
||||||
widget:
|
widget:
|
||||||
bulletins_and_web_links: Bulletins and Web Resources
|
bulletins_and_web_links: Differential Nav.
|
||||||
index: Index
|
index: Index
|
||||||
search: Search
|
search: Search
|
|
@ -35,6 +35,6 @@ zh_tw:
|
||||||
update_bulletin_category_success: 更新類別成功
|
update_bulletin_category_success: 更新類別成功
|
||||||
url: 連結位置
|
url: 連結位置
|
||||||
widget:
|
widget:
|
||||||
bulletins_and_web_links: 索引
|
bulletins_and_web_links: 分眾頁籤
|
||||||
index: 索引
|
index: 索引
|
||||||
search: 搜尋
|
search: 搜尋
|
|
@ -52,6 +52,11 @@ module Announcement
|
||||||
widget_i18n "announcement.widget.search"
|
widget_i18n "announcement.widget.search"
|
||||||
end
|
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 "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"]
|
||||||
# item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
|
# item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue