update announcement & web_resource widget
This commit is contained in:
parent
a3f152b200
commit
78a139ff38
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 %>
|
||||
|
||||
|
|
|
@ -2,21 +2,19 @@
|
|||
|
||||
<% 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>
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div>
|
||||
<h3 class="h3 news_title"><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %></h3>
|
||||
<p class="news_wrap"><%= post.subtitle[I18n.locale] %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
<h3 class="h3 news_title"><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %></h3>
|
||||
<p class="news_wrap"><%= post.subtitle[I18n.locale] %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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 ></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 ></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 ></a>
|
||||
</div>
|
||||
|
||||
<% end %>
|
|
@ -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 %>
|
||||
|
|
Loading…
Reference in New Issue