changes for ad_banner
This commit is contained in:
1 parent
19bf2f2be5
commit
92d2af13f2
45 files changed
+500
-794
No files matched your search
@@ -0,0 +1 @@
|
||||
//= require lib/arrow-on-list-edit
|
||||
@@ -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 "<li><a href='#'></a></li>"; }
|
||||
});
|
||||
}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')!='')
|
||||
{
|
||||
|
||||
@@ -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() {
|
||||
|
||||
+17
@@ -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.transLine truncated
|
||||
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:"<div>{{title}}</div><div>{{desc}}</div>",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.currSlide<i.nextSlide,i.API.prepareTx(!0,t)}},stop:function(){var t=this.opts(),i=t.container;clearTimeout(t.timeoutId),t.timeoutId=0,t.API.stopTransition(),t.pauseOnHover&&(t.pauseOnHover!==!0&&(i=e(t.pauseOnHover)),i.off("mouseenter mouseleave")),t.API.trigger("cycle-stopped",[t]).log("cycle-stopped")},reinit:function(){var e=this.opts();e.API.destroy(),e.container.cycle()},remove:function(t){for(var i,n,s=this.opts(),o=[],c=1,r=0;s.slides.length>r;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:"<span>•</span>"}),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
|
||||
@@ -4,4 +4,4 @@
|
||||
//= require basic/bootstrap
|
||||
//= require kernel
|
||||
//= require lib/jquery.preload-min.js
|
||||
//= require lib/jquery.cycle.all.js
|
||||
//= require lib/jquery.cycle2.min.js
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Admin::TagsController < OrbitBackendController
|
||||
include OrbitTag::Merging
|
||||
|
||||
open_for_user only: [:index]
|
||||
open_for_manager
|
||||
|
||||
def index
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
+13
-53
@@ -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
|
||||
+7
-31
@@ -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
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<div class="tab-pane fade <%= "active in" if ad_banner_tab==@active%>" 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| -%>
|
||||
<div class="adbanner-setup well">
|
||||
<!--<p><%#= t("ad.banner_best_size") %>:</p>-->
|
||||
<%= 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 -%>
|
||||
<br>
|
||||
<%= f.submit t("ad.update_banner"), :class => 'btn' %>
|
||||
<%= f.submit t("cancel"),:type=>'reset', :class => 'btn' %>
|
||||
</div>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<h3><%= t("ad.picture_list")%></h3>
|
||||
<div class="adbanner-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 -%>
|
||||
<ul class="clear">
|
||||
<%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %>
|
||||
</ul>
|
||||
<% 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" } %>
|
||||
</div>
|
||||
<%#= render :partial => 'preview_block',:locals=> {:ad_banner =>ad_banner_tab} %>
|
||||
</div>
|
||||
@@ -1,13 +0,0 @@
|
||||
<li class="span3">
|
||||
<%= image_tag ad_image.file rescue nil%>
|
||||
<p>
|
||||
<%= ad_image.display? ? "[#{t('ad.showing')}]" : "[#{t('ad.not_showing')}]" %>
|
||||
<%= "#{ad_image.post_date} ~ #{ad_image.unpost_date}" %>
|
||||
</p>
|
||||
<%if at_least_module_manager || sub_manager?(ad_image.ad_banner) %>
|
||||
<p>
|
||||
<%= 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?') %>
|
||||
</p>
|
||||
<% end -%>
|
||||
</li>
|
||||
@@ -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| %>
|
||||
<fieldset>
|
||||
<legend><%= t("ad_banner.banner") %></legend>
|
||||
<label><%= t("ad_banner.banner_name") %></label>
|
||||
<%= f.text_field :title, :class=>"input-large", :placeholder=>"Banner Name" %>
|
||||
<span class="help-block"><%= t("ad_banner.banner_name_note") %></span>
|
||||
<label for="timeout"><%= t("ad_banner.ste") %></label>
|
||||
<%= f.text_field :transition_sec, :class => 'input-large', :placeholder => 'Time' %>
|
||||
<span class="help-block"><%= t("ad_banner.ste_note") %></span>
|
||||
<label><%= t("ad_banner.best_size") %></label>
|
||||
<%= f.text_field :best_size, :class=>"input-large", :placeholder=>"Banner Size" %>
|
||||
<span class="help-block"><%= t("ad_banner.best_size") %> EX:120x30 </span>
|
||||
<label><%= t("ad_banner.effect") %></label>
|
||||
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
|
||||
<div class="preview">
|
||||
<%= image_tag "slideshow_preview_A.png", :width=>220 %>
|
||||
<%= image_tag "slideshow_preview_B.png", :width=>220 %>
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
<div class="form-actions">
|
||||
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||
<%= f.submit t(:update_), class: 'btn btn-primary btn-small' %>
|
||||
</div>
|
||||
<span class="help-block"><%= t("ad_banner.effect") %></span>
|
||||
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||
<%= f.submit t(:update_), class: 'btn btn-primary btn-small' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
$('select').on('change', function() {
|
||||
$(".preview").cycle({
|
||||
delay: -3000,
|
||||
fx: $(this).val()
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
@@ -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') %>
|
||||
<span class="help-block"><%= t('ad_banner.name_only_english') %></span>
|
||||
|
||||
<%= 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;" %>
|
||||
<span class="help-block"><%= t('ad_banner.number_seconds') %></span>
|
||||
|
||||
<%= 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;" %>
|
||||
<span class="help-block"><%= t('ad_banner.number_milliseconds') %></span>
|
||||
|
||||
<%= f.label :size, t('ad_banner.size') %>
|
||||
<span class="banner_set">W:</span>
|
||||
<%= f.number_field :width, in: 10..1000, step: 10, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %>
|
||||
<span class="banner_set">H:</span>
|
||||
<%= f.number_field :height, in: 10..1000, step: 10, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %>
|
||||
<span class="help-block"><%= t('ad_banner.number_milliseconds') %></span>
|
||||
|
||||
<%= f.label :ad_fx, t('ad_banner.effect') %>
|
||||
<%= f.select :ad_fx, AdBanner::FX_TYPES, {}, {class: 'ad_banner_ad_fx'} %>
|
||||
<div class="preview">
|
||||
<%= image_tag "slideshow_preview_A.png" %>
|
||||
<%= image_tag "slideshow_preview_B.png" %>
|
||||
</div>
|
||||
<span class="help-block"><%= t('ad_banner.effect') %></span>
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(".ad_banner_ad_fx").change(function () {
|
||||
// bannerTime = $("#pageslide #timeout").val()*1000;
|
||||
// bannerSpeed = $("#pageslide #speed").val()*1000;
|
||||
bannerTime = "<%= @ad_banner.timeout_in_min %>"
|
||||
bannerSpeed = "<%= @ad_banner.speed %>"
|
||||
|
||||
bannerTime = parseInt(bannerTime) || 300;
|
||||
bannerSpeed = parseInt(bannerSpeed) || 300;
|
||||
slideshow($(this).val(), bannerTime, bannerSpeed);
|
||||
});
|
||||
</script>
|
||||
@@ -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 %>
|
||||
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"><%= t('ad_banner.title') %></th>
|
||||
<th class="span1"><%= t('ad_banner.transition_msec') %></th>
|
||||
<th class="span1"><%= t('ad_banner.ad_fx') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_locations" class="sort-holder">
|
||||
<% @ad_banners.each do |ad_banner| %>
|
||||
<tr class="with_action">
|
||||
<td><%= ad_banner.title %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<% if is_admin?%>
|
||||
<li><%= link_to t(:edit), edit_admin_ad_banner_path(ad_banner), :class => "open-slide" %></li>
|
||||
<li><%= link_to 'Destroy', admin_ad_banner_path(ad_banner), method: :delete , :confirm => t(:sure?) %></li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= ad_banner.transition_msec %></td>
|
||||
<td><%= ad_banner.ad_fx%></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%if is_manager? %>
|
||||
<!-- footer -->
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add_new), new_admin_ad_banner_path, :class => "btn btn-primary open-slide"%>
|
||||
</div>
|
||||
</div>
|
||||
<%= 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 %>
|
||||
|
||||
<div id="preview" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3 id="ModalLabel"><%= t(:preview) %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="preview">
|
||||
<%= image_tag "slideshow_preview_A.png" %>
|
||||
<%= image_tag "slideshow_preview_B.png" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,46 +0,0 @@
|
||||
|
||||
<div id="new-a-banner" class="modal fade <%= 'active' if @active.nil? %>">
|
||||
<%= form_for(:ad_banner,:remote => true, :url => admin_ad_banners_path) do |f| %>
|
||||
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3><%= t('new.banner') %></h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body form-horizontal">
|
||||
<div class="control-group">
|
||||
<%= f.label :title, t(:title),:class => "control-label" %>
|
||||
<div class="controls">
|
||||
<%= f.text_field :title %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<%= f.label :transition_sec, t('ad.transition_sec'),:class => "control-label" %>
|
||||
<div class="controls">
|
||||
<%= f.text_field :transition_sec %> <%= t("ad.trans_unit_sec") %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<%= f.label :best_size, t('ad.best_size'),:class => "control-label" %>
|
||||
<div class="controls">
|
||||
<%= f.text_field :best_size %> <%= t('ad.best_size_example') %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<%= f.label :ad_fx, t('ad.ab_fx') %>
|
||||
<div class="controls">
|
||||
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<span id="ad_banner-modal-info"></span>
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary',:remote=>true %>
|
||||
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<% if ad_banner -%>
|
||||
|
||||
<div class="modal hide fade in banner-preview" id="slideshow-<%=ad_banner.title.dehumanize%>">
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3><%= t(:preview) %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="ad_banner_slideshow">
|
||||
<% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
|
||||
<%= image_tag ad_image.file,:alt => (ad_image.title || " "),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || " ")) %>
|
||||
<% end -%>
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn" data-dismiss="modal"><%= t(:close) %></a>
|
||||
</div>
|
||||
<div>
|
||||
<script type="text/javascript" src="/static/kernel.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#slideshow-<%=ad_banner.title.dehumanize%>").on("show", function () {
|
||||
$("#slideshow-<%=ad_banner.title.dehumanize%>").find(".ad_banner_slideshow").cycle({delay: -1000, fx: "<%= ad_banner.ad_fx.nil?? "fade": ad_banner.ad_fx %>", timeoutFn: getTimeout });
|
||||
});
|
||||
$(".modal").on("hidden", function () {
|
||||
$("#show_preview").remove();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<% end -%>
|
||||
@@ -1,31 +1,9 @@
|
||||
<%= form_for(:ad_banner, :url => admin_ad_banners_path) do |f| %>
|
||||
<fieldset>
|
||||
<legend><%= t("ad_banner.banner") %></legend>
|
||||
<label><%= t("ad_banner.banner_name") %></label>
|
||||
<%= f.text_field :title, :class=>"input-large", :placeholder=>"Banner Name" %>
|
||||
<span class="help-block"><%= t("ad_banner.banner_name_note") %></span>
|
||||
<label for="timeout"><%= t("ad_banner.ste") %></label>
|
||||
<%= f.text_field :transition_sec, :class => 'input-large', :placeholder => 'Time' %>
|
||||
<span class="help-block"><%= t("ad_banner.ste_note") %></span>
|
||||
<label><%= t("ad_banner.best_size") %></label>
|
||||
<%= f.text_field :best_size, :class=>"input-large", :placeholder=>"Banner Size" %>
|
||||
<span class="help-block"><%= t("ad_banner.best_size") %> EX:120x30 </span>
|
||||
<label><%= t("ad_banner.effect") %></label>
|
||||
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
|
||||
<div class="preview">
|
||||
<%= image_tag "slideshow_preview_A.png", :width=>220 %>
|
||||
<%= image_tag "slideshow_preview_B.png", :width=>220 %>
|
||||
</div>
|
||||
<span class="help-block"><%= t("ad_banner.effect") %></span>
|
||||
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||
<%= f.submit t(:create_), class: 'btn btn-primary btn-small' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
$('select').on('change', function() {
|
||||
$(".preview").cycle({
|
||||
delay: -3000,
|
||||
fx: $(this).val()
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<%= form_for @ad_banner, url: admin_ad_banners_path, remote: true do |f| %>
|
||||
<fieldset>
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
<div class="form-actions">
|
||||
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||
<%= f.submit t(:create_), class: 'btn btn-primary btn-small' %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
@@ -1,7 +0,0 @@
|
||||
<%= f.fields_for field_name, new_add_banner_file do |f| %>
|
||||
<p class="new_file">
|
||||
<%= f.file_field :file %>
|
||||
<%#= render :partial => "ad_image_form", :locals => { :f => f } %>
|
||||
<%= button_tag '+', :class => "multi_files"%>
|
||||
</p>
|
||||
<% end %>
|
||||
@@ -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'} %>
|
||||
|
||||
<div class="modal hide fade in banner-preview" id='slideshow-<%=ad_banner.title.dehumanize%>'>
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3><%= t(:preview) %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="ad_banner_slideshow">
|
||||
<% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
|
||||
<%= image_tag ad_image.file,:alt => (ad_image.title || ' '),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || ' ')) %>
|
||||
<% end -%>
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn" data-dismiss="modal">Close</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end -%>
|
||||
|
||||
<script type='text/javascript' src='/static/kernel.js'></script>
|
||||
<script type='text/javascript'>
|
||||
$('#slideshow-<%=ad_banner.title.dehumanize%>').on('show', function () {
|
||||
$('#slideshow-<%=ad_banner.title.dehumanize%>').find(".ad_banner_slideshow").cycle({delay: -1000, fx: '<%= ad_banner.ad_fx.nil?? 'fade': ad_banner.ad_fx %>', timeoutFn: getTimeout });
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -1 +0,0 @@
|
||||
$("#ad_banner-modal-info").append("<%= @ad_banner.errors.full_messages.join(',')%>");
|
||||
@@ -1,9 +1,3 @@
|
||||
<% content_for :right_nav do %>
|
||||
<div class="searchClear pull-right">
|
||||
<input id="filter-input" class="search-query input-medium" type="text" placeholder="<%= t('search.tags') %>" value="">
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div id="tags_index">
|
||||
<div id="banner_index">
|
||||
<%= render 'index' %>
|
||||
</div>
|
||||
@@ -1,3 +1,3 @@
|
||||
$("#categories_index").html("<%= j render 'index' %>")
|
||||
$("#banner_index").html("<%= j render 'index' %>")
|
||||
$.pageslide.close();
|
||||
openSlide();
|
||||
@@ -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 %>
|
||||
@@ -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%>"
|
||||
@@ -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 %>
|
||||
|
||||
<!-- Forms -->
|
||||
<form class="form-horizontal main-forms">
|
||||
<fieldset>
|
||||
|
||||
<%= f.error_messages %>
|
||||
|
||||
<!-- Input Area -->
|
||||
<div class="input-area">
|
||||
<!-- Input Area -->
|
||||
<div class="input-area">
|
||||
|
||||
<!-- Module Tabs -->
|
||||
<div class="nav-name"><strong>Module</strong></div>
|
||||
<ul class="nav nav-pills module-nav">
|
||||
<li class="active">
|
||||
<a href="#basic" data-toggle="tab">Basic</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#status" data-toggle="tab">Status</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tag" data-toggle="tab">Tags</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#type" data-toggle="tab">Type</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#frequency" data-toggle="tab">Frequency</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#link" data-toggle="tab">Link</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#imageupload" data-toggle="tab">Images</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Module Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:module) %></strong></div>
|
||||
<ul class="nav nav-pills module-nav">
|
||||
<li class="active">
|
||||
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tag" data-toggle="tab"><%= t(:tags) %></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#type" data-toggle="tab"><%= t('ad_banner.type') %></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#frequency" data-toggle="tab"><%= t(:frequency) %></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#link" data-toggle="tab"><%= t(:link) %></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#imageupload" data-toggle="tab"><%= t(:image) %></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Module -->
|
||||
<div class="tab-content module-area">
|
||||
<!-- Module -->
|
||||
<div class="tab-content module-area">
|
||||
|
||||
<!-- Basic Module -->
|
||||
<div class="tab-pane fade in active" id="basic">
|
||||
<!-- Basic Module -->
|
||||
<div class="tab-pane fade in active" id="basic">
|
||||
|
||||
<!-- Category -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted">Banner</label>
|
||||
<div class="controls">
|
||||
<%= select_tag 'ad_banner[id]',options_from_collection_for_select(AdBanner.all, "id", "title", @ad_image.ad_banner_id) , :class=>"input-medium" %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Category -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t('ad_banner.banner') %></label>
|
||||
<div class="controls">
|
||||
<%= f.select :ad_banner_id, @ad_banners.collect{|t| [ t.title, t.id ]} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Date Time Picker -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:start_date) %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :postdate, :no_label => true %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Date Time Picker -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:start_date) %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :post_date, :no_label => true %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Date Time Picker -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:end_date) %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :deadline, :no_label => true %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Date Time Picker -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:end_date) %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :unpost_date, :no_label => true %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Status Module -->
|
||||
<div class="tab-pane fade" id="status">
|
||||
|
||||
<!-- Status -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted">Status</label>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<label class="checkbox inline btn">
|
||||
<input type="checkbox" value="1"> Top
|
||||
</label>
|
||||
<label class="checkbox inline btn">
|
||||
<input type="checkbox" value="2"> Hot
|
||||
</label>
|
||||
<label class="checkbox inline btn">
|
||||
<input type="checkbox" value="3"> Hide
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Tag Module -->
|
||||
<!-- Tag Module -->
|
||||
<div class="tab-pane fade" id="tag">
|
||||
|
||||
<!-- Tag -->
|
||||
@@ -116,83 +87,83 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Type Module -->
|
||||
<div class="tab-pane fade" id="type">
|
||||
<!-- Type Module -->
|
||||
<div class="tab-pane fade" id="type">
|
||||
|
||||
<!-- Type -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted">Type</label>
|
||||
<div class="controls">
|
||||
<%= f.select :link_open ,AdImage::LINK_OPEN_TYPES%>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Type -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t('ad_banner.type') %></label>
|
||||
<div class="controls">
|
||||
<%= f.select :link_open, AdImage::LINK_OPEN_TYPES.map{|a| [t("ad_banner.#{a}"), a]} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Frequency Module -->
|
||||
<div class="tab-pane fade" id="frequency">
|
||||
<!-- Frequency Module -->
|
||||
<div class="tab-pane fade" id="frequency">
|
||||
|
||||
<!-- Frequency -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted">Frequency</label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :weight ,:class=> 'span3',:placeholder=> t('ad.chinese_1') %>
|
||||
<span class="help-block">Please enter the number</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Frequency -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:frequency) %></label>
|
||||
<div class="controls">
|
||||
<%= f.number_field :weight, placeholder: t(:frequency), in: 1..99, maxlength: 2, onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" %>
|
||||
<span class="help-block"><%= t('ad_banner.enter_number') %></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Link Module -->
|
||||
<div class="tab-pane fade" id="link">
|
||||
<!-- Link Module -->
|
||||
<div class="tab-pane fade" id="link">
|
||||
|
||||
<!-- Link -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted">link</label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :out_link ,:class=> 'span3',:placeholder=> "URL" %>
|
||||
<span class="help-block">Please enter the URL</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Link -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:link) %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :out_link, placeholder: t(:url) %>
|
||||
<span class="help-block"><%= t('ad_banner.enter_url') %></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Images Module -->
|
||||
<div class="tab-pane fade" id="imageupload">
|
||||
<!-- Images Module -->
|
||||
<div class="tab-pane fade" id="imageupload">
|
||||
|
||||
<!-- Images Upload -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:image) %></label>
|
||||
<div class="controls">
|
||||
<!-- if this page editing please add class "fileupload-edit" -->
|
||||
<div class="fileupload fileupload-new clearfix fileupload-edit" data-provides="fileupload">
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<% if @ad_image.file %>
|
||||
<%= image_tag @ad_image.file %>
|
||||
<% else %>
|
||||
<%= image_tag "http://www.placehold.it/50x50/EFEFEF/AAAAAA" %>
|
||||
<%end%>
|
||||
</div>
|
||||
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||
<span class="btn btn-file">
|
||||
<span class="fileupload-new"><%= t(:select_image) %></span>
|
||||
<span class="fileupload-exists"><%= t(:change) %></span>
|
||||
<%= f.file_field :file %>
|
||||
</span>
|
||||
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<label class="checkbox inline btn btn-danger fileupload-remove">
|
||||
<%= f.check_box :remove_file %><%= t(:remove) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Images Upload -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:image) %></label>
|
||||
<div class="controls">
|
||||
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @ad_image.file.file %>" data-provides="fileupload">
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<% if @ad_image.file.file %>
|
||||
<%= image_tag @ad_image.file %>
|
||||
<% else %>
|
||||
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||
<span class="btn btn-file">
|
||||
<span class="fileupload-new"><%= t(:select_image) %></span>
|
||||
<span class="fileupload-exists"><%= t(:change) %></span>
|
||||
<%= f.file_field :file %>
|
||||
</span>
|
||||
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<label class="checkbox inline btn btn-danger fileupload-remove">
|
||||
<%= f.check_box :remove_file %><%= t(:remove) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Language Tabs -->
|
||||
</div>
|
||||
|
||||
<!-- Language Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
@@ -224,8 +195,8 @@
|
||||
<label class="control-label muted"><%= t(:content) %></label>
|
||||
<div class="controls">
|
||||
<div class="textarea">
|
||||
<%= f.fields_for :text_translations do |f| %>
|
||||
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@ad_image.text_translations[locale] rescue nil) %>
|
||||
<%= f.fields_for :context_translations do |f| %>
|
||||
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@ad_image.context_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -234,24 +205,13 @@
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Form Actions -->
|
||||
<%= f.hidden_field :id, :value => @ad_image.id %>
|
||||
<div class="form-actions">
|
||||
<%= f.submit t("submit"),:class=>"btn btn-primary" %>
|
||||
<%= f.submit t("cancel"),:class=>"btn ",:type => 'reset' %>
|
||||
<!-- <button type="submit" class="btn btn-primary">Save</button>
|
||||
<button type="button" class="btn">Preview</button>
|
||||
<button type="button" class="btn">Cancel</button> -->
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
<!-- Form Actions -->
|
||||
<div class="form-actions">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
@@ -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| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
@@ -1,48 +1,56 @@
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"><%= t('ad_image.image') %></th>
|
||||
<th class="span1"><%= t('ad_image.post_date') %></th>
|
||||
<th class="span1"><%= t('ad_image.unpost_date') %></th>
|
||||
<th class="span1"><%= t('ad_image.context') %></th>
|
||||
<th class="span1"><%= t('ad_image.out_link') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_locations" class="sort-holder">
|
||||
<% @ad_images.each do |ad_image| %>
|
||||
<tr class="with_action">
|
||||
<td><%= image_tag ad_image.file.thumb %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<% if is_admin?%>
|
||||
<li><%= link_to t(:edit), edit_admin_ad_image_path(ad_image)%></li>
|
||||
<li><%= link_to 'Destroy', admin_ad_image_path(ad_image), method: :delete , :confirm => t(:sure?) %></li>
|
||||
<% set_default_index do
|
||||
objects @ad_images
|
||||
quick_edit_link type: 'edit',
|
||||
link: 'edit_admin_ad_image_path'
|
||||
# quick_edit_link type: 'detail'
|
||||
quick_edit_link type: 'delete',
|
||||
link: 'admin_ad_image_path'
|
||||
# can have: title, warning, cancel and submit values
|
||||
field type: 'image',
|
||||
db_field: 'file',
|
||||
translation: 'preview',
|
||||
hide: 'phone'
|
||||
# field type: 'status',
|
||||
# db_field: @statuses,
|
||||
# translation: 'status',
|
||||
# hide: 'phone',
|
||||
# sort: 'status'
|
||||
field type: 'associated',
|
||||
db_field: 'ad_banner',
|
||||
model_field: 'title',
|
||||
translation: 'ad_banner.banner',
|
||||
hide: 'phone',
|
||||
sort: 'ad_banner'
|
||||
field db_field: 'title',
|
||||
translation: 'title',
|
||||
sort: 'title',
|
||||
quick_edit: true,
|
||||
header_class: 'span5',
|
||||
sort: 'title'
|
||||
field db_field: 'postdate',
|
||||
translation: 'start_date',
|
||||
hide: 'phone',
|
||||
sort: 'start_date'
|
||||
field db_field: 'deadline',
|
||||
translation: 'end_date',
|
||||
hide: 'phone',
|
||||
sort: 'end_date'
|
||||
field db_field: 'out_link',
|
||||
translation: 'link',
|
||||
sort: 'link',
|
||||
display_option: 'link_to value, value'
|
||||
# filter_field type: 'array',
|
||||
# values: @statuses,
|
||||
# translation: 'status'
|
||||
# filter_field type: 'objects',
|
||||
# values: @categories,
|
||||
# translation: 'category',
|
||||
# object_field: 'title'
|
||||
# filter_field type: 'objects',
|
||||
# values: @tags,
|
||||
# translation: 'tags',
|
||||
# object_field: 'name'
|
||||
footer link: 'new_admin_ad_image_path'
|
||||
end %>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= ad_image.post_date %></td>
|
||||
<td><%= ad_image.unpost_date %></td>
|
||||
<td><%= ad_image.context %></td>
|
||||
<td><%=link_to "#{ad_image.out_link}", ad_image.out_link %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%if is_manager? %>
|
||||
<!-- footer -->
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add_new), "#add-banner", :class => "btn btn-primary open-slide"%>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= paginate @ad_images unless @ad_images.blank? %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="add-banner" class="nano" style="display:none">
|
||||
<%= render 'new' %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<%= render 'admin/default_index/index' %>
|
||||
@@ -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| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
@@ -1,20 +1,9 @@
|
||||
<div style='position:relative'>
|
||||
<ul id='banner_nav' class='clear banner_nav-<%= @ad_banner.title.dehumanize %>'></ul>
|
||||
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class='slideshow'>
|
||||
<% (images = @ad_banner.ad_images).shuffle.each do |ad_image| %>
|
||||
<% if ad_image.display? %>
|
||||
<img src='<%= ad_image.file %>' alt='<%= 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 %>
|
||||
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class="cycle-slideshow" data-cycle-timeout="<%= @ad_banner.timeout_in_min %>" data-cycle-pager=".banner_nav_<%= @ad_banner.title.dehumanize %>" data-cycle-pager-template="<li><a href='#'></a></li>" data-cycle-pager-active-class="activeSlide" style="z-index: 0">
|
||||
<% @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 %>
|
||||
</div>
|
||||
<ul class='clear banner_nav banner_nav_<%= @ad_banner.title.dehumanize %>'></ul>
|
||||
</div>
|
||||
<script type='text/javascript'>
|
||||
var banner = {"banner_name":"#slideshow-<%= @ad_banner.title.dehumanize %>",
|
||||
"banner_fx":"<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>",
|
||||
"banner_pager":".banner_nav-<%= @ad_banner.title.dehumanize %>",
|
||||
"image_count":"<%= @ad_banner.ad_images.length %>",
|
||||
"image_loaded":0,
|
||||
"time_to_next":<%= @ad_banner.transition_msec %>,
|
||||
};
|
||||
banners.push(banner);
|
||||
</script>
|
||||
@@ -1,4 +1,4 @@
|
||||
<%if @ad_image && @ad_image.display? %>
|
||||
<% if @ad_image %>
|
||||
<h1 class="h1"><%= @ad_image.title %></h1>
|
||||
<div class="info">
|
||||
<div class="info1">
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<div class="slideshow">
|
||||
<% @ad_banner.ad_images.shuffle.each do |image| %>
|
||||
<% if image.display? %>
|
||||
<div class="slidebanner"><%= image_tag image.file.url, :class => 'slideImg' %></div>
|
||||
<% end %>
|
||||
<% @ad_banner.ad_images.can_display.shuffle.each do |image| %>
|
||||
<div class="slidebanner"><%= image_tag image.file.url, :class => 'slideImg' %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="newlist clear">
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
<iframe src=<%= @preview_obj.get_preview_link %> style="width:1024px;height:300px" >
|
||||
|
||||
</iframe>
|
||||
|
||||
<%# 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 -%>
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@@ -22,10 +18,7 @@
|
||||
<script type="text/javascript" src="/static/kernel.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
// $("#news_bulletin-<%#=news_bulletin.title.dehumanize%>").on("show", function () {
|
||||
// $("#news_bulletin-<%#=news_bulletin.title.dehumanize%>").find(".news_bulletin_slideshow").cycle({delay: -1000, fx: "<%#= news_bulletin.ad_fx.nil?? "fade": news_bulletin.ad_fx %>", timeoutFn: getTimeout });
|
||||
// });
|
||||
|
||||
$(".modal").on("hidden", function () {
|
||||
$("#show_preview").remove();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user