diff --git a/app/assets/images/-sign-in-logo.png b/app/assets/images/-sign-in-logo.png deleted file mode 100644 index 53756c7c..00000000 Binary files a/app/assets/images/-sign-in-logo.png and /dev/null differ diff --git a/app/assets/images/ncculogo.ico b/app/assets/images/ncculogo.ico index 3aa5e1c6..0550cd4b 100644 Binary files a/app/assets/images/ncculogo.ico and b/app/assets/images/ncculogo.ico differ diff --git a/app/assets/images/sign-in-logo.png b/app/assets/images/sign-in-logo.png index a3148bab..53756c7c 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/jquery.mu.image.resize.degsin.js b/app/assets/javascripts/jquery.mu.image.resize.degsin.js new file mode 100644 index 00000000..9c87bf78 --- /dev/null +++ b/app/assets/javascripts/jquery.mu.image.resize.degsin.js @@ -0,0 +1,6 @@ + var pic = $(".app-pic").length,w,h; + for(i=0; i'; + }); + } + + if (!$.browser.msie) + { + // Get original size for calcutation. + ow = this.width; + oh = this.height; + } + + // if cannot get width or height. + if (0==ow || 0==oh){ + $(this).width(_set.width); + $(this).height(_set.height); + }else{ + + // Merge position settings + var sh_margin_type=''; + + // if original image's width > height. + if (ow > oh) { + p = oh / _set.height; + oh = _set.height; + ow = ow / p; + + // original image width smaller than settings. + if (ow < _set.width){ + // need to resize again, + // because new image size range must can cover settings' range, than we can crop it correctly. + p = ow / _set.width; + ow = _set.width; + oh = oh / p; + + // the crop range would be in the center of new image size. + sh = (oh-_set.height)/2; + t=sh+'px'; + r=_set.width+'px'; + b=(_set.height+sh)+'px'; + l='0px'; + + // need to be adjust top position latter. + sh_margin_type = 'margin-top'; + + // original image width bigger than settings. + }else{ + // new image range can cover settings' range. + sh = (ow-_set.width)/2; + t='0px'; + r=(_set.width+sh)+'px'; + b=_set.height+'px'; + l=sh+'px'; + // need to be adjust left position latter. + sh_margin_type = 'margin-left'; + } + // ref above, change width to height then do same things. + }else{ + p = ow / _set.width; + ow = _set.width; + oh = oh / p; + + if (oh < _set.height) { + p = oh / _set.height; + oh = _set.height; + ow = ow / p; + + sh = (ow-_set.width)/2; + t='0px'; + r=(_set.width+sh)+'px'; + b=_set.height+'px'; + l=sh+'px'; + sh_margin_type = 'margin-left'; + }else{ + sh = (oh-_set.height)/2; + t=sh+'px'; + r=_set.width+'px'; + b=(_set.height+sh)+'px'; + l='0px'; + sh_margin_type = 'margin-top'; + } + } + + // Resize img. + $(this).width(ow); + $(this).height(oh); + + // Crop img by set clip style. + $(this).css('clip','rect('+t+' '+r+' '+b+' '+l+')'); + + var osh = 0; + if('auto' != $(this).css(sh_margin_type)){ + osh = parseInt($(this).css(sh_margin_type)); + } + + if (0 < sh) {sh*=-1;} + sh += osh; + + $(this).css(sh_margin_type, sh+'px'); + $(this).css('position','absolute'); + } + $(this).fadeIn('slow'); + }) + .one( "error", function() { + //$(this).hide(); + }) + .each(function() { + $(this).hide(); + // Trigger load event (for Gecko and MSIE) + if ( this.complete || $.browser.msie ) { + $( this ).trigger( "load" ).trigger( "error" ); + } + }); + }; + +})( jQuery ); \ No newline at end of file diff --git a/app/assets/javascripts/page_edit.js.erb b/app/assets/javascripts/page_edit.js.erb index d7aaccd0..8d2ca97c 100644 --- a/app/assets/javascripts/page_edit.js.erb +++ b/app/assets/javascripts/page_edit.js.erb @@ -24,6 +24,10 @@ $("#module_app_list select").live('change', function() { $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets'); }); +$("#widget_list select").live('change', function() { + $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widget_styles?module_app_id=' + $("#module_app_list select").val()); +}); + $("#tag_list select").live('change', function() { $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_r_tag_options'); }); diff --git a/app/assets/stylesheets/banner_nav.css b/app/assets/stylesheets/banner_nav.css index ed613576..0ff3a05c 100644 --- a/app/assets/stylesheets/banner_nav.css +++ b/app/assets/stylesheets/banner_nav.css @@ -1,34 +1,35 @@ -#banner_nav { - position: absolute; - z-index: 10; - bottom: 0; - margin-right: 5px; - right: 0; -} -#banner_nav>li { - float: left; - display: inline-block; - *display: inline; - -} -#banner_nav>li>a { - width: 10px; - height: 10px; - border-radius: 5px; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - background-color: #FFFFFF; - opacity: .5; - filter: alpha(opacity = 50); - margin: 0 4px 10px; - text-indent: -9999px; - box-shadow: 0 0 5px rgba(0,0,0,.7); -} -#banner_nav>li>a:hover { - opacity: 1; - filter: alpha(opacity = 100); -} -#banner_nav>li.activeSlide>a { - opacity: 1; - filter: alpha(opacity = 100); -} +#banner_nav { + position: absolute; + z-index: 10; + bottom: 0; + margin-right: 5px; + right: 0; +} +#banner_nav>li { + float: left; + display: inline-block; + *display: inline; + +} +#banner_nav>li>a { + display:block; + width: 10px; + height: 10px; + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + background-color: #FFFFFF; + opacity: .5; + filter: alpha(opacity = 50); + margin: 0 4px 10px; + text-indent: -9999px; + box-shadow: 0 0 5px rgba(0,0,0,.7); +} +#banner_nav>li>a:hover { + opacity: 1; + filter: alpha(opacity = 100); +} +#banner_nav>li.activeSlide>a { + opacity: 1; + filter: alpha(opacity = 100); +} diff --git a/app/assets/stylesheets/style.css.erb b/app/assets/stylesheets/style.css.erb index 047933fe..835975e1 100644 --- a/app/assets/stylesheets/style.css.erb +++ b/app/assets/stylesheets/style.css.erb @@ -1,1348 +1,1351 @@ -@import url(http://fonts.googleapis.com/css?family=Cuprum|Open+Sans:400,300); - -@font-face{ - font-family: 'WebSymbolsRegular'; - src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>); - src: url(<%= asset_path 'websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'), - url(<%= asset_path 'websymbols-regular-webfont.woff' %>) format('woff'), - url(<%= asset_path 'websymbols-regular-webfont.ttf' %>) format('truetype'), - url(<%= asset_path 'websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg'); -} -.login-logo { - text-indent: -9999px; - background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 80px; - padding-top: 40px; - height: 160px; -} -#orbit-bar { - margin-bottom: 0; - position:fixed; - width:100%; - z-index: 99; - top: 0; - left: 0; -} -#orbit-bar .navbar-inner { - height: 28px; - -moz-border-radius: 0px; - -webkit-border-radius: 0px; - border-radius: 0px; - padding-top: 2px; - padding-bottom: 1px; - -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; - -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; - - background-image: -moz-linear-gradient(top, #5282A6, #133757); - background-image: -ms-linear-gradient(top, #5282A6, #133757); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5282A6), to(#133757)); - background-image: -webkit-linear-gradient(top, #5282A6, #133757); - background-image: -o-linear-gradient(top, #5282A6, #133757); - background-image: linear-gradient(top, #5282A6, #133757); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5282A6', endColorstr='#133757', GradientType=0); - /* - background-image: -moz-linear-gradient(top, #545b60, #191a1c); - background-image: -ms-linear-gradient(top, #545b60, #191a1c); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c)); - background-image: -webkit-linear-gradient(top, #545b60, #191a1c); - background-image: -o-linear-gradient(top, #545b60, #191a1c); - background-image: linear-gradient(top, #545b60, #191a1c); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#545b60', endColorstr='#191a1c', GradientType=0); - */ -} -#orbit-bar .navbar-search { - left: 28px; - margin: 0; - position: absolute; - text-align: right; - top: -1px; -} -#orbit-bar .nav.pull-right { - margin-right: -20px; -} -#orbit-bar .search-query { - padding: 7px 9px 5px; - height: 10px; - margin-top: 3px; - border: 1px solid #333333; - font-size: 11px; - /*background-color: rgba(255, 255, 255, 0.8); - color: #333; - text-shadow: 0px 1px 0px #FFF;*/ - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) inset, 0 1px 0 rgba(255, 255, 255, 0.15); -} -#orbit-bar .search-query:focus { - /*background-color: rgba(255, 255, 255, 0.9); - text-shadow: 0px 1px 0px #FFF;*/ - background-position: 5px 2px; -} -#orbit-bar .container { - width:100%; -} -#orbit-bar .orbit-logo .brand { - /* background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px; */ - background: url(<%= asset_path 'nccu_logo.png' %>) no-repeat 6px 0px; - text-indent:-9999px; - padding: 5px 20px 4px; -} -#orbit-bar .orbit-logo .brand:hover { - background-color: rgba(0,157,220,1); -} -#orbit-bar .orbit-logo.open .brand { - background-color: rgba(0,157,220,1); -} -#orbit-bar .orbit-logo .dropdown-menu { - left: -15px; -} -#orbit-bar .nav > li { - height: 28px; -} -#orbit-bar .nav > li > a:hover { - background-color: rgba(0,157,220,1); -} -#orbit-bar .nav > li > a { - background-image: url(<%= asset_path 'orbit-bar.png' %>); - background-repeat:no-repeat; - display: inline-block; - width: 16px; - height: 16px; - text-indent: -9999px; - padding:6px; -} -#orbit-bar .nav > li.search { - overflow: hidden; - width: 28px; - position: relative; -} -#orbit-bar .nav > li > a.orbit-bar-home { - background-position: -10px -10px; -} -#orbit-bar .nav > li > a.orbit-bar-desktop { - background-position: -73px -42px; - width: 48px; -} -#orbit-bar .nav > li > a.orbit-bar-member { - background-position: -4px -37px; -} -#orbit-bar .nav > li > a.orbit-bar-member { - background-position: -10px -43px; -} -#orbit-bar .nav > li > a.orbit-bar-language { - background-position: -42px -42px; -} -#orbit-bar .nav > li > a.orbit-bar-search { - background-position: -75px -10px; - overflow: hidden; -} -.language-menu .active { - color: #ffffff; - text-decoration: none; - background-color: #0088cc; -} -#orbit-bar .nav > li > a.orbit-bar-account { - background-image: none; - height: 22px; - padding: 3px; - text-indent: inherit; - min-width: 110px; - width: auto !important; - text-align: left; -} -#orbit-bar .nav span.member-name { - display: inline-block; - line-height: 22px; - padding: 0 10px; -} -#orbit-bar .nav img.member-img { - display: inline-block; - float: left; - max-width: 22px; -} -#orbit-bar .clear { - clear: none; -} -#orbit-bar .account-menu { - right: 5px; -} -#orbit-bar .bar-login { - -} -#orbit-bar .bar-login .open, #orbit-bar .open .orbit-bar-account { - background-color: #009DDC; -} -#orbit-bar .bar-login .dropdown-menu { - padding: 0 0 10px; - max-width: 260px; -} -#orbit-bar .bar-login .dropdown-menu .log { - margin: 10px 15px 0; - list-style: none outside none; -} -#orbit-bar .bar-login .dropdown-menu .log .title { - background: url(<%= asset_path 'sign-in-logo2.png' %>) no-repeat center center; - height: 70px; -} -#orbit-bar .bar-login .dropdown-menu .log form { - margin: 0 0 8px; -} -#orbit-bar .bar-login .dropdown-menu .log input { - display: inline-block; - margin: 0; -} -#orbit-bar .bar-login .dropdown-menu .log .span2 { - width: 183px; -} -#orbit-bar .bar-login .dropdown-menu .log .forgot { - margin-bottom: 20px; - padding: 3px 0 0; - float: right; - display: inline-block; - color: #0088CC; -} -#orbit-bar .bar-login .dropdown-menu .log .input-prepend { - margin-top: 20px; -} -#orbit-bar .bar-login .dropdown-menu .log .remember { - margin-top: 5px; -} -#orbit-bar .bar-login .dropdown-menu .log .forgot:hover { - padding: 3px 0 0; - float: right; - display: inline-block; - color: #005580; - text-decoration: underline; - background-color: transparent; -} -#orbit-bar .bar-login .dropdown-menu .log .btn { - width: 220px; -} -#orbit-bar .bar-login .dropdown-menu .log .divider { - position:relative; - overflow: inherit; - margin: 20px 0; -} -#orbit-bar .bar-login .dropdown-menu .log .divider span { - position: absolute; - width: 20px; - height: 20px; - background-color: #FFF; - color: #666; - top: -9px; - left: 100px; - font-size:16px; - text-align: center; -} -#orbit-bar .bar-login .dropdown-menu .register { - color: #FFFFFF; - margin: 0 15px; - width: 188px; -} -#main-sidebar { - background: url(<%= asset_path 'background.jpg' %>) repeat left top; - width: 155px; - padding-right: 4px; - border-right: 1px solid rgba(0,0,0,.2); - position:fixed; - top: 31px; - z-index: 88; -} -#main-sidebar .nav { - padding-top: 5px; -} -#main-sidebar .nav > li.active > a [class^="icons-"] { - background-image: url(<%= asset_path 'icons_pack_white.png' %>); -} -#main-sidebar .nav > li > .nav { - margin-left: -14px; - margin-bottom: 5px; - width: 155px; - padding: 0; - background-color: #FFF; - /*border-radius: 0px 0px 8px 0px; - -webkit-border-radius: 0px 0px 8px 0px; - -moz-border-radius: 0px 0px 8px 0px;*/ - box-shadow: 0px 2px 1px rgba(0,0,0,0.1); - -moz-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); - -webkit-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); - display: none; -} -#main-sidebar .nav > li.active > .nav { - display: block; -} -#main-sidebar .nav > li > .nav > li > a { - margin-left: 0; - padding-left: 19px; - color: #999; -} -#main-sidebar .nav > li > .nav > li > a:hover { - color: #000; - background-color: #d7eeff; -} -#main-sidebar .nav > li > .nav > li.active > a { - background-color: #b7b7b7; - color: #fff; -} -#main-wrap { - background-color: #FFF; - margin-left:160px; - padding-top: 32px; - /*padding-bottom: 18px;*/ - position: relative; - padding-bottom: 45px; - /*min-height: 100%;*/ -} -/*#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; -} -#main-wrap .pagination { - margin: 18px 0 0; - text-align: center; -} -.main-list .route-group td { - border: none; -} -#main-wrap .route-group .breadcrumb { - background-image: none; - border-radius: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-width: 0 0 1px 0; - box-shadow: none; - -webkit-box-shadow: none; - -moz-box-shadow: none; - margin-bottom: 0px; - padding: 7px 8px 5px; -} -#main-wrap .breadcrumb li { - font-size: 12px; - color: #999; -} -.form-actions .btn { - margin-bottom: 0; -} -#sub-wiget { - clear: right; - float: right; - padding-right: 10px; - padding-top: 8px; - position: relative; - margin-bottom: 13px; - width: 304px; -} -.main-wiget .widget-box { - margin: 5px 0; - width: 100%; -} -#poststuff .form-actions { - background-color: transparent; - text-align: right; - padding-left: 10px; - padding-right: 10px; - margin-bottom: -50px; - clear: both; -} -#poststuff form { - margin-bottom: 0; -} -#post-body { - float: left; - clear: left; - width: 100%; - margin-right: -340px; -} -#post-body .title input[type=text] { - margin-bottom: 0; - width: 100%; - height: 30px; -} -#post-body .btn-group { - margin-left: 5px; -} -#post-body .well { - margin: 0; - border-radius: 0px; - -moz-border-radius: 0px; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - border-top: none; -} -#post-body .editor { -} -#post-body-content { - /*margin-right: 320px;*/ - padding: 8px 0 8px 6px; -} -.filter .accordion-heading > a:hover { - text-decoration: none; -} -.filter .accordion-group { - border-bottom: none; - border-top: none; - border-left: 1px solid rgba(0,0,0,0.07); - border-right: none; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; - margin-bottom: -1px; - position: relative; - left: 0; - top: 0; -} -.filter .accordion-group:last-child { - border-right: 1px solid rgba(0,0,0,0.07); -} -.filter .accordion-heading .accordion-toggle { - padding: 9px 15px; -} -.accordion-group .accordion-toggle .caret { - border-top-color: #0088CC; - margin-top: 6px; -} -.filter .active { - background-color: #0088CC; -} -.filter .active a { - color: #FFF; -} -.filter form { - margin: 5px 10px; -} -.filters { - background-color: rgba(0,0,0,0.075); - -webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); - -moz-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); - box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); -} -.filters > div { - background-color: #dadada; -} -.filters .btn { - margin-bottom: 5px; -} -.filters .accordion-inner { - border-top: none; - padding: 9px 15px 4px; -} -.filters .filter-clear { - padding: 5px 5px 0; - border-top: 1px solid rgba(0,0,0,0.1); - text-align: right; - margin: 0 5px; - -webkit-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); - -moz-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); - box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); -} -.filters .in { - /*border-bottom: 1px solid rgba(0,0,0,0.07)*/ -} -#tags { -} -#tags .tag { - line-height: 32px; - padding: 0 10px; - background-color: #FFFFFF; - border-bottom: 1px solid #DDDDDD; - border-top: medium none; -} -#tags .tag form, #tags .tag form input { - margin:0; -} -#tags .tagitem { - display: inline-block; - float: left; -} -#tags .action { - display: inline-block; - float: right; -} -.sign-in { - width: 360px; - margin: 0 auto 70px; - background-color: #FFF; - -moz-border-radius: 0 0 5px 5px; - -webkit-border-radius: 0 0 5px 5px; - border-radius: 0 0 5px 5px; - -moz-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - -webkit-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - border-width: 0px 1px 1px 1px; - border-style: none solid solid solid; - border-color: transparent #c6c6c6 #c6c6c6 #c6c6c6; -} -#signin-header { - width: 340px; - margin: 30px auto 0; - line-height: 25px; - padding: 5px 10px; - border-width: 1px 1px 0px 1px; - border-style: solid solid none solid; - border-color: #c6c6c6 #c6c6c6 transparent #c6c6c6; - background-color: #006dcc; - background-image: -moz-linear-gradient(top, #dadada, #c0c0c0); - background-image: -ms-linear-gradient(top, #dadada, #c0c0c0); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#dadada), to(#c0c0c0)); - background-image: -webkit-linear-gradient(top, #dadada, #c0c0c0); - background-image: -o-linear-gradient(top, #dadada, #c0c0c0); - background-image: linear-gradient(top, #dadada, #c0c0c0); - -moz-border-radius: 5px 5px 0px 0px ; - -webkit-border-radius: 5px 5px 0px 0px; - border-radius: 5px 5px 0px 0px; - -moz-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); - -webkit-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); - box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); -} -#signin-header h3 { - color: #848484; - text-shadow: 0 1px 0 #e9e9e9; -} -#sign-footer { - width: 100%; - position:fixed; - bottom: 0; - height: 40px; - background-color: #dadada; - color: #7a7a7a; - box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); - -webkit-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); -} -#sign-footer p { - line-height: 40px; - padding: 0 10px; - text-align: right; -} -.sign-in .control-group label { - text-align: left; - width: auto; - font-size: 15px; -} -.sign-in .forgot { - padding-top: 5px; -} -.sign-in .content { - padding: 10px; -} -.sign-in .form-actions { - padding: 17px 10px 18px; - margin: 0; - -moz-border-radius: 0px 0px 5px 5px; - -webkit-border-radius: 0px 0px 5px 5px; - border-radius: 0px 0px 5px 5px; -} -.sign-in form { - margin: 0; -} -.sign-in .control-group .help-inline { - display:none; -} -.sign-in .error .help-inline { - display:inline-block; -} -.web-symbol:after { - font-family: 'WebSymbolsRegular'; - content: "{"; - margin-left: 2px; - margin-top: 8px; -} -.active .web-symbol:after { - content: "}"; -} -.img-peview { - margin-left: 12px; -} -.popover img { - max-height: 120px; - max-width: 100%; -} -.popover-inner { - width: auto; -} -.popover-title { - padding: 5px; -} -.popover-content { - -webkit-border-radius: 0 0 3px 3px; - -moz-border-radius: 0 0 3px 3px; - border-radius: 0 0 3px 3px; - padding: 5px; -} -.popover-title { - display: none; -} - -/*show link and file*/ -.linkAndFile { - clear: both; -} -.linkAndFile>div { - margin-top: 20px; -} -.linkAndFile [class^="icons-"] { - float: left; - margin-top: 10px; -} -.linkAndFile .showLink, .linkAndFile .showFile { - background-color: #ededed; - padding: 5px; - border-radius: 5px; - margin-left: 25px; -} -.linkAndFile .showLink a, .linkAndFile .showFile a { - display: inline-block; - margin: 5px 10px; -} -.linkAndFile>div>a:last-child { - margin-right: 5px -} -.news_paragraph p { - line-height: 20px; -} -.nav-tabs>li>.edit, .nav-tabs>li>.edit:hover { - background-color: #333; - color: #FFF; - padding-right: 12px; -} -.nav-tabs li .icons-pencil { - float: right; - margin-top: 8px; -} -.nav-tabs li a { - padding-right: 32px; -} - - -/*icons*/ -.the-icons i:after { - content: attr(class); - display: block; - font-style: normal; - margin-left: 20px; - width: 140px; -} -.the-icons i { - display: block; - margin-bottom: 5px; -} -[class^="text-"] { - font-size: 15px !important; -} -.text-blue { - color: #0088CC !important; -} -.text-red { - color: #CC3300 !important; -} -.text-yellow { - color: #ffcc00 !important; -} -.text-orange { - color: #f7941d !important; -} -.text-purple { - color: #a864a8 !important; -} -.text-palm { - color: #a67c52 !important; -} -.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; -} -#banner [id^="slideshow-"] { - z-index: 2 !important; -} - -#back_main .editable { - position: relative; -} -#back_main .editable:after { - content: ''; - clear: both; - display: block; - visibility: hidden; - height: 0; -} - -#back_main .edit_link a { - position: absolute; - z-index: 10; - width: 100%; - height: 100%; - top: 0; - left: 0; - text-indent: -9999px; - background: url(<%= asset_path 'editicon.png' %>) no-repeat center center rgba(255,255,255,.8); - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); -} - -#category_id, #module_app_id { - width: auto; -} - -[class^="icons-"] { - display: inline-block; - width: 16px; - height: 16px; - vertical-align: text-top; - background-image: url(<%= asset_path 'icons_pack.png' %>); - background-position: 16px 16px; - background-repeat: no-repeat; - *margin-right: .3em; - margin-right:10px; -} -[class^="icons-"]:last-child { - *margin-left: 0; -} -.icons-white { - background-image: url(<%= asset_path 'icons_pack_white.png' %>); -} -/*1*/ -.icons-pencil { - background-position: 0 0; -} -.icons-brush { - background-position: -32px 0; -} -.icons-pen { - background-position: -64px 0; -} -.icons-brush-large { - background-position: -128px 0; -} -.icons-pen-small { - background-position: -96px 0; -} -.icons-bucket { - background-position: -160px 0; -} -.icons-eye { - background-position: -192px 0; -} -.icons-ban { - background-position: -224px 0; -} -.icons-trash { - background-position: -256px 0; -} -.icons-zoom { - background-position: -288px 0; -} -.icons-zoom-out { - background-position: -320px 0; -} -.icons-zoom-in { - background-position: -352px 0; -} -.icons-magic { - background-position: -384px 0; -} -.icons-aim { - background-position: -416px 0; -} -/*2*/ -.icons-flag { - background-position: 0 -32px; -} -.icons-paperclip { - background-position: -32px -32px; -} -.icons-share { - background-position: -64px -32px; -} -.icons-link { - background-position: -96px -32px; -} -.icons-tag { - background-position: -128px -32px; -} -.icons-lock { - background-position: -160px -32px; -} -.icons-unlock { - background-position: -192px -32px; -} -.icons-thumbtack { - background-position: -224px -32px; -} -.icons-pin { - background-position: -257px -32px; -} -.icons-shield { - background-position: -288px -32px; -} -.icons-key { - background-position: -320px -32px; -} -.icons-fire { - background-position: -352px -32px; -} -.icons-bulls-eye { - background-position: -384px -32px; -} -.icons-flash { - background-position: -416px -32px; -} -.icons-time { - background-position: -448px -32px; -} -.icons-halo { - background-position: -480px -32px; -} -.icons-hourglass { - background-position: -513px -32px; -} -.icons-alarm-clock { - background-position: -545px -32px; -} -.icons-paper { - background-position: -577px -32px; -} -.icons-banner { - background-position: -608px -32px; -} -/*3*/ -.icons-phone { - background-position: 0px -64px; -} -.icons-mobile { - background-position: -32px -64px; -} -.icons-mail { - background-position: -64px -64px; -} -.icons-mail-open { - background-position: -96px -64px; -} -.icons-mail-read { - background-position: -128px -64px; -} -.icons-content { - background-position: -160px -64px; -} -.icons-content-out { - background-position: -192px -64px; -} -.icons-content-in { - background-position: -224px -64px; -} -.icons-projector { - background-position: -256px -64px; -} -.icons-tape { - background-position: -288px -64px; -} -.icons-chat-a { - background-position: -320px -64px; -} -.icons-chat-b { - background-position: -352px -64px; -} -.icons-chat-c { - background-position: -384px -64px; -} -.icons-comment { - background-position: -416px -64px; -} -.icons-rss { - background-position: -448px -64px; -} -.icons-ship { - background-position: -480px -64px; -} -.icons-send { - background-position: -512px -64px; -} -.icons-bell { - background-position: -544px -64px; -} -.icons-announcement { - background-position: -576px -64px; -} -/*4*/ -.icons-contact { - background-position: 0 -96px; -} -.icons-roll { - background-position: -32px -96px; -} -.icons-member { - background-position: -288px -96px; -} -.icons-member-user { - background-position: -64px -96px; -} -.icons-member-admin { - background-position: -96px -96px; -} -.icons-member-manager{ - background-position: -128px -96px; -} -.icons-member-plus{ - background-position: -160px -96px; -} -.icons-member-minus{ - background-position: -192px -96px; -} -.icons-member-blockade{ - background-position: -224px -96px; -} -.icons-carte { - background-position: -256px -96px; -} -.icons-building { - background-position: -320px -96px; -} -.icons-calendar { - background-position: -352px -96px; -} -.icons-calendars { - background-position: -384px -96px; -} -.icons-out { - background-position: -416px -96px; -} -.icons-desktop { - background-position: -448px -96px; -} -/*5*/ -.icons-page-blank { - background-position: 0px -128px; -} -.icons-page { - background-position: -32px -128px; -} -.icons-page-copy { - background-position: -64px -128px; -} -.icons-folder { - background-position: -96px -128px; -} -.icons-folder-open { - background-position: -128px -128px; -} -.icons-folder-lock { - background-position: -160px -128px; -} -.icons-folder-plus { - background-position: -192px -128px; -} -.icons-folder-minus { - background-position: -224px -128px; -} -.icons-page-plus { - background-position: -256px -128px; -} -.icons-page-minus { - background-position: -288px -128px; -} -.icons-page-edit { - background-position: -320px -128px; -} -.icons-page-download { - background-position: -352px -128px; -} -/*6*/ -.icons-house-w { - background-position: 0px -160px; -} -.icons-house-b { - background-position: -32px -160px; -} -.icons-signs { - background-position: -64px -160px; -} -.icons-globe { - background-position: -96px -160px; -} -.icons-map { - background-position: -128px -160px; -} -.icons-markers { - background-position: -160px -160px; -} -.icons-barrier { - background-position: -192px -160px; -} -.icons-assist { - background-position: -224px -160px; -} -.icons-cones { - background-position: -256px -160px; -} -.icons-group { - background-position: -288px -160px; -} -.icons-cuble { - background-position: -320px -160px; -} -.icons-structure { - background-position: -352px -160px; -} -.icons-layer { - background-position: -384px -160px; -} -/*7*/ -.icons-shopcar-a { - background-position: 0px -192px; -} -.icons-shopcar-b { - background-position: -34px -192px; -} -.icons-purchase { - background-position: -64px -192px; -} -.icons-shopcart { - background-position: -96px -192px; -} -.icons-van { - background-position: -128px -192px; -} -.icons-form { - background-position: -160px -192px; -} -.icons-gift { - background-position: -192px -192px; -} -.icons-credit-card { - background-position: -224px -192px; -} -.icons-cash { - background-position: -256px -192px; -} -.icons-assets { - background-position: -288px -192px; -} -.icons-computer { - background-position: -320px -192px; -} -.icons-library { - background-position: -352px -192px; -} -/*8*/ -.icons-dashboard { - background-position: 0 -224px; -} -.icons-cog { - background-position: -32px -224px; -} -.icons-cogs { - background-position: -64px -224px; -} -.icons-tool { - background-position: -96px -224px; -} -.icons-screwdriver { - background-position: -128px -224px; -} -.icons-wrench { - background-position: -160px -224px; -} -.icons-toolbox { - background-position: -192px -224px; -} -.icons-switch { - background-position: -224px -224px; -} -.icons-valve { - background-position: -256px -224px; -} -/*9*/ -.icons-book-cover { - background-position: 0px -256px; -} -.icons-book-make { - background-position: -32px -256px; -} -.icons-binder { - background-position: -64px -256px; -} -.icons-album { - background-position: -96px -256px; -} -.icons-camera { - background-position: -128px -256px; -} -.icons-video-camera { - background-position: -160px -256px; -} -.icons-pillar { - background-position: -192px -256px; -} -.icons-chart { - background-position: -224px -256px; -} -.icons-picture { - background-position: -256px -256px; -} -.icons-pictures { - background-position: -288px -256px; -} -.icons-brief { - background-position: -320px -256px; -} -.icons-film { - background-position: -352px -256px; -} -.icons-asset { - background-position: -384px -256px; -} -.icons-asset-download { - background-position: -416px -256px; -} -.icons-asset-upload { - background-position: -448px -256px; -} -.icons-music { - background-position: -480px -256px; -} -.icons-book-open-w { - background-position: -512px -256px; -} -.icons-book-open-b { - background-position: -544px -256px; -} -.icons-clapper-board { - background-position: -576px -256px; -} -/*10*/ -.icons-date { - background-position: 0px -288px; -} -.icons-screen { - background-position: -32px -288px; -} -.icons-iphone { - background-position: -64px -288px; -} -.icons-ipad { - background-position: -96px -288px; -} -.icons-ipod { - background-position: -128px -288px; -} -.icons-battery-low { - background-position: -160px -288px; -} -.icons-battery-mid { - background-position: -192px -288px; -} -.icons-battery-full { - background-position: -224px -288px; -} -.icons-battery-charge { - background-position: -256px -288px; -} -/*11*/ -.icons-pie { - background-position: 0px -320px; -} -.icons-histogram { - background-position: -32px -320px; -} -.icons-window { - background-position: -64px -320px; -} -.icons-window-line{ - background-position: -96px -320px; -} -.icons-window-command{ - background-position: -128px -320px; -} -.icons-window-list{ - background-position: -160px -320px; -} -.icons-window-block{ - background-position: -192px -320px; -} -.icons-terminal{ - background-position: -224px -320px; -} -/*12*/ -.icons-heart-w { - background-position: 0px -352px; -} -.icons-heart-b { - background-position: -32px -352px; -} -.icons-like { - background-position: -64px -352px; -} -.icons-hate { - background-position: -96px -352px; -} -.icons-medal { - background-position: -128px -352px; -} -.icons-warning { - background-position: -160px -352px; -} -.icons-check { - background-position: -192px -352px; -} -.icons-check-box-solid { - background-position: -224px -352px; -} -.icons-check-box-dot { - background-position: -256px -352px; -} -.icons-check-2 { - background-position: -288px -352px; -} -.icons-check-circle-solid { - background-position: -320px -352px; -} -.icons-check-circle-dot { - background-position: -352px -352px; -} -.icons-check-circle-b { - background-position: -384px -352px; -} -.icons-star-thin { - background-position: -416px -352px; -} -.icons-star { - background-position: -448px -352px; -} -/*13*/ -.icons- { - background-position: -0px -384px; -} -/*14*/ -.icons- { - background-position: -0px -416px; -} -/*15*/ -.icons- { - background-position: -0px -448px; -} -/*16*/ -.icons- { - background-position: -0px -480px; -} -/*17*/ -.icons- { - background-position: -0px -512px; -} -/*18*/ -.icons-help { - background-position: -160px -544px; -} -.icons- { - background-position: -0px -544px; -} -/*19*/ -.icons-plus-cube { - background-position: -192px -576px; -} -.icons-plus { - background-position: -288px -576px; -} -/*20*/ -.icons-power { - background-position: -0px -608px; -} -.icons-output { - background-position: -32px -608px; -} -.icons-col-resize { - background-position: -64px -608px; -} -.icons-move { - background-position: -96px -608px; -} -.icons-size-out { - background-position: -128px -608px; -} -.icons-size-in { - background-position: -160px -608px; -} -.icons-slash { - background-position: -192px -608px; -} -.icons-level { - background-position: -224px -608px; -} -.icons-share { - background-position: -256px -608px; -} -.icons-share2 { - background-position: -288px -608px; -} -.icons-re { - background-position: -320px -608px; -} -.icons-insert { - background-position: -352px -608px; -} -.icons-insert2 { - background-position: -384px -608px; -} -.icons-download { - background-position: -416px -608px; -} -.icons-tag-rignt { - background-position: -448px -608px; -} -.icons-tag-top { - background-position: -480px -608px; -} -.icons-tag-bottom { - background-position: -512px -608px; -} -.icons-tag-left { - background-position: -544px -608px; -} -.icons-moves { - background-position: -576px -608px; -} -/*21*/ -.icons- { - background-position: -0px -640px; +/*style*/ + +@import url(http://fonts.googleapis.com/css?family=Cuprum); +@font-face{ + font-family: 'WebSymbolsRegular'; + src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>); + src: url(<%= asset_path 'websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'), + url(<%= asset_path 'websymbols-regular-webfont.woff' %>) format('woff'), + url(<%= asset_path 'websymbols-regular-webfont.ttf' %>) format('truetype'), + url(<%= asset_path 'websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg'); +} +.login-logo { + text-indent: -9999px; + background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 40px; + padding-top: 40px; + height: 160px; +} +#orbit-bar { + margin-bottom: 0; + position:fixed; + width:100%; + z-index: 99; + top: 0; + left: 0; +} +#orbit-bar .navbar-inner { + height: 28px; + -moz-border-radius: 0px; + -webkit-border-radius: 0px; + border-radius: 0px; + padding-top: 2px; + padding-bottom: 1px; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; + + /* + background-image: -moz-linear-gradient(top, #5282A6, #133757); + background-image: -ms-linear-gradient(top, #5282A6, #133757); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5282A6), to(#133757)); + background-image: -webkit-linear-gradient(top, #5282A6, #133757); + background-image: -o-linear-gradient(top, #5282A6, #133757); + background-image: linear-gradient(top, #5282A6, #133757); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5282A6', endColorstr='#133757', GradientType=0); + */ + + background-image: -moz-linear-gradient(top, #545b60, #191a1c); + background-image: -ms-linear-gradient(top, #545b60, #191a1c); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c)); + background-image: -webkit-linear-gradient(top, #545b60, #191a1c); + background-image: -o-linear-gradient(top, #545b60, #191a1c); + background-image: linear-gradient(top, #545b60, #191a1c); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#545b60', endColorstr='#191a1c', GradientType=0); + +} +#orbit-bar .navbar-search { + left: 28px; + margin: 0; + position: absolute; + text-align: right; + top: -1px; +} +#orbit-bar .nav.pull-right { + margin-right: -20px; +} +#orbit-bar .search-query { + padding: 7px 9px 5px; + height: 10px; + margin-top: 3px; + border: 1px solid #333333; + font-size: 11px; + /*background-color: rgba(255, 255, 255, 0.8); + color: #333; + text-shadow: 0px 1px 0px #FFF;*/ + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) inset, 0 1px 0 rgba(255, 255, 255, 0.15); +} +#orbit-bar .search-query:focus { + /*background-color: rgba(255, 255, 255, 0.9); + text-shadow: 0px 1px 0px #FFF;*/ + background-position: 5px 2px; +} +#orbit-bar .container { + width:100%; +} +#orbit-bar .orbit-logo .brand { + background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px; + /* background: url(<%= asset_path 'nccu_logo.png' %>) no-repeat 6px 0px; */ + text-indent:-9999px; + padding: 5px 20px 4px; +} +#orbit-bar .orbit-logo .brand:hover { + background-color: rgba(0,157,220,1); +} +#orbit-bar .orbit-logo.open .brand { + background-color: rgba(0,157,220,1); +} +#orbit-bar .orbit-logo .dropdown-menu { + left: -15px; +} +#orbit-bar .nav > li { + height: 28px; +} +#orbit-bar .nav > li > a:hover { + background-color: rgba(0,157,220,1); +} +#orbit-bar .nav > li > a { + background-image: url(<%= asset_path 'orbit-bar.png' %>); + background-repeat:no-repeat; + display: inline-block; + width: 16px; + height: 16px; + text-indent: -9999px; + padding:6px; +} +#orbit-bar .nav > li.search { + overflow: hidden; + width: 28px; + position: relative; +} +#orbit-bar .nav > li > a.orbit-bar-home { + background-position: -10px -10px; +} +#orbit-bar .nav > li > a.orbit-bar-desktop { + background-position: -106px -10px; + width: 16px; +} +#orbit-bar .nav > li > a.orbit-bar-member { + background-position: -4px -37px; +} +#orbit-bar .nav > li > a.orbit-bar-member { + background-position: -10px -43px; +} +#orbit-bar .nav > li > a.orbit-bar-language { + background-position: -42px -42px; +} +#orbit-bar .nav > li > a.orbit-bar-search { + background-position: -75px -10px; + overflow: hidden; +} +.language-menu .active { + color: #ffffff; + text-decoration: none; + background-color: #0088cc; +} +#orbit-bar .nav > li > a.orbit-bar-account { + background-image: none; + height: 22px; + padding: 3px; + text-indent: inherit; + min-width: 110px; + width: auto !important; + text-align: left; +} +#orbit-bar .nav span.member-name { + display: inline-block; + line-height: 22px; + padding: 0 10px; +} +#orbit-bar .nav img.member-img { + display: inline-block; + float: left; + max-width: 22px; +} +#orbit-bar .clear { + clear: none; +} +#orbit-bar .account-menu { + right: 5px; +} +#orbit-bar .bar-login { + +} +#orbit-bar .bar-login .open, #orbit-bar .open .orbit-bar-account { + background-color: #009DDC; +} +#orbit-bar .bar-login .dropdown-menu { + padding: 0 0 10px; + max-width: 260px; +} +#orbit-bar .bar-login .dropdown-menu .log { + margin: 10px 15px 0; + list-style: none outside none; +} +#orbit-bar .bar-login .dropdown-menu .log .title { + background: url(<%= asset_path 'sign-in-logo2.png' %>) no-repeat center center; + height: 70px; +} +#orbit-bar .bar-login .dropdown-menu .log form { + margin: 0 0 8px; +} +#orbit-bar .bar-login .dropdown-menu .log input { + display: inline-block; + margin: 0; +} +#orbit-bar .bar-login .dropdown-menu .log .span2 { + width: 183px; +} +#orbit-bar .bar-login .dropdown-menu .log .forgot { + margin-bottom: 20px; + padding: 3px 0 0; + float: right; + display: inline-block; + color: #0088CC; +} +#orbit-bar .bar-login .dropdown-menu .log .input-prepend { + margin-top: 20px; +} +#orbit-bar .bar-login .dropdown-menu .log .remember { + margin-top: 5px; +} +#orbit-bar .bar-login .dropdown-menu .log .forgot:hover { + padding: 3px 0 0; + float: right; + display: inline-block; + color: #005580; + text-decoration: underline; + background-color: transparent; +} +#orbit-bar .bar-login .dropdown-menu .log .btn { + width: 220px; +} +#orbit-bar .bar-login .dropdown-menu .log .divider { + position:relative; + overflow: inherit; + margin: 20px 0; +} +#orbit-bar .bar-login .dropdown-menu .log .divider span { + position: absolute; + width: 20px; + height: 20px; + background-color: #FFF; + color: #666; + top: -9px; + left: 100px; + font-size:16px; + text-align: center; +} +#orbit-bar .bar-login .dropdown-menu .register { + color: #FFFFFF; + margin: 0 15px; + width: 188px; +} +#main-sidebar { + background: url(<%= asset_path 'background.jpg' %>) repeat left top; + width: 155px; + padding-right: 4px; + border-right: 1px solid rgba(0,0,0,.2); + position:fixed; + top: 31px; + z-index: 88; +} +#main-sidebar .nav { + padding-top: 5px; +} +#main-sidebar .nav > li.active > a [class^="icons-"] { + background-image: url(<%= asset_path 'icons_pack_white.png' %>); +} +#main-sidebar .nav > li > .nav { + margin-left: -14px; + margin-bottom: 5px; + width: 155px; + padding: 0; + background-color: #FFF; + /*border-radius: 0px 0px 8px 0px; + -webkit-border-radius: 0px 0px 8px 0px; + -moz-border-radius: 0px 0px 8px 0px;*/ + box-shadow: 0px 2px 1px rgba(0,0,0,0.1); + -moz-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); + -webkit-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); + display: none; +} +#main-sidebar .nav > li.active > .nav { + display: block; +} +#main-sidebar .nav > li > .nav > li > a { + margin-left: 0; + padding-left: 19px; + color: #999; +} +#main-sidebar .nav > li > .nav > li > a:hover { + color: #000; + background-color: #d7eeff; +} +#main-sidebar .nav > li > .nav > li.active > a { + background-color: #b7b7b7; + color: #fff; +} +#main-wrap { + background-color: #FFF; + margin-left:160px; + padding-top: 32px; + /*padding-bottom: 18px;*/ + position: relative; + padding-bottom: 45px; + /*min-height: 100%;*/ +} +/*#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; +} +#main-wrap .pagination { + margin: 18px 0 0; + text-align: center; +} +.main-list .route-group td { + border: none; +} +#main-wrap .route-group .breadcrumb { + background-image: none; + border-radius: 0; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-width: 0 0 1px 0; + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + margin-bottom: 0px; + padding: 7px 8px 5px; +} +#main-wrap .breadcrumb li { + font-size: 12px; + color: #999; +} +.form-actions .btn { + margin-bottom: 0; +} +#sub-wiget { + clear: right; + float: right; + padding-right: 10px; + padding-top: 8px; + position: relative; + margin-bottom: 13px; + width: 304px; +} +.main-wiget .widget-box { + margin: 5px 0; + width: 100%; +} +#poststuff .form-actions { + background-color: transparent; + text-align: right; + padding-left: 10px; + padding-right: 10px; + margin-bottom: -50px; + clear: both; +} +#poststuff form { + margin-bottom: 0; +} +#post-body { + float: left; + clear: left; + width: 100%; + margin-right: -340px; +} +#post-body .title input[type=text] { + margin-bottom: 0; + width: 100%; + height: 30px; +} +#post-body .btn-group { + margin-left: 5px; +} +#post-body .well { + margin: 0; + border-radius: 0px; + -moz-border-radius: 0px; + box-shadow: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + border-top: none; +} +#post-body .editor { +} +#post-body-content { + /*margin-right: 320px;*/ + padding: 8px 0 8px 6px; +} +.filter .accordion-heading > a:hover { + text-decoration: none; +} +.filter .accordion-group { + border-bottom: none; + border-top: none; + border-left: 1px solid rgba(0,0,0,0.07); + border-right: none; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; + margin-bottom: -1px; + position: relative; + left: 0; + top: 0; +} +.filter .accordion-group:last-child { + border-right: 1px solid rgba(0,0,0,0.07); +} +.filter .accordion-heading .accordion-toggle { + padding: 9px 15px; +} +.accordion-group .accordion-toggle .caret { + border-top-color: #0088CC; + margin-top: 6px; +} +.filter .active { + background-color: #0088CC; +} +.filter .active a { + color: #FFF; +} +.filter form { + margin: 5px 10px; +} +.filters { + background-color: rgba(0,0,0,0.075); + -webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); + -moz-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); + box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); +} +.filters > div { + background-color: #dadada; +} +.filters .btn { + margin-bottom: 5px; +} +.filters .accordion-inner { + border-top: none; + padding: 9px 15px 4px; +} +.filters .filter-clear { + padding: 5px 5px 0; + border-top: 1px solid rgba(0,0,0,0.1); + text-align: right; + margin: 0 5px; + -webkit-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); + -moz-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); + box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); +} +.filters .in { + /*border-bottom: 1px solid rgba(0,0,0,0.07)*/ +} +#tags { +} +#tags .tag { + line-height: 32px; + padding: 0 10px; + background-color: #FFFFFF; + border-bottom: 1px solid #DDDDDD; + border-top: medium none; +} +#tags .tag form, #tags .tag form input { + margin:0; +} +#tags .tagitem { + display: inline-block; + float: left; +} +#tags .action { + display: inline-block; + float: right; +} +.sign-in { + width: 360px; + margin: 0 auto 70px; + background-color: #FFF; + -moz-border-radius: 0 0 5px 5px; + -webkit-border-radius: 0 0 5px 5px; + border-radius: 0 0 5px 5px; + -moz-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + -webkit-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + border-width: 0px 1px 1px 1px; + border-style: none solid solid solid; + border-color: transparent #c6c6c6 #c6c6c6 #c6c6c6; +} +#signin-header { + width: 340px; + margin: 30px auto 0; + line-height: 25px; + padding: 5px 10px; + border-width: 1px 1px 0px 1px; + border-style: solid solid none solid; + border-color: #c6c6c6 #c6c6c6 transparent #c6c6c6; + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #dadada, #c0c0c0); + background-image: -ms-linear-gradient(top, #dadada, #c0c0c0); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#dadada), to(#c0c0c0)); + background-image: -webkit-linear-gradient(top, #dadada, #c0c0c0); + background-image: -o-linear-gradient(top, #dadada, #c0c0c0); + background-image: linear-gradient(top, #dadada, #c0c0c0); + -moz-border-radius: 5px 5px 0px 0px ; + -webkit-border-radius: 5px 5px 0px 0px; + border-radius: 5px 5px 0px 0px; + -moz-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); + -webkit-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); + box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); +} +#signin-header h3 { + color: #848484; + text-shadow: 0 1px 0 #e9e9e9; +} +#sign-footer { + width: 100%; + position:fixed; + bottom: 0; + height: 40px; + background-color: #dadada; + color: #7a7a7a; + box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); + -webkit-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); +} +#sign-footer p { + line-height: 40px; + padding: 0 10px; + text-align: right; +} +.sign-in .control-group label { + text-align: left; + width: auto; + font-size: 15px; +} +.sign-in .forgot { + padding-top: 5px; +} +.sign-in .content { + padding: 10px; +} +.sign-in .form-actions { + padding: 17px 10px 18px; + margin: 0; + -moz-border-radius: 0px 0px 5px 5px; + -webkit-border-radius: 0px 0px 5px 5px; + border-radius: 0px 0px 5px 5px; +} +.sign-in form { + margin: 0; +} +.sign-in .control-group .help-inline { + display:none; +} +.sign-in .error .help-inline { + display:inline-block; +} +.web-symbol:after { + font-family: 'WebSymbolsRegular'; + content: "{"; + margin-left: 2px; + margin-top: 8px; +} +.active .web-symbol:after { + content: "}"; +} +.img-peview { + margin-left: 12px; +} +.popover img { + max-height: 120px; + max-width: 100%; +} +.popover-inner { + width: auto; +} +.popover-title { + padding: 5px; +} +.popover-content { + -webkit-border-radius: 0 0 3px 3px; + -moz-border-radius: 0 0 3px 3px; + border-radius: 0 0 3px 3px; + padding: 5px; +} +.popover-title { + display: none; +} + +/*show link and file*/ +.linkAndFile { + clear: both; +} +.linkAndFile>div { + margin-top: 20px; +} +.linkAndFile [class^="icons-"] { + float: left; + margin-top: 10px; +} +.linkAndFile .showLink, .linkAndFile .showFile { + background-color: #ededed; + padding: 5px; + border-radius: 5px; + margin-left: 25px; +} +.linkAndFile .showLink a, .linkAndFile .showFile a { + display: inline-block; + margin: 5px 10px; +} +.linkAndFile>div>a:last-child { + margin-right: 5px +} +.news_paragraph p { + line-height: 20px; +} +.nav-tabs>li>.edit, .nav-tabs>li>.edit:hover { + background-color: #333; + color: #FFF; + padding-right: 12px; +} +.nav-tabs li .icons-pencil { + float: right; + margin-top: 8px; +} +.nav-tabs li a { + padding-right: 32px; +} + + +/*icons*/ +.the-icons i:after { + content: attr(class); + display: block; + font-style: normal; + margin-left: 20px; + width: 140px; +} +.the-icons i { + display: block; + margin-bottom: 5px; +} +[class^="text-"] { + font-size: 15px !important; +} +.text-blue { + color: #0088CC !important; +} +.text-red { + color: #CC3300 !important; +} +.text-yellow { + color: #ffcc00 !important; +} +.text-orange { + color: #f7941d !important; +} +.text-purple { + color: #a864a8 !important; +} +.text-palm { + color: #a67c52 !important; +} +.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; +} +#banner [id^="slideshow-"] { + z-index: 2 !important; +} + +#back_main .editable { + position: relative; +} +#back_main .editable:after { + content: ''; + clear: both; + display: block; + visibility: hidden; + height: 0; +} + +#back_main .edit_link a { + position: absolute; + z-index: 10; + width: 100%; + height: 100%; + top: 0; + left: 0; + text-indent: -9999px; + background: url(<%= asset_path 'editicon.png' %>) no-repeat center center rgba(255,255,255,.8); + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); +} + +#category_id, #module_app_id { + width: auto; +} + +[class^="icons-"] { + display: inline-block; + width: 16px; + height: 16px; + vertical-align: text-top; + background-image: url(<%= asset_path 'icons_pack.png' %>); + background-position: 16px 16px; + background-repeat: no-repeat; + *margin-right: .3em; + margin-right:10px; +} +[class^="icons-"]:last-child { + *margin-left: 0; +} +.icons-white { + background-image: url(<%= asset_path 'icons_pack_white.png' %>); +} +/*1*/ +.icons-pencil { + background-position: 0 0; +} +.icons-brush { + background-position: -32px 0; +} +.icons-pen { + background-position: -64px 0; +} +.icons-brush-large { + background-position: -128px 0; +} +.icons-pen-small { + background-position: -96px 0; +} +.icons-bucket { + background-position: -160px 0; +} +.icons-eye { + background-position: -192px 0; +} +.icons-ban { + background-position: -224px 0; +} +.icons-trash { + background-position: -256px 0; +} +.icons-zoom { + background-position: -288px 0; +} +.icons-zoom-out { + background-position: -320px 0; +} +.icons-zoom-in { + background-position: -352px 0; +} +.icons-magic { + background-position: -384px 0; +} +.icons-aim { + background-position: -416px 0; +} +/*2*/ +.icons-flag { + background-position: 0 -32px; +} +.icons-paperclip { + background-position: -32px -32px; +} +.icons-share { + background-position: -64px -32px; +} +.icons-link { + background-position: -96px -32px; +} +.icons-tag { + background-position: -128px -32px; +} +.icons-lock { + background-position: -160px -32px; +} +.icons-unlock { + background-position: -192px -32px; +} +.icons-thumbtack { + background-position: -224px -32px; +} +.icons-pin { + background-position: -257px -32px; +} +.icons-shield { + background-position: -288px -32px; +} +.icons-key { + background-position: -320px -32px; +} +.icons-fire { + background-position: -352px -32px; +} +.icons-bulls-eye { + background-position: -384px -32px; +} +.icons-flash { + background-position: -416px -32px; +} +.icons-time { + background-position: -448px -32px; +} +.icons-halo { + background-position: -480px -32px; +} +.icons-hourglass { + background-position: -513px -32px; +} +.icons-alarm-clock { + background-position: -545px -32px; +} +.icons-paper { + background-position: -577px -32px; +} +.icons-banner { + background-position: -608px -32px; +} +/*3*/ +.icons-phone { + background-position: 0px -64px; +} +.icons-mobile { + background-position: -32px -64px; +} +.icons-mail { + background-position: -64px -64px; +} +.icons-mail-open { + background-position: -96px -64px; +} +.icons-mail-read { + background-position: -128px -64px; +} +.icons-content { + background-position: -160px -64px; +} +.icons-content-out { + background-position: -192px -64px; +} +.icons-content-in { + background-position: -224px -64px; +} +.icons-projector { + background-position: -256px -64px; +} +.icons-tape { + background-position: -288px -64px; +} +.icons-chat-a { + background-position: -320px -64px; +} +.icons-chat-b { + background-position: -352px -64px; +} +.icons-chat-c { + background-position: -384px -64px; +} +.icons-comment { + background-position: -416px -64px; +} +.icons-rss { + background-position: -448px -64px; +} +.icons-ship { + background-position: -480px -64px; +} +.icons-send { + background-position: -512px -64px; +} +.icons-bell { + background-position: -544px -64px; +} +.icons-announcement { + background-position: -576px -64px; +} +/*4*/ +.icons-contact { + background-position: 0 -96px; +} +.icons-roll { + background-position: -32px -96px; +} +.icons-member { + background-position: -288px -96px; +} +.icons-member-user { + background-position: -64px -96px; +} +.icons-member-admin { + background-position: -96px -96px; +} +.icons-member-manager{ + background-position: -128px -96px; +} +.icons-member-plus{ + background-position: -160px -96px; +} +.icons-member-minus{ + background-position: -192px -96px; +} +.icons-member-blockade{ + background-position: -224px -96px; +} +.icons-carte { + background-position: -256px -96px; +} +.icons-building { + background-position: -320px -96px; +} +.icons-calendar { + background-position: -352px -96px; +} +.icons-calendars { + background-position: -384px -96px; +} +.icons-out { + background-position: -416px -96px; +} +.icons-desktop { + background-position: -448px -96px; +} +/*5*/ +.icons-page-blank { + background-position: 0px -128px; +} +.icons-page { + background-position: -32px -128px; +} +.icons-page-copy { + background-position: -64px -128px; +} +.icons-folder { + background-position: -96px -128px; +} +.icons-folder-open { + background-position: -128px -128px; +} +.icons-folder-lock { + background-position: -160px -128px; +} +.icons-folder-plus { + background-position: -192px -128px; +} +.icons-folder-minus { + background-position: -224px -128px; +} +.icons-page-plus { + background-position: -256px -128px; +} +.icons-page-minus { + background-position: -288px -128px; +} +.icons-page-edit { + background-position: -320px -128px; +} +.icons-page-download { + background-position: -352px -128px; +} +/*6*/ +.icons-house-w { + background-position: 0px -160px; +} +.icons-house-b { + background-position: -32px -160px; +} +.icons-signs { + background-position: -64px -160px; +} +.icons-globe { + background-position: -96px -160px; +} +.icons-map { + background-position: -128px -160px; +} +.icons-markers { + background-position: -160px -160px; +} +.icons-barrier { + background-position: -192px -160px; +} +.icons-assist { + background-position: -224px -160px; +} +.icons-cones { + background-position: -256px -160px; +} +.icons-group { + background-position: -288px -160px; +} +.icons-cuble { + background-position: -320px -160px; +} +.icons-structure { + background-position: -352px -160px; +} +.icons-layer { + background-position: -384px -160px; +} +/*7*/ +.icons-shopcar-a { + background-position: 0px -192px; +} +.icons-shopcar-b { + background-position: -34px -192px; +} +.icons-purchase { + background-position: -64px -192px; +} +.icons-shopcart { + background-position: -96px -192px; +} +.icons-van { + background-position: -128px -192px; +} +.icons-form { + background-position: -160px -192px; +} +.icons-gift { + background-position: -192px -192px; +} +.icons-credit-card { + background-position: -224px -192px; +} +.icons-cash { + background-position: -256px -192px; +} +.icons-assets { + background-position: -288px -192px; +} +.icons-computer { + background-position: -320px -192px; +} +.icons-library { + background-position: -352px -192px; +} +/*8*/ +.icons-dashboard { + background-position: 0 -224px; +} +.icons-cog { + background-position: -32px -224px; +} +.icons-cogs { + background-position: -64px -224px; +} +.icons-tool { + background-position: -96px -224px; +} +.icons-screwdriver { + background-position: -128px -224px; +} +.icons-wrench { + background-position: -160px -224px; +} +.icons-toolbox { + background-position: -192px -224px; +} +.icons-switch { + background-position: -224px -224px; +} +.icons-valve { + background-position: -256px -224px; +} +/*9*/ +.icons-book-cover { + background-position: 0px -256px; +} +.icons-book-make { + background-position: -32px -256px; +} +.icons-binder { + background-position: -64px -256px; +} +.icons-album { + background-position: -96px -256px; +} +.icons-camera { + background-position: -128px -256px; +} +.icons-video-camera { + background-position: -160px -256px; +} +.icons-pillar { + background-position: -192px -256px; +} +.icons-chart { + background-position: -224px -256px; +} +.icons-picture { + background-position: -256px -256px; +} +.icons-pictures { + background-position: -288px -256px; +} +.icons-brief { + background-position: -320px -256px; +} +.icons-film { + background-position: -352px -256px; +} +.icons-asset { + background-position: -384px -256px; +} +.icons-asset-download { + background-position: -416px -256px; +} +.icons-asset-upload { + background-position: -448px -256px; +} +.icons-music { + background-position: -480px -256px; +} +.icons-book-open-w { + background-position: -512px -256px; +} +.icons-book-open-b { + background-position: -544px -256px; +} +.icons-clapper-board { + background-position: -576px -256px; +} +/*10*/ +.icons-date { + background-position: 0px -288px; +} +.icons-screen { + background-position: -32px -288px; +} +.icons-iphone { + background-position: -64px -288px; +} +.icons-ipad { + background-position: -96px -288px; +} +.icons-ipod { + background-position: -128px -288px; +} +.icons-battery-low { + background-position: -160px -288px; +} +.icons-battery-mid { + background-position: -192px -288px; +} +.icons-battery-full { + background-position: -224px -288px; +} +.icons-battery-charge { + background-position: -256px -288px; +} +/*11*/ +.icons-pie { + background-position: 0px -320px; +} +.icons-histogram { + background-position: -32px -320px; +} +.icons-window { + background-position: -64px -320px; +} +.icons-window-line{ + background-position: -96px -320px; +} +.icons-window-command{ + background-position: -128px -320px; +} +.icons-window-list{ + background-position: -160px -320px; +} +.icons-window-block{ + background-position: -192px -320px; +} +.icons-terminal{ + background-position: -224px -320px; +} +/*12*/ +.icons-heart-w { + background-position: 0px -352px; +} +.icons-heart-b { + background-position: -32px -352px; +} +.icons-like { + background-position: -64px -352px; +} +.icons-hate { + background-position: -96px -352px; +} +.icons-medal { + background-position: -128px -352px; +} +.icons-warning { + background-position: -160px -352px; +} +.icons-check { + background-position: -192px -352px; +} +.icons-check-box-solid { + background-position: -224px -352px; +} +.icons-check-box-dot { + background-position: -256px -352px; +} +.icons-check-2 { + background-position: -288px -352px; +} +.icons-check-circle-solid { + background-position: -320px -352px; +} +.icons-check-circle-dot { + background-position: -352px -352px; +} +.icons-check-circle-b { + background-position: -384px -352px; +} +.icons-star-thin { + background-position: -416px -352px; +} +.icons-star { + background-position: -448px -352px; +} +/*13*/ +.icons- { + background-position: -0px -384px; +} +/*14*/ +.icons- { + background-position: -0px -416px; +} +/*15*/ +.icons- { + background-position: -0px -448px; +} +/*16*/ +.icons- { + background-position: -0px -480px; +} +/*17*/ +.icons- { + background-position: -0px -512px; +} +/*18*/ +.icons-help { + background-position: -160px -544px; +} +.icons- { + background-position: -0px -544px; +} +/*19*/ +.icons-plus-cube { + background-position: -192px -576px; +} +.icons-plus { + background-position: -288px -576px; +} +/*20*/ +.icons-power { + background-position: -0px -608px; +} +.icons-output { + background-position: -32px -608px; +} +.icons-col-resize { + background-position: -64px -608px; +} +.icons-move { + background-position: -96px -608px; +} +.icons-size-out { + background-position: -128px -608px; +} +.icons-size-in { + background-position: -160px -608px; +} +.icons-slash { + background-position: -192px -608px; +} +.icons-level { + background-position: -224px -608px; +} +.icons-share { + background-position: -256px -608px; +} +.icons-share2 { + background-position: -288px -608px; +} +.icons-re { + background-position: -320px -608px; +} +.icons-insert { + background-position: -352px -608px; +} +.icons-insert2 { + background-position: -384px -608px; +} +.icons-download { + background-position: -416px -608px; +} +.icons-tag-rignt { + background-position: -448px -608px; +} +.icons-tag-top { + background-position: -480px -608px; +} +.icons-tag-bottom { + background-position: -512px -608px; +} +.icons-tag-left { + background-position: -544px -608px; +} +.icons-moves { + background-position: -576px -608px; +} +/*21*/ +.icons- { + background-position: -0px -640px; } \ No newline at end of file diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb index 1393bf32..3d0fd896 100644 --- a/app/controllers/admin/module_apps_controller.rb +++ b/app/controllers/admin/module_apps_controller.rb @@ -11,6 +11,11 @@ class Admin::ModuleAppsController < ApplicationController def reload_frontend_pages @module_app = ModuleApp.find(params[:id]) + + @frontend_path = @module_app.widgets.keys[0] if ( !@module_app.widgets.blank? && @module_app.widgets[0].blank? ) + + @frontend_style = @module_app.widgets[@frontend_path] if ( !@frontend_path.blank? ) + case @module_app.key when 'announcement' @categories = BulletinCategory.all diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index 9ef2aa1b..294715da 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -26,6 +26,10 @@ class Admin::PagePartsController < ApplicationController @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 rescue nil + + @widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0] + @widget_style = @module_app.widgets[@widget_path] + case @module_app.key when 'announcement' @categories = BulletinCategory.all @@ -45,6 +49,10 @@ class Admin::PagePartsController < ApplicationController def update @part = PagePart.find(params[:id]) + + params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] ) + params[:page_part][:widget_field_type] = nil + if @part.update_attributes(params[:page_part]) set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu') flash.now[:notice] = t('admin.update_success_content') @@ -69,6 +77,11 @@ class Admin::PagePartsController < ApplicationController def reload_widgets @module_app = ModuleApp.find(params[:id]) + + @widget_path = @module_app.widgets.keys[0] if ( @module_app.widgets[0].blank? ) + + @widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? ) + case @module_app.key when 'announcement' @categories = BulletinCategory.all @@ -84,6 +97,16 @@ class Admin::PagePartsController < ApplicationController format.js {} end end + + def reload_widget_styles + @module_app = ModuleApp.find(params[:module_app_id]) + + @widget_style = @module_app.widgets[params[:id]] + + respond_to do |format| + format.js {} + end + end def reload_r_tag_options @r_tag = (ModuleApp.find(params[:id]) rescue nil) || params[:id] diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 5fc6cb77..26a29795 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -28,10 +28,19 @@ class Admin::PagesController < ApplicationController def edit @item = Page.find(params[:id]) @apps = ModuleApp.excludes(app_pages: nil).entries + + @module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc) + @designs = Design.all.entries @design = @item.design ? @item.design : @designs.first @app_frontend_urls = @item.module_app.app_pages if @item.module_app + if @item.module_app + @module_app = @item.module_app + + @frontend_path = @item.app_frontend_url ? @item.app_frontend_url : @module_app.widgets.keys[0] + @frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank? + case @item.module_app.key when 'announcement' @categories = BulletinCategory.all @@ -45,6 +54,7 @@ class Admin::PagesController < ApplicationController end else @categories = nil + @module_app = @module_apps[0] end end @@ -79,6 +89,9 @@ class Admin::PagesController < ApplicationController @item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id ) end + params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] ) + params[:page][:frontend_field_type] = nil + if @item.update_attributes(params[:page]) flash[:notice] = t('admin.update_success_page') respond_to do |format| diff --git a/app/models/module_app.rb b/app/models/module_app.rb index 7ad4ac1d..007467de 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -14,7 +14,9 @@ class ModuleApp field :enable_frontend, type: Boolean, :default => true field :app_pages ,type: Array - field :widgets ,type: Array + # field :widgets ,type: Array + field :widgets ,type: Hash + field :widget_fields ,type: Array has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app diff --git a/app/models/page.rb b/app/models/page.rb index 970df4cf..9c7a7e30 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -10,6 +10,10 @@ class Page < Item field :tag field :view_count, :type => Integer, :default => 0 + field :frontend_style + field :frontend_field , :type => Array + field :frontend_data_count + belongs_to :design belongs_to :module_app has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy @@ -18,7 +22,7 @@ class Page < Item has_many :page_metas, :autosave => true, :dependent => :destroy accepts_nested_attributes_for :page_parts, :allow_destroy => true - before_save :create_parts, :set_key + before_save :create_parts, :set_key , :delete_empty_frontend_field # embeds_many :custom_images, :class_name => 'Image', as: :design_image @@ -53,4 +57,18 @@ class Page < Item end end + def delete_empty_frontend_field + + if self.frontend_field + self.frontend_field.reject! { |ff| (ff[0].blank? || ff[1].blank?) } + # self.frontend_field.each do | ff | + # if ff[0].blank? || ff[1].blank? + # self.frontend_field.delete("") if self.frontend_field + # self.frontend_field.delete(ff) + # end + # end + end + + end + end diff --git a/app/models/page_part.rb b/app/models/page_part.rb index 52eafdf3..8226426c 100644 --- a/app/models/page_part.rb +++ b/app/models/page_part.rb @@ -11,13 +11,17 @@ class PagePart field :public_r_tag_option, :default => nil field :widget_path + field :widget_style + field :widget_field , :type => Array + field :widget_data_count + has_one :i18n_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy belongs_to :page belongs_to :module_app - before_save :set_key + before_save :set_key, :delete_empty_widget_field def i18n_variable @i18n_variable ||= I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => self.id, :language_value_type => self.class}) rescue nil @@ -33,5 +37,13 @@ class PagePart title.key = 'title' if title && (title.key.blank? rescue true) i18n_variable.key = 'i18n_variable' if i18n_variable && (i18n_variable.key.blank? rescue true) end + + def delete_empty_widget_field + + if self.widget_field + self.widget_field.reject! { |wf| (wf[0].blank? || wf[1].blank?) } + end + # self.widget_field.delete("") if self.widget_field + end end \ No newline at end of file diff --git a/app/models/site.rb b/app/models/site.rb index 55d6bfaf..0baa743f 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -17,6 +17,8 @@ class Site field :school field :department + + mount_uploader :default_image, ImageUploader has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb index 29a4d92b..ed142405 100644 --- a/app/uploaders/image_uploader.rb +++ b/app/uploaders/image_uploader.rb @@ -30,7 +30,10 @@ class ImageUploader < CarrierWave::Uploader::Base # def default_url # "/images/fallback/" + [version_name, "default.png"].compact.join('_') # end - + def default_url + Site.first.default_image.url rescue "-sign-in-logo.png" + end + # Process files as they are uploaded: # process :scale => [200, 300] # diff --git a/app/views/admin/module_apps/reload_frontend_pages.js.erb b/app/views/admin/module_apps/reload_frontend_pages.js.erb index 2fc90b8e..863e64b2 100644 --- a/app/views/admin/module_apps/reload_frontend_pages.js.erb +++ b/app/views/admin/module_apps/reload_frontend_pages.js.erb @@ -1,3 +1,5 @@ $('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', @module_app.app_pages) %>"); +$('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @module_app.widgets[@frontend_path]) if !@frontend_path.blank? %>"); $('#app_page_category').html("<%= j (select 'page', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, {:include_blank => true}) if @categories %>"); -$('#app_page_tag').html("<%= j (select 'page', 'tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, {:include_blank => true}) if @tags %>"); \ No newline at end of file +$('#app_page_tag').html("<%= j (select 'page', 'tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, {:include_blank => true}) if @tags %>"); +$('#app_page_frontend_field').html("<%= j render '../admin/pages/frontend_fields' %>") \ No newline at end of file diff --git a/app/views/admin/page_parts/_module_widget.html.erb b/app/views/admin/page_parts/_module_widget.html.erb index 1a1dd63c..76f06db8 100644 --- a/app/views/admin/page_parts/_module_widget.html.erb +++ b/app/views/admin/page_parts/_module_widget.html.erb @@ -14,7 +14,12 @@ - <%= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %> + <%#= f.select :widget_path, @module_app.widgets.collect{|widget| [widget.humanize, widget]}, :selected => @part.widget_path %> + <%= f.select :widget_path, @module_app.widgets.collect{|k,v| [k.humanize, k]}, {}, { :selected => @part.widget_path, :rel => admin_page_parts_path } %> + + + + <%= f.select :widget_style, @widget_style, :selected => @part.widget_style %> : @@ -25,4 +30,22 @@ <%= t :or_lower %> <%= render 'widget_tags' %> - \ No newline at end of file + + + + + <%= render 'widget_fields' %> + + <%#= f.label :widget_field %> + <%# @module_app.widget_fields.each_with_index do |widget_field, i| %> + <%#= i+1 %> + <%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, (@part.widget_field ? @part.widget_field[i] : nil) ), :include_blank => true %>
+ <%# end %> + + <%#= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, @part.widget_field.collect{|widget_field| widget_field}), {:multiple => :multiple, :size => 6} %> +
+ +
+<%= f.label :widget_data_count %> +<%= f.text_field :widget_data_count %> +
\ No newline at end of file diff --git a/app/views/admin/page_parts/_widget_fields.html.erb b/app/views/admin/page_parts/_widget_fields.html.erb new file mode 100644 index 00000000..21196b5b --- /dev/null +++ b/app/views/admin/page_parts/_widget_fields.html.erb @@ -0,0 +1,12 @@ + + <% if (@module_app && @module_app.widget_fields) %> + + <%= label_tag('widget_field') %> + + <% @module_app.widget_fields.each_with_index do |widget_field, i| %> + <%= i+1 %> + <%= select_tag "page_part[widget_field][]", options_for_select(@module_app.widget_fields.collect{|widget_field| [widget_field.humanize, widget_field]}, (@part[:widget_field][i][0] if (@part && !@part[:widget_field].blank? && !@part[:widget_field][i].blank?)) ), :include_blank => true %> + <%= select_tag "page_part[widget_field_type][]", options_for_select(LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}, (@part[:widget_field][i][1] if (@part && !@part[:widget_field].blank? && !@part[:widget_field][i].blank?)) ), :include_blank => true %>
+ <% end %> + + <% end %> \ No newline at end of file diff --git a/app/views/admin/page_parts/reload_widget_styles.js.erb b/app/views/admin/page_parts/reload_widget_styles.js.erb new file mode 100644 index 00000000..41b2ad9c --- /dev/null +++ b/app/views/admin/page_parts/reload_widget_styles.js.erb @@ -0,0 +1 @@ +$('#widget_style_list select').html("<%= j options_for_select(@module_app.widgets[params[:id]]) %>") diff --git a/app/views/admin/page_parts/reload_widgets.js.erb b/app/views/admin/page_parts/reload_widgets.js.erb index 2b851ce0..6d41a9b7 100644 --- a/app/views/admin/page_parts/reload_widgets.js.erb +++ b/app/views/admin/page_parts/reload_widgets.js.erb @@ -1,3 +1,5 @@ -$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|widget| [widget.humanize, widget]}) %>") +$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| k}) %>") +$('#widget_style_list select').html("<%= j options_for_select( @module_app.widgets[@widget_path] ) if !@widget_path.blank? %>") +$('#widget_field').html("<%= j render 'widget_fields' %>") $('#widget_category').html("<%= j render 'widget_categories' %>") $('#widget_tag').html("<%= j render 'widget_tags' %>") \ No newline at end of file diff --git a/app/views/admin/pages/_form.html.erb b/app/views/admin/pages/_form.html.erb index eff3e4df..8b429e55 100644 --- a/app/views/admin/pages/_form.html.erb +++ b/app/views/admin/pages/_form.html.erb @@ -42,15 +42,27 @@ <%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> + + <%= select('page','frontend_style', @frontend_style, :selected => @item[:frontend_style], :include_blank => true ) rescue ''%> + <%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%> <%= select('page','tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, :selected => @item[:tag], :include_blank => true ) rescue ''%> + + <%= render 'frontend_fields' %> + +
+ <%= f.label :frontend_data_count, t('admin.frontend_data_count'), :class => 'control-label' %> +
+ <%= f.text_field :frontend_data_count %> +
+
<%= f.label :is_published, "#{t('admin.is_published')} ?", :class => 'control-label' %>
diff --git a/app/views/admin/pages/_frontend_fields.html.erb b/app/views/admin/pages/_frontend_fields.html.erb new file mode 100644 index 00000000..ce042ddd --- /dev/null +++ b/app/views/admin/pages/_frontend_fields.html.erb @@ -0,0 +1,11 @@ + + <% if (@module_app && @module_app.widget_fields) %> + <%= label_tag('frontend_field & frontend_field_type') %> + <% @module_app.widget_fields.each_with_index do |frontend_field, i| %> + <%= i+1 %> + <%= select_tag "page[frontend_field][]", options_for_select(@module_app.widget_fields.collect{|frontend_field| [frontend_field.humanize, frontend_field]}, (@item[:frontend_field][i][0] if (@item && !@item[:frontend_field].blank? && !@item[:frontend_field][i].blank?)) ), :include_blank => true %> + <%= select_tag "page[frontend_field_type][]", options_for_select(LIST[:widget_field_type].collect{|frontend_field| [frontend_field.humanize, frontend_field]}, (@item[:frontend_field][i][1] if (@item && !@item[:frontend_field].blank? && !@item[:frontend_field][i].blank?)) ), :include_blank => true %>
+ <% end %> + <% end %> + + \ No newline at end of file diff --git a/app/views/admin/sites/site_info.html.erb b/app/views/admin/sites/site_info.html.erb index e19307ca..1dccac31 100644 --- a/app/views/admin/sites/site_info.html.erb +++ b/app/views/admin/sites/site_info.html.erb @@ -1,3 +1,5 @@ +<% # encoding: utf-8 %> + <% content_for :side_bar do %> <%= render 'side_bar' %> <% end %> @@ -70,6 +72,24 @@ <% end %>
+
+ +
+ <%= f.file_field :default_image, :id => "input-upload", :class => 'upload', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %> + + + <% if @site.default_image %> + <%= image_tag( @site.default_image, :size=>"120x120") rescue ''%> + <% else %> + + <% end %> +
+ <% if @site.default_image.file %> + <%= f.check_box :remove_default_image %> + <%= t('刪除已上傳檔案') %> + <% end %> +
+
<% end %> <% end %> diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index e6954af6..c6b5cf5c 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -67,7 +67,6 @@ <% end -%> <% end -%> - <%= content_tag :li, :class => active_for_controllers('orbit_galleries','/panel/gallery/back_end/tags') || active_for_app_auth("orbit_gallery") do -%> <%= link_to content_tag(:i, nil, :class => 'icons-picture') + t('admin.orbit_gallery'), panel_gallery_back_end_orbit_gallery_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('orbit_galleries') ) do -%> diff --git a/config/list.yml b/config/list.yml index ef95ba31..f723c5ff 100644 --- a/config/list.yml +++ b/config/list.yml @@ -14,4 +14,27 @@ public_r_tags: page_part_kinds: - text - public_r_tag - - module_widget \ No newline at end of file + - module_widget + +widget_field: + - title + - category + - image + - date + - subtitle + - content + - link + - file + +widget_field_type: + - title + - category + - img + - date + - text + - link + - file + - status + - tag + - viewcount + - poster \ No newline at end of file diff --git a/config/mongoid.yml b/config/mongoid.yml index f333e2e6..0b1bf1bc 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -9,7 +9,6 @@ defaults: &defaults development: <<: *defaults database: prototype_r4_development - test: <<: *defaults database: prototype_r4_test diff --git a/config/routes.rb b/config/routes.rb index 6d844c6d..b966652c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -97,6 +97,7 @@ Orbit::Application.routes.draw do resources :page_parts do member do get 'reload_widgets' + get 'reload_widget_styles' get 'reload_r_tag_options' end end diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index 32820a6f..18140aa1 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -187,7 +187,7 @@ module ParserCommon ret << part.i18n_variable[I18n.locale] rescue '' when 'module_widget' url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" - options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}" + options = "&category_id=#{!part[:category].blank? ? part[:category] : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&part_id=#{part.id}" ret << "
" when 'public_r_tag' ret << "" diff --git a/vendor/built_in_modules/announcement/announcement.json b/vendor/built_in_modules/announcement/announcement.json index b23ec572..7d68bc1e 100644 --- a/vendor/built_in_modules/announcement/announcement.json +++ b/vendor/built_in_modules/announcement/announcement.json @@ -1,12 +1,16 @@ { - "title": "announcement", + "title": "announcement", "version": "0.1", "organization": "Rulingcom", "author": "RD dep", "intro": "A simple blog……", "update_info": "Some info", "create_date": "11-11-2011", - "app_pages": ["bulletins"], - "widgets": ["bulletins", "bulletins_and_web_links"], - "enable_frontend": true + "app_pages": ["bulletins"], + "widgets": { + "index":["1","2","3","4","5"], + "bulletins_and_web_links":[] + }, + "widget_fields":["title","category","postdate"], + "enable_frontend": true } diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index 9fd97b9b..da67c0bb 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -9,17 +9,27 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController # GET /bulletins.xml def index + + @item = Page.find(params[:page_id]) + if @item.frontend_data_count + @page_num = @item.frontend_data_count + else + @page_num = 10 + end + + @frontend_style = @item.frontend_style + date_now = Time.now if !params[:category_id].blank? - @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) + @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil elsif !params[:tag_id].blank? @tag = AnnouncementTag.find(params[:tag_id]) rescue nil @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag - @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) + @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) else - @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(10) + @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) end end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb index 299dcec9..8d38802a 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb @@ -9,17 +9,62 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController # GET /bulletins.xml def index + + @part = PagePart.find(params[:part_id]) + + if @part.widget_data_count + @page_num = @part.widget_data_count + else + @page_num = 4 + end + + if @part.widget_field + @widget_fields = @part.widget_field + else + @widget_fields = [] + end + + @title = params[:part_title] + + @widget_style = @part.widget_style + + @category_id = @part.category + + date_now = Time.now + if !@category_id.blank? + @bulletins = Bulletin.can_display.where(:bulletin_category_id => @category_id).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num) + @current_category = BulletinCategory.from_id(@category_id) rescue nil + elsif !params[:tag_id].blank? + @tag = AnnouncementTag.find(params[:tag_id]) rescue nil + @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag + @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num) + else + @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num) + end + + get_categorys + + end + + def bulletins_list_and_pic + + if params[:widget_data_count] + @page_num = params[:widget_data_count]; + else + @page_num = 4; + end + @title = params[:part_title] date_now = Time.now if !params[:category_id].blank? - @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(4) + @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num) @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil elsif !params[:tag_id].blank? @tag = AnnouncementTag.find(params[:tag_id]) rescue nil @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag - @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(4) + @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num) else - @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(4) + @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num) end get_categorys diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index c515dc65..180cf67a 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -146,7 +146,7 @@ <%= I18nVariable.from_locale(locale) %> <%= f.text_field locale, :class=>'post-title' %> <% end %> - +
<%= f.label :subtitle %> @@ -275,6 +275,7 @@ <% content_for :page_specific_javascript do %> + <%= javascript_include_tag "bulletin_form" %> <%= javascript_include_tag "inc/jquery.imagesloaded.js" %> + +
<%= render 'index' %>
\ No newline at end of file diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb index 85614059..435a71ff 100644 --- a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb @@ -1,4 +1,7 @@ <%# encoding: utf-8 %> +// refresh the imagesArray +// viewonly tags + $.extend($.expr[':'], { 'containsi': function (elem, i, match, array) { return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; @@ -160,9 +163,10 @@ var galleryAPI = function(){ $.each(categories,function(x,category){ $.each(category,function(i,album){ if(album.cover == "default") - var $img = $("
"+album.name+"
"); + var $img = $("
"+album.name+""+album.category_name+"
"); else - var $img = $("
"+album.name+"
"); + var $img = $("
"+album.name+""+album.category_name+"
"); + var tag_string = ""; for(tag in album.tag_names){ tag_string+= '' + album.tag_names[tag] + ''; @@ -514,20 +518,26 @@ var galleryAPI = function(){ // }) }) + var tag_panel_hidden = true; + var last_clicked = null; $('.bt-tag').click(function(){ - $(this).toggleClass("active"); + var $tag_panel = $('#tag_panel'), tag_panel_position = 0; - - if( $tag_panel.css('right') == '0px' ){ - tag_panel_position = -200; - } + if( $tag_panel.css('right') == '0px' ){ + tag_panel_position = -200; + } + if(last_clicked == $(this)) + alert("same") + else + alert("no") $tag_panel.animate({'right':tag_panel_position}, 300); g.albumArea .delay(200) .animate({'margin-right':tag_panel_position+200},300); + return false; }); g.albumArea.find("#tag_search_box").keyup(function(e){ diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb new file mode 100644 index 00000000..4f7a068a --- /dev/null +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb @@ -0,0 +1,617 @@ +<%# encoding: utf-8 %> +$.extend($.expr[':'], { + 'containsi': function (elem, i, match, array) { + return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; + } +}); +var galleryAPI = function(){ + g = this; + this.urlVars = rcom.getUrlVars(); + this.albumArea = $("#orbit_gallery"); + this.loadArea = null; + this.tagList = $("ul#gallery_tag_list"); + // this.authenticated = false; + this.initialize = function(callbackFn){ + $(document).ready(function(){ + bindHandlers(); + var passid = null; + if(typeof g.urlVars['cat']!= "undefined"){ + g.loadArea = "albums"; + passid = g.urlVars['cat']; + g.loadAlbums(g.urlVars['cat']); + }else if(typeof g.urlVars['album']!= "undefined"){ + g.loadArea = "images"; + passid = g.urlVars['album']; + g.loadImages(g.urlVars['album']); + }else if(typeof g.urlVars['theater']!= "undefined"){ + g.loadArea = "theater"; + passid = g.urlVars['theater']; + g.loadTheater(g.urlVars['theater']); + }else if(typeof g.urlVars['edit']!= "undefined"){ + g.loadArea = "edit"; + passid = g.urlVars['edit']; + g.editAlbum(g.urlVars['edit']); + }else if(typeof g.urlVars['tag']!= "undefined"){ + g.loadArea = "albums"; + passid = g.urlVars['tag']; + g.loadAlbums(g.urlVars['tag']); + }else if(g.urlVars["locale"]){ + g.loadArea = "albums"; + g.loadAlbums("all"); + }else if(g.urlVars.length == 0) { + g.loadArea = "albums"; + g.loadAlbums("all"); + } + if(typeof callbackFn == "function"){ + callbackFn.call(this,g.loadArea,passid); + } + }) + var bindHandlers = function(){ + $("#filter .filter_btns a").click(function(){ + if(!$(this).hasClass("active")){ + $(this).addClass("active"); + if(g.urlVars.length == 0) + window.location = "orbit_gallery?" + $(this).attr("href"); + else + window.location = window.location.href +"&"+ $(this).attr("href"); + }else{ + $(this).removeClass("active"); + var loc = window.location.href; + var url = loc.replace($(this).attr("href")+"&",""); + if(url == loc) + url = loc.replace($(this).attr("href"),""); + + if(url.charAt(url.length-1)=="&" || url.charAt(url.length-1)=="?") + url = url.substr(0,url.length-1); + window.location = url; + } + }) + + } + $("#filter .filter-clear a").click(function(){ + var loc = window.location.href; + var url = null; + var forwhat = $(this).attr("for"); + $("#filter ."+forwhat+" a.active").each(function(){ + $(this).removeClass("active"); + url = loc.replace($(this).attr("href")+"&",""); + if(url == loc) + url = loc.replace($(this).attr("href"),""); + + if(url.charAt(url.length-1)=="&" || url.charAt(url.length-1)=="?") + url = url.substr(0,url.length-1); + loc = url; + }) + window.location = url; + }) + } + this.makeNewAlbum = function(){ + $.get("add_album",function(html){ + rcom.modalWindow({loadHtml:html,width:400,height:320,"closeBtn":false},function(dom){ + dom.find("#album_name_save_btn").click(function(){ + var options ={ + cid : dom.find("select#category_list").val(), + albumname : { + "en" : dom.find("#name_en").val(), + "zh_tw" : dom.find("#name_zh_tw").val() + }, + albumdesc : { + "en" : dom.find("#desc_en").val(), + "zh_tw" : dom.find("#desc_zh_tw").val() + } + } + if(options.cid){ + $.post("create_album",options,function(response){ + if(g.loadArea == "albums") + g.loadAlbums("all"); + rcom.modalWindowClose(); + }) + } + }) + dom.find("#album_name_close_btn").click(function(){ + rcom.modalWindowClose(); + }) + }) + + }) + } + this.deleteAlbum = function(id){ + if(confirm("<%= I18n.t('gallery.del_album?') %>")){ + $.post("delete_album",{aid:id},function(){ + window.location = "orbit_gallery"; + }) + } + } + + this.loadAlbums = function(id){ + g.loadFooterPanel(g.loadArea,id,function(headbtn){ + headbtn = $(headbtn); + headbtn.click(function(){g.makeNewAlbum();}) + g.albumArea.find(".rghead .rgfn").html(headbtn); + }) + + g.albumArea.addClass('o_gallery'); + g.albumArea.find("#imgholder").empty(); + // var $addsign = $(''); + // $addsign.find("a").click(function(){g.makeNewAlbum();}) + + if(id!="all"){ + var cids = []; + var tids = []; + var href = null; + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); + for(var i = 0; i < hashes.length; i++){ + hash = hashes[i].split('='); + if(hash[0]=="cat"){ + cids.push(hash[1]); + href = "cat="+hash[1]; + }else if(hash[0]=="tag"){ + tids.push(hash[1]); + href = "tag="+hash[1]; + } + $("#filter .filter_btns a[href='"+href+"']").addClass("active"); + } + if(cids.length == 0) + cids = "all"; + }else{ + var cids = "all"; + } + $.getJSON("panel/gallery/front_end/get_albums",{cid:cids,tid:tids,"inner":true},function(categories){ + $.each(categories,function(x,category){ + $.each(category,function(i,album){ + if(album.cover == "default") + var $img = $("
"+album.name+""+album.category_name+"
"); + else + var $img = $("
"+album.name+""+album.category_name+"
"); + var tag_string = ""; + for(tag in album.tag_names){ + tag_string+= '' + album.tag_names[tag] + ''; + } + $img.find(".tagnames").html(tag_string); + g.albumArea.find("#imgholder").append($img); + }) + }) + // g.albumArea.find("#imgholder").append($addsign); + }) + } + this.loadImages = function(id){ + var panelopen = false; + g.loadFooterPanel(g.loadArea,id,function(headerPanel){ + headarea = $(headerPanel); + g.albumArea.find(".rghead .rgfn").html(headarea); + $('.bt-tag').click(function(){ + $(this).toggleClass("active"); + var $tag_panel = $('#tag_panel'), + tag_panel_position = 0; + + if( $tag_panel.css('right') == '0px' ){ + tag_panel_position = -200; + } + $tag_panel.animate({'right':tag_panel_position}, 300); + + g.albumArea + .delay(200) + .animate({'margin-right':tag_panel_position+200},300); + return false; + }); + g.albumArea.find("#tag_search_box").keyup(function(e){ + sval = $(this).val(); + if(sval == "<%= I18n.t('gallery.search_tags') %>") + sval = ""; + sval = sval.replace(/(^\s*)|(\s*$)/g,''); + if(sval){ + var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range + var re2 = new RegExp("^[\uE7C7-\uE7F3]*$"); + if ((re1.test(sval) && (re2.test(sval)))){ + $("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp(); + }else{ + $("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp(); + } + }else{ + $("#gallery_tag_list li").slideDown(); + } + }) + g.albumArea.find("#tag_panel .bt-save").click(function(){ + g.saveTags(id,g.loadArea); + }) + g.albumArea.find(".rghead .rgfn .bt-add").click(function(){ + showUploadPanel(); + }) + g.albumArea.find(".rghead .rgfn .bt-del").click(function(){ + g.deleteAlbum(id); + }) + }) + var uploadpanel = $(''); + var frame = $(''); + uploadpanel.find(".bt-cls").click(function(){ + uploadpanel.hide("slide"); + frame.remove(); + g.loadImages(id); + panelopen = false; + }) + var showUploadPanel = function(){ + if(!panelopen){ + uploadpanel.prepend(frame); + uploadpanel.show("slide"); + panelopen = true; + } + } + + g.albumArea.addClass('o_album'); + g.albumArea.find(".rghead .rgfn").append(uploadpanel); + g.albumArea.find("#imgholder").empty(); + $("#filter").remove(); + g.albumArea.css("margin-top",""); + // var $addsign = $(''); + // $addsign.find("a").click(function(){showUploadPanel();}) + $.getJSON("get_images",{aid:id},function(album){ + $.each(album.images,function(i,image){ + var thumb = image.file.thumb.url; + var $img = $("
"); + g.albumArea.find("#imgholder").append($img); + }) + g.tagList.find("input").attr("checked",false); + $.each(album.tags,function(i,tag){ + + g.tagList.find("li[data-content="+tag+"] input").attr("checked",true); + }) + // g.albumArea.find("#imgholder").append($addsign); + }) + // g.albumArea.find("#imgholder").append($addsign); + // tag + + } + this.loadTheater = function(id){ + var imageArray; + var imagecount = 0; + var picHeight = 0; + var bindHandlers = function(){ + var $slidelist = $('.slidelist'), + $rslide = $('.rslide'), + $rslidenav = $('.rslidenav'), + $img = $("#main_pic img"), + wHeight = $(window).height(); + + $("#main_pic").height(picHeight); + $img.height("100%"); + + $('.bt-tag').click(function(){ + if(!$(this).hasClass("active")) + updatePhotoTag(); + $(this).toggleClass("active"); + var $tag_panel = $('#tag_panel'), + tag_panel_position = 0; + + if( $tag_panel.css('right') == '0px' ){ + tag_panel_position = -200; + } + $tag_panel.animate({'right':tag_panel_position}, 300); + + g.albumArea + .delay(200) + .animate({'margin-right':tag_panel_position+200},300); + return false; + }); + var updatePhotoTag = function(){ + var tags = imageArray[imagecount].tag_ids; + g.tagList.find("input").attr("checked",false); + for(tag in tags){ + g.tagList.find("li[data-content="+tags[tag]+"] input").attr("checked",true); + } + } + g.albumArea.find("#tag_search_box").keyup(function(e){ + sval = $(this).val(); + if(sval == "<%= I18n.t('gallery.search_tags') %>") + sval = ""; + sval = sval.replace(/(^\s*)|(\s*$)/g,''); + if(sval){ + var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range + var re2 = new RegExp("^[\uE7C7-\uE7F3]*$"); + if ((re1.test(sval) && (re2.test(sval)))){ + $("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp(); + }else{ + $("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp(); + } + + }else{ + $("#gallery_tag_list li").slideDown(); + } + }) + g.albumArea.find("#tag_panel .bt-save").click(function(){ + g.saveTags(imageArray[imagecount]._id,g.loadArea); + }) + $(".slidectrl a.togglelist").click(function(){ + var rslide_h = $rslide.outerHeight(); + if ( $slidelist.height() < 1 ){ + $slidelist.stop().animate({'height':rslide_h - 30}, 300); + $slidelist.find("ul").show(); + } else { + $slidelist.stop().animate({'height':'0px'}, 300); + $slidelist.find("ul").hide(); + } + }) + $(".slidectrl .togglescreen").click(function(){ + toggleFullscreen(); + }) + $(".slidectrl .browserfullscreen").click(function(){ + browserFullScreen(); + }) + $slidelist.find(".list_element").click(function(){ + imagecount = parseInt($(this).parent().attr("for")); + changeImage($(this)); + }) + $rslidenav.find(".navN").click(function(){ + nextpic($(this)); + }) + $rslidenav.find("a.navP").click(function(){ + prevpic($(this)); + }) + $("#nextpic").click(function(){ + nextpic($(this)); + }) + + $(document).keydown(function(e){ + if (e.keyCode == 37){ + prevpic($rslidenav.find(".navP")); + return false; + } + if(e.keyCode == 39){ + nextpic($rslidenav.find(".navN")); + return false; + } + if(e.keyCode == 27){ + toggleFullscreen(); + $rslide.removeClass('browserFullScreen'); + return false; + } + if(e.keyCode == 70 || e.keyCode == 102){ + if($rslide.hasClass("fullscreen")) + browserFullScreen(); + } + }); + var browserFullScreen = function(){ + var el = document.documentElement, + rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen; + rfs.call(el); + $rslide.addClass('browserFullScreen'); + } + var nextpic = function(dom){ + if(imagecount == imageArray.length - 1) + imagecount = 0; + else + imagecount++; + changeImage(dom); + } + var prevpic = function(dom){ + if(imagecount == 0) + imagecount = imageArray.length - 1 + else + imagecount--; + changeImage(dom); + } + var toggleFullscreen = function(){ + if($rslide.hasClass("fullscreen")){ + $rslide.css("position","relative"); + $rslide.removeClass("fullscreen"); + $(".slidectrl .browserfullscreen").hide(); + $img.css({"padding":""}) + $("#main_pic").height(picHeight ); + }else{ + $("#main_pic").height(wHeight); + // $img.height("100%"); + $rslide.css("position",""); + $rslide.addClass("fullscreen"); + $img.css({"padding":($rslide.height()-$img.height())/2}) + $(".slidectrl .browserfullscreen").show(); + } + } + var changeImage = function(dom){ + var pageurl = dom.attr('href'); + $img.fadeOut(200,function(){ + $img.attr({"src":dom.attr("data-content"),"height":picHeight+"px"}); + $img.fadeIn(200); + if($rslide.hasClass("fullscreen")){ + $img.css({"padding":($rslide.height()-$img.height())/2}) + } + $slidelist.stop().animate({'height':'0px'}, 300); + $slidelist.find("ul").hide(); + if(pageurl!=window.location){ + window.history.pushState({path:pageurl},'',pageurl); + } + // $(".slideinfo b.info").text(imageArray[imagecount].title); + if($('.bt-tag').hasClass("active")) + updatePhotoTag(); + $(".slideinfo .info").text(imageArray[imagecount].description); + if(imageArray.length > 1) + updateNavigation(); + }) + + } + var updateNavigation = function(){ + var next, prev; + if(imagecount == 0){ + next = 1; + prev = imageArray.length - 1; + }else if(imagecount == imageArray.length - 1){ + next = 0 + prev = imageArray.length - 2; + }else{ + next = imagecount + 1; + prev = imagecount - 1; + } + $(".navN").attr({"href":"orbit_gallery?theater="+imageArray[next]._id,"data-content":imageArray[next].file.url}); + $(".navP").attr({"href":"orbit_gallery?theater="+imageArray[prev]._id,"data-content":imageArray[prev].file.url}); + }; + if(imageArray.length > 1) + updateNavigation(); + } + + var preparestage = function(albumid){ + $.getJSON("get_images",{aid:albumid},function(album){ + imageArray = eval(album.images); + $.each(album.images,function(i,image){ + if(image._id == id) + imagecount = i; + }) + bindHandlers(); + }) + } + g.albumArea.find("#imgholder").load("theater?pic="+id,function(theater,response,xhr){ + if(xhr.status == 404){ + $(this).text("<%= I18n.t('gallery.pic_not_found') %>."); + return false; + } + $("#filter").remove(); + g.albumArea.css("margin-top",""); + var albumid = $(theater).find("#main_pic").attr("data-content"); + g.loadFooterPanel(g.loadArea,id,function(head){ + head = $(head); + g.albumArea.find(".rghead .rgfn").html(head); + g.albumArea.find(".bt-back").attr("href","orbit_gallery?album="+albumid); + g.albumArea.find(".bt-edit").attr("href","orbit_gallery?edit="+albumid); + }) + g.albumArea.css("margin-bottom","0"); + picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight()); + preparestage(albumid); + + }); + } + + this.editAlbum = function(id){ + var bindHandlers = function(){ + $(".nav .nav-tabs a").click(function(){ + $(".tab_content .tab-pane").hide(); + + }) + $(".description_loader .edit_fn .bt-cover").click(function(){ + $(".bt-cover").removeClass("setcover"); + $(this).addClass("setcover"); + $.post("set_cover",{"imageid":$(this).attr("href"),"aid":id},function(){}) + }) + $(".description_loader .edit_fn .bt-dels").click(function(){ + $(this) + .toggleClass("setdelete btn-danger active") + .find('span').toggleClass('icon-white'); + if($(".description_loader .edit_fn .setdelete").length > 0){ + g.albumArea.find(".rghead .rgfn .bt-delete").show(); + }else{ + g.albumArea.find(".rghead .rgfn .bt-delete").hide(); + } + }) + g.albumArea.find(".rghead .rgfn .bt-save").click(function(){ + // var dataArray = Array(); + // $(".description_loader .en .txtchange").each(function(){ + // var thisid = $(this).attr("for"); + // dataArray.push({"id":thisid,"text":{"en":$(this).val(),"zh_tw":$(".description_loader .zh_tw .txtchange[for="+thisid+"]").val()}}); + // }) + // var albumnm = Array(); + // $(".albumname_edit .txtchange").each(function(){ + // albumnm.push($(this).val()) + // }) + // var dataArray = $("form#edit_album").serialize(); + // $.post("update_album",{"data":dataArray},function(){ + + // }) + + }) + $('.bt-tag').click(function(){ + + $(this).toggleClass("active"); + var $tag_panel = $('#tag_panel'), + tag_panel_position = 0; + + if( $tag_panel.css('right') == '0px' ){ + tag_panel_position = -200; + } + $tag_panel.animate({'right':tag_panel_position}, 300); + + g.albumArea + .delay(200) + .animate({'margin-right':tag_panel_position+200},300); + return false; + }); + g.albumArea.find("#tag_search_box").keyup(function(e){ + sval = $(this).val(); + if(sval == "<%= I18n.t('gallery.search_tags') %>") + sval = ""; + sval = sval.replace(/(^\s*)|(\s*$)/g,''); + if(sval){ + var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range + var re2 = new RegExp("^[\uE7C7-\uE7F3]*$"); + if ((re1.test(sval) && (re2.test(sval)))){ + $("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp(); + }else{ + $("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp(); + } + + }else{ + $("#gallery_tag_list li").slideDown(); + } + }) + g.albumArea.find("#tag_panel .bt-save").click(function(){ + g.saveTags(imageArray[imagecount]._id,g.loadArea); + }) + var tempval; + $(".txtchange").focus(function(){ + tempval = $(this).val(); + }).keyup(function(){ + if($(this).val() != tempval) + g.albumArea.find(".rghead .rgfn .bt-save").show(); + }) + g.albumArea.find(".rghead .rgfn .bt-delete").click(function(){ + var images_to_delete = new Array(); + var delete_cover = false; + var doms_to_delete = new Array(); + var thiscover = $(".description_loader .edit_fn .setcover").attr("href"); + $(".description_loader .edit_fn .bt-dels").each(function(){ + if($(this).hasClass("setdelete")){ + images_to_delete.push($(this).attr("href")); + doms_to_delete.push($(this).parent().parent()); + if(thiscover == $(this).attr("href")) + delete_cover = true; + } + }) + if(confirm("Deleting "+images_to_delete.length+" image(s)?")){ + $.post("delete_images",{"images":images_to_delete,"delete_cover":delete_cover,"aid":id},function(response){ + if(response.success){ + for(dom in doms_to_delete){ + doms_to_delete[dom].hide("slide",function(){$(this).remove();}) + } + } + g.albumArea.find(".rghead .rgfn .bt-delete").hide(); + }) + } + }) + } + $("#filter").remove(); + g.albumArea.addClass('o_album_edit'); + g.albumArea.css("margin-top",""); + var head ='"><%= I18n.t("gallery.back_to_photos") %>
'; + head+=''; + head+=''; + g.albumArea.find(".rghead .rgfn").html(head); + g.albumArea.find("#imgholder").load("edit_album?aid="+id,function(data,response,xhr){ + if(xhr.status == 404){ + $(this).text("<%= I18n.t('gallery.album_not_found') %>"); + return false; + } + bindHandlers(); + }) + } + this.saveTags = function(id,tagsfor){ + var tagids = new Array(); + g.tagList.find("li input:checked").each(function(){ + tagids.push($(this).parent().attr("data-content")); + }) + var tag = null; + if(g.loadArea == "images") + tag = "album"; + else if(g.loadArea == "theater") + tag = "pic"; + + $.post("save_tags",{"id":id,"tag":tag,"tids":tagids},function(){ + + }) + } +} +galleryAPI.prototype.locale = "en"; diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb index 2bd9a94a..dcd99cb0 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/orbit_galleries_controller.rb @@ -90,24 +90,20 @@ include AdminHelper end end end - i = 0 + @output = Array.new @albums.each do |album| + @albs = Array.new album.each do |values| - # if values.tag_ids.kind_of?(Array) tags = Array.new - values.tag_ids.each do |tag| - tags << GalleryTag.find(tag)[I18n.locale] - end - # end - values.tag_names = tags - values.save + values.tag_ids.each do |tag| + tags << GalleryTag.find(tag)[I18n.locale] + end + category = GalleryCategory.find(values.gallery_category_id).name + @albs << {"_id"=>values.id,"cover"=>values.cover,"cover_path"=>values.cover_path,"description"=>values.description,"category_name"=>category,"gallery_category_id" => values.gallery_category_id,"name"=>values.name,"tag_ids"=>values.tag_ids,"tag_names"=>tags} end - i = i + 1 + @output << @albs end - # @albums = GalleryAlbum.find("5017a7babd98eb049900000a") - # @albums.update_attributes({:tag_ids =>["501ba786bd98eb0232000126"]}) - - render :json=>@albums.to_json + render :json=>@output.to_json end def upload_image diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/orbit_galleries_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/orbit_galleries_controller.rb new file mode 100644 index 00000000..5f47d692 --- /dev/null +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/orbit_galleries_controller.rb @@ -0,0 +1,228 @@ +class Panel::Gallery::FrontEnd::OrbitGalleriesController < OrbitWidgetController +include AdminHelper + def index + @authenticated = false + @categorylist = GalleryCategory.all + @cid = params['cat'] + @tags = GalleryTag.all + end + + def new_category + names = params['category'] + category = GalleryCategory.new + I18n.locale = :en + category.name = names['en'] + I18n.locale = :zh_tw + category.name = names['zh_tw'] + category.save! + render :json=>{"success"=>true,"id"=>category.id}.to_json + end + + def categorylist + @categorylist = GalleryCategory.all + #render :layout => false + end + + def gallery_category_delete + @category = GalleryCategory.find(params['id']) + @category.delete + render :json=>{"success"=>"true"}.to_json + end + + def add_album + if is_manager? || is_admin? + @categorylist = GalleryCategory.all + elsif is_sub_manager? + @categorylist = GalleryCategory.authed_for_user(current_user,"new_album") + end + render :layout => false + end + + def create_album + category = GalleryCategory.find(params['cid']) + albumnames = params["albumname"] + albumdescs = params["albumdesc"] + album = category.gallery_albums.new + I18n.locale = :en + album.name = albumnames["en"] + album.description = albumdescs["en"] + I18n.locale = :zh_tw + album.name = albumnames["zh_tw"] + album.description = albumdescs["zh_tw"] + album.save! + #x = category.gallery_albums.create({name: params['albumname'],description: params['albumdesc']}) + render :json=>{"success"=>true,"id"=>album.id}.to_json + end + + def get_albums + @categoryids = params["cid"] + @tags = params["tid"] + @albums = Array.new + if @categoryids == "all" + if @tags + if @tags.kind_of?(Array) + @tags.each do |tag| + @albums << GalleryAlbum.where(tag_ids: tag) + end + else + @albums << GalleryAlbum.where(tag_ids: @tags) + end + else + @albums << GalleryAlbum.all + end + else + @categoryids.each do |id| + category = GalleryCategory.find(id) + if @tags + if @tags.kind_of?(Array) + @tags.each do |tag| + @albums << category.gallery_albums.where(tag_ids: tag) + end + else + @albums << category.gallery_albums.where(tag_ids: @tags) + end + else + @albums << category.gallery_albums.all + end + end + end + i = 0 + @albums.each do |album| + album.each do |values| + # if values.tag_ids.kind_of?(Array) + tags = Array.new + values.tag_ids.each do |tag| + tags << GalleryTag.find(tag)[I18n.locale] + end + # end + values.tag_names = tags + values.save + end + i = i + 1 + end + # @albums = GalleryAlbum.find("5017a7babd98eb049900000a") + # @albums.update_attributes({:tag_ids =>["501ba786bd98eb0232000126"]}) + + render :json=>@albums.to_json + end + + def upload_image + albumid = params['aid']; + @album = GalleryAlbum.find(albumid) + @files = params['files'] + a = Array.new + @files.each do |file| + @image = @album.gallery_images.new + @image.file = file + @image.save! + a << {"thumbnail_url"=>@image.file.thumb.url} + end + render :json=>a.to_json + end + + def upload_panel + render :layout => false + end + + def get_images + @album = GalleryAlbum.find(params["aid"]) + render :json=>{"images" => @album.gallery_images.all, "tags" => @album.tag_ids}.to_json + end + + def theater + picid = params["pic"] + @image = GalleryImage.find(picid) + @albumid = @image.gallery_album_id + album = GalleryAlbum.find(@albumid) + @images = album.gallery_images.all + render :layout=>false + end + + def delete_album + aid = params['aid'] + album = GalleryAlbum.find(aid) + album.delete + render :json =>{"success"=>true}.to_json + end + + def edit_album + if is_manager? || is_admin? || is_sub_manager? + aid = params['aid'] + album = GalleryAlbum.find(aid) + @images = album.gallery_images.all + @album_name = album.name_translations + @cover = album.cover + render :layout => false + end + end + + def set_cover + aid = params['aid'] + album = GalleryAlbum.find(aid) + image = GalleryImage.find(params[:imageid]) + album.update_attributes({:cover_path => image.file.thumb.url, :cover=>params[:imageid]}) + render :json =>{"success"=>true}.to_json + end + + def delete_images + images = params['images'] + images.each do |image| + img = GalleryImage.find(image) + img.delete + end + if params['delete_cover'] == "true" + album = GalleryAlbum.find(params['aid']) + album.update_attributes(:cover=>"default") + end + render :json =>{"success"=>true}.to_json + end + + def update_album + # data = params['data'] + # album_name = params['name'] + # aid = params['aid'] + # data.each do |d| + # image = GalleryImage.find(d[1][:id]) + # image.update_attributes(:description=>d[1][:text]) + # end + # album = GalleryAlbum.find(aid) + # album.update_attributes(:name => album_name) + album_names = params[:albumnm] + data = params[:data] + aid =params[:aid] + debugger + data.each do |d| + image = GalleryImage.find(d[1][:id]) + @site_valid_locales.each do |locale| + image.description_translations[locale] = d[1][:text][locale] + end + image.save! + end + + album = GalleryAlbum.find(aid) + + @site_valid_locales.each_with_index do |locale,i| + album.name_translations[locale] = album_names[i] + end + album.save! + + render :json =>{"success"=>true}.to_json + end + + def save_tags + case params[:tag] + when "album" + @object = GalleryAlbum.find(params[:id]) + when "pic" + @object = GalleryImage.find(params[:id]) + end + @object.update_attributes({:tag_ids => params[:tids]}) + render :json => {"success"=> "true"}.to_json + end +end + + + + + + diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/edit_album.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/edit_album.html.erb index 3291942f..3cef3544 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/edit_album.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/orbit_galleries/edit_album.html.erb @@ -27,7 +27,7 @@
- +
<% if image.id.to_s == @cover %> diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/add_album.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/add_album.html.erb new file mode 100644 index 00000000..7af4f761 --- /dev/null +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/orbit_galleries/add_album.html.erb @@ -0,0 +1,34 @@ +