diff --git a/.gitignore b/.gitignore index 71494e30..b57fdb65 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,7 @@ uploads/**/* *.swp -public/javascripts -public/stylesheets +public/assets config/application.rb .rvmrc diff --git a/Gemfile b/Gemfile index a1ed5fb0..5c9b15e7 100644 --- a/Gemfile +++ b/Gemfile @@ -21,6 +21,9 @@ gem 'mysql2' gem 'nokogiri' gem 'radius' gem 'rake' +gem 'resque' # background jobs +gem 'resque-scheduler' # job scheduling +gem 'resque-restriction' gem 'ruby-debug19' gem 'rubyzip' gem 'therubyracer' diff --git a/Gemfile.lock b/Gemfile.lock index 5089191c..a12a663b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,7 +97,6 @@ GEM railties (~> 3.0) thor (~> 0.14) json (1.6.5) - libv8 (3.3.10.4) linecache19 (0.5.12) ruby_core_source (>= 0.1.4) mail (2.3.3) @@ -155,6 +154,20 @@ GEM rake (0.9.2.2) rdoc (3.12) json (~> 1.4) + redis (2.2.2) + redis-namespace (1.0.3) + redis (< 3.0.0) + resque (1.20.0) + multi_json (~> 1.0) + redis-namespace (~> 1.0.2) + sinatra (>= 0.9.2) + vegas (~> 0.1.2) + resque-restriction (0.3.0) + resque (>= 1.7.0) + resque-scheduler (1.9.9) + redis (>= 2.0.1) + resque (>= 1.8.0) + rufus-scheduler rspec (2.8.0) rspec-core (~> 2.8.0) rspec-expectations (~> 2.8.0) @@ -184,6 +197,8 @@ GEM ruby_parser (2.3.1) sexp_processor (~> 3.0) rubyzip (0.9.6.1) + rufus-scheduler (2.0.16) + tzinfo (>= 0.3.23) ruport (1.6.3) fastercsv pdf-writer (= 1.1.8) @@ -211,8 +226,6 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.1) - therubyracer (0.9.10) - libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) tinymce-rails (3.4.8) @@ -226,6 +239,8 @@ GEM uglifier (1.2.3) execjs (>= 0.3.0) multi_json (>= 1.0.2) + vegas (0.1.11) + rack (>= 1.0.0) warden (1.1.1) rack (>= 1.0) watchr (0.7) @@ -265,6 +280,9 @@ DEPENDENCIES radius rails (>= 3.1.0, < 3.2.0) rake + resque + resque-restriction + resque-scheduler rspec (~> 2.0) rspec-rails (~> 2.0) ruby-debug19 @@ -275,7 +293,6 @@ DEPENDENCIES sinatra spork sprockets - therubyracer tinymce-rails uglifier watchr diff --git a/Rakefile b/Rakefile index 9a495de7..e0dc9c5b 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,9 @@ +# /usr/bin/ruby -Ku # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) +require 'resque/tasks' require 'rake/dsl_definition' require 'rake' diff --git a/app/assets/fonts/widget.css b/app/assets/fonts/widget.css deleted file mode 100644 index fe83b22d..00000000 --- a/app/assets/fonts/widget.css +++ /dev/null @@ -1,79 +0,0 @@ -.widget-size-300 { - width:298px; -} -.widget-box { - background-color: #FFF; - overflow: hidden; - min-width: 300px; - border: 1px solid #DDD; - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - margin: 0 0 5px 5px; - position:relative; -} -.widget-box .widget-title { - background: #999; - color: #FFF; - padding-left: 5px; - border-radius: 5px 5px 0 0; - -moz-border-radius: 5px 5px 0 0; - -webkit-border-radius: 5px 5px 0 0; -} -.widget-box .widget-content { - padding: 10px; -} -.widget-box .form-horizontal .control-group > label { - width: 50px; -} -.widget-box .form-horizontal .controls { - margin-left: 60px; -} -.widget-action { - position:absolute; - right:1px; - top:6px; -} -.action { - float: left; - display:inline-block; - margin-right: 5px; - opacity: 0.8; - filter: alpha(opacity=80); -} -.action:hover { - opacity: 1; - filter: alpha(opacity=100); - cursor: pointer; -} -.select-role { - display:none; - padding: 10px 0 0; -} -.file-upload { - position:relative; -} -.file-upload .file-name { - display: inline-block; - margin: 0 0 5px 5px; - white-space: nowrap; - width: 140px; -} -.file-upload .upload { - margin:0; - padding:0; - position:absolute; - top:0; - left:0; - opacity:.0; - filter: alpha(opacity=100); -} -.file-upload .upload:focus { - position:absolute; -} -.upload-picture { - margin-right: 5px; -} -#widget-link table { - margin-bottom:0 -} \ No newline at end of file diff --git a/public/assets/sign-in-logo-96872662bbb7d39f593224ee38f4cd9b.png b/app/assets/images/-sign-in-logo.png similarity index 100% rename from public/assets/sign-in-logo-96872662bbb7d39f593224ee38f4cd9b.png rename to app/assets/images/-sign-in-logo.png diff --git a/app/assets/images/check.png b/app/assets/images/check.png index e415c89b..0972e33a 100644 Binary files a/app/assets/images/check.png and b/app/assets/images/check.png differ diff --git a/app/assets/images/orbit-bar.png b/app/assets/images/orbit-bar.png index 160b9d78..4b2a5585 100644 Binary files a/app/assets/images/orbit-bar.png and b/app/assets/images/orbit-bar.png differ diff --git a/app/assets/images/sign-in-logo.png b/app/assets/images/sign-in-logo.png index 53756c7c..a3148bab 100644 Binary files a/app/assets/images/sign-in-logo.png and b/app/assets/images/sign-in-logo.png differ diff --git a/app/assets/javascripts/ajax_form.js b/app/assets/javascripts/ajax_form.js index c026e518..d9b5abfe 100644 --- a/app/assets/javascripts/ajax_form.js +++ b/app/assets/javascripts/ajax_form.js @@ -1,4 +1,4 @@ -$('#submit_button').live('click', function(){ +$(document).on('click', '#ajax_form_submit', function(){ $('#ajaxForm').ajaxSubmit({ beforeSubmit: function(a,f,o) { o.dataType = 'script'; diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index abb908b4..cf2dfd69 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -6,23 +6,14 @@ $('.bulletin_files_block a.delete').live('click', function(){ $(this).parents('.list_item').remove(); }); -$('.action a.remove_existing_record').live('click', function(){ +$(document).on('click', '.action a.remove_existing_record', function(){ $(this).next('.should_destroy').attr('value', 1); - //$("#bulletin_" + $(this).prev().attr('value')).hide(); - $("tr#bulletin_" + $(this).prev().attr('value')).hide(); + $("tr #" + $(this).prev().attr('value')).hide(); }); -$('.quick_edit_cancel').live('click', function(){ +$(document).on('click', '.quick_edit_cancel', function(){ tr = $(this).attr('rel'); $('#' + tr).hide(); $("tr#bulletin_file_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_link_" + $(this).prev().attr('value')).hide(); -}); - -$(document).on('click', '.list-remove', function(){ - $('#delete_bulletins').submit(); -}); - -$(document).on('click', '#check_all_bulletins', function(){ - $('.checkbox_in_list').attr("checked", this.checked); }); \ No newline at end of file diff --git a/app/assets/javascripts/inc/jquery.imagesloaded.js b/app/assets/javascripts/inc/jquery.imagesloaded.js new file mode 100644 index 00000000..5b35bb9c --- /dev/null +++ b/app/assets/javascripts/inc/jquery.imagesloaded.js @@ -0,0 +1,137 @@ +/*! + * jQuery imagesLoaded plugin v2.0.1 + * http://github.com/desandro/imagesloaded + * + * MIT License. by Paul Irish et al. + */ + +/*jshint curly: true, eqeqeq: true, noempty: true, strict: true, undef: true, browser: true */ +/*global jQuery: false */ + +;(function($, undefined) { +'use strict'; + +// blank image data-uri bypasses webkit log warning (thx doug jones) +var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='; + +$.fn.imagesLoaded = function( callback ) { + var $this = this, + deferred = $.isFunction($.Deferred) ? $.Deferred() : 0, + hasNotify = $.isFunction(deferred.notify), + $images = $this.find('img').add( $this.filter('img') ), + loaded = [], + proper = [], + broken = []; + + function doneLoading() { + var $proper = $(proper), + $broken = $(broken); + + if ( deferred ) { + if ( broken.length ) { + deferred.reject( $images, $proper, $broken ); + } else { + deferred.resolve( $images ); + } + } + + if ( $.isFunction( callback ) ) { + callback.call( $this, $images, $proper, $broken ); + } + } + + function imgLoaded( img, isBroken ) { + // don't proceed if BLANK image, or image is already loaded + if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) { + return; + } + + // store element in loaded images array + loaded.push( img ); + + // keep track of broken and properly loaded images + if ( isBroken ) { + broken.push( img ); + } else { + proper.push( img ); + } + + // cache image and its state for future calls + $.data( img, 'imagesLoaded', { isBroken: isBroken, src: img.src } ); + + // trigger deferred progress method if present + if ( hasNotify ) { + deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] ); + } + + // call doneLoading and clean listeners if all images are loaded + if ( $images.length === loaded.length ){ + setTimeout( doneLoading ); + $images.unbind( '.imagesLoaded' ); + } + } + + // if no images, trigger immediately + if ( !$images.length ) { + doneLoading(); + } else { + $images.bind( 'load.imagesLoaded error.imagesLoaded', function( event ){ + // trigger imgLoaded + imgLoaded( event.target, event.type === 'error' ); + }).each( function( i, el ) { + var src = el.src; + + // find out if this image has been already checked for status + // if it was, and src has not changed, call imgLoaded on it + var cached = $.data( el, 'imagesLoaded' ); + if ( cached && cached.src === src ) { + imgLoaded( el, cached.isBroken ); + return; + } + + // if complete is true and browser supports natural sizes, try + // to check for image status manually + if ( el.complete && el.naturalWidth !== undefined ) { + imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 ); + return; + } + + // cached images don't fire load sometimes, so we reset src, but only when + // dealing with IE, or image is complete (loaded) and failed manual check + // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f + if ( el.readyState || el.complete ) { + el.src = BLANK; + el.src = src; + } + }); + } + + return deferred ? deferred.promise( $this ) : $this; +}; + +})(jQuery); + +$(document).ready(function() { + $('.upload-picture').find('img').imagesLoaded(function(){ + var picH = $('.upload-picture').width()/$('.upload-picture').find('img').width()*$('.upload-picture').find('img').height(); + var imgMarginTop = ($('.upload-picture').height()-picH)/2; + var d = $('.upload-picture').height(); + if(imgMarginTop>0){ + imgMarginTop = 0; + d = picH; + $('.upload-picture').css({height:d}) + } + $('.upload-picture').find('img').css({marginTop:imgMarginTop}) + $('.upload-picture').each(function (i){ + $(this).mouseenter(function(){ + var h= picH; + $(this).stop().animate({height:h}, 500); + $(this).find('img').stop().animate({marginTop:0}, 500); + }); + $(this).mouseleave(function(){ + $(this).stop().animate({height:d}, 500); + $(this).find('img').stop().animate({marginTop:imgMarginTop}, 500); + }); + }); + }); +}); \ No newline at end of file diff --git a/app/assets/javascripts/inc/modal-preview.js b/app/assets/javascripts/inc/modal-preview.js new file mode 100644 index 00000000..959f04b2 --- /dev/null +++ b/app/assets/javascripts/inc/modal-preview.js @@ -0,0 +1,20 @@ +//Preview need a link in form as Ex and a corresponding PUT action in controller +//Ex preview trigger: +// <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%> + +$(document).ready(function() { + $("a.preview_trigger").click(function(){ + $("#main-wrap").after(""); + $.ajax({ + type: 'PUT', + url:$(this).attr("href"), + data:$(this).parents("form").serialize(), + success: function (msg) { + $("#"+start_modal_with_id).modal('show'); }, + error: function(){ + alert("ERROR"); + } + }); + return false; + }); +}); \ No newline at end of file diff --git a/app/assets/javascripts/inc/permission-checkbox.js b/app/assets/javascripts/inc/permission-checkbox.js index fc91b857..23716f68 100644 --- a/app/assets/javascripts/inc/permission-checkbox.js +++ b/app/assets/javascripts/inc/permission-checkbox.js @@ -1,4 +1,7 @@ $(document).ready(function() { + permissionCheckbox(); +}); +function permissionCheckbox(){ $('.check[checked="checked"]').parents(".checkbox").addClass("checked") $(".checkbox").click(function(){ if($(this).children(".check").attr("checked")){ @@ -16,4 +19,4 @@ $(document).ready(function() { placement: 'bottom', delay: { show: 100, hide: 300 }, }); -}); \ No newline at end of file +}; \ No newline at end of file diff --git a/app/assets/javascripts/jquery.tinyscrollbar.min.js b/app/assets/javascripts/jquery.tinyscrollbar.min.js index 98786a77..e385ff8e 100644 --- a/app/assets/javascripts/jquery.tinyscrollbar.min.js +++ b/app/assets/javascripts/jquery.tinyscrollbar.min.js @@ -1 +1,118 @@ -(function(a){function b(b,c){function w(a){if(!(g.ratio>=1)){o.now=Math.min(i[c.axis]-j[c.axis],Math.max(0,o.start+((k?a.pageX:a.pageY)-p.start)));n=o.now*h.ratio;g.obj.css(l,-n);j.obj.css(l,o.now)}return false}function v(b){a(document).unbind("mousemove",w);a(document).unbind("mouseup",v);j.obj.unbind("mouseup",v);document.ontouchmove=j.obj[0].ontouchend=document.ontouchend=null;return false}function u(b){if(!(g.ratio>=1)){var b=b||window.event;var d=b.wheelDelta?b.wheelDelta/120:-b.detail/3;n-=d*c.wheel;n=Math.min(g[c.axis]-f[c.axis],Math.max(0,n));j.obj.css(l,n/h.ratio);g.obj.css(l,-n);b=a.event.fix(b);b.preventDefault()}}function t(b){p.start=k?b.pageX:b.pageY;var c=parseInt(j.obj.css(l));o.start=c=="auto"?0:c;a(document).bind("mousemove",w);document.ontouchmove=function(b){a(document).unbind("mousemove");w(b.touches[0])};a(document).bind("mouseup",v);j.obj.bind("mouseup",v);j.obj[0].ontouchend=document.ontouchend=function(b){a(document).unbind("mouseup");j.obj.unbind("mouseup");v(b.touches[0])};return false}function s(){j.obj.bind("mousedown",t);j.obj[0].ontouchstart=function(a){a.preventDefault();j.obj.unbind("mousedown");t(a.touches[0]);return false};i.obj.bind("mouseup",w);if(c.scroll&&this.addEventListener){e[0].addEventListener("DOMMouseScroll",u,false);e[0].addEventListener("mousewheel",u,false)}else if(c.scroll){e[0].onmousewheel=u}}function r(){j.obj.css(l,n/h.ratio);g.obj.css(l,-n);p["start"]=j.obj.offset()[l];var a=m.toLowerCase();h.obj.css(a,i[c.axis]);i.obj.css(a,i[c.axis]);j.obj.css(a,j[c.axis])}function q(){d.update();s();return d}var d=this;var e=b;var f={obj:a(".viewport",b)};var g={obj:a(".overview",b)};var h={obj:a(".scrollbar",b)};var i={obj:a(".track",h.obj)};var j={obj:a(".thumb",h.obj)};var k=c.axis=="x",l=k?"left":"top",m=k?"Width":"Height";var n,o={start:0,now:0},p={};this.update=function(a){f[c.axis]=f.obj[0]["offset"+m];g[c.axis]=g.obj[0]["scroll"+m];g.ratio=f[c.axis]/g[c.axis];h.obj.toggleClass("disable",g.ratio>=1);i[c.axis]=c.size=="auto"?f[c.axis]:c.size;j[c.axis]=Math.min(i[c.axis],Math.max(0,c.sizethumb=="auto"?i[c.axis]*g.ratio:c.sizethumb));h.ratio=c.sizethumb=="auto"?g[c.axis]/i[c.axis]:(g[c.axis]-f[c.axis])/(i[c.axis]-j[c.axis]);n=a=="relative"&&g.ratio<=1?Math.min(g[c.axis]-f[c.axis],Math.max(0,n)):0;n=a=="bottom"&&g.ratio<=1?g[c.axis]-f[c.axis]:isNaN(parseInt(a))?n:parseInt(a);r()};return q()}a.tiny=a.tiny||{};a.tiny.scrollbar={options:{axis:"y",wheel:40,scroll:true,size:"auto",sizethumb:"auto"}};a.fn.tinyscrollbar=function(c){var c=a.extend({},a.tiny.scrollbar.options,c);this.each(function(){a(this).data("tsb",new b(a(this),c))});return this};a.fn.tinyscrollbar_update=function(b){return a(this).data("tsb").update(b)};})(jQuery) \ No newline at end of file +(function(a){ + function b(b,c){ + function w(a){ + if(!(g.ratio>=1)){ + o.now=Math.min(i[c.axis]-j[c.axis],Math.max(0,o.start+((k?a.pageX:a.pageY)-p.start))); + n=o.now*h.ratio;g.obj.css(l,-n); + j.obj.css(l,o.now) + } + return false + } + function v(b){ + a(document).unbind("mousemove",w); + a(document).unbind("mouseup",v); + j.obj.unbind("mouseup",v); + document.ontouchmove=j.obj[0].ontouchend=document.ontouchend=null; + return false + } + function u(b){ + if(!(g.ratio>=1)){ + var b=b||window.event; + var d=b.wheelDelta?b.wheelDelta/120:-b.detail/3; + n-=d*c.wheel; + n=Math.min(g[c.axis]-f[c.axis],Math.max(0,n)); + j.obj.css(l,n/h.ratio); + g.obj.css(l,-n); + b=a.event.fix(b); + b.preventDefault() + } + } + function t(b){ + p.start=k?b.pageX:b.pageY; + var c=parseInt(j.obj.css(l)); + o.start=c=="auto"?0:c; + a(document).bind("mousemove",w); + document.ontouchmove=function(b){ + a(document).unbind("mousemove"); + w(b.touches[0]) + }; + a(document).bind("mouseup",v); + j.obj.bind("mouseup",v); + j.obj[0].ontouchend=document.ontouchend=function(b){ + a(document).unbind("mouseup"); + j.obj.unbind("mouseup"); + v(b.touches[0]) + }; + return false + } + function s(){ + j.obj.bind("mousedown",t); + j.obj[0].ontouchstart=function(a){ + a.preventDefault(); + j.obj.unbind("mousedown"); + t(a.touches[0]); + return false + }; + i.obj.bind("mouseup",w); + if(c.scroll&&this.addEventListener){ + e[0].addEventListener("DOMMouseScroll",u,false); + e[0].addEventListener("mousewheel",u,false) + }else if(c.scroll){ + e[0].onmousewheel=u + } + } + function r(){ + j.obj.css(l,n/h.ratio); + g.obj.css(l,-n); + p["start"]=j.obj.offset()[l]; + var a=m.toLowerCase(); + h.obj.css(a,i[c.axis]); + i.obj.css(a,i[c.axis]); + j.obj.css(a,j[c.axis]) + } + function q(){ + d.update(); + s(); + return d + } + var d=this; + var e=b; + var f={obj:a(".viewport",b)}; + var g={obj:a(".overview",b)}; + var h={obj:a(".scrollbar",b)}; + var i={obj:a(".track",h.obj)}; + var j={obj:a(".thumb",h.obj)}; + var k=c.axis=="x", + l=k?"left":"top", + m=k?"Width":"Height"; + var n, + o={start:0,now:0}, + p={}; + this.update=function(a){ + f[c.axis]=f.obj[0]["offset"+m]; + g[c.axis]=g.obj[0]["scroll"+m]; + g.ratio=f[c.axis]/g[c.axis]; + h.obj.toggleClass("disable",g.ratio>=1); + i[c.axis]=c.size=="auto"?f[c.axis]:c.size; + j[c.axis]=Math.min(i[c.axis],Math.max(0,c.sizethumb=="auto"?i[c.axis]*g.ratio:c.sizethumb)); + h.ratio=c.sizethumb=="auto"?g[c.axis]/i[c.axis]:(g[c.axis]-f[c.axis])/(i[c.axis]-j[c.axis]); + n=a=="relative"&&g.ratio<=1?Math.min(g[c.axis]-f[c.axis],Math.max(0,n)):0; + n=a=="bottom"&&g.ratio<=1?g[c.axis]-f[c.axis]:isNaN(parseInt(a))?n:parseInt(a); + r() + }; + return q() + } + a.tiny=a.tiny||{}; + a.tiny.scrollbar={options:{axis:"y",wheel:40,scroll:true,size:"auto",sizethumb:"auto"}}; + a.fn.tinyscrollbar=function(c){ + var c=a.extend({},a.tiny.scrollbar.options,c); + this.each(function(){ + a(this).data("tsb",new b(a(this),c)) + }); + return this + }; + a.fn.tinyscrollbar_update=function(b){ + return a(this).data("tsb").update(b) + }; +}) +(jQuery) \ No newline at end of file diff --git a/app/assets/javascripts/new_admin.js b/app/assets/javascripts/new_admin.js index 45bfcbbc..f20267cd 100644 --- a/app/assets/javascripts/new_admin.js +++ b/app/assets/javascripts/new_admin.js @@ -6,6 +6,7 @@ // //= require jquery //= require jquery_ujs +//= require jquery.form //= require bootstrap //= require jquery.isotope.min //= require jquery.tinyscrollbar.min @@ -13,4 +14,5 @@ //= require tinymce-jquery //= require tinymce_orbit //= require orbit-bar-search -//= require side_bar_history \ No newline at end of file +//= require side_bar_history +//= require ajax_form \ No newline at end of file diff --git a/app/assets/javascripts/news_bulletin_form.js b/app/assets/javascripts/news_bulletin_form.js new file mode 100644 index 00000000..6f0f9ac5 --- /dev/null +++ b/app/assets/javascripts/news_bulletin_form.js @@ -0,0 +1,19 @@ +$('.news_bulletin_links_block a.delete').live('click', function(){ + $(this).parents('.list_item').remove(); +}); + +$('.news_bulletin_files_block a.delete').live('click', function(){ + $(this).parents('.list_item').remove(); +}); + +$(document).on('click', '.action a.remove_existing_record', function(){ + $(this).next('.should_destroy').attr('value', 1); + $("tr #" + $(this).prev().attr('value')).hide(); +}); + +$(document).on('click', '.quick_edit_cancel', function(){ + tr = $(this).attr('rel'); + $('#' + tr).hide(); + $("tr#news_bulletin_file_" + $(this).prev().attr('value')).hide(); + $("tr#news_bulletin_link_" + $(this).prev().attr('value')).hide(); +}); \ No newline at end of file diff --git a/app/assets/javascripts/orbit-1.0.js b/app/assets/javascripts/orbit-1.0.js index 5f69b297..b1ac9993 100644 --- a/app/assets/javascripts/orbit-1.0.js +++ b/app/assets/javascripts/orbit-1.0.js @@ -14,9 +14,9 @@ $(document).ready(function(){ placement: "left" }); + $(document).on('click', '.privacy', function() { - console.log($(this).val()); switch ($(this).val()) { case 'true': $(this).parents('.controls').children('.select-role').slideUp(300); @@ -47,14 +47,19 @@ $(document).ready(function(){ /*tinyscrollbar&windows-Size*/ resize(); - var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2; - $('#main-sidebar').css("height", viewportheight-30); - $('#main-sidebar .viewport').css("height", viewportheight-30); - $('.post-title').css("width", viewportwidth-495); + var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2, + $subWiget = $('#sub-wiget').width()+18; + $orbitBar = $('#orbit-bar').height(), + $mainSidebar = $('#main-sidebar').width()+5, + $formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right")); + $('#main-sidebar').css("height", viewportheight-$orbitBar); + $('#main-sidebar .viewport').css("height", viewportheight-$orbitBar); + $('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget); + $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16); $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft); - $('#main-sidebar').tinyscrollbar(); + $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding); + $('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)}); $('.detal-list').tinyscrollbar(); - $('#main-sidebar').tinyscrollbar({size:(viewportheight-34)}); mainTablePosition(); /*isotope*/ @@ -68,12 +73,18 @@ $(document).ready(function(){ }); $(window).resize(function(){ resize(); - var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2; - $('#main-sidebar').css("height", viewportheight-30); - $('#main-sidebar .viewport').css("height", viewportheight-30); - $('.post-title').css("width", viewportwidth-495); - $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft) - $('#main-sidebar').tinyscrollbar({size:(viewportheight-34)}); + var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2, + $subWiget = $('#sub-wiget').width()+18; + $orbitBar = $('#orbit-bar').height(), + $mainSidebar = $('#main-sidebar').width()+5, + $formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right")); + $('#main-sidebar').css("height", viewportheight-$orbitBar); + $('#main-sidebar .viewport').css("height", viewportheight-$orbitBar); + $('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget); + $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16); + $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft); + $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding); + $('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)}); mainTablePosition(); }); /*main-table position*/ @@ -101,5 +112,4 @@ $(window).scroll(function () { $(".table-label").css({left:$winLeft*-1} ); //$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} ); //$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} ); - //console.log($mainWrapMarginLeft+($winLeft*-1)+5); }); diff --git a/app/assets/javascripts/orbit-bar-search.js b/app/assets/javascripts/orbit-bar-search.js index 26f44d84..7ef1dd05 100644 --- a/app/assets/javascripts/orbit-bar-search.js +++ b/app/assets/javascripts/orbit-bar-search.js @@ -1,3 +1,9 @@ + +$(document).ready(function(){ + $('.search').tooltip({ + placement: "bottom" + }); +}); $(document).on('click', '.orbit-bar-search', function (){ if ($(this).parents('.search').hasClass('visible')){ $(this).parents('.search').stop().animate({ diff --git a/app/assets/javascripts/orbit_bar.js b/app/assets/javascripts/orbit_bar.js index 06c3113d..e9b1b4ea 100644 --- a/app/assets/javascripts/orbit_bar.js +++ b/app/assets/javascripts/orbit_bar.js @@ -4,4 +4,4 @@ $(document).ready(function() { $('body').prepend($(this).html()); $(this).remove(); }); -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/page_edit.js b/app/assets/javascripts/page_edit.js index 31a7d600..a889f5b2 100644 --- a/app/assets/javascripts/page_edit.js +++ b/app/assets/javascripts/page_edit.js @@ -24,6 +24,10 @@ $("#module_app_list select").live('change', function() { $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets'); }); +$("#tag_list select").live('change', function() { + $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_r_tag_options'); +}); + $('.part_kind').live('click', function() { $('.part_kind_partial').hide(); $('#part_' + $(this).attr('value')).show(); diff --git a/app/assets/javascripts/side_bar_history.js b/app/assets/javascripts/side_bar_history.js index 4b5da1d4..ad29b497 100644 --- a/app/assets/javascripts/side_bar_history.js +++ b/app/assets/javascripts/side_bar_history.js @@ -1,28 +1,28 @@ var history_edited = false; -// $('#back_sidebar a, #back_main a.nav').live('click', -// function () { -// $.getScript(this.href); -// history.pushState(null, document.title, this.href); -// history_edited = true; -// return false; -// } -// ); +$('#back_sidebar a, #back_main a.nav').live('click', + function () { + $.getScript(this.href); + history.pushState(null, document.title, this.href); + history_edited = true; + return false; + } +); -// $('#back_main a.reload').live('click', -// function () { -// $.getScript(this.href); -// history.replaceState(null, document.title, this.href); -// history_edited = true; -// return false; -// } -// ); +$('#back_main a.reload').live('click', + function () { + $.getScript(this.href); + history.replaceState(null, document.title, this.href); + history_edited = true; + return false; + } +); -// $('.form').live('submit', function () { -// $.post(this.action, $(this).serialize(), null, 'script'); -// history_edited = true; -// return false; -// }); +$('#back_main .form').live('submit', function () { + $.post(this.action, $(this).serialize(), null, 'script'); + history_edited = true; + return false; +}); $(document).on('click', '.js_history', function () { diff --git a/app/assets/javascripts/site_editor.js b/app/assets/javascripts/site_editor.js index 1eb5e3f1..4451accb 100644 --- a/app/assets/javascripts/site_editor.js +++ b/app/assets/javascripts/site_editor.js @@ -6,6 +6,10 @@ // //= require jquery //= require jquery_ujs -//= require page_edit +//= require bootstrap +//= require jquery.isotope.min +//= require jquery.tinyscrollbar.min +//= require orbit-1.0 +//= require orbit-bar-search //= require side_bar_history -//= require new_admin \ No newline at end of file +//= require page_edit \ No newline at end of file diff --git a/app/assets/javascripts/sort_header.js b/app/assets/javascripts/sort_header.js new file mode 100644 index 00000000..25a16344 --- /dev/null +++ b/app/assets/javascripts/sort_header.js @@ -0,0 +1,7 @@ +$(document).on('click', '.list-remove', function(){ + $('#delete_all').submit(); +}); + +$(document).on('click', '#check_all', function(){ + $('.checkbox_in_list').attr("checked", this.checked); +}); \ No newline at end of file diff --git a/app/assets/stylesheets/bootstrap-orbit.css b/app/assets/stylesheets/bootstrap-orbit.css index 34425d50..2ce9bc9c 100644 --- a/app/assets/stylesheets/bootstrap-orbit.css +++ b/app/assets/stylesheets/bootstrap-orbit.css @@ -1,3 +1,5 @@ +/*bootstrap-orbit*/ + h1, h2, h3, h4, h5, h6 { font-weight:normal ; } @@ -110,6 +112,18 @@ table .span1-3 { .qe-block .form-horizontal .form-actions { text-align:right; } +.form-actions form { + margin-bottom: 0; +} +.form-actions form input { + margin-bottom: 0; +} .modal.fade { top: -50%; +} +.form-search button { + margin-bottom: 0; +} +.modal form { + margin-bottom: 0; } \ No newline at end of file diff --git a/app/assets/stylesheets/bootstrap.css.erb b/app/assets/stylesheets/bootstrap.css.erb index ee2ae5a4..62a0afe8 100644 --- a/app/assets/stylesheets/bootstrap.css.erb +++ b/app/assets/stylesheets/bootstrap.css.erb @@ -1,3 +1,4 @@ +/*bootstrap*/ /*! * Bootstrap v2.0.0 * @@ -65,6 +66,7 @@ textarea { margin: 0; font-size: 100%; vertical-align: middle; + margin-bottom: 10px; } button, input { *overflow: visible; @@ -538,7 +540,7 @@ select, width: 210px; height: 18px; padding: 4px; - margin-bottom: 9px; + /*margin-bottom: 9px;*/ font-size: 13px; line-height: 18px; color: #555555; @@ -2664,18 +2666,23 @@ button.btn.small, input[type="submit"].btn.small { display: inline; } -.pagination .page{ +/*.pagination .page{ float: left; padding: 0 14px; line-height: 34px; text-decoration: none; border: 1px solid #ddd; border-left-width: 0; -} +}*/ .pagination a { float: left; + padding: 0 14px; + line-height: 34px; + text-decoration: none; + border: 1px solid #DDD; + border-left-width: 0; } -.pagination .next{ +/*.pagination .next{ float: left; padding: 0 14px; line-height: 34px; @@ -2690,12 +2697,15 @@ button.btn.small, input[type="submit"].btn.small { text-decoration: none; border: 1px solid #ddd; border-left-width: 0; -} +}*/ .pagination .current{ border-left-width: 1px; } +.pagination a { + background-color: #FFFFFF; +} .pagination a:hover, .pagination .active a { - background-color: #f5f5f5; + background-color: #e8e8e8; } .pagination .active a { color: #999999; diff --git a/app/assets/stylesheets/inc/permission-checkbox.css b/app/assets/stylesheets/inc/permission-checkbox.css.erb similarity index 79% rename from app/assets/stylesheets/inc/permission-checkbox.css rename to app/assets/stylesheets/inc/permission-checkbox.css.erb index 0adf7225..7e3f5bff 100644 --- a/app/assets/stylesheets/inc/permission-checkbox.css +++ b/app/assets/stylesheets/inc/permission-checkbox.css.erb @@ -1,3 +1,5 @@ +/*permission-checkbox*/ + .checkblock { display: inline-block; float: left; @@ -8,37 +10,40 @@ } .checkbox{ padding: 5px; - margin: 5px 5px 10px; + margin: 0; display: inline-block; color:#777777; text-shadow: 0 1px 0px rgba(255,255,255,.4); - border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; height: 30px; position: relative; cursor: pointer; - background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); + border-style: solid; + border-width: 0px 1px 1px 0; + border-color: #dfdfdf; + /*background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px;*/ } .checkbox .check-icon { display: none; position: absolute; - width: 26px; - height: 26px; - background: url('img/check.png') no-repeat left top; + width: 32px; + height: 32px; + background: url(<%= asset_path 'check.png' %>) no-repeat left top; right: -10px; - top: -5px; + top: 15px; } .checkbox .member-name { cursor: pointer; font-family: helvetica; font-size: 12px; - line-height: 30px; + line-height: 15px; padding: 0 10px 0 40px; color: #333333; display: inline-block; diff --git a/app/assets/stylesheets/isotope.css b/app/assets/stylesheets/isotope.css index 1d659c5e..3e7bf739 100644 --- a/app/assets/stylesheets/isotope.css +++ b/app/assets/stylesheets/isotope.css @@ -1,16 +1,11 @@ +/*isotope*/ + #isotope { margin-top: 2px; - background-color:#f4f4f4; } .isotope-item { z-index: 2; } - -.isotope-hidden.isotope-item { - pointer-events: none; - z-index: 1; -} - /**** Isotope CSS3 transitions ****/ .isotope, @@ -46,28 +41,27 @@ transition-duration: 0s; } .w-a { - width: 388px; + width: 398px; } .w-b { - width: 802px; + width: 812px; } .h-a { height: 315px; } .h-b { - height: 699px; + height: 703px; } .item { margin: 5px 0 15px 15px; } .item h3 { - margin: 5px 0; + margin: 20px 0 5px; } .item h3 [class^="icons-"] { - margin: 3px 5px 0 3px; + margin: 1px 5px 0 3px; } .item .detail { - padding: 5px; border: 1px solid rgba(0, 0, 0, 0.1); background-color: #FFFFFF; border-radius: 5px; @@ -75,12 +69,11 @@ -moz-border-radius: 5px; box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1); - -moz-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1); } .item .detail .totle { font-size: 50px; - padding:10px 5px 20px 0; - margin: 0px; + padding:10px 5px 30px 0; + margin: 0; text-align: right; border-bottom:1px solid #d9d9d9; } @@ -90,20 +83,60 @@ color: #333; padding-left: 5px; text-align:left; + margin-bottom: -7px; +} +.item .detail .table { + margin-bottom: 0; } .item .detail .table th, .item .detail .table td { border-top: none; border-bottom: 1px solid #DDDDDD; } +.item .detail .table tr th { + background-color: #F2F2F2; + border-bottom: 1px solid #AAAAAA; +} .item .detail .table tr td:first-child { color: #666;; } -.item .detail .table tr td:last-child { +.item .detail .table tr td:last-child, .item .detail .table tr th:last-child { text-align:right; + padding-right: 15px; } .item .h-a .my_scroll .viewport { - height: 248px; + height: 210px; } .item .h-b .my_scroll .viewport { - height: 632px; + height: 594px; +} +.item .isotope-hidden.isotope-item { + pointer-events: none; + z-index: 1; +} +.item .my_scroll { + position: relative; +} +.item .my_scroll .scrollbar { + right: 3px; + top: 0; + position: absolute; + z-index: 10; +} +.item .my_scroll .track { + background-color: transparent; +} +.detail.noStatistics { + overflow: hidden; +} +.detail.noStatistics.h-a { + height: 315px; +} +.detail.noStatistics.h-a .my_scroll .viewport { + height: 280px; +} +.detail.noStatistics.h-b { + height: 704px; +} +.detail.noStatistics.h-b .my_scroll .viewport { + height: 670px; } \ No newline at end of file diff --git a/app/assets/stylesheets/list.css b/app/assets/stylesheets/list.css index c7785778..4d7c11b1 100644 --- a/app/assets/stylesheets/list.css +++ b/app/assets/stylesheets/list.css @@ -1,8 +1,5 @@ -.list-remove { - position: relative; - top: 2px; - left: 2px; -} +/*list*/ + .table th.select { border-bottom:2px solid #0088CC; } @@ -25,7 +22,7 @@ .main-list .nav-pills > li > a { border-radius: 5px 5px 5px 5px; margin: 2px; - padding:5px + padding:5px; } .main-list tbody .quick-edit { position:relative; @@ -38,6 +35,9 @@ width: 350px; left: -8px; } +.main-list tr:first-child td { + border-top: 1px solid #DDDDDD; +} .main-list td { background-color: #FFFFFF; border-bottom: 1px solid #DDDDDD; @@ -54,6 +54,11 @@ position: relative; height: 40px; } +.main-list .label-group .label { + margin-bottom: 1px; + display: inline-block; + padding: 0 3px; +} .main-list .label-td { background-color: rgba(255, 255, 255, 1); height: 40px; @@ -65,9 +70,8 @@ } .main-list .label-td:hover { height: auto; - text-align: center; padding: 5px 5px 8px; - left: -6px; + left: -40px; top: -6px; border: 1px solid rgba(0, 0, 0, 0.2); box-shadow: 0px 5px 10px rgba(0,0,0,0.2); @@ -77,6 +81,10 @@ -webkit-border-radius: 3px; -moz-border-radius: 3px; z-index: 5; + width: 200px; +} +.qe-edit-div .table-condensed { + background-color: #F2F2F2; } .table-label { background-color: #F2F2F2; @@ -96,6 +104,19 @@ .qe-block td { height:auto; padding: 0; + /*background-color: #dedede;*/ +} +.qe-block legend { + padding-left: 8px; + margin-bottom: 0; + padding-bottom: 0; +} +.qe-block .control-group { + margin-bottom: 0; +} +.qe-block .controls, .qe-block .control-label { + margin-top: 10px; + margin-bottom: 10px; } .qe-block .table td, .qe-block .table th { padding: 8px; @@ -112,9 +133,6 @@ legend { margin-bottom: 15px; padding-bottom: 5px; } -.upload-picture { - margin-left: 20px; -} .subnav { -moz-border-radius: 0; -webkit-border-radius: 0; @@ -148,4 +166,38 @@ legend { .dropdown-menu.tags li:last-child a { display: block; text-align:center; +} +.sort-header th { + padding: 0 8px; + vertical-align: inherit; + position: relative; +} +.sort-header th a { + display: block; + padding: 10px 0; + white-space: nowrap; +} +.sort-header th a:hover { + text-decoration: none; +} +.list-remove { + position: absolute; + top: 0; + padding-top: 9px !important; + left: 25px; +} +.form-fixed { + position: fixed; + margin: 0; + padding: 10px; + bottom: 0; + z-index: 2; +} +.form-fixed .btn { + margin-top: 4px; +} +.paginationFixed { +} +.paginationFixed .pagination { + margin-top: 0 !important; } \ No newline at end of file diff --git a/app/assets/stylesheets/message.css b/app/assets/stylesheets/message.css index ad67f31a..9ee1d45d 100644 --- a/app/assets/stylesheets/message.css +++ b/app/assets/stylesheets/message.css @@ -1,3 +1,5 @@ +/*message*/ + .error{ color:red; } diff --git a/app/assets/stylesheets/new_admin.css.erb b/app/assets/stylesheets/new_admin.css.erb index d336a2de..99542101 100644 --- a/app/assets/stylesheets/new_admin.css.erb +++ b/app/assets/stylesheets/new_admin.css.erb @@ -6,10 +6,10 @@ *= require_self *= require message *= require bootstrap + *= require style *= require bootstrap-orbit *= require list - *= require style - *= widget + *= require widgets *= require scroll_style *= require isotope -*/ +*/ diff --git a/app/assets/stylesheets/reset.css.erb b/app/assets/stylesheets/reset.css.erb index 5c0a9cd5..f0a027a3 100644 --- a/app/assets/stylesheets/reset.css.erb +++ b/app/assets/stylesheets/reset.css.erb @@ -1,3 +1,6 @@ +/*reset*/ + + html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { -webkit-text-size-adjust:none; } diff --git a/app/assets/stylesheets/scroll_style.css b/app/assets/stylesheets/scroll_style.css index 2f79f62b..849fbc13 100644 --- a/app/assets/stylesheets/scroll_style.css +++ b/app/assets/stylesheets/scroll_style.css @@ -1,3 +1,5 @@ +/*scroll_style*/ + @charset "UTF-8"; /* CSS Document */ .my_scroll { diff --git a/app/assets/stylesheets/sidebar.css.erb b/app/assets/stylesheets/sidebar.css.erb index 79022cac..4231d0bf 100644 --- a/app/assets/stylesheets/sidebar.css.erb +++ b/app/assets/stylesheets/sidebar.css.erb @@ -1,11 +1,23 @@ +/*sidebar*/ -#back_sidebar { - left: 0; - position: fixed; - top: 0; - width: 160px; +.nav-list { + padding: 0px 0px 100px 5px; } - +.nav-list li { + position: relative; +} +.nav-list ul { + margin-left: 10px; +} +.nav-list ul li { + padding: 5px 0; +} +.nav-list ul li a { + font-size: 13px; + padding: 3px 0px; + display: block; +} +/* #back_sidebar h1 { background: url(<%= asset_path "h1_bg.png" %>) repeat-x scroll left top transparent; border-bottom: 1px solid #1B1B1B; @@ -105,36 +117,35 @@ } #main-sidebar ul ul li a{ padding: 10px 0 10px 20px; +}*/ +.with_action:hover .hide { + display: block; } -#main-sidebar li:hover .quick-edit{ - display:block; -} -#main-sidebar .quick-edit{ +#main-sidebar .quick-edit { background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #DDDDDD; border-radius: 5px 5px 5px 5px; - display: none; - margin:-3px 0 0 3px; - padding: 3px; + margin: 0 0 0 3px; + padding: 0; z-index:1; + position: absolute; + left: -3px; + width: 70px; } -#main-sidebar .quick-edit:after{ - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} -#main-sidebar .quick-edit a{ +#main-sidebar .quick-edit a { + display: block; + line-height: 22px; border-bottom: medium none; - border-radius: 5px 5px 5px 5px; font-size:12px; - float: left; - margin: 0 3px 0 0; - padding: 3px; + margin: 0; + padding: 3px 5px; } - -#main-sidebar .quick-edit a:hover{ - background: none repeat scroll 0 0 #EEEEEE; - border-bottom:none; +#main-sidebar .quick-edit a:first-child { + border-radius: 5px 5px 0px 0px; +} +#main-sidebar .quick-edit a:last-child { + border-radius: 0px 0px 5px 5px; +} +#main-sidebar .quick-edit a:hover { + background-color: #DDDDDD; } \ No newline at end of file diff --git a/app/assets/stylesheets/site_assets.css.erb b/app/assets/stylesheets/site_assets.css.erb index cd5e882d..41c14933 100644 --- a/app/assets/stylesheets/site_assets.css.erb +++ b/app/assets/stylesheets/site_assets.css.erb @@ -1,3 +1,5 @@ +/*site_assets*/ + .assets_setup{ padding:42px 0 0 0; } \ No newline at end of file diff --git a/app/assets/stylesheets/site_designs.css.erb b/app/assets/stylesheets/site_designs.css.erb index cf8442d0..805468cc 100644 --- a/app/assets/stylesheets/site_designs.css.erb +++ b/app/assets/stylesheets/site_designs.css.erb @@ -1,3 +1,5 @@ +/*site_designs*/ + .designs_setup{ padding:42px 0 0 0; } diff --git a/app/assets/stylesheets/site_editor.css.erb b/app/assets/stylesheets/site_editor.css.erb index 1e16ea3f..e36d0b7b 100644 --- a/app/assets/stylesheets/site_editor.css.erb +++ b/app/assets/stylesheets/site_editor.css.erb @@ -5,6 +5,10 @@ *= require reset *= require_self *= require message + *= require bootstrap + *= require style + *= require bootstrap-orbit + *= require scroll_style *= require site_items *= require sidebar */ \ No newline at end of file diff --git a/app/assets/stylesheets/site_items.css.erb b/app/assets/stylesheets/site_items.css.erb index 922bfe56..6fcef6bd 100644 --- a/app/assets/stylesheets/site_items.css.erb +++ b/app/assets/stylesheets/site_items.css.erb @@ -1,3 +1,5 @@ +/*site_items*/ + html, body{ height: 100%; margin: 0; diff --git a/app/assets/stylesheets/style.css.erb b/app/assets/stylesheets/style.css.erb index 39beaec9..b4410a47 100644 --- a/app/assets/stylesheets/style.css.erb +++ b/app/assets/stylesheets/style.css.erb @@ -1,3 +1,5 @@ +/*style*/ + @font-face{ font-family: 'WebSymbolsRegular'; src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>); @@ -8,7 +10,7 @@ } .login-logo { text-indent: -9999px; - background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 40px; + background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 80px; padding-top: 40px; height: 160px; } @@ -59,8 +61,8 @@ margin-right: -20px; } #orbit-bar .search-query { - padding: 4px 9px; - height: 12px; + padding: 7px 9px 5px; + height: 10px; margin-top: 3px; border: 1px solid #333333; font-size: 11px; @@ -108,6 +110,7 @@ padding:6px; } #orbit-bar .nav > li.search { + background-image: none; overflow: hidden; width: 28px; position: relative; @@ -116,7 +119,8 @@ background-position: -10px -10px; } #orbit-bar .nav > li > a.orbit-bar-desktop { - background-position: -106px -9px; + background-position: -73px -42px; + width: 48px; } #orbit-bar .nav > li > a.orbit-bar-member { background-position: -4px -37px; @@ -240,7 +244,7 @@ padding-right: 4px; border-right: 1px solid rgba(0,0,0,.2); position:fixed; - top: 32px; + top: 31px; z-index: 88; } #main-sidebar .nav { @@ -283,17 +287,18 @@ background-color: #FFF; margin-left:160px; padding-top: 32px; - padding-bottom: 18px; + /*padding-bottom: 18px;*/ position: relative; - min-height: 100%; + padding-bottom: 45px; + /*min-height: 100%;*/ } -#main-wrap > .form-actions { +/*#main-wrap > .form-actions { background-color: #FFF; text-align: center; padding: 17px 20px 0; margin: 0; border-top: none; -} +}*/ #main-wrap .subnav { height: auto; min-height: 36px; @@ -321,6 +326,9 @@ font-size: 12px; color: #999; } +.form-actions .btn { + margin-bottom: 0; +} #sub-wiget { clear: right; float: right; @@ -339,7 +347,7 @@ text-align: right; padding-left: 10px; padding-right: 10px; - margin-bottom: 0; + margin-bottom: -50px; clear: both; } #poststuff form { @@ -371,7 +379,7 @@ #post-body .editor { } #post-body-content { - margin-right: 320px; + /*margin-right: 320px;*/ padding: 8px 0 8px 6px; } .filter .accordion-heading > a:hover { @@ -563,7 +571,9 @@ padding: 5px; } .popover-content { - border-radius: 3px; + -webkit-border-radius: 0 0 3px 3px; + -moz-border-radius: 0 0 3px 3px; + border-radius: 0 0 3px 3px; padding: 5px; } .popover-title { @@ -605,6 +615,43 @@ .text-green { color: #39b54a !important; } +.adbanner-setup { + margin-right: 10px; + margin-bottom: 30px !important; +} +.adbanner-list { + border-top: 1px solid #AAA; + margin-right: 10px; + padding-top: 10px; + position: relative; +} +.adbanner-list ul { + margin: 0px; +} +.adbanner-list ul li { + list-style: none; + margin-left: 0; + margin-right: 20px; +} +.adbanner-action { + margin-bottom: 20px; +} +.textarea-height-s { + resize: none; + max-height: 150px; +} +.textarea-height-m { + resize: none; + max-height: 250px; +} +.textarea-height-l { + resize: none; + max-height: 350px; +} +.textarea-height-xl { + resize: none; + max-height: 500px; +} [class^="icons-"] { display: inline-block; width: 16px; @@ -893,5 +940,5 @@ } /*21*/ .icons- { - background-position: -0px -640px; -} \ No newline at end of file + background-position: -0px -640px +} diff --git a/app/assets/stylesheets/widget.css b/app/assets/stylesheets/widget.css deleted file mode 100644 index 2a9f430d..00000000 --- a/app/assets/stylesheets/widget.css +++ /dev/null @@ -1,148 +0,0 @@ -.widget-size-300 { - width:298px; -} -.widget-box { - background-color: #FFF; - overflow: hidden; - min-width: 300px; - margin: 0 0 5px 5px; - position:relative; -} -.widget-box .widget-title { - color: #FFF; - padding-left: 5px; - border-radius: 5px 5px 0 0; - -moz-border-radius: 5px 5px 0 0; - -webkit-border-radius: 5px 5px 0 0; - background-image: -moz-linear-gradient(top, #B7B7B7, #9d9d9d); - background-image: -ms-linear-gradient(top, #B7B7B7, #9d9d9d); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#B7B7B7), to(#9d9d9d)); - background-image: -webkit-linear-gradient(top, #B7B7B7, #9d9d9d); - background-image: -o-linear-gradient(top, #B7B7B7, #9d9d9d); - background-image: linear-gradient(top, #B7B7B7, #9d9d9d); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#B7B7B7', endColorstr='#9d9d9d', GradientType=0); -} -.widget-box .widget-title [class^="icons-"] { - margin: 3px 5px 0 2px; -} -.widget-box .widget-content { - padding: 10px; - border-width: 0 1px 1px; - border-style: solid; - border-color: #CCCCCC; - border-radius: 0 0 5px 5px; - -moz-border-radius: 0 0 5px 5px; - -webkit-border-radius: 0 0 5px 5px; -} -.widget-box .form-horizontal .control-group > label { - width: 50px; -} -.widget-box .form-horizontal .controls { - margin-left: 60px; -} -.widget-action { - position:absolute; - right:1px; - top:6px; -} -.action { - float: left; - display:inline-block; - margin-right: 5px; - opacity: 0.8; - filter: alpha(opacity=80); -} -.action:hover { - opacity: 1; - filter: alpha(opacity=100); - cursor: pointer; -} -.select-role { - display:none; - padding: 10px 0; -} -.file-upload { - position:relative; - overflow: hidden; -} -.file-upload .file-name { - white-space: nowrap; - overflow: hidden; - border-style: solid; - border-width: 1px 1px 1px 0; - border-color: #CCC; - display: inline-block; - float: left; - padding: 4px 10px; - height: 18px; - line-height: 18px; - -webkit-border-radius: 0 3px 3px 0; - -moz-border-radius: 0 3px 3px 0; - border-radius: 0 3px 3px 0; - text-align: left; - margin: 0; - width: 182px; -} -.file-upload .upload { - margin:0; - padding:0; - position:absolute; - top: 0; - left:0; - opacity:.0; - font-size: 60px; - left: -595px/9; - filter: alpha(opacity: 0); - outline: none; -} -.file-upload .upload:focus { - position:absolute; -} -.upload-picture { - margin-bottom: 5px; - text-align: center; - width: 276px; - overflow: hidden; - height: 90px; -} -.upload-picture img { - left: 0; - margin-top: -15%; - width: 100%; -} -.widget-box .widgetInfo { - display: inline-block; - text-align: center; - width: 255px; - margin : 0px 0 5px; - padding: 5px 10px; -} -.file-upload .input-medium { - border-radius: 3px 3px 3px 3px !important; - width: 267px; - position: relative; - z-index: 5; -} -#widget-link table { - margin-bottom:0 -} -/*Date*/ -.showDate { - border-style: solid; - border-width: 1px 0 1px 1px; - border-color: #CCC; - display: inline-block; - float: left; - padding: 4px 10px; - height: 18px; - line-height: 18px; - -webkit-border-radius: 3px 0 0 3px; - -moz-border-radius: 3px 0 0 3px; - border-radius: 3px 0 0 3px; - text-align: center; -} -.calendarInput { - position: absolute; - visibility: hidden; - left: 11px; -} diff --git a/app/assets/stylesheets/widgets.css b/app/assets/stylesheets/widgets.css index 175a303a..eb66b33b 100644 --- a/app/assets/stylesheets/widgets.css +++ b/app/assets/stylesheets/widgets.css @@ -1,3 +1,6 @@ +/*Widget*/ + + .widget-size-300 { width:298px; } @@ -81,7 +84,7 @@ border-radius: 0 3px 3px 0; text-align: left; margin: 0; - width: 182px; + width: 193px; } .file-upload .upload { margin:0; @@ -92,12 +95,24 @@ opacity:.0; font-size: 60px; left: -595px/9; - filter: alpha(opacity: 0); + filter: alpha(opacity= 0); outline: none; } .file-upload .upload:focus { position:absolute; } +.file-upload .input-medium { + border-radius: 3px 3px 3px 3px !important; + width: 267px; + position: relative; + z-index: 5; + display: block; + clear: both; +} +.file-upload .control-label { + margin-top: 0; + margin-bottom: 5px; +} .upload-picture { margin-bottom: 5px; text-align: center; @@ -117,12 +132,6 @@ margin : 0px 0 5px; padding: 5px 10px; } -.file-upload .input-medium { - border-radius: 3px 3px 3px 3px !important; - width: 267px; - position: relative; - z-index: 5; -} #widget-link table { margin-bottom:0 } diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index 95ce7e7c..47d3d355 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -1,7 +1,7 @@ -class Admin::AdBannersController < ApplicationController +class Admin::AdBannersController < OrbitBackendController layout "new_admin" before_filter :authenticate_user! - before_filter :is_admin? + before_filter :for_app_manager def destroy @ad_banner = AdBanner.find(params[:id]) @@ -22,9 +22,14 @@ class Admin::AdBannersController < ApplicationController def create @ad_banner = AdBanner.new(params[:ad_banner]) - @ad_banner.save - redirect_to admin_ad_banners_url - + if @ad_banner.save + @active = @ad_banner + respond_to do |format| + format.js {render 'new_created_node'} + end + else + render 'create_error_msg' + end end def edit @@ -39,13 +44,14 @@ class Admin::AdBannersController < ApplicationController redirect_to admin_ad_banners_url end - def destroy_ad_image - + 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 + @active = @ad_banners.first 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 3fb681da..d2039ab5 100644 --- a/app/controllers/admin/ad_images_controller.rb +++ b/app/controllers/admin/ad_images_controller.rb @@ -19,6 +19,8 @@ class Admin::AdImagesController < ApplicationController def new @ad_image =AdImage.new + @ad_image.post_date = Date.today + @ad_image.unpost_date = Date.today + 30 #render :action => 'new',:url=> {:ad_banner_id => params.has_key?(:ad_banner_id)? params[:ad_banner_id],nil} end diff --git a/app/controllers/admin/dashboards_controller.rb b/app/controllers/admin/dashboards_controller.rb index 7b761361..b7f377d3 100644 --- a/app/controllers/admin/dashboards_controller.rb +++ b/app/controllers/admin/dashboards_controller.rb @@ -2,7 +2,7 @@ class Admin::DashboardsController < ApplicationController layout "new_admin" before_filter :authenticate_user! - before_filter :is_admin? +# before_filter :is_admin? def index end diff --git a/app/controllers/admin/designs_controller.rb b/app/controllers/admin/designs_controller.rb index 519b36a5..84f2b770 100644 --- a/app/controllers/admin/designs_controller.rb +++ b/app/controllers/admin/designs_controller.rb @@ -1,11 +1,12 @@ -class Admin::DesignsController < ApplicationController +class Admin::DesignsController < OrbitBackendController require "net/http" require "uri" require 'zip/zip' layout "new_admin" before_filter :authenticate_user! - before_filter :is_admin? + before_filter :is_admin? + before_filter :for_admin_only def upload_package if !params[:design].nil? @@ -24,7 +25,7 @@ class Admin::DesignsController < ApplicationController end def index - @designs = Design.all.entries + @designs = params[:sort] ? get_sorted_and_filtered("designs") : Design.all end def new @@ -83,6 +84,13 @@ class Admin::DesignsController < ApplicationController render :action => 'new' end end + + def delete + if params[:to_delete] + designs = Design.any_in(:_id => params[:to_delete]).delete_all + end + redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) + end protected diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb index e93fb521..4f373f14 100644 --- a/app/controllers/admin/module_apps_controller.rb +++ b/app/controllers/admin/module_apps_controller.rb @@ -2,7 +2,7 @@ class Admin::ModuleAppsController < ApplicationController before_filter :user_has_manager_privilege?, :only => [ :assign_manager, :remove_manager ] before_filter :user_has_sub_manager_privilege?, :only => [ :assign_sub_manager, :remove_sub_manager ] - layout "admin" + layout "new_admin" def index @module_apps = ModuleApp.all.entries diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index e8779dc4..ab343360 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -1,6 +1,6 @@ class Admin::ObjectAuthsController < ApplicationController include OrbitCoreLib::PermissionUnility - layout "admin" + layout "new_admin" before_filter :force_order # before_filter :is_admin? ,:only => :index diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index 1fb6752a..86bc674e 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -25,10 +25,12 @@ class Admin::PagePartsController < ApplicationController @module_apps = ModuleApp.all(:conditions => {:enable_frontend => true}) @module_app = @part.module_app ? @part.module_app : @module_apps[0] @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag - @tag_objects = @r_tag.classify.constantize.all + @tag_objects = @r_tag.classify.constantize.all rescue nil case @module_app.key - when 'bulletin' + when 'announcement' @categories = BulletinCategory.all + when 'news' + @categories = NewsBulletinCategory.all when 'web_resource' @categories = WebLinkCategory.all end @@ -65,17 +67,27 @@ class Admin::PagePartsController < ApplicationController def reload_widgets @categories =[] @module_app = ModuleApp.find(params[:id]) - - unless (@module_app.category.nil? rescue true) - @module_app.category.each do |category| - @categories << eval(category).all.entries - end - @categories.flatten! + + case @module_app.key + when 'announcement' + @categories = BulletinCategory.all + when 'news' + @categories = NewsBulletinCategory.all + when 'web_resource' + @categories = WebLinkCategory.all end respond_to do |format| format.js {} end end + + def reload_r_tag_options + @r_tag = (ModuleApp.find(params[:id]) rescue nil) || params[:id] + @tag_objects = @r_tag.classify.constantize.all rescue nil + respond_to do |format| + format.js {} + end + end end diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 411297ce..65754319 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -31,7 +31,18 @@ class Admin::PagesController < ApplicationController @designs = Design.all.entries @design = @item.design ? @item.design : @designs.first @app_frontend_urls = @item.module_app.app_pages if @item.module_app - @categories = BulletinCategory.all if @item.module_app && @item.module_app.key.eql?('announcement') + if @item.module_app + case @item.module_app.key + when 'announcement' + @categories = BulletinCategory.all + when 'news' + @categories = NewsBulletinCategory.all + when 'web_resource' + @categories = WebLinkCategory.all + end + else + @categories = nil + end end def create diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb index 9475e708..1a19aebd 100644 --- a/app/controllers/admin/sites_controller.rb +++ b/app/controllers/admin/sites_controller.rb @@ -1,16 +1,48 @@ class Admin::SitesController < ApplicationController - layout "admin" + layout "new_admin" before_filter :authenticate_user! before_filter :is_admin? + before_filter :get_site - def index - @site = Site.first - redirect_to :action => :new unless @site + # def index + # @site = Site.first + # # redirect_to :action => :new unless @site + # end + + # def new + # @site = Site.new + # end + + def update + @site.update_attributes(params[:site]) + redirect_to :back end - - def new - @site = Site.new + + def site_info + + end + + def system_info + + end + + def language + + end + + def mail_setting + + end + + def ui_theme + + end + + private + + def get_site + @site ||= Site.first end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fb82774e..494b497e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -39,15 +39,65 @@ class ApplicationController < ActionController::Base @parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil end + def auth_failed_in_backend + #redirect_to admin_dashboards_url + redirect_to root_path + end + # Check if the current_user is admin def is_admin? - redirect_to root_url unless current_user.admin? + current_user.admin? ? true : auth_failed_in_backend + end + + def is_manager? + @module_app.managing_users.include?(current_user) || is_admin? + end + + def for_admin_only + if is_admin? + true + else + flash[:error] = t("admin.access.denied.not_admin") + auth_failed_in_backend + end + end + + def for_app_manager + if is_manager? + true + else + flash[:error] = t("admin.access.denied.app.not_manager") + auth_failed_in_backend + end + end + + def for_app_sub_manager + if (@module_app.sub_managing_users.include?(current_user) || is_manager?) + true + else + flash[:error] = t("admin.access.denied.app.not_sub_manager") + auth_failed_in_backend + end + end + + def for_app_user + if (@module_app.app_auth.auth_users.include?(current_user) || for_app_sub_manager ) + true + else + flash[:error] = t("admin.access.denied.app.not_authed_user") + auth_failed_in_backend + end + end + + def check_object_premission(obj,title) + flash[:error] = t("admin.access.denied.object") + auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_user) || is_manager? || is_admin? ) end # Render the page - def render_page(id = nil) + def render_page(param={}) if @item - render :text => process_page(@item, id), :layout => 'page_layout' + render :text => process_page(@item, param[:id], param), :layout => 'page_layout' else render :text => '404 Not Found' end @@ -78,8 +128,8 @@ class ApplicationController < ActionController::Base # set site if exist or create site @site = Site.first || Site.create({:valid_locales => [], :in_use_locales => []}) session[:site] = @site.id - @site_in_use_locales = @site.in_use_locales - @site_valid_locales = @site.valid_locales + @site_in_use_locales = site_locales_default_head(@site.in_use_locales) + @site_valid_locales = site_locales_default_head(@site.valid_locales) end def set_current_item @@ -114,4 +164,14 @@ class ApplicationController < ActionController::Base end end + def site_locales_default_head(locales) + if locales[0].eql? I18n.locale.to_s + locales + else + a = Array.new(locales) + shift_out = a.delete(I18n.locale.to_s) + [shift_out] + a + end + end + end diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index fe37db82..a03a1f6c 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -12,7 +12,7 @@ class OrbitBackendController< ApplicationController @app_title = request.fullpath.split('/')[2] @module_app = ModuleApp.first(conditions: {:key => @app_title} ) end - + private def force_order @@ -22,8 +22,136 @@ class OrbitBackendController< ApplicationController def check_user_can_use unless check_permission - redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) + #redirect_to polymorphic_path(['panel',@app_title,'back_end','public']) + render :text => '403 Forbidden' end end + + def get_sorted_and_filtered(object_class, query=nil) + object_class = object_class.classify.constantize + if query + objects = object_class.all.where(query) + else + objects = object_class.all + end + + if !params[:sort].blank? + options = params[:sort_options] + options = [options] if !options.class.eql?(Array) + options.each do |option| + if object_class.fields.include?(option) + case object_class.fields[option].type.to_s + when 'BigDecimal', 'Boolean', 'Date', 'DateTime', 'Float', 'Integer', 'String', 'Symbol', 'Time' + (objects = objects.order_by(option, params[:direction])) rescue nil + when 'Object' + objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option) + end + elsif object_class.relations.include?(option) + case object_class.relations[option].macro + when :references_one + a = Array.new + objects.each { |object| a << [get_string_value_from_object(object), object] } + sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse! + objects = sorted.collect {|x| x[1] } + when :references_many, :references_and_referenced_in_many + objects = get_objects_from_self(object_class, objects, option) + when :referenced_in + objects = get_objects_from_referenced_objects(object_class.relations[option].class_name.constantize, objects, "#{option}_id") + end + end + end + end + if @filter + @filter.each do |key, value| + case key + when 'status' + a = Array.new + objects.each do |object| + value.each do |v| + a << object if object[v] + end + end + objects = a.uniq + when 'categories' + a = Array.new + objects.each do |object| + a << object if value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s) + end + objects = a.uniq + when 'tags' + a = Array.new + objects.each do |object| + object.tags.each do |tag| + a << object if value.include?(tag.id.to_s) + end + end + objects = a.uniq + end if value.size > 0 + end + end + Kaminari.paginate_array(objects).page(params[:page]).per(10) + end + + def get_string_value_from_object(object) + s = object[I18n.locale] rescue nil + s = object.i18n_variable unless s rescue nil + s = object.name unless s rescue nil + s = object.title unless s rescue nil + if s + case s.class.to_s + when "String" + s.downcase + when "I18nVariable" + s[I18n.locale].downcase + else + nil + end + end + end + + def get_objects_from_referenced_objects(object_class, objects, option) + referer_ids = objects.distinct(option) + referenced_objects = object_class.find(referer_ids) rescue nil + if referenced_objects + a = Array.new + referenced_objects.each { |referer| a << [get_string_value_from_object(referer), referer.id] } + sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse! + sorted_objects = sorted.collect {|x| objects.where(option => x[1]).entries } + sorted_objects.flatten! + sorted_objects.uniq! + get_with_nil(objects, option, sorted_objects) + else + objects + end + end + + def get_objects_from_self(object_class, objects, option) + referenced_class = object_class.relations[option].class_name.constantize + referenced_objects = referenced_class.all rescue nil + if referenced_objects + reverse_relation = nil + referenced_class.relations.each { |relation| reverse_relation = relation[1].name.to_s if relation[1].class_name.eql?(object_class.to_s) } + a = Array.new + referenced_objects.each { |referenced_object| a << [get_string_value_from_object(referenced_object), referenced_object] } + a.compact! + sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse! + sorted_objects = Array.new + sorted.each {|x| sorted_objects << x[1].send(reverse_relation) } + sorted_objects.flatten! + sorted_objects.uniq! + get_with_nil(objects, option, sorted_objects) + else + objects + end + end + + def get_with_nil(objects, option, sorted_objects) + tmp = Array.new + objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).blank? || (object.send(option).size == 0 rescue nil)) } + sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse! + sorted_tmp = sorted.collect {|a| a[1] } + a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp) + a.flatten + end end \ No newline at end of file diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 4860ea2e..c4e00aa2 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -16,10 +16,10 @@ class PagesController < ApplicationController def show #begin @item = Item.first(:conditions => {:full_name => params[:page_name]}) - if @item && @item.is_published + if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) case @item._type when 'Page' - render_page(params[:id]) + render_page(params) when 'Link' redirect_to "http://#{@item[:url]}" end @@ -33,14 +33,16 @@ class PagesController < ApplicationController def index_from_link if params[:page] - redirect_to "/#{@item.full_name}?page=#{params[:page]}" + redirect_to "/#{@item.full_name}?page=#{params[:page]}&category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}" else - redirect_to "/#{@item.full_name}" + redirect_to "/#{@item.full_name}?category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}" end end def show_from_link - redirect_to "/#{@item.full_name}?id=#{params[:id]}" + # debugger + # a=1 + redirect_to "/#{@item.full_name}?id=#{params[:id]}&preview=#{params[:preview]}" end def load_orbit_bar @@ -51,11 +53,11 @@ class PagesController < ApplicationController def get_item module_app = ModuleApp.first(:conditions => {:key => params[:app_name]}) - if params[:category_id] - @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]}) - else + # if params[:category_id] + # @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]}) + # else @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]}) - end + # end end end diff --git a/app/helpers/admin/ad_images_helper.rb b/app/helpers/admin/ad_images_helper.rb index 1f2422fc..b09bd263 100644 --- a/app/helpers/admin/ad_images_helper.rb +++ b/app/helpers/admin/ad_images_helper.rb @@ -1,7 +1,3 @@ module Admin::AdImagesHelper - def active_when_default_locale_eq locale - locale.to_sym == I18n.default_locale ? 'active': '' - end - end diff --git a/app/helpers/admin/item_helper.rb b/app/helpers/admin/item_helper.rb index c9715a71..8af4db34 100644 --- a/app/helpers/admin/item_helper.rb +++ b/app/helpers/admin/item_helper.rb @@ -9,29 +9,34 @@ module Admin::ItemHelper when 'Link' dest = admin_link_path(node) end - ret << "
尺寸:
+- <%= ad_image.display? ? '[Showing]' : '[NotShawing]' %> + <%= ad_image.display? ? "[#{t('admin.ad.showing')}]" : "[#{t('admin.ad.not_showing')}]" %> <%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %>
- <%= link_to 'Edit',edit_admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn btn-primary' %> - <%= link_to 'Del',admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn',:method => :delete,:confirm => t('sure?') %> + <%= 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?') %>
-