| 
									
										
										
										
											2012-01-31 10:31:31 +00:00
										 |  |  | module Admin::AdBannerHelper | 
					
						
							| 
									
										
										
										
											2012-04-09 04:44:08 +00:00
										 |  |  |   def preview_block_ad_images_helper(ad_banner)   | 
					
						
							| 
									
										
										
										
											2012-04-01 15:39:49 +00:00
										 |  |  |          printable_ad_images = [] | 
					
						
							|  |  |  |          ad_banner.ad_images.each do |ad_image| | 
					
						
							|  |  |  |            if ad_image.display? | 
					
						
							|  |  |  |              ad_image.weight.times do | 
					
						
							|  |  |  |                printable_ad_images << ad_image | 
					
						
							|  |  |  |             end | 
					
						
							|  |  |  |            end | 
					
						
							|  |  |  |           end | 
					
						
							|  |  |  |            | 
					
						
							|  |  |  |       printable_ad_images.shuffle! | 
					
						
							| 
									
										
										
										
											2012-04-09 04:44:08 +00:00
										 |  |  |  end | 
					
						
							| 
									
										
										
										
											2012-05-15 08:39:23 +00:00
										 |  |  |     def sub_manager?(ad_banner) | 
					
						
							|  |  |  |       ad_banner.authed_users(:edit).include?(current_user) | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-15 01:57:05 +00:00
										 |  |  |     def show_ad_banner_permission_link(ad_banner) | 
					
						
							| 
									
										
										
										
											2012-05-15 10:55:16 +00:00
										 |  |  |       type = 'edit' | 
					
						
							|  |  |  |       oa = ad_banner.get_object_auth_by_title(type) | 
					
						
							| 
									
										
										
										
											2012-05-15 01:57:05 +00:00
										 |  |  |     if oa.nil? | 
					
						
							|  |  |  |       ad_banner.object_auths.new(title: type ).save | 
					
						
							|  |  |  |       oa = ad_banner.get_object_auth_by_title(type) | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | #    link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa) | 
					
						
							| 
									
										
										
										
											2012-05-15 08:39:23 +00:00
										 |  |  |      link_to t('admin.ad.cate_auth'),admin_object_auth_ob_auth_path(oa),:class => "btn btn-warning" | 
					
						
							| 
									
										
										
										
											2012-05-15 01:57:05 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-04-01 15:39:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-15 10:55:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-15 08:39:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-31 10:31:31 +00:00
										 |  |  | end |