diff --git a/app/assets/javascripts/admin/ad_banners.js b/app/assets/javascripts/admin/ad_banners.js new file mode 100644 index 000000000..1e5958c7d --- /dev/null +++ b/app/assets/javascripts/admin/ad_banners.js @@ -0,0 +1 @@ +//= require lib/arrow-on-list-edit \ No newline at end of file diff --git a/app/assets/javascripts/kernel.js b/app/assets/javascripts/kernel.js index 6821079f1..e82858a6d 100644 --- a/app/assets/javascripts/kernel.js +++ b/app/assets/javascripts/kernel.js @@ -23,12 +23,14 @@ function ajax_load_proc(wapper,url,isBanner){ if (textSta == 'success') { if(isBanner=="true"){ wapper.html(respText); - 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(); + // 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); } @@ -41,21 +43,26 @@ function ajax_load_proc(wapper,url,isBanner){ 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({ - delay: -1000, + $(banner.banner_name).cycle({ fx: banner.banner_fx, - timeout: banner.time_to_next, + 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+")",500); + setTimeout("BannerCycle("+banner_index+")",100); } } $(document).ready(function() { - $(document).on('click', '.slideshow img', function() + $(document).on('click', '.cycle-slideshow img', function() { if($(this).attr('link_url')!='') { diff --git a/app/assets/javascripts/lib/ad_banner/banner_preview.js b/app/assets/javascripts/lib/ad_banner/banner_preview.js index 59970304a..3cfafb051 100644 --- a/app/assets/javascripts/lib/ad_banner/banner_preview.js +++ b/app/assets/javascripts/lib/ad_banner/banner_preview.js @@ -67,9 +67,10 @@ $(function() { fx: bannerEffect, timeout: bannerTime, speed: bannerSpeed, - fit: 1, - width: bannerW, - height: bannerH, + }); + $(this).find('img').css({ + 'width': bannerW, + 'height': bannerH }); }); $('#preview').on('hidden', function() { diff --git a/app/assets/javascripts/lib/jquery.cycle2.min.js b/app/assets/javascripts/lib/jquery.cycle2.min.js new file mode 100644 index 000000000..9f9ec0f08 --- /dev/null +++ b/app/assets/javascripts/lib/jquery.cycle2.min.js @@ -0,0 +1,17 @@ +/*! +* jQuery Cycle2; build: v20131005 +* http://jquery.malsup.com/cycle2/ +* Copyright (c) 2013 M. Alsup; Dual licensed: MIT/GPL +*/ +/*! core engine; version: 20131003 */ +(function(e){"use strict";function t(e){return(e||"").toLowerCase()}var i="20131003";e.fn.cycle=function(i){var n;return 0!==this.length||e.isReady?this.each(function(){var n,s,o,c,r=e(this),l=e.fn.cycle.log;if(!r.data("cycle.opts")){(r.data("cycle-log")===!1||i&&i.log===!1||s&&s.log===!1)&&(l=e.noop),l("--c2 init--"),n=r.data();for(var a in n)n.hasOwnProperty(a)&&/^cycle[A-Z]+/.test(a)&&(c=n[a],o=a.match(/^cycle(.*)/)[1].replace(/^[A-Z]/,t),l(o+":",c,"("+typeof c+")"),n[o]=c);s=e.extend({},e.fn.cycle.defaults,n,i||{}),s.timeoutId=0,s.paused=s.paused||!1,s.container=r,s._maxZ=s.maxZ,s.API=e.extend({_container:r},e.fn.cycle.API),s.API.log=l,s.API.trigger=function(e,t){return s.container.trigger(e,t),s.API},r.data("cycle.opts",s),r.data("cycle.API",s.API),s.API.trigger("cycle-bootstrap",[s,s.API]),s.API.addInitialSlides(),s.API.preInitSlideshow(),s.slides.length&&s.API.initSlideshow()}}):(n={s:this.selector,c:this.context},e.fn.cycle.log("requeuing slideshow (dom not ready)"),e(function(){e(n.s,n.c).cycle(i)}),this)},e.fn.cycle.API={opts:function(){return this._container.data("cycle.opts")},addInitialSlides:function(){var t=this.opts(),i=t.slides;t.slideCount=0,t.slides=e(),i=i.jquery?i:t.container.find(i),t.random&&i.sort(function(){return Math.random()-.5}),t.API.add(i)},preInitSlideshow:function(){var t=this.opts();t.API.trigger("cycle-pre-initialize",[t]);var i=e.fn.cycle.transitions[t.fx];i&&e.isFunction(i.preInit)&&i.preInit(t),t._preInitialized=!0},postInitSlideshow:function(){var t=this.opts();t.API.trigger("cycle-post-initialize",[t]);var i=e.fn.cycle.transitions[t.fx];i&&e.isFunction(i.postInit)&&i.postInit(t)},initSlideshow:function(){var t,i=this.opts(),n=i.container;i.API.calcFirstSlide(),"static"==i.container.css("position")&&i.container.css("position","relative"),e(i.slides[i.currSlide]).css("opacity",1).show(),i.API.stackSlides(i.slides[i.currSlide],i.slides[i.nextSlide],!i.reverse),i.pauseOnHover&&(i.pauseOnHover!==!0&&(n=e(i.pauseOnHover)),n.hover(function(){i.API.pause(!0)},function(){i.API.resume(!0)})),i.timeout&&(t=i.API.getSlideOpts(i.currSlide),i.API.queueTransition(t,t.timeout+i.delay)),i._initialized=!0,i.API.updateView(!0),i.API.trigger("cycle-initialized",[i]),i.API.postInitSlideshow()},pause:function(t){var i=this.opts(),n=i.API.getSlideOpts(),s=i.hoverPaused||i.paused;t?i.hoverPaused=!0:i.paused=!0,s||(i.container.addClass("cycle-paused"),i.API.trigger("cycle-paused",[i]).log("cycle-paused"),n.timeout&&(clearTimeout(i.timeoutId),i.timeoutId=0,i._remainingTimeout-=e.now()-i._lastQueue,(0>i._remainingTimeout||isNaN(i._remainingTimeout))&&(i._remainingTimeout=void 0)))},resume:function(e){var t=this.opts(),i=!t.hoverPaused&&!t.paused;e?t.hoverPaused=!1:t.paused=!1,i||(t.container.removeClass("cycle-paused"),0===t.slides.filter(":animated").length&&t.API.queueTransition(t.API.getSlideOpts(),t._remainingTimeout),t.API.trigger("cycle-resumed",[t,t._remainingTimeout]).log("cycle-resumed"))},add:function(t,i){var n,s=this.opts(),o=s.slideCount,c=!1;"string"==e.type(t)&&(t=e.trim(t)),e(t).each(function(){var t,n=e(this);i?s.container.prepend(n):s.container.append(n),s.slideCount++,t=s.API.buildSlideOpts(n),s.slides=i?e(n).add(s.slides):s.slides.add(n),s.API.initSlide(t,n,--s._maxZ),n.data("cycle.opts",t),s.API.trigger("cycle-slide-added",[s,t,n])}),s.API.updateView(!0),c=s._preInitialized&&2>o&&s.slideCount>=1,c&&(s._initialized?s.timeout&&(n=s.slides.length,s.nextSlide=s.reverse?n-1:1,s.timeoutId||s.API.queueTransition(s)):s.API.initSlideshow())},calcFirstSlide:function(){var e,t=this.opts();e=parseInt(t.startingSlide||0,10),(e>=t.slides.length||0>e)&&(e=0),t.currSlide=e,t.reverse?(t.nextSlide=e-1,0>t.nextSlide&&(t.nextSlide=t.slides.length-1)):(t.nextSlide=e+1,t.nextSlide==t.slides.length&&(t.nextSlide=0))},calcNextSlide:function(){var e,t=this.opts();t.reverse?(e=0>t.nextSlide-1,t.nextSlide=e?t.slideCount-1:t.nextSlide-1,t.currSlide=e?0:t.nextSlide+1):(e=t.nextSlide+1==t.slides.length,t.nextSlide=e?0:t.nextSlide+1,t.currSlide=e?t.slides.length-1:t.nextSlide-1)},calcTx:function(t,i){var n,s=t;return i&&s.manualFx&&(n=e.fn.cycle.transitions[s.manualFx]),n||(n=e.fn.cycle.transitions[s.fx]),n||(n=e.fn.cycle.transitions.fade,s.API.log('Transition "'+s.fx+'" not found. Using fade.')),n},prepareTx:function(e,t){var i,n,s,o,c,r=this.opts();return 2>r.slideCount?(r.timeoutId=0,void 0):(!e||r.busy&&!r.manualTrump||(r.API.stopTransition(),r.busy=!1,clearTimeout(r.timeoutId),r.timeoutId=0),r.busy||(0!==r.timeoutId||e)&&(n=r.slides[r.currSlide],s=r.slides[r.nextSlide],o=r.API.getSlideOpts(r.nextSlide),c=r.API.calcTx(o,e),r._tx=c,e&&void 0!==o.manualSpeed&&(o.speed=o.manualSpeed),r.nextSlide!=r.currSlide&&(e||!r.paused&&!r.hoverPaused&&r.timeout)?(r.API.trigger("cycle-before",[o,n,s,t]),c.before&&c.before(o,n,s,t),i=function(){r.busy=!1,r.container.data("cycle.opts")&&(c.after&&c.after(o,n,s,t),r.API.trigger("cycle-after",[o,n,s,t]),r.API.queueTransition(o),r.API.updateView(!0))},r.busy=!0,c.transition?c.transition(o,n,s,t,i):r.API.doTransition(o,n,s,t,i),r.API.calcNextSlide(),r.API.updateView()):r.API.queueTransition(o)),void 0)},doTransition:function(t,i,n,s,o){var c=t,r=e(i),l=e(n),a=function(){l.animate(c.animIn||{opacity:1},c.speed,c.easeIn||c.easing,o)};l.css(c.cssBefore||{}),r.animate(c.animOut||{},c.speed,c.easeOut||c.easing,function(){r.css(c.cssAfter||{}),c.sync||a()}),c.sync&&a()},queueTransition:function(t,i){var n=this.opts(),s=void 0!==i?i:t.timeout;return 0===n.nextSlide&&0===--n.loop?(n.API.log("terminating; loop=0"),n.timeout=0,s?setTimeout(function(){n.API.trigger("cycle-finished",[n])},s):n.API.trigger("cycle-finished",[n]),n.nextSlide=n.currSlide,void 0):(s&&(n._lastQueue=e.now(),void 0===i&&(n._remainingTimeout=t.timeout),n.paused||n.hoverPaused||(n.timeoutId=setTimeout(function(){n.API.prepareTx(!1,!n.reverse)},s))),void 0)},stopTransition:function(){var e=this.opts();e.slides.filter(":animated").length&&(e.slides.stop(!1,!0),e.API.trigger("cycle-transition-stopped",[e])),e._tx&&e._tx.stopTransition&&e._tx.stopTransition(e)},advanceSlide:function(e){var t=this.opts();return clearTimeout(t.timeoutId),t.timeoutId=0,t.nextSlide=t.currSlide+e,0>t.nextSlide?t.nextSlide=t.slides.length-1:t.nextSlide>=t.slides.length&&(t.nextSlide=0),t.API.prepareTx(!0,e>=0),!1},buildSlideOpts:function(i){var n,s,o=this.opts(),c=i.data()||{};for(var r in c)c.hasOwnProperty(r)&&/^cycle[A-Z]+/.test(r)&&(n=c[r],s=r.match(/^cycle(.*)/)[1].replace(/^[A-Z]/,t),o.API.log("["+(o.slideCount-1)+"]",s+":",n,"("+typeof n+")"),c[s]=n);c=e.extend({},e.fn.cycle.defaults,o,c),c.slideNum=o.slideCount;try{delete c.API,delete c.slideCount,delete c.currSlide,delete c.nextSlide,delete c.slides}catch(l){}return c},getSlideOpts:function(t){var i=this.opts();void 0===t&&(t=i.currSlide);var n=i.slides[t],s=e(n).data("cycle.opts");return e.extend({},i,s)},initSlide:function(t,i,n){var s=this.opts();i.css(t.slideCss||{}),n>0&&i.css("zIndex",n),isNaN(t.speed)&&(t.speed=e.fx.speeds[t.speed]||e.fx.speeds._default),t.sync||(t.speed=t.speed/2),i.addClass(s.slideClass)},updateView:function(e,t){var i=this.opts();if(i._initialized){var n=i.API.getSlideOpts(),s=i.slides[i.currSlide];!e&&t!==!0&&(i.API.trigger("cycle-update-view-before",[i,n,s]),0>i.updateView)||(i.slideActiveClass&&i.slides.removeClass(i.slideActiveClass).eq(i.currSlide).addClass(i.slideActiveClass),e&&i.hideNonActive&&i.slides.filter(":not(."+i.slideActiveClass+")").hide(),i.API.trigger("cycle-update-view",[i,n,s,e]),e&&i.API.trigger("cycle-update-view-after",[i,n,s]))}},getComponent:function(t){var i=this.opts(),n=i[t];return"string"==typeof n?/^\s*[\>|\+|~]/.test(n)?i.container.find(n):e(n):n.jquery?n:e(n)},stackSlides:function(t,i,n){var s=this.opts();t||(t=s.slides[s.currSlide],i=s.slides[s.nextSlide],n=!s.reverse),e(t).css("zIndex",s.maxZ);var o,c=s.maxZ-2,r=s.slideCount;if(n){for(o=s.currSlide+1;r>o;o++)e(s.slides[o]).css("zIndex",c--);for(o=0;s.currSlide>o;o++)e(s.slides[o]).css("zIndex",c--)}else{for(o=s.currSlide-1;o>=0;o--)e(s.slides[o]).css("zIndex",c--);for(o=r-1;o>s.currSlide;o--)e(s.slides[o]).css("zIndex",c--)}e(i).css("zIndex",s.maxZ-1)},getSlideIndex:function(e){return this.opts().slides.index(e)}},e.fn.cycle.log=function(){window.console&&console.log&&console.log("[cycle2] "+Array.prototype.join.call(arguments," "))},e.fn.cycle.version=function(){return"Cycle2: "+i},e.fn.cycle.transitions={custom:{},none:{before:function(e,t,i,n){e.API.stackSlides(i,t,n),e.cssBefore={opacity:1,display:"block"}}},fade:{before:function(t,i,n,s){var o=t.API.getSlideOpts(t.nextSlide).slideCss||{};t.API.stackSlides(i,n,s),t.cssBefore=e.extend(o,{opacity:0,display:"block"}),t.animIn={opacity:1},t.animOut={opacity:0}}},fadeout:{before:function(t,i,n,s){var o=t.API.getSlideOpts(t.nextSlide).slideCss||{};t.API.stackSlides(i,n,s),t.cssBefore=e.extend(o,{opacity:1,display:"block"}),t.animOut={opacity:0}}},scrollHorz:{before:function(e,t,i,n){e.API.stackSlides(t,i,n);var s=e.container.css("overflow","hidden").width();e.cssBefore={left:n?s:-s,top:0,opacity:1,display:"block"},e.cssAfter={zIndex:e._maxZ-2,left:0},e.animIn={left:0},e.animOut={left:n?-s:s}}}},e.fn.cycle.defaults={allowWrap:!0,autoSelector:".cycle-slideshow[data-cycle-auto-init!=false]",delay:0,easing:null,fx:"fade",hideNonActive:!0,loop:0,manualFx:void 0,manualSpeed:void 0,manualTrump:!0,maxZ:100,pauseOnHover:!1,reverse:!1,slideActiveClass:"cycle-slide-active",slideClass:"cycle-slide",slideCss:{position:"absolute",top:0,left:0},slides:"> img",speed:500,startingSlide:0,sync:!0,timeout:4e3,updateView:-1},e(document).ready(function(){e(e.fn.cycle.defaults.autoSelector).cycle()})})(jQuery),/*! Cycle2 autoheight plugin; Copyright (c) M.Alsup, 2012; version: 20130304 */ +function(e){"use strict";function t(t,n){var s,o,c,r=n.autoHeight;if("container"==r)o=e(n.slides[n.currSlide]).outerHeight(),n.container.height(o);else if(n._autoHeightRatio)n.container.height(n.container.width()/n._autoHeightRatio);else if("calc"===r||"number"==e.type(r)&&r>=0){if(c="calc"===r?i(t,n):r>=n.slides.length?0:r,c==n._sentinelIndex)return;n._sentinelIndex=c,n._sentinel&&n._sentinel.remove(),s=e(n.slides[c].cloneNode(!0)),s.removeAttr("id name rel").find("[id],[name],[rel]").removeAttr("id name rel"),s.css({position:"static",visibility:"hidden",display:"block"}).prependTo(n.container).addClass("cycle-sentinel cycle-slide").removeClass("cycle-slide-active"),s.find("*").css("visibility","hidden"),n._sentinel=s}}function i(t,i){var n=0,s=-1;return i.slides.each(function(t){var i=e(this).height();i>s&&(s=i,n=t)}),n}function n(t,i,n,s){var o=e(s).outerHeight(),c=i.sync?i.speed/2:i.speed;i.container.animate({height:o},c)}function s(i,o){o._autoHeightOnResize&&(e(window).off("resize orientationchange",o._autoHeightOnResize),o._autoHeightOnResize=null),o.container.off("cycle-slide-added cycle-slide-removed",t),o.container.off("cycle-destroyed",s),o.container.off("cycle-before",n),o._sentinel&&(o._sentinel.remove(),o._sentinel=null)}e.extend(e.fn.cycle.defaults,{autoHeight:0}),e(document).on("cycle-initialized",function(i,o){function c(){t(i,o)}var r,l=o.autoHeight,a=e.type(l),d=null;("string"===a||"number"===a)&&(o.container.on("cycle-slide-added cycle-slide-removed",t),o.container.on("cycle-destroyed",s),"container"==l?o.container.on("cycle-before",n):"string"===a&&/\d+\:\d+/.test(l)&&(r=l.match(/(\d+)\:(\d+)/),r=r[1]/r[2],o._autoHeightRatio=r),"number"!==a&&(o._autoHeightOnResize=function(){clearTimeout(d),d=setTimeout(c,50)},e(window).on("resize orientationchange",o._autoHeightOnResize)),setTimeout(c,30))})}(jQuery),/*! caption plugin for Cycle2; version: 20130306 */ +function(e){"use strict";e.extend(e.fn.cycle.defaults,{caption:"> .cycle-caption",captionTemplate:"{{slideNum}} / {{slideCount}}",overlay:"> .cycle-overlay",overlayTemplate:"
    {{title}}
    {{desc}}
    ",captionModule:"caption"}),e(document).on("cycle-update-view",function(t,i,n,s){"caption"===i.captionModule&&e.each(["caption","overlay"],function(){var e=this,t=n[e+"Template"],o=i.API.getComponent(e);o.length&&t?(o.html(i.API.tmpl(t,n,i,s)),o.show()):o.hide()})}),e(document).on("cycle-destroyed",function(t,i){var n;e.each(["caption","overlay"],function(){var e=this,t=i[e+"Template"];i[e]&&t&&(n=i.API.getComponent("caption"),n.empty())})})}(jQuery),/*! command plugin for Cycle2; version: 20130707 */ +function(e){"use strict";var t=e.fn.cycle;e.fn.cycle=function(i){var n,s,o,c=e.makeArray(arguments);return"number"==e.type(i)?this.cycle("goto",i):"string"==e.type(i)?this.each(function(){var r;return n=i,o=e(this).data("cycle.opts"),void 0===o?(t.log('slideshow must be initialized before sending commands; "'+n+'" ignored'),void 0):(n="goto"==n?"jump":n,s=o.API[n],e.isFunction(s)?(r=e.makeArray(c),r.shift(),s.apply(o.API,r)):(t.log("unknown command: ",n),void 0))}):t.apply(this,arguments)},e.extend(e.fn.cycle,t),e.extend(t.API,{next:function(){var e=this.opts();if(!e.busy||e.manualTrump){var t=e.reverse?-1:1;e.allowWrap===!1&&e.currSlide+t>=e.slideCount||(e.API.advanceSlide(t),e.API.trigger("cycle-next",[e]).log("cycle-next"))}},prev:function(){var e=this.opts();if(!e.busy||e.manualTrump){var t=e.reverse?1:-1;e.allowWrap===!1&&0>e.currSlide+t||(e.API.advanceSlide(t),e.API.trigger("cycle-prev",[e]).log("cycle-prev"))}},destroy:function(){this.stop();var t=this.opts(),i=e.isFunction(e._data)?e._data:e.noop;clearTimeout(t.timeoutId),t.timeoutId=0,t.API.stop(),t.API.trigger("cycle-destroyed",[t]).log("cycle-destroyed"),t.container.removeData(),i(t.container[0],"parsedAttrs",!1),t.retainStylesOnDestroy||(t.container.removeAttr("style"),t.slides.removeAttr("style"),t.slides.removeClass(t.slideActiveClass)),t.slides.each(function(){e(this).removeData(),i(this,"parsedAttrs",!1)})},jump:function(e){var t,i=this.opts();if(!i.busy||i.manualTrump){var n=parseInt(e,10);if(isNaN(n)||0>n||n>=i.slides.length)return i.API.log("goto: invalid slide index: "+n),void 0;if(n==i.currSlide)return i.API.log("goto: skipping, already on slide",n),void 0;i.nextSlide=n,clearTimeout(i.timeoutId),i.timeoutId=0,i.API.log("goto: ",n," (zero-index)"),t=i.currSlider;r++)i=s.slides[r],r==t?n=i:(o.push(i),e(i).data("cycle.opts").slideNum=c,c++);n&&(s.slides=e(o),s.slideCount--,e(n).remove(),t==s.currSlide?s.API.advanceSlide(1):s.currSlide>t?s.currSlide--:s.currSlide++,s.API.trigger("cycle-slide-removed",[s,t,n]).log("cycle-slide-removed"),s.API.updateView())}}),e(document).on("click.cycle","[data-cycle-cmd]",function(t){t.preventDefault();var i=e(this),n=i.data("cycle-cmd"),s=i.data("cycle-context")||".cycle-slideshow";e(s).cycle(n,i.data("cycle-arg"))})}(jQuery),/*! hash plugin for Cycle2; version: 20130905 */ +function(e){"use strict";function t(t,i){var n;return t._hashFence?(t._hashFence=!1,void 0):(n=window.location.hash.substring(1),t.slides.each(function(s){if(e(this).data("cycle-hash")==n){if(i===!0)t.startingSlide=s;else{var o=s>t.currSlide;t.nextSlide=s,t.API.prepareTx(!0,o)}return!1}}),void 0)}e(document).on("cycle-pre-initialize",function(i,n){t(n,!0),n._onHashChange=function(){t(n,!1)},e(window).on("hashchange",n._onHashChange)}),e(document).on("cycle-update-view",function(e,t,i){i.hash&&"#"+i.hash!=window.location.hash&&(t._hashFence=!0,window.location.hash=i.hash)}),e(document).on("cycle-destroyed",function(t,i){i._onHashChange&&e(window).off("hashchange",i._onHashChange)})}(jQuery),/*! loader plugin for Cycle2; version: 20130307 */ +function(e){"use strict";e.extend(e.fn.cycle.defaults,{loader:!1}),e(document).on("cycle-bootstrap",function(t,i){function n(t,n){function o(t){var o;"wait"==i.loader?(r.push(t),0===a&&(r.sort(c),s.apply(i.API,[r,n]),i.container.removeClass("cycle-loading"))):(o=e(i.slides[i.currSlide]),s.apply(i.API,[t,n]),o.show(),i.container.removeClass("cycle-loading"))}function c(e,t){return e.data("index")-t.data("index")}var r=[];if("string"==e.type(t))t=e.trim(t);else if("array"===e.type(t))for(var l=0;t.length>l;l++)t[l]=e(t[l])[0];t=e(t);var a=t.length;a&&(t.hide().appendTo("body").each(function(t){function c(){0===--l&&(--a,o(d))}var l=0,d=e(this),u=d.is("img")?d:d.find("img");return d.data("index",t),u=u.filter(":not(.cycle-loader-ignore)").filter(':not([src=""])'),u.length?(l=u.length,u.each(function(){this.complete?c():e(this).load(function(){c()}).error(function(){0===--l&&(i.API.log("slide skipped; img not loaded:",this.src),0===--a&&"wait"==i.loader&&s.apply(i.API,[r,n]))})}),void 0):(--a,r.push(d),void 0)}),a&&i.container.addClass("cycle-loading"))}var s;i.loader&&(s=i.API.add,i.API.add=n)})}(jQuery),/*! pager plugin for Cycle2; version: 20130525 */ +function(e){"use strict";function t(t,i,n){var s,o=t.API.getComponent("pager");o.each(function(){var o=e(this);if(i.pagerTemplate){var c=t.API.tmpl(i.pagerTemplate,i,t,n[0]);s=e(c).appendTo(o)}else s=o.children().eq(t.slideCount-1);s.on(t.pagerEvent,function(e){e.preventDefault(),t.API.page(o,e.currentTarget)})})}function i(e,t){var i=this.opts();if(!i.busy||i.manualTrump){var n=e.children().index(t),s=n,o=s>i.currSlide;i.currSlide!=s&&(i.nextSlide=s,i.API.prepareTx(!0,o),i.API.trigger("cycle-pager-activated",[i,e,t]))}}e.extend(e.fn.cycle.defaults,{pager:"> .cycle-pager",pagerActiveClass:"cycle-pager-active",pagerEvent:"click.cycle",pagerTemplate:""}),e(document).on("cycle-bootstrap",function(e,i,n){n.buildPagerLink=t}),e(document).on("cycle-slide-added",function(e,t,n,s){t.pager&&(t.API.buildPagerLink(t,n,s),t.API.page=i)}),e(document).on("cycle-slide-removed",function(t,i,n){if(i.pager){var s=i.API.getComponent("pager");s.each(function(){var t=e(this);e(t.children()[n]).remove()})}}),e(document).on("cycle-update-view",function(t,i){var n;i.pager&&(n=i.API.getComponent("pager"),n.each(function(){e(this).children().removeClass(i.pagerActiveClass).eq(i.currSlide).addClass(i.pagerActiveClass)}))}),e(document).on("cycle-destroyed",function(e,t){var i=t.API.getComponent("pager");i&&(i.children().off(t.pagerEvent),t.pagerTemplate&&i.empty())})}(jQuery),/*! prevnext plugin for Cycle2; version: 20130709 */ +function(e){"use strict";e.extend(e.fn.cycle.defaults,{next:"> .cycle-next",nextEvent:"click.cycle",disabledClass:"disabled",prev:"> .cycle-prev",prevEvent:"click.cycle",swipe:!1}),e(document).on("cycle-initialized",function(e,t){if(t.API.getComponent("next").on(t.nextEvent,function(e){e.preventDefault(),t.API.next()}),t.API.getComponent("prev").on(t.prevEvent,function(e){e.preventDefault(),t.API.prev()}),t.swipe){var i=t.swipeVert?"swipeUp.cycle":"swipeLeft.cycle swipeleft.cycle",n=t.swipeVert?"swipeDown.cycle":"swipeRight.cycle swiperight.cycle";t.container.on(i,function(){t.API.next()}),t.container.on(n,function(){t.API.prev()})}}),e(document).on("cycle-update-view",function(e,t){if(!t.allowWrap){var i=t.disabledClass,n=t.API.getComponent("next"),s=t.API.getComponent("prev"),o=t._prevBoundry||0,c=void 0!==t._nextBoundry?t._nextBoundry:t.slideCount-1;t.currSlide==c?n.addClass(i).prop("disabled",!0):n.removeClass(i).prop("disabled",!1),t.currSlide===o?s.addClass(i).prop("disabled",!0):s.removeClass(i).prop("disabled",!1)}}),e(document).on("cycle-destroyed",function(e,t){t.API.getComponent("prev").off(t.nextEvent),t.API.getComponent("next").off(t.prevEvent),t.container.off("swipeleft.cycle swiperight.cycle swipeLeft.cycle swipeRight.cycle swipeUp.cycle swipeDown.cycle")})}(jQuery),/*! progressive loader plugin for Cycle2; version: 20130315 */ +function(e){"use strict";e.extend(e.fn.cycle.defaults,{progressive:!1}),e(document).on("cycle-pre-initialize",function(t,i){if(i.progressive){var n,s,o=i.API,c=o.next,r=o.prev,l=o.prepareTx,a=e.type(i.progressive);if("array"==a)n=i.progressive;else if(e.isFunction(i.progressive))n=i.progressive(i);else if("string"==a){if(s=e(i.progressive),n=e.trim(s.html()),!n)return;if(/^(\[)/.test(n))try{n=e.parseJSON(n)}catch(d){return o.log("error parsing progressive slides",d),void 0}else n=n.split(RegExp(s.data("cycle-split")||"\n")),n[n.length-1]||n.pop()}l&&(o.prepareTx=function(e,t){var s,o;return e||0===n.length?(l.apply(i.API,[e,t]),void 0):(t&&i.currSlide==i.slideCount-1?(o=n[0],n=n.slice(1),i.container.one("cycle-slide-added",function(e,t){setTimeout(function(){t.API.advanceSlide(1)},50)}),i.API.add(o)):t||0!==i.currSlide?l.apply(i.API,[e,t]):(s=n.length-1,o=n[s],n=n.slice(0,s),i.container.one("cycle-slide-added",function(e,t){setTimeout(function(){t.currSlide=1,t.API.advanceSlide(-1)},50)}),i.API.add(o,!0)),void 0)}),c&&(o.next=function(){var e=this.opts();if(n.length&&e.currSlide==e.slideCount-1){var t=n[0];n=n.slice(1),e.container.one("cycle-slide-added",function(e,t){c.apply(t.API),t.container.removeClass("cycle-loading")}),e.container.addClass("cycle-loading"),e.API.add(t)}else c.apply(e.API)}),r&&(o.prev=function(){var e=this.opts();if(n.length&&0===e.currSlide){var t=n.length-1,i=n[t];n=n.slice(0,t),e.container.one("cycle-slide-added",function(e,t){t.currSlide=1,t.API.advanceSlide(-1),t.container.removeClass("cycle-loading")}),e.container.addClass("cycle-loading"),e.API.add(i,!0)}else r.apply(e.API)})}})}(jQuery),/*! tmpl plugin for Cycle2; version: 20121227 */ +function(e){"use strict";e.extend(e.fn.cycle.defaults,{tmplRegex:"{{((.)?.*?)}}"}),e.extend(e.fn.cycle.API,{tmpl:function(t,i){var n=RegExp(i.tmplRegex||e.fn.cycle.defaults.tmplRegex,"g"),s=e.makeArray(arguments);return s.shift(),t.replace(n,function(t,i){var n,o,c,r,l=i.split(".");for(n=0;s.length>n;n++)if(c=s[n]){if(l.length>1)for(r=c,o=0;l.length>o;o++)c=r,r=r[l[o]]||i;else r=c[i];if(e.isFunction(r))return r.apply(c,s);if(void 0!==r&&null!==r&&r!=i)return r}return i})}})}(jQuery); +//@ sourceMappingURL=jquery.cycle2.js.map \ No newline at end of file diff --git a/app/assets/javascripts/page_layout.js b/app/assets/javascripts/page_layout.js index 2622695c7..ea7b6bad3 100644 --- a/app/assets/javascripts/page_layout.js +++ b/app/assets/javascripts/page_layout.js @@ -4,4 +4,4 @@ //= require basic/bootstrap //= require kernel //= require lib/jquery.preload-min.js -//= require lib/jquery.cycle.all.js \ No newline at end of file +//= require lib/jquery.cycle2.min.js \ No newline at end of file diff --git a/app/assets/stylesheets/banner_nav.css b/app/assets/stylesheets/banner_nav.css index 0ff3a05c0..1f6138704 100644 --- a/app/assets/stylesheets/banner_nav.css +++ b/app/assets/stylesheets/banner_nav.css @@ -1,17 +1,17 @@ -#banner_nav { +.banner_nav { position: absolute; z-index: 10; bottom: 0; margin-right: 5px; right: 0; } -#banner_nav>li { +.banner_nav>li { float: left; display: inline-block; *display: inline; } -#banner_nav>li>a { +.banner_nav>li>a { display:block; width: 10px; height: 10px; @@ -25,11 +25,11 @@ text-indent: -9999px; box-shadow: 0 0 5px rgba(0,0,0,.7); } -#banner_nav>li>a:hover { +.banner_nav>li>a:hover { opacity: 1; filter: alpha(opacity = 100); } -#banner_nav>li.activeSlide>a { +.banner_nav>li.activeSlide>a { opacity: 1; filter: alpha(opacity = 100); } diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index 989eb0eb7..1e5262003 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -1,17 +1,10 @@ class Admin::AdBannersController < OrbitBackendController + open_for_visitor :only => [:index, :show] - open_for_manager :except => [:index,:show,:update,:realtime_preview] - open_for_sub_manager :except => [:index, :show] + open_for_sub_manager - def rename - @ad_banner = AdBanner.find(params[:id]) - @ad_banner.title = params[:body] - render :json => {:success =>@ad_banner.save!} - end - def destroy - @ad_banner = AdBanner.find(params[:id]) - @ad_banner.destroy - redirect_to admin_ad_banners_url + def index + @ad_banners = AdBanner.all.page(params[:page]).per(10) end def show @@ -28,13 +21,10 @@ class Admin::AdBannersController < OrbitBackendController def create @ad_banner = AdBanner.new(params[:ad_banner]) if @ad_banner.save - @active = @ad_banner redirect_to admin_ad_banners_url - #respond_to do |format| - # format.js {render 'new_created_node'} - #end else - render 'create_error_msg' + @ad_banner = AdBanner.new(params[:ad_banner]) + render :new end end @@ -45,20 +35,17 @@ class Admin::AdBannersController < OrbitBackendController def update @ad_banner = AdBanner.find(params[:id]) - @ad_banner.update_attributes(params[:ad_banner]) - @ad_banner.save + if @ad_banner.update_attributes(params[:ad_banner]) + redirect_to admin_ad_banners_url + else + render :edit + end + end + + def destroy + @ad_banner = AdBanner.find(params[:id]) + @ad_banner.destroy redirect_to admin_ad_banners_url end - def realtime_preview - @ad_banner = AdBanner.find( params[:id] ).preview_clone - @ad_banner.update_attributes(params[:ad_banner])#.update_attributes(params[:ad_images]) - end - - def index - @ad_banners = AdBanner.all - @active = @ad_banners.first - @tags = get_tags - end - end \ No newline at end of file diff --git a/app/controllers/admin/ad_images_controller.rb b/app/controllers/admin/ad_images_controller.rb index 755236240..35dc6c521 100644 --- a/app/controllers/admin/ad_images_controller.rb +++ b/app/controllers/admin/ad_images_controller.rb @@ -1,62 +1,56 @@ class Admin::AdImagesController < Admin::AdBannersController - - # before_filter :force_order_for_user - # before_filter :for_app_sub_manager - # before_filter :for_app_manager - + + before_filter :only => [ :new, :edit ] do + @ad_banners = AdBanner.all + @tags = get_tags + end + def initialize super @app_title = "ad_banner" end def index - #@ad_banner = AdBanner.find params[:ad_banner_id] - #@ad_images = @ad_banner.ad_images.all.page(params[:page]).per(10) - @ad_images = AdImage.all.page(params[:page]).per(10) + @ad_images = AdImage.all.page(params[:page]).per(10) end def edit - #@ad_banner = AdBanner.find params[:ad_banner_id] @ad_image = AdImage.find(params[:id]) - @tags = get_tags end def update - @ad_banner = AdBanner.find params[:ad_banner][:id] - @ad_image = AdImage.find(params[:ad_image][:id]) - @ad_image.update_attributes(params[:ad_image]) - @ad_banner.ad_images << @ad_image - redirect_to admin_ad_images_path + @ad_image = AdImage.find(params[:id]) + if @ad_image.update_attributes(params[:ad_image]) + redirect_to admin_ad_images_url + else + @ad_banners = AdBanner.all + @tags = get_tags + render action: :edit + end end - def new - #ad_banner = AdBanner.find params[:ad_banner_id] - #@ad_image =ad_banner.ad_images.build + def new @ad_image = AdImage.new - @ad_image.post_date = Date.today - @ad_image.unpost_date = Date.today + 30 - @tags = get_tags - #render :action => 'new',:url=> {:ad_banner_id => params.has_key?(:ad_banner_id)? params[:ad_banner_id],nil} + @ad_image.postdate = Date.today + @ad_image.deadline = Date.today + 30 end def create - @ad_banner = AdBanner.find params[:ad_banner][:id] - @ad_image = AdImage.new params[:ad_image] - @ad_image.to_save = true - @ad_banner.ad_images << @ad_image - + @ad_image = AdImage.new(params[:ad_image]) if @ad_image.save - redirect_to admin_ad_images_path + redirect_to admin_ad_images_url + else + @ad_banners = AdBanner.all + @tags = get_tags + @ad_image = AdImage.new(params[:ad_image]) + render action: :new end - end def destroy - #@ad_banner = AdBanner.find params[:ad_banner_id] @ad_image = AdImage.find params[:id] if @ad_image.destroy - flash[:notice] = t('ad.success_destroy_ad_image') - redirect_to admin_ad_images_path + redirect_to admin_ad_images_url end end diff --git a/app/controllers/admin/tags_controller.rb b/app/controllers/admin/tags_controller.rb index 3baf86512..768e8a3c9 100644 --- a/app/controllers/admin/tags_controller.rb +++ b/app/controllers/admin/tags_controller.rb @@ -1,6 +1,7 @@ class Admin::TagsController < OrbitBackendController include OrbitTag::Merging + open_for_user only: [:index] open_for_manager def index diff --git a/app/helpers/admin/ad_banners_helper.rb b/app/helpers/admin/ad_banners_helper.rb deleted file mode 100644 index b97f49cdb..000000000 --- a/app/helpers/admin/ad_banners_helper.rb +++ /dev/null @@ -1,31 +0,0 @@ -module Admin::AdBannersHelper - def preview_block_ad_images_helper(ad_banner) - 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! - end - def sub_manager?(ad_banner) - ad_banner.authed_users(:edit).include?(current_user) - end - - def show_ad_banner_permission_link(ad_banner) - type = 'edit' - oa = ad_banner.get_object_auth_by_title(type) - if oa.nil? - ad_banner.object_auths.new(title: type ).save - oa = ad_banner.get_object_auth_by_title(type) - end -# link_to t(:category_auth), edit_admin_object_auth_path(oa) - link_to t(:category_auth),admin_object_auth_ob_auth_path(oa),:class => "btn btn-warning" - end - - - -end diff --git a/app/helpers/orbit_backend_helper.rb b/app/helpers/orbit_backend_helper.rb index f636f9f2b..0961d3d27 100644 --- a/app/helpers/orbit_backend_helper.rb +++ b/app/helpers/orbit_backend_helper.rb @@ -24,13 +24,16 @@ module OrbitBackendHelper def show_delete_link(object) if !current_user.nil? - by_object = (object.create_user_id == current_user.id ) - by_user = (is_manager? or is_admin?) - by_object or by_user + if object.class.fields.include?('create_user_id') + by_object = (object.create_user_id == current_user.id ) + by_user = (is_manager? or is_admin?) + by_object or by_user + else + true + end else false end - end # def show_bulletin_title_at_index (bulletin) @@ -55,7 +58,7 @@ module OrbitBackendHelper def is_sort_active?(field) res = t(field[:translation]) - if params[:sort].eql?(field[:sort]) + if params[:sort] && params[:sort].eql?(field[:sort]) res << " " + content_tag(:b, nil, class: (params[:direction].eql?('asc') ? "icons-arrow-up-3" : "icons-arrow-down-4 ")) end res.html_safe @@ -108,12 +111,14 @@ module OrbitBackendHelper res << status.join(' ') when 'tags' sorted_objects = get_sorted_objects(object.tags, 'name') rescue '' + when 'standalone' + res << (field[:need_value] ? eval(field[:display_option]) : field[:display_option]) else sorted_values = object.send(field[:db_field]) sorted_values = sorted_values.sort if sorted_values.is_a?(Array) end - res << display_value_from_object(object, sorted_values, field[:display_option]) if sorted_values - res << display_value_from_objects(sorted_objects, field[:model_field], field[:display_option]) if sorted_objects + res << display_value_from_object(object, sorted_values, field[:display_option]).to_s if sorted_values + res << display_value_from_objects(sorted_objects, field[:model_field], field[:display_option]).to_s if sorted_objects if field[:quick_edit] res << (content_tag :div, class: "quick-edit" do content_tag :ul, class: "nav nav-pills" do @@ -131,7 +136,7 @@ module OrbitBackendHelper concat (content_tag :thead do (content_tag :tr, class: "sort-header" do @fields.each do |field| - concat (content_tag :th, "data-hide" => field[:hide], class: "#{field[:header_class]} #{'active' if params[:sort].eql?(field[:sort])}" do + concat (content_tag :th, "data-hide" => field[:hide], class: "#{field[:header_class]} #{'active' if (params[:sort] && params[:sort].eql?(field[:sort]))}" do if field[:sort] link_to is_sort_active?(field), url_for({:filter => @filter}.merge(sortable_options(field[:sort]).merge(:sort_options => field[:db_field]))) else @@ -241,6 +246,8 @@ module OrbitBackendHelper args[:translation] ||= 'tags' args[:display_option] ||= "content_tag(:span, object.name, class: 'label label-warning')" @fields << args + elsif !args.blank? && args[:type].eql?('standalone') + @fields << args end end @@ -267,7 +274,7 @@ module OrbitBackendHelper link = (is_manager? || is_sub_manager? rescue nil) && args.has_key?(:link) ? true : false if paginate || link @index_footer = content_tag :div, class: "bottomnav clearfix" do - concat content_tag :div, link_to(content_tag(:i, nil, :class => 'icon-plus') + ' ' + t(:add), send(args[:link]), :class => 'btn btn-primary' ), class: "action pull-right" if link + concat content_tag :div, link_to(content_tag(:i, nil, :class => 'icon-plus') + ' ' + t(:add), send(args[:link]), :class => (args[:link_class] || 'btn btn-primary'), data: args[:link_data]), class: "action pull-right" if link concat content_tag :div, paginate(@objects, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]}), class: "pagination pagination-centered" if paginate end end @@ -285,7 +292,7 @@ module OrbitBackendHelper end when 'edit' if authorization && approvable - content_tag :li, link_to(t(quick[:translation] || :edit), eval("#{quick[:link]}('#{object.id}')"), class: quick[:class]) + content_tag :li, link_to(t(quick[:translation] || :edit), eval("#{quick[:link]}('#{object.id}')"), class: quick[:class], data: quick[:data]) end when 'delete' if show_delete_link(object) @@ -323,7 +330,7 @@ module OrbitBackendHelper if object.is_a?(klass.constantize) autorized ||= object.user_can_sub_manage?(current_user) else - autorized ||= object.category.user_can_sub_manage?(current_user) + autorized ||= object.send(klass.underscore).user_can_sub_manage?(current_user) end autorized end diff --git a/app/models/ad_banner.rb b/app/models/ad_banner.rb index b5a433675..c30e51b3a 100644 --- a/app/models/ad_banner.rb +++ b/app/models/ad_banner.rb @@ -5,67 +5,27 @@ class AdBanner include OrbitTag::Taggable include OrbitModel::Authorizable - field :title - field :transition_msec,type: Integer field :ad_fx #TODO Design should explain - field :best_size,:default => '' + field :height, type: Integer + field :speed, type: Integer + field :title + field :timeout, type: Integer + field :width, type: Integer - before_save :save_or_destroy - validates_uniqueness_of :title - validates :title , :length => { :minimum => 2 } has_many :ad_images , dependent: :delete + + validates_uniqueness_of :title + validates :title, :length => { :minimum => 2 } + validates :height, :speed, :timeout, :width, :presence => true 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"] -attr_writer :transition_sec - AfterObjectAuthUrl = '/panel/page_content/back_end/page_contexts' - APP_NAME = 'ad_banners' - ObjectAuthTitlesOptions = %W{edit} - - - - def pp_object - title + def size + "#{self.width} x #{self.height}" end - def transition_sec - self.transition_msec/1000 rescue nil + def timeout_in_min + self.timeout*1000 rescue 0 end - def transition_sec=(sec) - self.transition_msec = sec.to_i*1000 - end - - def preview_clone - preview_banner = self.clone - preview_banner.ad_images = self.ad_images - preview_banner - end - # def new_ad_images(*attrs) - # debugger - # a=1 - # attrs[0].each do |attr| #Loop by JSs,Themes,Imgs - # unless attr[:file].nil? - # self.ad_images << AdImage.new(attr) - # end - # end - # end - - # def existing_ad_images=(*attrs) - # attrs[0].each do |attr| #Loop by JSs,Themes,Imgs - # ad_image = self.ad_images.find attr[0] - # ad_image.update_attributes(attr[1]) - # end - # end - - def save_or_destroy - self.ad_images.each do |ad_image| - if ad_image.to_save? - ad_image.save - end - if ad_image.to_destroy? - ad_image.destroy - end - end - end end \ No newline at end of file diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb index ac34a5959..3f624b5d9 100644 --- a/app/models/ad_image.rb +++ b/app/models/ad_image.rb @@ -1,53 +1,29 @@ class AdImage include Mongoid::Document include Mongoid::Timestamps + include OrbitModel::TimeFrame include OrbitTag::Taggable mount_uploader :file, ImageUploader field :title, localize: true - field :context, localize: true - field :to_save, :type => Boolean - field :to_destroy, :type => Boolean - - - field :direct_to_after_click,type: Boolean - - field :weight ,type: Integer ,default: 1 + field :context, localize: true + field :weight, type: Integer, default: 1 field :out_link #the link itself field :link_open #how will the link be opened - LINK_OPEN_TYPES = ["new_window","local"] - - field :post_date,type: Date - field :unpost_date,type: Date + LINK_OPEN_TYPES = ["local", "new_window"] belongs_to :ad_banner before_validation :add_http + validates :file, :presence => true validates :out_link, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i, :allow_blank => true - - def display? - if (self.post_date <= Date.today && (self.unpost_date.nil? || self.unpost_date>= Date.today) rescue false) - return true - end - return false - end - - - 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 + validates :title, :at_least_one => true protected def add_http - unless self.out_link[/^http:\/\//] || self.out_link[/^https:\/\//] || self.out_link.blank? + unless self.out_link.blank? || self.out_link[/^http:\/\//] || self.out_link[/^https:\/\//] self.out_link = 'http://' + self.out_link end end diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb deleted file mode 100644 index ac5c1ae0e..000000000 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -
    " id=<%= ad_banner_tab.title.dehumanize %>> -<% if at_least_module_manager || sub_manager?(ad_banner_tab)%> - <%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%> -
    - - <%= f.label :ad_fx, t('ad.ab_fx') %> - <%= f.select :ad_fx ,AdBanner::FX_TYPES %> - <%= f.label :transition_sec, t('ad.transition_sec') %> - <%= f.text_field :transition_sec,:placeholder=>t('ad.sec_place_holder'),:class=> "span3" %> <%= t("ad.trans_unit_sec") %> - <%if at_least_module_manager%> - <%= f.label :best_size, t('ad.best_size') %> - <%= f.text_field :best_size %> Ex: 500px x 300px - <% end -%> -
    - <%= f.submit t("ad.update_banner"), :class => 'btn' %> - <%= f.submit t("cancel"),:type=>'reset', :class => 'btn' %> -
    - <% end -%> -<% end -%> -

    <%= t("ad.picture_list")%>

    -
    - <%if (at_least_module_manager || ad_banner_tab.cur_user_is_sub_manager_of(:edit) )%> - <%= content_tag :div ,:class=>'adbanner-action' do%> - <%= link_to t("ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%> - <%= link_to t(:preview), admin_realtime_preview_ad_banner_path(ad_banner_tab.id) , :class=>'preview_trigger btn btn-success'%> - <% end -%> - <% end -%> -
      - <%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %> -
    - <% if at_least_module_manager %> - <%= show_ad_banner_permission_link ad_banner_tab%> - <%= link_to t(:delete_),admin_ad_banner_path(ad_banner_tab),:class => 'btn',:method => :delete,:confirm => t('sure?') %> - <% end -%> - - <%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %> -
    - <%#= render :partial => 'preview_block',:locals=> {:ad_banner =>ad_banner_tab} %> -
    diff --git a/app/views/admin/ad_banners/_ad_image_update.html.erb b/app/views/admin/ad_banners/_ad_image_update.html.erb deleted file mode 100644 index b0f6c63c7..000000000 --- a/app/views/admin/ad_banners/_ad_image_update.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -
  • - <%= image_tag ad_image.file rescue nil%> -

    - <%= ad_image.display? ? "[#{t('ad.showing')}]" : "[#{t('ad.not_showing')}]" %> - <%= "#{ad_image.post_date} ~ #{ad_image.unpost_date}" %> -

    - <%if at_least_module_manager || sub_manager?(ad_image.ad_banner) %> -

    - <%= link_to t('edit'),edit_admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn btn-primary' %> - <%= link_to t(:delete_),admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn',:method => :delete,:confirm => t('sure?') %> -

    - <% end -%> -
  • \ No newline at end of file diff --git a/app/views/admin/ad_banners/_edit.html.erb b/app/views/admin/ad_banners/_edit.html.erb index ac95cd561..cfbbbaaeb 100644 --- a/app/views/admin/ad_banners/_edit.html.erb +++ b/app/views/admin/ad_banners/_edit.html.erb @@ -1,31 +1,9 @@ -<%= form_for @ad_banner, url: admin_ad_banner_path(@ad_banner) do |f| %> +<%= form_for @ad_banner, url: admin_ad_banner_path(@ad_banner), remote: true do |f| %>
    - <%= t("ad_banner.banner") %> - - <%= f.text_field :title, :class=>"input-large", :placeholder=>"Banner Name" %> - <%= t("ad_banner.banner_name_note") %> - - <%= f.text_field :transition_sec, :class => 'input-large', :placeholder => 'Time' %> - <%= t("ad_banner.ste_note") %> - - <%= f.text_field :best_size, :class=>"input-large", :placeholder=>"Banner Size" %> - <%= t("ad_banner.best_size") %> EX:120x30 - - <%= f.select :ad_fx ,AdBanner::FX_TYPES %> -
    - <%= image_tag "slideshow_preview_A.png", :width=>220 %> - <%= image_tag "slideshow_preview_B.png", :width=>220 %> + <%= render :partial => "form", :locals => { :f => f } %> +
    + <%= t(:cancel) %> + <%= f.submit t(:update_), class: 'btn btn-primary btn-small' %>
    - <%= t("ad_banner.effect") %> - <%= t(:cancel) %> - <%= f.submit t(:update_), class: 'btn btn-primary btn-small' %>
    -<% end %> - \ No newline at end of file +<% end %> \ No newline at end of file diff --git a/app/views/admin/ad_banners/_form.html.erb b/app/views/admin/ad_banners/_form.html.erb new file mode 100644 index 000000000..40062f2ba --- /dev/null +++ b/app/views/admin/ad_banners/_form.html.erb @@ -0,0 +1,45 @@ +<%= flash_messages %> +<%= f.error_messages %> + +<%= f.label :title, t('ad_banner.banner_name') %> +<%= f.text_field :title, class: 'input-large', placeholder: t('ad_banner.banner_name') %> +<%= t('ad_banner.name_only_english') %> + +<%= f.label :timeout, t('ad_banner.transition_interval') %> +<%= f.number_field :timeout, in: 0..60, step: 1, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %> +<%= t('ad_banner.number_seconds') %> + +<%= f.label :speed, t('ad_banner.transition_speed') %> +<%= f.number_field :speed, in: 0..1000, step: 100, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %> +<%= t('ad_banner.number_milliseconds') %> + +<%= f.label :size, t('ad_banner.size') %> + +<%= f.number_field :width, in: 10..1000, step: 10, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %> + +<%= f.number_field :height, in: 10..1000, step: 10, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %> +<%= t('ad_banner.number_milliseconds') %> + +<%= f.label :ad_fx, t('ad_banner.effect') %> +<%= f.select :ad_fx, AdBanner::FX_TYPES, {}, {class: 'ad_banner_ad_fx'} %> +
    + <%= image_tag "slideshow_preview_A.png" %> + <%= image_tag "slideshow_preview_B.png" %> +
    +<%= t('ad_banner.effect') %> + + + + + \ No newline at end of file diff --git a/app/views/admin/ad_banners/_index.html.erb b/app/views/admin/ad_banners/_index.html.erb index 2a75ee1e8..81268aedd 100644 --- a/app/views/admin/ad_banners/_index.html.erb +++ b/app/views/admin/ad_banners/_index.html.erb @@ -1,39 +1,63 @@ -<%= javascript_include_tag "lib/jquery.cycle.all.js"%> +<% set_default_index do + objects @ad_banners + quick_edit_link type: 'edit', + link: 'edit_admin_ad_banner_path', + class: 'open-slide', + data: {title: t('ad_banner.edit_banner')} + quick_edit_link type: 'detail' + quick_edit_link type: 'delete', + link: 'admin_ad_banner_path' + # can have: title, warning, cancel and submit values + field db_field: 'title', + translation: 'ad_banner.banner_name', + sort: 'title', + quick_edit: true, + header_class: 'span4', + sort: 'title' + field db_field: 'ad_fx', + translation: 'ad_banner.effect', + hide: 'phone', + sort: 'effect' + field db_field: 'timeout', + translation: 'ad_banner.transition_interval', + hide: 'phone', + sort: 'timeout' + field db_field: 'speed', + translation: 'ad_banner.transition_speed', + hide: 'phone', + sort: 'speed' + field db_field: 'size', + translation: 'ad_banner.size', + hide: 'phone', + sort: 'size' + field type: 'standalone', + translation: 'preview', + display_option: "link_to(t(:preview), '#', data: {w: object.width, h: object.height, fx: object.ad_fx, time: object.timeout_in_min, speed: object.speed}, class: 'btn btn-success open-modal')", + need_value: true, + hide: 'phone' + footer link: 'new_admin_ad_banner_path', + link_class: 'btn btn-primary open-slide', + link_data: {title: t('ad_banner.new_banner')} +end %> - - - - - - - - - - <% @ad_banners.each do |ad_banner| %> - - - - - - <% end %> - -
    <%= t('ad_banner.title') %><%= t('ad_banner.transition_msec') %><%= t('ad_banner.ad_fx') %>
    <%= ad_banner.title %> -
    - -
    -
    <%= ad_banner.transition_msec %><%= ad_banner.ad_fx%>
    -<%if is_manager? %> - -
    -
    - <%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add_new), new_admin_ad_banner_path, :class => "btn btn-primary open-slide"%> -
    -
    +<%= render 'admin/default_index/index' %> +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "lib/jquery.cycle.all.js" %> + <%= javascript_include_tag "lib/ad_banner/banner_preview" %> <% end %> + + diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb deleted file mode 100644 index dc35a7044..000000000 --- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb +++ /dev/null @@ -1,46 +0,0 @@ - - - diff --git a/app/views/admin/ad_banners/_modal_preview.html.erb b/app/views/admin/ad_banners/_modal_preview.html.erb deleted file mode 100644 index adf84adb8..000000000 --- a/app/views/admin/ad_banners/_modal_preview.html.erb +++ /dev/null @@ -1,36 +0,0 @@ -<% if ad_banner -%> - - - - - -<% end -%> diff --git a/app/views/admin/ad_banners/_new.html.erb b/app/views/admin/ad_banners/_new.html.erb index 95b114511..945c2a206 100644 --- a/app/views/admin/ad_banners/_new.html.erb +++ b/app/views/admin/ad_banners/_new.html.erb @@ -1,31 +1,9 @@ -<%= form_for(:ad_banner, :url => admin_ad_banners_path) do |f| %> -
    - <%= t("ad_banner.banner") %> - - <%= f.text_field :title, :class=>"input-large", :placeholder=>"Banner Name" %> - <%= t("ad_banner.banner_name_note") %> - - <%= f.text_field :transition_sec, :class => 'input-large', :placeholder => 'Time' %> - <%= t("ad_banner.ste_note") %> - - <%= f.text_field :best_size, :class=>"input-large", :placeholder=>"Banner Size" %> - <%= t("ad_banner.best_size") %> EX:120x30 - - <%= f.select :ad_fx ,AdBanner::FX_TYPES %> -
    - <%= image_tag "slideshow_preview_A.png", :width=>220 %> - <%= image_tag "slideshow_preview_B.png", :width=>220 %> -
    - <%= t("ad_banner.effect") %> - <%= t(:cancel) %> - <%= f.submit t(:create_), class: 'btn btn-primary btn-small' %> -
    -<% end %> - \ No newline at end of file +<%= form_for @ad_banner, url: admin_ad_banners_path, remote: true do |f| %> +
    + <%= render :partial => "form", :locals => { :f => f } %> +
    + <%= t(:cancel) %> + <%= f.submit t(:create_), class: 'btn btn-primary btn-small' %> +
    +
    +<% end %> \ No newline at end of file diff --git a/app/views/admin/ad_banners/_new_add_banner_file.html.erb b/app/views/admin/ad_banners/_new_add_banner_file.html.erb deleted file mode 100644 index 457b57f1a..000000000 --- a/app/views/admin/ad_banners/_new_add_banner_file.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<%= f.fields_for field_name, new_add_banner_file do |f| %> -

    - <%= f.file_field :file %> - <%#= render :partial => "ad_image_form", :locals => { :f => f } %> - <%= button_tag '+', :class => "multi_files"%> -

    -<% end %> \ No newline at end of file diff --git a/app/views/admin/ad_banners/_preview_block.html.erb b/app/views/admin/ad_banners/_preview_block.html.erb deleted file mode 100644 index cbaad8e8b..000000000 --- a/app/views/admin/ad_banners/_preview_block.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<% if ad_banner -%> -<%= link_to t(:preview),"#slideshow-#{ad_banner.title.dehumanize}",:class=>"btn btn-primary btn-large",:data=>{:toggle=>'modal'} %> - - - -<% end -%> - - - diff --git a/app/views/admin/ad_banners/create_error_msg.js.erb b/app/views/admin/ad_banners/create_error_msg.js.erb deleted file mode 100644 index dbd013dfd..000000000 --- a/app/views/admin/ad_banners/create_error_msg.js.erb +++ /dev/null @@ -1 +0,0 @@ -$("#ad_banner-modal-info").append("<%= @ad_banner.errors.full_messages.join(',')%>"); \ No newline at end of file diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb index cf8c645e7..f87f7fac9 100644 --- a/app/views/admin/ad_banners/index.html.erb +++ b/app/views/admin/ad_banners/index.html.erb @@ -1,9 +1,3 @@ -<% content_for :right_nav do %> -
    - -
    -<% end %> - -
    + \ No newline at end of file diff --git a/app/views/admin/ad_banners/index.js.erb b/app/views/admin/ad_banners/index.js.erb index 641d1fa74..8a38bfd11 100644 --- a/app/views/admin/ad_banners/index.js.erb +++ b/app/views/admin/ad_banners/index.js.erb @@ -1,3 +1,3 @@ -$("#categories_index").html("<%= j render 'index' %>") +$("#banner_index").html("<%= j render 'index' %>") $.pageslide.close(); openSlide(); \ No newline at end of file diff --git a/app/views/admin/ad_banners/new_created_node.js.erb b/app/views/admin/ad_banners/new_created_node.js.erb deleted file mode 100644 index df27da4f0..000000000 --- a/app/views/admin/ad_banners/new_created_node.js.erb +++ /dev/null @@ -1,18 +0,0 @@ -$('<%= escape_javascript(content_tag(:li,link_to(@ad_banner.title,"##{@ad_banner.title}",:data=>{:toggle=>"tab"}))) %>').insertBefore("#new_ad_banner_tab_but"); -$('<%= escape_javascript(render(:partial => "ad_banner_tab",:locals => {:ad_banner_tab => @ad_banner})) %>').insertAfter($("#ad_banner-tab-content").children(".tab-pane").last()); - -$('.modal').modal('hide'); -$("#ad_banner-modal-info").empty(); -$("#new-a-banner form").each(function(){this.reset();}); - -$('#new-a-banner').unbind(); -$('#post-body-content').find(".nav.nav-tabs").children('li.active').removeClass("active"); -$("#ad_banner-tab-content").children(".tab-pane").removeClass("active"); -$('#post-body-content').find(".nav.nav-tabs").children('li[id!="new_ad_banner_tab_but"]').last().addClass("active"); -$("#ad_banner-tab-content").children(".tab-pane").last().addClass("active"); - -<% if params[:action] && params[:action] =='create'%> - var trigger = $("#ad_banner-tab-content").children(".tab-pane").last().find(".preview_trigger"); - new_url = trigger.attr("href").replace(/\/admin\/ad_banners\/.*\/preview/gi,"/admin/ad_banners/<%= @ad_banner.id %>/preview"); - trigger.attr("href",new_url); -<% end %> \ No newline at end of file diff --git a/app/views/admin/ad_banners/realtime_preview.js.erb b/app/views/admin/ad_banners/realtime_preview.js.erb deleted file mode 100644 index 1ab728f25..000000000 --- a/app/views/admin/ad_banners/realtime_preview.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_preview',:locals => {:ad_banner => @ad_banner})) %>"); -var start_modal_with_id = "slideshow-<%=@ad_banner.title.dehumanize%>" \ No newline at end of file diff --git a/app/views/admin/ad_images/_form.html.erb b/app/views/admin/ad_images/_form.html.erb index f28b1b90b..71d6dbf44 100644 --- a/app/views/admin/ad_images/_form.html.erb +++ b/app/views/admin/ad_images/_form.html.erb @@ -1,104 +1,75 @@ <% content_for :page_specific_css do %> <%= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "lib/fileupload" %> - <%= stylesheet_link_tag "lib/main-list" %> <% end %> <% content_for :page_specific_javascript do %> <%= javascript_include_tag "lib/bootstrap-fileupload" %> <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> - <%= javascript_include_tag "lib/modal-preview" %> - <%= javascript_include_tag "lib/file-type" %> + <%= javascript_include_tag "lib/module-area" %> <% end %> - -
    -
    - +<%= f.error_messages %> - -
    + +
    - - - + + + - -
    + +
    - -
    + +
    - -
    - -
    - <%= select_tag 'ad_banner[id]',options_from_collection_for_select(AdBanner.all, "id", "title", @ad_image.ad_banner_id) , :class=>"input-medium" %> -
    -
    + +
    + +
    + <%= f.select :ad_banner_id, @ad_banners.collect{|t| [ t.title, t.id ]} %> +
    +
    + +
    + +
    + <%= f.datetime_picker :postdate, :no_label => true %> +
    +
    - -
    - -
    - <%= f.datetime_picker :post_date, :no_label => true %> -
    -
    + +
    + +
    + <%= f.datetime_picker :deadline, :no_label => true %> +
    +
    - -
    - -
    - <%= f.datetime_picker :unpost_date, :no_label => true %> -
    -
    +
    -
    - - -
    - - -
    - -
    - - - -
    -
    - -
    - +
    @@ -116,83 +87,83 @@
    - -
    + +
    - -
    - -
    - <%= f.select :link_open ,AdImage::LINK_OPEN_TYPES%> -
    -
    + +
    + +
    + <%= f.select :link_open, AdImage::LINK_OPEN_TYPES.map{|a| [t("ad_banner.#{a}"), a]} %> +
    +
    -
    +
    - -
    + +
    - -
    - -
    - <%= f.text_field :weight ,:class=> 'span3',:placeholder=> t('ad.chinese_1') %> - Please enter the number -
    -
    + +
    + +
    + <%= f.number_field :weight, placeholder: t(:frequency), in: 1..99, maxlength: 2, onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %> + <%= t('ad_banner.enter_number') %> +
    +
    -
    +
    - - - -
    + +
    - -
    - -
    - -
    -
    - <% if @ad_image.file %> - <%= image_tag @ad_image.file %> - <% else %> - <%= image_tag "http://www.placehold.it/50x50/EFEFEF/AAAAAA" %> - <%end%> -
    -
    - - <%= t(:select_image) %> - <%= t(:change) %> - <%= f.file_field :file %> - - <%= t(:cancel) %> -
    - -
    -
    -
    -
    + +
    + +
    +
    +
    + <% if @ad_image.file.file %> + <%= image_tag @ad_image.file %> + <% else %> + + <% end %> +
    +
    + + <%= t(:select_image) %> + <%= t(:change) %> + <%= f.file_field :file %> + + <%= t(:cancel) %> +
    + +
    +
    +
    +
    -
    +
    -
    - +
    + +
    <% end %> - - -
    +
    - - + - - - <%= f.hidden_field :id, :value => @ad_image.id %> -
    - <%= f.submit t("submit"),:class=>"btn btn-primary" %> - <%= f.submit t("cancel"),:class=>"btn ",:type => 'reset' %> - -
    - - - \ No newline at end of file + +
    + <%= f.submit t('submit'), class: 'btn btn-primary' %> + <%= link_to t('cancel'), get_go_back, :class=>"btn" %> +
    diff --git a/app/views/admin/ad_images/edit.html.erb b/app/views/admin/ad_images/edit.html.erb index a3852f4fd..113b93e0f 100644 --- a/app/views/admin/ad_images/edit.html.erb +++ b/app/views/admin/ad_images/edit.html.erb @@ -1,8 +1,5 @@ -<%= flash_messages %> - -<%= form_for @ad_image, :url => admin_ad_image_path, :html => { :class => 'form' } do |f| %> - - <%= render :partial => "form", :locals => { :f => f } %> - - -<% end %> +<%= form_for @ad_image, url: admin_ad_image_path(@ad_image), html: {class: "form-horizontal main-forms"} do |f| %> +
    + <%= render partial: 'form', locals: {f: f} %> +
    +<% end %> \ No newline at end of file diff --git a/app/views/admin/ad_images/index.html.erb b/app/views/admin/ad_images/index.html.erb index 4222a2816..acbbf3efb 100644 --- a/app/views/admin/ad_images/index.html.erb +++ b/app/views/admin/ad_images/index.html.erb @@ -1,48 +1,56 @@ - - - - - - - - - - - - <% @ad_images.each do |ad_image| %> - - - - - - - - <% end %> - -
    <%= t('ad_image.image') %><%= t('ad_image.post_date') %><%= t('ad_image.unpost_date') %><%= t('ad_image.context') %><%= t('ad_image.out_link') %>
    <%= image_tag ad_image.file.thumb %> -
    - -
    -
    <%= ad_image.post_date %><%= ad_image.unpost_date %><%= ad_image.context %><%=link_to "#{ad_image.out_link}", ad_image.out_link %>
    -<%if is_manager? %> - -
    -
    - <%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add_new), "#add-banner", :class => "btn btn-primary open-slide"%> -
    - -
    - - - -<% end %> \ No newline at end of file +<%= render 'admin/default_index/index' %> diff --git a/app/views/admin/ad_images/new.html.erb b/app/views/admin/ad_images/new.html.erb index e6345f062..288ae4fae 100644 --- a/app/views/admin/ad_images/new.html.erb +++ b/app/views/admin/ad_images/new.html.erb @@ -1,7 +1,5 @@ -<%= flash_messages %> -<%= form_for @ad_image, :url => admin_create_ad_image_path, :html => { :class => 'form' ,:multipart => true} do |f| %> - - <%= render :partial => "form", :locals => { :f => f } %> - - -<% end %> +<%= form_for @ad_image, url: admin_ad_images_path, html: {class: "form-horizontal main-forms"} do |f| %> +
    + <%= render partial: 'form', locals: {f: f} %> +
    +<% end %> \ No newline at end of file diff --git a/app/views/front/show_banner.html.erb b/app/views/front/show_banner.html.erb index a14596fbb..e2822f500 100644 --- a/app/views/front/show_banner.html.erb +++ b/app/views/front/show_banner.html.erb @@ -1,20 +1,9 @@
    - -
    - <% (images = @ad_banner.ad_images).shuffle.each do |ad_image| %> - <% if ad_image.display? %> - <%= ad_image.title || ' title='<%= ad_image.title || ' ' %>' time_to_next='<%= @ad_banner.transition_msec %>' link_open='<%= ad_image.link_open %>' link_url='<%= ad_image_link(ad_image) %>' style=' <%= 'cursor:pointer;' if !ad_image_link(ad_image).blank? %>'/> - <% end %> +
    + <% @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?) %> <% end %>
    +
    - \ No newline at end of file diff --git a/app/views/front/show_inner_ad_image.html.erb b/app/views/front/show_inner_ad_image.html.erb index 39350f62a..7e0771d63 100644 --- a/app/views/front/show_inner_ad_image.html.erb +++ b/app/views/front/show_inner_ad_image.html.erb @@ -1,4 +1,4 @@ -<%if @ad_image && @ad_image.display? %> +<% if @ad_image %>

    <%= @ad_image.title %>

    diff --git a/app/views/mobile/index.mobile.erb b/app/views/mobile/index.mobile.erb index b91bc35bc..76aef5288 100644 --- a/app/views/mobile/index.mobile.erb +++ b/app/views/mobile/index.mobile.erb @@ -1,8 +1,6 @@
    - <% @ad_banner.ad_images.shuffle.each do |image| %> - <% if image.display? %> -
    <%= image_tag image.file.url, :class => 'slideImg' %>
    - <% end %> + <% @ad_banner.ad_images.can_display.shuffle.each do |image| %> +
    <%= image_tag image.file.url, :class => 'slideImg' %>
    <% end %>
    diff --git a/app/views/shared/preview/_modal_preview.html.erb b/app/views/shared/preview/_modal_preview.html.erb index 741df400d..2722d1988 100644 --- a/app/views/shared/preview/_modal_preview.html.erb +++ b/app/views/shared/preview/_modal_preview.html.erb @@ -8,10 +8,6 @@ - - <%# preview_block_ad_images_helper(news_bulletin).each do |ad_image| -%> - <%#= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => news_bulletin.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || news_bulletin.context || " ")) %> - <%# end -%>