diff --git a/app/assets/javascripts/ad_banner.js b/app/assets/javascripts/ad_banner.js index 57176a1c..bab55a67 100644 --- a/app/assets/javascripts/ad_banner.js +++ b/app/assets/javascripts/ad_banner.js @@ -15,4 +15,4 @@ $('a.remove_mark').live("click",function(){ $(this).next().remove(); $(this).remove(); return false; -}); \ No newline at end of file +}); diff --git a/app/models/ad_banner.rb b/app/models/ad_banner.rb index 4fcfea9b..0a2928b3 100644 --- a/app/models/ad_banner.rb +++ b/app/models/ad_banner.rb @@ -18,6 +18,13 @@ class AdBanner FX_TYPES = ["blindX","blindY","blindZ","cover","curtainX","curtainY","fade","fadeZoom","growX","growY","scrollUp","scrollDown","scrollLeft","scrollRight","scrollHorz","scrollVert","shuffle","slideX","slideY","toss","turnUp","turnDown","turnLeft","turnRight","uncover","wipe","zoom"] + def display? + if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today)) + return true + end + return false + end + def new_ad_images=(*attrs) attrs[0].each do |attr| #Loop by JSs,Themes,Imgs unless attr[:file].nil? diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb index dc8eab8b..5d06d798 100644 --- a/app/models/ad_image.rb +++ b/app/models/ad_image.rb @@ -7,10 +7,23 @@ class AdImage field :time_to_next #Weight field :picture_intro field :out_link + field :link_open field :to_save, :type => Boolean field :to_destroy, :type => Boolean + LINK_OPEN_TYPES = ["new_window","local"] + + embedded_in :ad_banner + def get_delay_time + time = '' + if self.time_to_next.nil? + time = '1000' + else + time = (self.time_to_next.to_i * 1000).to_s + end + time + end end diff --git a/app/views/admin/ad_banners/_ad_image.html.erb b/app/views/admin/ad_banners/_ad_image.html.erb index 7ecdaa3b..e724a47f 100644 --- a/app/views/admin/ad_banners/_ad_image.html.erb +++ b/app/views/admin/ad_banners/_ad_image.html.erb @@ -1,7 +1,8 @@
+ Time to next: <%= ad_image.time_to_next %> + Intro: <%= ad_image.picture_intro %> + Out Link <%= link_to ad_image.out_link %> by <%= ad_image.link_open %> +
<%= f.label :unpost_date, t('admin.unpost_date') %> - <%= f.date_select :unpost_date, :order => [:year, :month, :day], :use_month_numbers => true %> - + <%= f.date_select :unpost_date, :order => [:year, :month, :day], :use_month_numbers => true,:prompt => { :day => t('form.date_unlimited'), :month => t('form.date_unlimited'), :year => t('form.date_unlimited') } %>
<%= f.label :context, t('admin.context') %> diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb index 54217140..e109830e 100644 --- a/app/views/admin/ad_banners/index.html.erb +++ b/app/views/admin/ad_banners/index.html.erb @@ -20,6 +20,7 @@