update announcement & web_resource widget

This commit is contained in:
unknown 2012-02-17 19:45:48 +08:00
parent 5da75161c4
commit daebaa43f8
8 changed files with 39 additions and 99 deletions

View File

@ -7,6 +7,6 @@
"update_info": "Some info",
"create_date": "11-11-2011",
"app_pages": ["bulletins"],
"widgets": ["bulletins"],
"widgets": ["bulletins","bulletins_list"],
"enable_frontend": true
}

View File

@ -2,7 +2,6 @@
<% if @bulletins and !@bulletins.nil? %>
<!-- tag -->
<div class="tag_block">
<ul class="tag_list">
<% @tags.each do |tag| %>
@ -11,15 +10,18 @@
</ul>
</div>
<!-- news -->
<div class="news_block">
<h3 class="news_title"><%= t('公告訊息')%></h3>
<% @tags.each_with_index do |tag, index| %>
<div id="news_<%= index %>" class="news_block">
<h3 class="news_title2"><%= t('公告訊息')%></h3>
<div class="news_prev">prev</div>
<div class="news_next">next</div>
<ul class="news_list">
<% @bulletins.each do |post| %>
<% tag.bulletins.each do |post| %>
<li><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %></li>
<% end %>
</ul>
</div>
<% end %>
<% end %>

View File

@ -2,11 +2,11 @@
<% if @bulletins and !@bulletins.nil? %>
<div class="topic_news">
<div class="topic_news2">
<h2 class="topic_title"><%= t('焦點新聞')%></h2>
<%= link_to "more+",panel_announcement_front_end_bulletins_path(), :class => "topic_note" %>
<ul>
<h2 class="topic_title"><%= t('焦點新聞')%></h2>
<%= link_to "more+",panel_announcement_front_end_bulletins_path(), :class => "topic_note" %>
<div class="topic_prev">previous page</div>
<div class="topic_next">next page</div>
<ul>
<% @bulletins.each do |post| %>
<li>
<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div>
@ -14,9 +14,7 @@
<p class="news_wrap"><%= post.subtitle[I18n.locale] %></p>
</li>
<% end %>
</ul>
</div>
</div>
</ul>
<% end %>

View File

@ -1,30 +0,0 @@
class Panel::Announcement::Widget::BulletinsController < ObitWidgetController
def initialize
super
@app_title = NewBlog::MOUDLEAPP_TITLE
end
# GET /bulletins
# GET /bulletins.xml
def index
# deadline
@bulletin = Bulletin.where( :postdate.lte => Date.today ).desc(:is_top, :postdate).first
@bulletins = Bulletin.widget_datas
get_categorys
end
protected
def get_categorys
@bulletin_categorys = BulletinCategory.excludes('disabled' => true)
end
end

View File

@ -12,11 +12,14 @@ class Panel::WebResource::Widget::WebLinksController < ObitWidgetController
# deadline
@web_link = WebLink.where( :is_hidden => false ).desc(:is_top, :name).first
# @web_link = WebLink.where( :is_hidden => false ).desc(:is_top, :name).first
@web_links = WebLink.widget_datas
@web_links = WebLink.widget_datas.limit(5)
get_categorys
# get_categorys
module_app = ModuleApp.first(:conditions => {:key => 'web_resource'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id})
end

View File

@ -2,4 +2,9 @@ class WebResourceTag < Tag
has_and_belongs_to_many :web_links
def get_visible_links(sort = :name)
self.web_links.where(:is_hidden => false).desc(:is_top, sort)
end
end

View File

@ -1,42 +0,0 @@
<% if @bulletin and !@bulletin.nil? %>
<div id="col1" class="col">
<h1 class="h1 ini_heading col_title"><%= @bulletin.title %></h1>
<p class="ini_txt"><%= @bulletin.subtitle %></p>
<%= link_to "read more >",panel_announcement_front_end_bulletin_path(@bulletin.id) %>
<a class="btn" href="">read more &gt;</a>
</div>
<% end %>
<% if @bulletins and !@bulletins.nil? %>
<div id="col2" class="col">
<h1 class="h1 ini_heading col_title">news</h1>
<ul class="ini_list">
<% @bulletins.each do |post| %>
<li><span class="time"><%= post.postdate.to_s.gsub("-", "") %></span><%= link_to post.title,panel_announcement_front_end_bulletin_path(post) %></li>
<% end %>
</ul>
<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %>
<a class="btn" href="announcement">read more &gt;</a>
</div>
<div id="col2" class="col">
<h1 class="h1 ini_heading col_title">news</h1>
<ul class="ini_list">
<% @bulletins.each do |post| %>
<li>
<%= image_tag(post.image.url, :size => "160x140") if post.image.file %>
<h4><%= post.title %></h4>
<%= post.subtitle %>
</li>
<% end %>
</ul>
<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %>
<a class="btn" href="announcement">read more &gt;</a>
</div>
<% end %>

View File

@ -2,13 +2,17 @@
<% if @web_links and !@web_links.nil? %>
<div class="links_block">
<% @tags.each_with_index do |tag, index| %>
<div id="links_<%= index %>" class="links_block">
<h3 class="links_title"><%= t('相關連結')%></h3>
<div class="links_prev">prev</div>
<div class="links_next">next</div>
<ul class="links_list">
<% @web_links.each do |post| %>
<%# tag.web_links.each do |post| %>
<% tag.get_visible_links(:name).each do |post| %>
<li><%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %></li>
<% end %>
</ul>
</div>
<% end %>
<% end %>