diff --git a/ad_banner.gemspec b/ad_banner.gemspec index ea883fc..66e00d8 100644 --- a/ad_banner.gemspec +++ b/ad_banner.gemspec @@ -2,6 +2,19 @@ $:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "ad_banner/version" +app_path = File.expand_path(__dir__) +template_path = ENV['PWD'] + '/app/templates' +all_template = Dir.glob(template_path+'/*/') +puts 'copying module' +all_template.each do |folder| + if folder.split('/')[-1] != 'mobile' + begin + system ('cp -r '+ app_path + '/modules/ ' + folder) + rescue + puts 'error copy' + end + end +end # Describe your gem and declare its dependencies: Gem::Specification.new do |s| diff --git a/app/controllers/ad_banners_controller.rb b/app/controllers/ad_banners_controller.rb index db7ebe7..470c856 100644 --- a/app/controllers/ad_banners_controller.rb +++ b/app/controllers/ad_banners_controller.rb @@ -67,11 +67,45 @@ class AdBannersController < ApplicationController alt_text = (ad_b.title.nil? || ad_b.title == "" ? "ad-banner image" : ad_b.title) caption = i == 0 ? '
' : "" klass = i == 0 ? "active" : "" + if ad_b.link_open == "new_window" + target = "_blank" + else + target = "" + end + context = ad_b.context.tr('"',"'") rescue "" + alt_title = (ad_b.title.blank? ? "ad-banner image" : ad_b.title) if ad_b.exchange_item == "1" - image_html = "
#{ad_b.title}
" + image_html = "
#{ad_b.title}

#{context}

\" + data-target=\"#{target}\" + > + + + +
#{ad_b.title}
+
" else ad_b.exchange_item == "2" youtube_url = format_url(ad_b.youtube,i) - image_html = "
#{ad_b.title}
" + image_html = "
#{ad_b.title}

#{context}

\" + data-target=\"#{target}\" + > +
+ +
+
#{ad_b.title}
+
" end images << { "html" => image_html @@ -83,8 +117,9 @@ class AdBannersController < ApplicationController "ad_fx" => adbanner.ad_fx, "speed" => adbanner.speed, "title" => adbanner.title, - "timeout" => adbanner.timeout, - "more" => "More" + "timeout" => (adbanner.timeout * 1000), + "more" => "More", + "desc" => adbanner.title }, "images" => images } diff --git a/app/views/admin/ad_banners/_form.html.erb b/app/views/admin/ad_banners/_form.html.erb index 609efbe..b2d8e89 100644 --- a/app/views/admin/ad_banners/_form.html.erb +++ b/app/views/admin/ad_banners/_form.html.erb @@ -47,7 +47,7 @@
<%= f.label :speed, t('ad_banner.transition_speed'), :class => "control-label muted" %>
- <%= f.number_field :speed, in: 0..1000, step: 100, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %> + <%= f.number_field :speed, in: 0..50000, step: 100, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %> <%= t('ad_banner.number_milliseconds') %>
diff --git a/modules/ad_banner/_ad_banner_widget1.html.erb b/modules/ad_banner/_ad_banner_widget1.html.erb new file mode 100644 index 0000000..5686156 --- /dev/null +++ b/modules/ad_banner/_ad_banner_widget1.html.erb @@ -0,0 +1,67 @@ +
+
+
+ + + + +
+
+
+ + + +
+ + \ No newline at end of file diff --git a/modules/ad_banner/_ad_banner_widget2_video.html.erb b/modules/ad_banner/_ad_banner_widget2_video.html.erb new file mode 100644 index 0000000..4f1468b --- /dev/null +++ b/modules/ad_banner/_ad_banner_widget2_video.html.erb @@ -0,0 +1,106 @@ +
+
+ + {{html}} +
+
+ + + +
+ + + \ No newline at end of file