demo widget
This commit is contained in:
parent
9aea2824b9
commit
71742179a8
|
@ -14,7 +14,8 @@ class ModuleApp
|
|||
field :enable_frontend, type: Boolean, :default => true
|
||||
|
||||
field :app_pages ,type: Array
|
||||
field :widgets ,type: Array
|
||||
# field :widgets ,type: Array
|
||||
field :widgets ,type: Hash
|
||||
|
||||
has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app
|
||||
has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app
|
||||
|
|
|
@ -10,6 +10,8 @@ class PagePart
|
|||
field :public_r_tag_object_id, :default => nil
|
||||
field :public_r_tag_option, :default => nil
|
||||
field :widget_path
|
||||
field :widget_style
|
||||
field :widget_data_count
|
||||
|
||||
has_one :i18n_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
|
|
@ -15,6 +15,12 @@
|
|||
|
||||
<span id='widget_list'>
|
||||
<%= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %>
|
||||
<%#= f.select :widget_path, @module_app.widgets.collect{|k,v| k}, :selected => @part.widget_path %>
|
||||
</span>
|
||||
|
||||
<span id='widget_style_list'>
|
||||
<%= @module_app.widget_indexs.collect { |k,v| v } %>
|
||||
<%= f.select :widget_style, @module_app.widget_styles.each, :selected => @part.widget_style, :include_blank => 'None' %>
|
||||
</span>
|
||||
|
||||
:
|
||||
|
@ -26,3 +32,8 @@
|
|||
<span id="widget_tag">
|
||||
<%= render 'widget_tags' %>
|
||||
</span>
|
||||
|
||||
<div id="widget_data_count">
|
||||
<%= f.label :widget_data_count %>
|
||||
<%= f.text_field :widget_data_count %>
|
||||
</div>
|
|
@ -1,3 +1,3 @@
|
|||
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|widget| [widget.humanize, widget]}) %>")
|
||||
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| k}) %>")
|
||||
$('#widget_category').html("<%= j render 'widget_categories' %>")
|
||||
$('#widget_tag').html("<%= j render 'widget_tags' %>")
|
|
@ -187,7 +187,7 @@ module ParserCommon
|
|||
ret << part.i18n_variable[I18n.locale] rescue ''
|
||||
when 'module_widget'
|
||||
url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true"
|
||||
options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}"
|
||||
options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&widget_style=#{part.widget_style}&widget_data_count=#{part[:widget_data_count]}"
|
||||
ret << "<div class='dymanic_load' path='#{url + options}'></div>"
|
||||
when 'public_r_tag'
|
||||
ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>"
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
{
|
||||
"title": "announcement",
|
||||
"title": "announcement",
|
||||
"version": "0.1",
|
||||
"organization": "Rulingcom",
|
||||
"author": "RD dep",
|
||||
"intro": "A simple blog……",
|
||||
"update_info": "Some info",
|
||||
"create_date": "11-11-2011",
|
||||
"app_pages": ["bulletins"],
|
||||
"widgets": ["bulletins", "bulletins_and_web_links"],
|
||||
"enable_frontend": true
|
||||
"app_pages": ["bulletins"],
|
||||
"widgets": {
|
||||
"index":["1","2","3","4","5","6","7","8","9",,"10","11","12","13","14","15","16","17","18","19"],
|
||||
"bulletins_and_web_links":[]
|
||||
},
|
||||
"enable_frontend": true
|
||||
}
|
||||
|
|
|
@ -9,17 +9,252 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
|||
# GET /bulletins.xml
|
||||
|
||||
def index
|
||||
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
|
||||
@title = params[:part_title]
|
||||
|
||||
@widget_style = params[:widget_style]
|
||||
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(4)
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(5)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(4)
|
||||
@bulletins = @tag.bulletins.can_display.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)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(4)
|
||||
@bulletins = Bulletin.can_display.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)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
end
|
||||
|
||||
def bulletins_list_2
|
||||
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
|
||||
@title = params[:part_title]
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(5)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.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)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.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)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
end
|
||||
|
||||
def bulletins_list_3
|
||||
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
|
||||
@title = params[:part_title]
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(5)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.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)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.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)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
end
|
||||
|
||||
def bulletins_list_4
|
||||
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
|
||||
@title = params[:part_title]
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(5)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.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)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.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)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
end
|
||||
|
||||
def bulletins_list_5
|
||||
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
|
||||
@title = params[:part_title]
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(5)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.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)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.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)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
end
|
||||
|
||||
def bulletins_list_6
|
||||
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
|
||||
@title = params[:part_title]
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(5)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.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)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.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)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
end
|
||||
|
||||
def bulletins_list_7
|
||||
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
|
||||
@title = params[:part_title]
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(5)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.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)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.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)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
end
|
||||
|
||||
def bulletins_list_8
|
||||
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
|
||||
@title = params[:part_title]
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(5)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.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)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.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)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
end
|
||||
|
||||
def bulletins_list_9
|
||||
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
|
||||
@title = params[:part_title]
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(5)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.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)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.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)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
end
|
||||
|
||||
def bulletins_list_and_pic
|
||||
|
||||
if params[:widget_data_count]
|
||||
@page_num = params[:widget_data_count];
|
||||
else
|
||||
@page_num = 4;
|
||||
end
|
||||
|
||||
@title = params[:part_title]
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).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)
|
||||
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
elsif !params[:tag_id].blank?
|
||||
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil
|
||||
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
|
||||
@bulletins = @tag.bulletins.can_display.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)
|
||||
else
|
||||
@bulletins = Bulletin.can_display.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)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
|
|
@ -13,6 +13,8 @@ class Bulletin
|
|||
has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_and_belongs_to_many :tags, :class_name => "AnnouncementTag"
|
||||
|
||||
field :title2, localize: true
|
||||
|
||||
field :postdate , :type => DateTime
|
||||
field :deadline , :type => DateTime
|
||||
# field :url
|
||||
|
|
|
@ -148,6 +148,12 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= f.label :title2 %>
|
||||
<%= f.fields_for :title2_translations do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title', :value => (@bulletin.title2_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :subtitle %>
|
||||
<%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %>
|
||||
|
@ -275,6 +281,7 @@
|
|||
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "bulletin_form" %>
|
||||
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
|
||||
<script>
|
||||
$('#add_bulletin_link a.add').live('click', function(){
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<% if form_bulletin_link.new_record? %>
|
||||
<a class="delete"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<%= f.hidden_field :id, :id => 'tr', :class => 'tr' %>
|
||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,17 +1,407 @@
|
|||
<% # encoding: utf-8 %>
|
||||
<% if @title %>
|
||||
<h1 class="h1"><%= @title %></h1>
|
||||
<% end %>
|
||||
|
||||
<ul>
|
||||
<% if @widget_style == '1' %>
|
||||
|
||||
<% @bulletins.each do |post| %>
|
||||
<p> ========== 1狀態(置頂 熱門等) 日期 標題 ========== </p>
|
||||
|
||||
<li>
|
||||
<div class="pic"><%= image_tag(post.image.url, :size => "90x90") if post.image.file %></div>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
</li>
|
||||
<div class="news news1">
|
||||
<ul class="newslist">
|
||||
|
||||
<% end %>
|
||||
<% @bulletins.each do |post| %>
|
||||
|
||||
</ul>
|
||||
<li>
|
||||
<% if post.is_top? %>
|
||||
<span class="top"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if post.is_hot? %>
|
||||
<span class="hot"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
|
||||
<% elsif @widget_style == '2' %>
|
||||
|
||||
<p> ========== 2日期 標題 ========== </p>
|
||||
|
||||
<div class="news news2">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
|
||||
<li>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '3' %>
|
||||
|
||||
<p> ========== 3狀態(置頂 熱門等) 標題 ========== </p>
|
||||
|
||||
<div class="news news3">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
|
||||
<li>
|
||||
<% if post.is_top? %>
|
||||
<span class="top"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if post.is_hot? %>
|
||||
<span class="hot"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '4' %>
|
||||
|
||||
<p> ========== 4狀態(置頂 熱門等) 類別 日期 標題 ========== </p>
|
||||
|
||||
<div class="news news4">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
|
||||
<li>
|
||||
<% if post.is_top? %>
|
||||
<span class="top"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if post.is_hot? %>
|
||||
<span class="hot"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<span class="category"><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '5' %>
|
||||
|
||||
<p> ========== 5日期 類別 標題 ========== </p>
|
||||
|
||||
<div class="news news5">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
|
||||
<li>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<span class="category"><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '6' %>
|
||||
|
||||
<p> ========== 6狀態(置頂 熱門等) 類別 標題 ========== </p>
|
||||
|
||||
<div class="news news6">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
|
||||
<li>
|
||||
<% if post.is_top? %>
|
||||
<span class="top"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if post.is_hot? %>
|
||||
<span class="hot"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
<span class="category"><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '7' %>
|
||||
|
||||
<p> ========== 7上架日期 標題 契子 ========== </p>
|
||||
|
||||
<div class="news news7">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
|
||||
<li>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
<span class="newsintro"><%= post.subtitle[I18n.locale].html_safe %></span>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '8' %>
|
||||
|
||||
<p> ========== 8上架日期 標題 契子 狀態 ========== </p>
|
||||
|
||||
<div class="news news8">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
|
||||
<li>
|
||||
<% if post.is_top? %>
|
||||
<span class="top"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if post.is_hot? %>
|
||||
<span class="hot"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
<span class="newsintro"><%= post.subtitle[I18n.locale].html_safe %></span>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '9' %>
|
||||
|
||||
<p> ========== 9上架日期 標題 瀏覽人次 ========== </p>
|
||||
|
||||
<div class="news news9">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
|
||||
<li>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
<span class="newscounter"><%= post.view_count %></span>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '10' %>
|
||||
|
||||
<p> ========== 10圖 標題 ========== </p>
|
||||
|
||||
<div class="news news10">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<div class="newsimg"><%= image_tag(post.image.url, :size => "90x90") if post.image.file %></div>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '11' %>
|
||||
|
||||
<p> ========== 11圖 日期 標題 ========== </p>
|
||||
|
||||
<div class="news news11">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<div class="newsimg"><%= image_tag(post.image.url, :size => "90x90") if post.image.file %></div>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '12' %>
|
||||
|
||||
<p> ========== 12圖 標題 狀態 ========== </p>
|
||||
|
||||
<div class="news news12">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<div class="newsimg"><%= image_tag(post.image.url, :size => "90x90") if post.image.file %></div>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
<% if post.is_top? %>
|
||||
<span class="top"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if post.is_hot? %>
|
||||
<span class="hot"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '13' %>
|
||||
|
||||
<p> ========== 13圖 日期 標題 狀態 ========== </p>
|
||||
|
||||
<div class="news news13">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<div class="newsimg"><%= image_tag(post.image.url, :size => "90x90") if post.image.file %></div>
|
||||
<% if post.is_top? %>
|
||||
<span class="top"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if post.is_hot? %>
|
||||
<span class="hot"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '14' %>
|
||||
|
||||
<p> ========== 14圖 標題 契子 ========== </p>
|
||||
|
||||
<div class="news news14">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<div class="newsimg"><%= image_tag(post.image.url, :size => "90x90") if post.image.file %></div>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
<span class="newsintro"><%= post.subtitle[I18n.locale].html_safe %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '15' %>
|
||||
|
||||
<p> ========== 15圖 標題 契子 狀態 ========== </p>
|
||||
|
||||
<div class="news news15">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<div class="newsimg"><%= image_tag(post.image.url, :size => "90x90") if post.image.file %></div>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
<% if post.is_top? %>
|
||||
<span class="top"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if post.is_hot? %>
|
||||
<span class="hot"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
<span class="newsintro"><%= post.subtitle[I18n.locale].html_safe %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '16' %>
|
||||
|
||||
<p> ========== 16 圖 日期 標題 契子 ========== </p>
|
||||
|
||||
<div class="news news16">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<div class="newsimg"><%= image_tag(post.image.url, :size => "90x90") if post.image.file %></div>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
<span class="newsintro"><%= post.subtitle[I18n.locale].html_safe %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '17' %>
|
||||
|
||||
<p> ========== 17圖 日期 標題 契子 狀態 ========== </p>
|
||||
|
||||
<div class="news news17">
|
||||
<ul class="newslist">
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<div class="newsimg"><%= image_tag(post.image.url, :size => "90x90") if post.image.file %></div>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
<% if post.is_top? %>
|
||||
<span class="top"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if post.is_hot? %>
|
||||
<span class="hot"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
<span class="newsintro"><%= post.subtitle[I18n.locale].html_safe %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
<% elsif @widget_style == '18' %>
|
||||
|
||||
<p> ========== 18圖一張 日期 多標題 ========== </p>
|
||||
|
||||
<div class="news news18">
|
||||
<ul class="newslist">
|
||||
<div class="newsbanner"><img src="/assets/default.jpg" alt="default" /></div>
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
|
||||
<% elsif @widget_style == '19' %>
|
||||
|
||||
<p> ========== 19圖一張 日期 多標題 ========== </p>
|
||||
|
||||
<div class="news news19">
|
||||
<ul class="newslist">
|
||||
<div class="newsbanner"><img src="/assets/default.jpg" alt="default" /></div>
|
||||
<% @bulletins.each do |post| %>
|
||||
<li>
|
||||
<span class="date"><%= display_date(post.postdate) %></span>
|
||||
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %>
|
||||
<% if post.is_top? %>
|
||||
<span class="top"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if post.is_hot? %>
|
||||
<span class="hot"><%= t(:hot) %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="more">more</div>
|
||||
</div>
|
||||
|
||||
|
||||
<% end %>
|
|
@ -39,7 +39,7 @@ Rails.application.routes.draw do
|
|||
# end
|
||||
end
|
||||
namespace :widget do
|
||||
match "bulletins" => "bulletins#index"
|
||||
match "index" => "bulletins#index"
|
||||
match "bulletins_and_web_links" => "bulletins#bulletins_and_web_links"
|
||||
match "reload_bulletins" => "bulletins#reload_bulletins"
|
||||
match "reload_web_links" => "bulletins#reload_web_links"
|
||||
|
|
Loading…
Reference in New Issue