diff --git a/app/assets/Archive/javascripts/mobile.js b/app/assets/Archive/javascripts/mobile.js
index 6005481c..7aa929c3 100644
--- a/app/assets/Archive/javascripts/mobile.js
+++ b/app/assets/Archive/javascripts/mobile.js
@@ -5,7 +5,7 @@
// the compiled file.
//
//= require jquery
-//= require mobile/jquery.cycle.all
+//= require cycle2
//= require mobile/jquery.mu.image.resize
//= require mobile/orbit.mobile
//= require mobile/jquery.mobile-1.2.0.min
diff --git a/app/assets/javascripts/kernel.js b/app/assets/javascripts/kernel.js
index e82858a6..f331a2b0 100644
--- a/app/assets/javascripts/kernel.js
+++ b/app/assets/javascripts/kernel.js
@@ -6,12 +6,7 @@ $(document).ready(function() {
if($(this).attr("path")==''){
$(this).html("App setting Failed");
}else{
- // Check if this App is AD_Banner
- if($(this).attr("path").indexOf("show_banner")>0){
- ajax_load_proc($(this),$(this).attr("path"),"true");
- }else{
- ajax_load_proc($(this),$(this).attr("path"),$(this).attr("path"));
- }
+ ajax_load_proc($(this),$(this).attr("path"));
}
});
@@ -21,48 +16,15 @@ $(document).ready(function() {
function ajax_load_proc(wapper,url,isBanner){
$.get(encodeURI(url), {}, function(respText,textSta,XML){
if (textSta == 'success') {
- if(isBanner=="true"){
- wapper.html(respText);
- $( '.cycle-slideshow' ).cycle();
- // var banner = banners[banner_index];
- // $(banner.banner_name+" > img").each(function(){
- // $(this).load(function(){banner.image_loaded++; });
- // });
- // BannerCycle(banner_index);
- // banner_index++;
- // $( '.cycle-slideshow' ).cycle();
- }else{
- wapper.html(respText);
- }
+ wapper.html(respText);
};
if(textSta == 'error')
wapper.html("Loading Failed
Go See");
});
}
-function BannerCycle(banner_index){
- var banner = banners[banner_index];
- // Wait untill all images are loaded
- // console.log(banner.image_loaded, $(banner.banner_name+" img").length, banners[banner_index])
- if (banner.image_loaded==$(banner.banner_name+" img").length){
- $(banner.banner_name).cycle({
- fx: banner.banner_fx,
- timeout: banner.timeout,
- pager: banner.banner_pager,
- speed: banner.banner_speed,
- fit: 1,
- containerResize: 0,
- width: banner.banner_width,
- height: banner.banner_height,
- pagerAnchorBuilder: function(idx, slide) { return "
"; }
- });
- }else{
- setTimeout("BannerCycle("+banner_index+")",100);
- }
-}
-
$(document).ready(function() {
- $(document).on('click', '.cycle-slideshow img', function()
+ $(document).on('click', '.orbit-cycle-slideshow img', function()
{
if($(this).attr('link_url')!='')
{
diff --git a/app/assets/javascripts/lib/jquery.preload-min.js b/app/assets/javascripts/lib/jquery.preload-min.js
deleted file mode 100755
index cf3a0f1f..00000000
--- a/app/assets/javascripts/lib/jquery.preload-min.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/**
- * jQuery.Preload - Multifunctional preloader
- * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com
- * Dual licensed under MIT and GPL.
- * Date: 3/25/2009
- * @author Ariel Flesler
- * @version 1.0.8
- */
-;(function($){var h=$.preload=function(c,d){if(c.split)c=$(c);d=$.extend({},h.defaults,d);var f=$.map(c,function(a){if(!a)return;if(a.split)return d.base+a+d.ext;var b=a.src||a.href;if(typeof d.placeholder=='string'&&a.src)a.src=d.placeholder;if(b&&d.find)b=b.replace(d.find,d.replace);return b||null}),data={loaded:0,failed:0,next:0,done:0,total:f.length};if(!data.total)return finish();var g=$(Array(d.threshold+1).join('')).load(handler).error(handler).bind('abort',handler).each(fetch);function handler(e){data.element=this;data.found=e.type=='load';data.image=this.src;data.index=this.index;var a=data.original=c[this.index];data[data.found?'loaded':'failed']++;data.done++;if(d.enforceCache)h.cache.push($('').attr('src',data.image)[0]);if(d.placeholder&&a.src)a.src=data.found?data.image:d.notFound||a.src;if(d.onComplete)d.onComplete(data);if(data.done0&&h>e&&(g=b.slice(e,h),b=b.slice(0,e),h=b.length),!h)return d(b,f,!0),void 0;for(var i,j=arguments.callee,k=0,l=function(){k++,k===h&&(d(b,f,!g),j(g,e,f))},m=0;m1&&(c=arguments[0],d=arguments[1]),c=a.extend({recursive:!0,part:0},c);var e=this,f=b(e,c);return a.preload(f,c.part,function(a){a&&"function"==typeof d&&d.call(e.get())}),this}}(jQuery);
\ No newline at end of file
diff --git a/app/assets/javascripts/page_layout.js b/app/assets/javascripts/page_layout.js
index eb2c9e3d..e3797585 100644
--- a/app/assets/javascripts/page_layout.js
+++ b/app/assets/javascripts/page_layout.js
@@ -3,5 +3,5 @@
//= require basic/bootstrap
//= require kernel
-//= require lib/jquery.preload-min.js
+//= require lib/jquery.preload.min.js
//= require cycle2
\ No newline at end of file
diff --git a/app/helpers/orbit_backend_helper.rb b/app/helpers/orbit_backend_helper.rb
index e8e30172..00dea4c3 100644
--- a/app/helpers/orbit_backend_helper.rb
+++ b/app/helpers/orbit_backend_helper.rb
@@ -113,6 +113,9 @@ module OrbitBackendHelper
sorted_objects = get_sorted_objects(object.tags, 'name') rescue ''
when 'standalone'
res << (field[:need_value] ? eval(field[:display_option]) : field[:display_option])
+ when 'image'
+ image = (field[:version] ? object.send(field[:db_field]).send(field[:version]) : object.send(field[:db_field]))
+ res << image_tag(image)
else
sorted_values = object.send(field[:db_field])
sorted_values = sorted_values.sort if sorted_values.is_a?(Array)
@@ -181,8 +184,6 @@ module OrbitBackendHelper
display_date(value)
when 'Time'
display_time(value)
- when /Uploader/
- image_tag(value.url)
else
value
end
diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb
index 2b1cd467..ef789d0f 100644
--- a/app/uploaders/image_uploader.rb
+++ b/app/uploaders/image_uploader.rb
@@ -68,7 +68,7 @@ def cache_dir
end
- def manipulate!
+ # def manipulate!
# cache_stored_file! if !cached?
#raise File.extname(current_path.to_s).to_s
# image = ::MiniMagick::Image.open(current_path)
@@ -77,6 +77,6 @@ def cache_dir
# ::MiniMagick::Image.open(current_path)
# rescue
# nil
- end
+ # end
end
diff --git a/app/views/admin/ad_images/index.html.erb b/app/views/admin/ad_images/index.html.erb
index acbbf3ef..7e687179 100644
--- a/app/views/admin/ad_images/index.html.erb
+++ b/app/views/admin/ad_images/index.html.erb
@@ -8,6 +8,7 @@
# can have: title, warning, cancel and submit values
field type: 'image',
db_field: 'file',
+ version: 'thumb',
translation: 'preview',
hide: 'phone'
# field type: 'status',
diff --git a/app/views/front/show_banner.html.erb b/app/views/front/show_banner.html.erb
index f4683650..acec13da 100644
--- a/app/views/front/show_banner.html.erb
+++ b/app/views/front/show_banner.html.erb
@@ -1,9 +1,26 @@
-
+
<% @ad_banner.ad_images.can_display.each do |ad_image| %>
<% link = ad_image_link(ad_image) %>
- <%= image_tag ad_image.file, width: @ad_banner.width, height: @ad_banner.height, 'link_open' => ad_image.link_open, 'link_url' => link, style: ('cursor:pointer;' if link.present?) %>
+ <%= image_tag ad_image.file, width: @ad_banner.width, height: @ad_banner.height, link_open: ad_image.link_open, link_url: link, style: "display:none; #{'cursor:pointer;' if link.present?}" %>
<% end %>
+
+
\ No newline at end of file
diff --git a/app/views/mobile/index.mobile.erb b/app/views/mobile/index.mobile.erb
index 76aef528..07d1e107 100644
--- a/app/views/mobile/index.mobile.erb
+++ b/app/views/mobile/index.mobile.erb
@@ -1,5 +1,5 @@
-
- <% @ad_banner.ad_images.can_display.shuffle.each do |image| %>
+
+ <% @ad_banner.ad_images.can_display.each do |image| %>
<%= image_tag image.file.url, :class => 'slideImg' %>
<% end %>
@@ -22,4 +22,18 @@
var $effect = "<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>"
var $timeout = "<%= @ad_banner.transition_msec %>"
var $info = "<%= t('mobile.location_description').html_safe %>"
+ $(function(){
+ if($("#slideshow-<%= @ad_banner.title.dehumanize %> img").length > 1){
+ var a = [];
+ <% @ad_banner.ad_images.can_display.each do |image| %>
+ a.push("<%= image.file.url %>");
+ <% end %>
+ $.preload(a, 2, function(){
+ $('.orbit-cycle-slideshow').cycle();
+ });
+ }
+ else{
+ $("#slideshow-<%= @ad_banner.title.dehumanize %> img").show()
+ }
+ });
diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb
index fc1f8bf3..2e84a888 100644
--- a/lib/parsers/parser_common.rb
+++ b/lib/parsers/parser_common.rb
@@ -1,5 +1,6 @@
module ParserCommon
include ActionView::Helpers::TagHelper
+ include ActionView::Helpers::FrontHelper
# include ActionView::Helpers::UrlHelper
def menu_level(page, current_page, current, menu, edit = false)
@@ -44,47 +45,38 @@ module ParserCommon
res = ''
ad_banner = AdBanner.find(banner["id"]) rescue nil
if ad_banner
- res << ""
res << "
"
res << "
"
- res << "
"
- printable_ad_images = []
+ res << "
"
ad_banner.ad_images.can_display.each do |ad_image|
- ad_image.weight.times do
- printable_ad_images << ad_image
- end
- end
- printable_ad_images.shuffle!
- hide = printable_ad_images.size > 1
- printable_ad_images.each do |ad_image| #TODO Need Reflact
- res << "
"
+ link = ad_image_link(ad_image)
+ res << "
"
end
res << "
"
res << "
"
+ res << ""
end
fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
banner.swap(fragment)