demo site widget
This commit is contained in:
		
							parent
							
								
									f223e4bb1e
								
							
						
					
					
						commit
						c0cac812c5
					
				|  | @ -0,0 +1,6 @@ | ||||||
|  | 		var pic = $(".app-pic").length,w,h; | ||||||
|  | 		for(i=0; i<pic; i=i+1) { | ||||||
|  | 			w = $(".app-pic").eq(i).width(); | ||||||
|  | 			h = $(".app-pic").eq(i).height(); | ||||||
|  | 			$(".app-pic").eq(i).find('img').muImageResize({width: w, height: h}); | ||||||
|  | 		} | ||||||
|  | @ -0,0 +1,147 @@ | ||||||
|  | (function( $ ) { | ||||||
|  | 	$.fn.muImageResize = function( params ) { | ||||||
|  | 		var _defaultSettings = { | ||||||
|  | 			width:300, | ||||||
|  | 			height:300, | ||||||
|  | 			wrap_fix:true // Let image display like in-line.
 | ||||||
|  | 		}; | ||||||
|  | 		var _set = $.extend(_defaultSettings, params);  | ||||||
|  | 		var isIE7 = $.browser.msie && (7 == ~~ $.browser.version); | ||||||
|  | 
 | ||||||
|  | 		//var anyDynamicSource = $(this).attr("src");
 | ||||||
|  | 		//$(this).attr("src",anyDynamicSource+ "?" + new Date().getTime());
 | ||||||
|  | 
 | ||||||
|  | 		// Just bind load event once per element.
 | ||||||
|  | 		return this.one('load', function() { | ||||||
|  | 			// Remove all attributes and CSS rules.
 | ||||||
|  | 			this.removeAttribute( "width" ); | ||||||
|  | 			this.removeAttribute( "height" ); | ||||||
|  | 			this.style.width = this.style.height = ""; | ||||||
|  | 			 | ||||||
|  | 			var ow, oh; | ||||||
|  | 			 | ||||||
|  | 			//[workaround] - msie need get width early
 | ||||||
|  | 			if ($.browser.msie) | ||||||
|  | 			{ | ||||||
|  | 				// Get original size for calcutation.
 | ||||||
|  | 				ow = this.width; | ||||||
|  | 				oh = this.height; | ||||||
|  | 			} | ||||||
|  | 			 | ||||||
|  | 			if (_set.wrap_fix) { | ||||||
|  | 				$(this).wrap(function(){ | ||||||
|  | 					return '<div style="width:'+_set.width+'px; height:'+_set.height+'px; display:inline-block;" />'; | ||||||
|  | 				}); | ||||||
|  | 			} | ||||||
|  | 			 | ||||||
|  | 			if (!$.browser.msie) | ||||||
|  | 			{ | ||||||
|  | 				// Get original size for calcutation.
 | ||||||
|  | 				ow = this.width; | ||||||
|  | 				oh = this.height; | ||||||
|  | 			} | ||||||
|  | 			 | ||||||
|  | 			// if cannot get width or height.
 | ||||||
|  | 			if (0==ow || 0==oh){ | ||||||
|  | 				$(this).width(_set.width); | ||||||
|  | 				$(this).height(_set.height); | ||||||
|  | 			}else{ | ||||||
|  | 					 | ||||||
|  | 				// Merge position settings
 | ||||||
|  | 				var sh_margin_type=''; | ||||||
|  | 
 | ||||||
|  | 				// if original image's width > height.
 | ||||||
|  | 				if (ow > oh) { | ||||||
|  | 					p = oh / _set.height;  | ||||||
|  | 					oh = _set.height;  | ||||||
|  | 					ow = ow / p; | ||||||
|  | 					 | ||||||
|  | 					// original image width smaller than settings.
 | ||||||
|  | 					if (ow < _set.width){ | ||||||
|  | 						// need to resize again, 
 | ||||||
|  | 						// because new image size range must can cover settings' range, than we can crop it correctly. 
 | ||||||
|  | 						p = ow / _set.width;  | ||||||
|  | 						ow = _set.width; | ||||||
|  | 						oh = oh / p; | ||||||
|  | 						 | ||||||
|  | 						// the crop range would be in the center of new image size.
 | ||||||
|  | 						sh = (oh-_set.height)/2; | ||||||
|  | 						t=sh+'px'; | ||||||
|  | 						r=_set.width+'px'; | ||||||
|  | 						b=(_set.height+sh)+'px'; | ||||||
|  | 						l='0px'; | ||||||
|  | 						 | ||||||
|  | 						// need to be adjust top position latter.
 | ||||||
|  | 						sh_margin_type = 'margin-top'; | ||||||
|  | 						 | ||||||
|  | 					// original image width bigger than settings.
 | ||||||
|  | 					}else{ | ||||||
|  | 						// new image range can cover settings' range. 
 | ||||||
|  | 						sh = (ow-_set.width)/2; | ||||||
|  | 						t='0px'; | ||||||
|  | 						r=(_set.width+sh)+'px'; | ||||||
|  | 						b=_set.height+'px'; | ||||||
|  | 						l=sh+'px'; | ||||||
|  | 						// need to be adjust left position latter.
 | ||||||
|  | 						sh_margin_type = 'margin-left'; | ||||||
|  | 					} | ||||||
|  | 				// ref above, change width to height then do same things.
 | ||||||
|  | 				}else{ | ||||||
|  | 					p = ow / _set.width; | ||||||
|  | 					ow = _set.width; | ||||||
|  | 					oh = oh / p; | ||||||
|  | 
 | ||||||
|  | 					if (oh < _set.height) { | ||||||
|  | 						p = oh / _set.height; | ||||||
|  | 						oh = _set.height; | ||||||
|  | 						ow = ow / p; | ||||||
|  | 						 | ||||||
|  | 						sh = (ow-_set.width)/2; | ||||||
|  | 						t='0px'; | ||||||
|  | 						r=(_set.width+sh)+'px'; | ||||||
|  | 						b=_set.height+'px'; | ||||||
|  | 						l=sh+'px'; | ||||||
|  | 						sh_margin_type = 'margin-left'; | ||||||
|  | 					}else{ | ||||||
|  | 						sh = (oh-_set.height)/2; | ||||||
|  | 						t=sh+'px'; | ||||||
|  | 						r=_set.width+'px'; | ||||||
|  | 						b=(_set.height+sh)+'px'; | ||||||
|  | 						l='0px'; | ||||||
|  | 						sh_margin_type = 'margin-top'; | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
|  | 				 | ||||||
|  | 				// Resize img.
 | ||||||
|  | 				$(this).width(ow); | ||||||
|  | 				$(this).height(oh); | ||||||
|  | 				 | ||||||
|  | 				// Crop img by set clip style.
 | ||||||
|  | 				$(this).css('clip','rect('+t+' '+r+' '+b+' '+l+')'); | ||||||
|  | 
 | ||||||
|  | 				var osh = 0; | ||||||
|  | 				if('auto' != $(this).css(sh_margin_type)){ | ||||||
|  | 					osh = parseInt($(this).css(sh_margin_type)); | ||||||
|  | 				} | ||||||
|  | 			 | ||||||
|  | 				if (0 < sh) {sh*=-1;} | ||||||
|  | 				sh += osh; | ||||||
|  | 				 | ||||||
|  | 				$(this).css(sh_margin_type, sh+'px'); | ||||||
|  | 				$(this).css('position','absolute'); | ||||||
|  | 			} | ||||||
|  | 			$(this).fadeIn('slow'); | ||||||
|  | 		}) | ||||||
|  | 		.one( "error", function() { | ||||||
|  | 			//$(this).hide();
 | ||||||
|  | 		}) | ||||||
|  | 		.each(function() { | ||||||
|  | 			$(this).hide(); | ||||||
|  | 			// Trigger load event (for Gecko and MSIE)
 | ||||||
|  | 			if ( this.complete || $.browser.msie ) { | ||||||
|  | 				$( this ).trigger( "load" ).trigger( "error" ); | ||||||
|  | 			} | ||||||
|  | 		}); | ||||||
|  | 	}; | ||||||
|  | 	 | ||||||
|  | })( jQuery ); | ||||||
|  | @ -24,6 +24,10 @@ $("#module_app_list select").live('change', function() { | ||||||
| 	$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets'); | 	$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets'); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  | $("#widget_list select").live('change', function() { | ||||||
|  | 	$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widget_styles?module_app_id=' + $("#module_app_list select").val()); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
| $("#tag_list select").live('change', function() { | $("#tag_list select").live('change', function() { | ||||||
| 	$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_r_tag_options'); | 	$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_r_tag_options'); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | @ -26,6 +26,10 @@ class Admin::PagePartsController < ApplicationController | ||||||
|     @module_app = @part.module_app ? @part.module_app : @module_apps[0] |     @module_app = @part.module_app ? @part.module_app : @module_apps[0] | ||||||
|     @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag |     @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag | ||||||
|     @tag_objects = @r_tag.classify.constantize.all rescue nil |     @tag_objects = @r_tag.classify.constantize.all rescue nil | ||||||
|  | 	 | ||||||
|  | 	@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0] | ||||||
|  |     @widget_style =  @module_app.widgets[@widget_path] | ||||||
|  | 	 | ||||||
|       case @module_app.key |       case @module_app.key | ||||||
|         when 'announcement' |         when 'announcement' | ||||||
|           @categories =  BulletinCategory.all |           @categories =  BulletinCategory.all | ||||||
|  | @ -69,8 +73,12 @@ class Admin::PagePartsController < ApplicationController | ||||||
|    |    | ||||||
|   def reload_widgets |   def reload_widgets | ||||||
|     @module_app = ModuleApp.find(params[:id]) |     @module_app = ModuleApp.find(params[:id]) | ||||||
|  | 	 | ||||||
|  | 	@widget_path = @module_app.widgets.keys[0] | ||||||
|  |     @widget_style =  @module_app.widgets[@widget_path] | ||||||
|     case @module_app.key |     case @module_app.key | ||||||
|       when 'announcement' |       when 'announcement' | ||||||
|  | 	# @widget_style =  @module_app.widgets['index'] | ||||||
|         @categories =  BulletinCategory.all |         @categories =  BulletinCategory.all | ||||||
|         @tags = AnnouncementTag.all |         @tags = AnnouncementTag.all | ||||||
|       when 'news' |       when 'news' | ||||||
|  | @ -85,6 +93,16 @@ class Admin::PagePartsController < ApplicationController | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|    |    | ||||||
|  |   def reload_widget_styles | ||||||
|  |     @module_app = ModuleApp.find(params[:module_app_id]) | ||||||
|  | 	 | ||||||
|  |     @widget_style =  @module_app.widgets[params[:id]] | ||||||
|  |      | ||||||
|  |     respond_to do |format| | ||||||
|  |       format.js  {} | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|   def reload_r_tag_options |   def reload_r_tag_options | ||||||
|     @r_tag = (ModuleApp.find(params[:id]) rescue nil) || params[:id] |     @r_tag = (ModuleApp.find(params[:id]) rescue nil) || params[:id] | ||||||
|     @tag_objects = @r_tag.classify.constantize.all rescue nil |     @tag_objects = @r_tag.classify.constantize.all rescue nil | ||||||
|  |  | ||||||
|  | @ -16,6 +16,7 @@ class ModuleApp | ||||||
|   field :app_pages ,type: Array |   field :app_pages ,type: Array | ||||||
|   # field :widgets ,type: Array |   # field :widgets ,type: Array | ||||||
|   field :widgets ,type: Hash |   field :widgets ,type: Hash | ||||||
|  |   field :widget_fields ,type: Array | ||||||
|      |      | ||||||
|   has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app |   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 |   has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app | ||||||
|  |  | ||||||
|  | @ -11,6 +11,7 @@ class PagePart | ||||||
|   field :public_r_tag_option, :default => nil |   field :public_r_tag_option, :default => nil | ||||||
|   field :widget_path |   field :widget_path | ||||||
|   field :widget_style |   field :widget_style | ||||||
|  |   field :widget_field , :type => Array | ||||||
|   field :widget_data_count |   field :widget_data_count | ||||||
|    |    | ||||||
|   has_one :i18n_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy |   has_one :i18n_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy | ||||||
|  |  | ||||||
|  | @ -18,6 +18,8 @@ class Site | ||||||
|   field :school |   field :school | ||||||
|   field :department |   field :department | ||||||
|    |    | ||||||
|  |   mount_uploader :default_image, ImageUploader | ||||||
|  | 
 | ||||||
|   has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy |   has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy | ||||||
|   has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy |   has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy | ||||||
|   has_one :sub_menu, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy |   has_one :sub_menu, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy | ||||||
|  |  | ||||||
|  | @ -30,6 +30,9 @@ class ImageUploader < CarrierWave::Uploader::Base | ||||||
|   # def default_url |   # def default_url | ||||||
|   #   "/images/fallback/" + [version_name, "default.png"].compact.join('_') |   #   "/images/fallback/" + [version_name, "default.png"].compact.join('_') | ||||||
|   # end |   # end | ||||||
|  |   def default_url | ||||||
|  | 	Site.first.default_image.url rescue "-sign-in-logo.png" | ||||||
|  |   end | ||||||
|    |    | ||||||
|   # Process files as they are uploaded: |   # Process files as they are uploaded: | ||||||
|   # process :scale => [200, 300] |   # process :scale => [200, 300] | ||||||
|  |  | ||||||
|  | @ -14,13 +14,13 @@ | ||||||
| </span> | </span> | ||||||
| 
 | 
 | ||||||
| <span id='widget_list'> | <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{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %> | ||||||
| 	<%#= f.select :widget_path, @module_app.widgets.collect{|k,v| k}, :selected => @part.widget_path %> | 	<%= f.select :widget_path, @module_app.widgets.collect{|k,v| [k.humanize, k]}, {}, { :selected => @part.widget_path, :rel => admin_page_parts_path } %> | ||||||
| </span> | </span> | ||||||
| 
 | 
 | ||||||
| <span id='widget_style_list'> | <span id='widget_style_list'> | ||||||
| <%= @module_app.widget_indexs.collect { |k,v| v } %> | 	<%= f.select :widget_style, @widget_style, :selected => @part.widget_style %> | ||||||
| 	<%= f.select :widget_style, @module_app.widget_styles.each, :selected => @part.widget_style, :include_blank => 'None'  %> | 	<%#= render 'widget_styles' %> | ||||||
| </span> | </span> | ||||||
| 
 | 
 | ||||||
| : | : | ||||||
|  | @ -33,6 +33,19 @@ | ||||||
| 	<%= render 'widget_tags' %> | 	<%= render 'widget_tags' %> | ||||||
| </span> | </span> | ||||||
| 
 | 
 | ||||||
|  | <span id='widget_field'> | ||||||
|  | 					 | ||||||
|  | 	<%= f.label :widget_field %> | ||||||
|  | 	 | ||||||
|  | 	<% @module_app.widget_fields.each_with_index do |widget_field, i| %> | ||||||
|  | 		<%= i+1 %> | ||||||
|  | 		<%= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, (@part.widget_field ? @part.widget_field[i] : nil) ), :include_blank => true %> <br /> | ||||||
|  | 		 | ||||||
|  | 	<% end %>	 | ||||||
|  | 	 | ||||||
|  | 	<%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, @part.widget_field.collect{|widget_field| widget_field}), {:multiple => :multiple, :size => 6} %> | ||||||
|  | </span> | ||||||
|  | 
 | ||||||
| <div id="widget_data_count"> | <div id="widget_data_count"> | ||||||
| <%= f.label :widget_data_count %> | <%= f.label :widget_data_count %> | ||||||
| <%= f.text_field :widget_data_count %> | <%= f.text_field :widget_data_count %> | ||||||
|  |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | 	<%= select 'page_part', 'widget_style', @widget_style, :selected => (@part ? @part[:widget_style] : nil), :include_blank => true if @widget_style && @widget_style.size > 0 %> | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | $('#widget_style_list select').html("<%= j options_for_select(@module_app.widgets[params[:id]]) %>") | ||||||
|  | @ -1,3 +1,4 @@ | ||||||
| $('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| k}) %>") | $('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| k}) %>") | ||||||
|  | $('#widget_style_list select').html("<%= j options_for_select(@module_app.widgets[@widget_path]) %>") | ||||||
| $('#widget_category').html("<%= j render 'widget_categories' %>") | $('#widget_category').html("<%= j render 'widget_categories' %>") | ||||||
| $('#widget_tag').html("<%= j render 'widget_tags' %>") | $('#widget_tag').html("<%= j render 'widget_tags' %>") | ||||||
|  | @ -1,3 +1,5 @@ | ||||||
|  | <% # encoding: utf-8 %> | ||||||
|  | 
 | ||||||
| <% content_for :side_bar do %> | <% content_for :side_bar do %> | ||||||
| 	<%= render 'side_bar' %> | 	<%= render 'side_bar' %> | ||||||
| <% end %> | <% end %> | ||||||
|  | @ -70,6 +72,24 @@ | ||||||
| 								<% end %> | 								<% end %> | ||||||
| 							</div> | 							</div> | ||||||
| 						</div> | 						</div> | ||||||
|  | 						<div class="control-group"> | ||||||
|  | 							<label class="control-label"><%= t 'admin.default_image' %></label> | ||||||
|  | 							<div class="controls"> | ||||||
|  | 								<%= f.file_field :default_image, :id => "input-upload", :class => 'upload', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %> | ||||||
|  | 								<span id='fu' class="file-name"></span> | ||||||
|  | 							  <!--請程式務必將圖片尺寸加入到行內裡--> | ||||||
|  | 							  <% if @site.default_image %> | ||||||
|  | 								<%= image_tag( @site.default_image, :size=>"120x120") rescue ''%> | ||||||
|  | 							  <% else %> | ||||||
|  | 								<img class="pull-left upload-picture" src="/assets/default-img.png" /> | ||||||
|  | 							  <% end %> | ||||||
|  | 								<br> | ||||||
|  | 								<% if @site.default_image.file %> | ||||||
|  | 								  <%= f.check_box :remove_default_image %> | ||||||
|  | 								  <%= t('刪除已上傳檔案') %> | ||||||
|  | 								<% end %> | ||||||
|  | 							</div> | ||||||
|  | 						</div> | ||||||
| 					<% end %> | 					<% end %> | ||||||
| 				<% end %> | 				<% end %> | ||||||
| 			</div> | 			</div> | ||||||
|  |  | ||||||
|  | @ -97,6 +97,7 @@ Orbit::Application.routes.draw do | ||||||
|     resources :page_parts do |     resources :page_parts do | ||||||
|       member do |       member do | ||||||
|         get 'reload_widgets' |         get 'reload_widgets' | ||||||
|  |         get 'reload_widget_styles' | ||||||
|         get 'reload_r_tag_options' |         get 'reload_r_tag_options' | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|  |  | ||||||
|  | @ -187,7 +187,7 @@ module ParserCommon | ||||||
|           ret << part.i18n_variable[I18n.locale] rescue '' |           ret << part.i18n_variable[I18n.locale] rescue '' | ||||||
|         when 'module_widget' |         when 'module_widget' | ||||||
|           url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" |           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}&widget_style=#{part.widget_style}&widget_data_count=#{part[:widget_data_count]}" |           options = "&category_id=#{!part[:category].blank? ? part[:category] : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&part_id=#{part.id}" | ||||||
|           ret << "<div class='dymanic_load' path='#{url + options}'></div>" |           ret << "<div class='dymanic_load' path='#{url + options}'></div>" | ||||||
|         when 'public_r_tag' |         when 'public_r_tag' | ||||||
|           ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>" |           ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>" | ||||||
|  |  | ||||||
|  | @ -8,8 +8,9 @@ | ||||||
|   "create_date": "11-11-2011", |   "create_date": "11-11-2011", | ||||||
|   "app_pages":  ["bulletins"], |   "app_pages":  ["bulletins"], | ||||||
|   "widgets": { |   "widgets": { | ||||||
|     "index":["1","2","3","4","5","6","7","8","9",,"10","11","12","13","14","15","16","17","18","19"], |     "index":["1","2"], | ||||||
|     "bulletins_and_web_links":[] |     "bulletins_and_web_links":[] | ||||||
|   }, |   }, | ||||||
|  |   "widget_fields":["title","subtitle","date","image","status"], | ||||||
|   "enable_frontend": true |   "enable_frontend": true | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -10,220 +10,30 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController | ||||||
|    |    | ||||||
|   def index |   def index | ||||||
|    |    | ||||||
| 	if params[:widget_data_count] | 	@part = PagePart.find(params[:part_id]) | ||||||
| 		@page_num = params[:widget_data_count]; |    | ||||||
|  | 	if @part.widget_data_count | ||||||
|  | 		@page_num = @part.widget_data_count | ||||||
| 	else | 	else | ||||||
| 		@page_num = 4; | 		@page_num = 4 | ||||||
|  | 	end | ||||||
|  |    | ||||||
|  | 	if @part.widget_field | ||||||
|  | 		@widget_fields = @part.widget_field | ||||||
|  | 	else | ||||||
|  | 		@widget_fields = [] | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
|     @title = params[:part_title] |     @title = params[:part_title] | ||||||
| 	 | 	 | ||||||
|     @widget_style = params[:widget_style] |     @widget_style = @part.widget_style | ||||||
|  | 	 | ||||||
|  | 	@category_id = @part.category | ||||||
| 	 | 	 | ||||||
|     date_now = Time.now |     date_now = Time.now | ||||||
|     if !params[:category_id].blank? |     if !@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) |       @bulletins = Bulletin.can_display.where(:bulletin_category_id => @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 |       @current_category = BulletinCategory.from_id(@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_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? |     elsif !params[:tag_id].blank? | ||||||
|       @tag = AnnouncementTag.find(params[:tag_id]) rescue nil |       @tag = AnnouncementTag.find(params[:tag_id]) rescue nil | ||||||
|       @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag |       @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag | ||||||
|  |  | ||||||
|  | @ -5,403 +5,88 @@ | ||||||
| 
 | 
 | ||||||
| <% if @widget_style == '1' %> | <% if @widget_style == '1' %> | ||||||
| 
 | 
 | ||||||
| 	<p> ========== 1狀態(置頂 熱門等) 日期  標題 ========== </p> | 	<p> ========== 1 ========== </p> | ||||||
| 	 | 	 | ||||||
| 	<div class="news news1"> | 	<div class="news news1"> | ||||||
| 		<ul class="newslist"> | 		<ul class="newslist"> | ||||||
| 
 | 
 | ||||||
| 			<% @bulletins.each do |post| %> | 			<% @bulletins.each_with_index do |post, i| %> | ||||||
|  | 			 | ||||||
|  | 			<li <%= ( (i+1) % 2 ) == 0 ? "class='odd'" : '' %> > | ||||||
|  | 				<% @widget_fields.each do |wf|  %> | ||||||
|  | 				 | ||||||
|  | 					<% if wf == 'title' %> | ||||||
|  | 						<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %> | ||||||
|  | 					<% elsif wf == 'date' %> | ||||||
|  | 						<span class="date"><%= display_date(post.postdate) %></span> | ||||||
|  | 					<% elsif wf == 'status' %> | ||||||
|  | 						<% if post.is_top? %> | ||||||
|  | 							<span class="top"><%= t(:top) %></span> | ||||||
|  | 						<% end %> | ||||||
|  | 						<% if post.is_hot? %> | ||||||
|  | 							<span class="hot"><%= t(:hot) %></span> | ||||||
|  | 						<% end %> | ||||||
|  | 					<% elsif wf == 'subtitle' %> | ||||||
|  | 						<span class="newsintro"><%= post.subtitle[I18n.locale].html_safe %></span> | ||||||
|  | 					<% elsif wf == 'image' %> | ||||||
|  | 						<div class="newsimg app-pic"><%#= image_tag(post.image.url, :size => "90x90") if post.image.file %><%= image_tag(post.image.url) %></div> | ||||||
|  | 					<% end %> | ||||||
| 					 | 					 | ||||||
| 			<li> |  | ||||||
| 				<% if post.is_top? %> |  | ||||||
| 					<span class="top"><%= t(:top) %></span> |  | ||||||
| 				<% end %> | 				<% 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> | 			</li> | ||||||
| 
 | 
 | ||||||
| 			<% end %> | 			<% end %> | ||||||
| 			 | 			 | ||||||
| 		</ul> | 		</ul> | ||||||
| 		<div class="more">more</div> | 		 | ||||||
|  | 		<% if !@category_id.blank? %> | ||||||
|  | 		<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div> | ||||||
|  | 		<% else %> | ||||||
|  | 		<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path() %></div> | ||||||
|  | 		<% end %> | ||||||
| 	</div> | 	</div> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| <% elsif @widget_style == '2' %> | <% elsif @widget_style == '2' %> | ||||||
| 
 | 
 | ||||||
| 	<p> ========== 2日期  標題 ========== </p> | 	<p> ========== 2 ========== </p> | ||||||
| 
 | 
 | ||||||
| 	<div class="news news2">	 | 	<div class="news news2">	 | ||||||
|  | 		<div class="newsimg app-pic"><%= image_tag(@bulletins.first.image.url) %></div> | ||||||
| 		<ul class="newslist"> | 		<ul class="newslist"> | ||||||
| 			<% @bulletins.each do |post| %> |  | ||||||
| 
 | 
 | ||||||
| 			<li> | 			<% @bulletins.each_with_index do |post, i| %> | ||||||
| 				<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 <%= ( (i+1) % 2 ) == 0 ? "class='odd'" : '' %> > | ||||||
|  | 				<% @widget_fields.each do |wf|  %> | ||||||
|  | 				 | ||||||
|  | 					<% if wf == 'title' %> | ||||||
|  | 						<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id), :class=>"newstitle" %> | ||||||
|  | 					<% elsif wf == 'date' %> | ||||||
|  | 						<span class="date"><%= display_date(post.postdate) %></span> | ||||||
|  | 					<% elsif wf == 'status' %> | ||||||
|  | 						<% if post.is_top? %> | ||||||
|  | 							<span class="top"><%= t(:top) %></span> | ||||||
|  | 						<% end %> | ||||||
|  | 						<% if post.is_hot? %> | ||||||
|  | 							<span class="hot"><%= t(:hot) %></span> | ||||||
|  | 						<% end %> | ||||||
|  | 					<% elsif wf == 'subtitle' %> | ||||||
|  | 						<span class="newsintro"><%= post.subtitle[I18n.locale].html_safe %></span> | ||||||
|  | 					<% end %> | ||||||
|  | 					 | ||||||
|  | 				<% end %> | ||||||
| 			</li> | 			</li> | ||||||
| 
 | 
 | ||||||
| 			<% end %> | 			<% end %> | ||||||
| 		</ul> | 		</ul> | ||||||
| 		<div class="more">more</div> | 		 | ||||||
|  | 		<% if !@category_id.blank? %> | ||||||
|  | 		<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path( :category_id => @category_id ) %></div> | ||||||
|  | 		<% else %> | ||||||
|  | 		<div class="more"><%= link_to t('more'), panel_announcement_front_end_bulletins_path() %></div> | ||||||
|  | 		<% end %> | ||||||
|  | 		 | ||||||
| 	</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 %> | <% end %> | ||||||
|  | @ -1,3 +1,7 @@ | ||||||
|  | 
 | ||||||
|  | <script type='text/javascript' src='/assets/jquery.mu.image.resize.js'></script> | ||||||
|  | <script type='text/javascript' src='/assets/jquery.mu.image.resize.degsin.js'></script> | ||||||
|  | 
 | ||||||
| <div id="bulletin_widget"> | <div id="bulletin_widget"> | ||||||
| 	<%= render 'index' %> | 	<%= render 'index' %> | ||||||
| </div> | </div> | ||||||
		Reference in New Issue