Merge for new timeline updates and font updates

This commit is contained in:
Harry Bomrah 2012-07-04 18:49:10 +08:00
commit f635f642fc
604 changed files with 26661 additions and 2981 deletions

3
.gitignore vendored
View File

@ -10,8 +10,7 @@ uploads/**/*
*.swp
public/javascripts
public/stylesheets
public/assets
config/application.rb
.rvmrc

13
Gemfile
View File

@ -10,15 +10,20 @@ gem 'devise', '1.5.3'
gem 'exception_notification' # Send error trace
gem 'execjs'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'kaminari'
gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
gem 'mini_magick'
gem 'mongoid'
gem 'mongoid-tree', :require => 'mongoid/tree'
gem "mongo_session_store-rails3"
gem 'nokogiri'
gem 'radius'
gem 'rake'
gem 'resque' # background jobs
gem 'resque-scheduler' # job scheduling
gem 'resque-restriction'
gem 'ruby-debug19'
gem 'rubyzip'
gem 'sinatra'
@ -29,6 +34,8 @@ gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")
gem 'mongoid-encryptor', :require => 'mongoid/encryptor'
#gem 'contacts'
gem "impressionist", :require => "impressionist", :path => "vendor/impressionist"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
@ -39,7 +46,7 @@ end
group :test, :development do
#gem 'spork'
gem 'spork'
gem 'database_cleaner' #Strategies for cleaning databases. Can be used to ensure a clean state for testing.
gem "rspec", "~> 2.0"
gem "rspec-rails", "~> 2.0"
@ -48,7 +55,7 @@ group :test, :development do
gem "simplecov"
gem "delorean"
gem "watchr"
#gem "spork"
gem "spork"
# gem "capybara"
# gem 'yard'
# gem "bluecloth"

View File

@ -84,16 +84,15 @@ GEM
hike (1.2.1)
hoe (2.16.1)
rake (~> 0.8)
httpclient (2.2.5)
i18n (0.6.0)
jquery-rails (1.0.19)
railties (~> 3.0)
thor (~> 0.14)
jquery-ui-rails (0.4.0)
jquery-rails
railties (>= 3.1.0)
json (1.6.5)
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
libv8 (3.3.10.4)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
mail (2.3.3)
@ -116,6 +115,8 @@ GEM
activesupport (~> 3.0)
encrypted_strings (~> 0.3.3)
mongoid (~> 2)
mongoid-tree (0.7.0)
mongoid (~> 2.0)
multi_json (1.1.0)
nokogiri (1.5.2)
nokogiri (1.5.2-x86-mingw32)
@ -154,6 +155,20 @@ GEM
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
redis (2.2.2)
redis-namespace (1.0.3)
redis (< 3.0.0)
resque (1.20.0)
multi_json (~> 1.0)
redis-namespace (~> 1.0.2)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
resque-restriction (0.3.0)
resque (>= 1.7.0)
resque-scheduler (1.9.9)
redis (>= 2.0.1)
resque (>= 1.8.0)
rufus-scheduler
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
@ -183,6 +198,8 @@ GEM
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
rubyzip (0.9.6.1)
rufus-scheduler (2.0.16)
tzinfo (>= 0.3.23)
ruport (1.6.3)
fastercsv
pdf-writer (= 1.1.8)
@ -202,13 +219,14 @@ GEM
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
spork (0.9.0)
spork (0.9.0-x86-mingw32)
win32-process
sprockets (2.0.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
subexec (0.2.1)
therubyracer (0.10.1)
libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
tinymce-rails (3.4.8)
@ -222,9 +240,19 @@ GEM
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
vegas (0.1.11)
rack (>= 1.0.0)
warden (1.1.1)
rack (>= 1.0)
watchr (0.7)
win32-api (1.4.8-x86-mingw32)
win32-process (0.6.5)
windows-pr (>= 1.1.2)
windows-api (0.4.1)
win32-api (>= 1.4.5)
windows-pr (1.2.1)
win32-api (>= 1.4.5)
windows-api (>= 0.3.0)
PLATFORMS
ruby
@ -242,16 +270,22 @@ DEPENDENCIES
exception_notification
execjs
factory_girl_rails
impressionist!
jquery-rails
kaminari
jquery-ui-rails
kaminari!
mini_magick
mongo_session_store-rails3
mongoid
mongoid-encryptor
mongoid-tree
nokogiri
radius
rails (>= 3.1.0, < 3.2.0)
rake
resque
resque-restriction
resque-scheduler
rspec (~> 2.0)
rspec-rails (~> 2.0)
ruby-debug19
@ -260,8 +294,8 @@ DEPENDENCIES
shoulda-matchers
simplecov
sinatra
spork
sprockets
therubyracer
tinymce-rails
uglifier
watchr

View File

@ -1,7 +1,9 @@
# /usr/bin/ruby -Ku
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'resque/tasks'
require 'rake/dsl_definition'
require 'rake'

View File

@ -1,79 +0,0 @@
.widget-size-300 {
width:298px;
}
.widget-box {
background-color: #FFF;
overflow: hidden;
min-width: 300px;
border: 1px solid #DDD;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
margin: 0 0 5px 5px;
position:relative;
}
.widget-box .widget-title {
background: #999;
color: #FFF;
padding-left: 5px;
border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
}
.widget-box .widget-content {
padding: 10px;
}
.widget-box .form-horizontal .control-group > label {
width: 50px;
}
.widget-box .form-horizontal .controls {
margin-left: 60px;
}
.widget-action {
position:absolute;
right:1px;
top:6px;
}
.action {
float: left;
display:inline-block;
margin-right: 5px;
opacity: 0.8;
filter: alpha(opacity=80);
}
.action:hover {
opacity: 1;
filter: alpha(opacity=100);
cursor: pointer;
}
.select-role {
display:none;
padding: 10px 0 0;
}
.file-upload {
position:relative;
}
.file-upload .file-name {
display: inline-block;
margin: 0 0 5px 5px;
white-space: nowrap;
width: 140px;
}
.file-upload .upload {
margin:0;
padding:0;
position:absolute;
top:0;
left:0;
opacity:.0;
filter: alpha(opacity=100);
}
.file-upload .upload:focus {
position:absolute;
}
.upload-picture {
margin-right: 5px;
}
#widget-link table {
margin-bottom:0
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
app/assets/images/Thumbs.db Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,4 +1,4 @@
$('#submit_button').live('click', function(){
$(document).on('click', '#ajax_form_submit', function(){
$('#ajaxForm').ajaxSubmit({
beforeSubmit: function(a,f,o) {
o.dataType = 'script';

View File

@ -6,23 +6,14 @@ $('.bulletin_files_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
$('.action a.remove_existing_record').live('click', function(){
$(document).on('click', '.action a.remove_existing_record', function(){
$(this).next('.should_destroy').attr('value', 1);
//$("#bulletin_" + $(this).prev().attr('value')).hide();
$("tr#bulletin_" + $(this).prev().attr('value')).hide();
$("tr #" + $(this).prev().attr('value')).hide();
});
$('.quick_edit_cancel').live('click', function(){
$(document).on('click', '.quick_edit_cancel', function(){
tr = $(this).attr('rel');
$('#' + tr).hide();
$("tr#bulletin_file_" + $(this).prev().attr('value')).hide();
$("tr#bulletin_link_" + $(this).prev().attr('value')).hide();
});
$(document).on('click', '.list-remove', function(){
$('#delete_bulletins').submit();
});
$(document).on('click', '#check_all_bulletins', function(){
$('.checkbox_in_list').attr("checked", this.checked);
});

View File

@ -7,7 +7,7 @@
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require jquery.tinyscrollbar.min
//= require jquery.tinyscrollbar
//= require jquery.miniColors.min
//= require bootstrap
//= require orbitdesktopAPI

View File

@ -66,7 +66,7 @@ $(document).ready(function(){
function getEvent(selet){
$.ajax({
type: "GET",
url: "/static/Other.xml",
url: "/static/nccu_calendar.xml",
dataType: "xml",
timeout: 1000,
error: function(xml){

View File

@ -0,0 +1,7 @@
jQuery(document).ajaxStart(function(){
$('<div class="modal-backdrop fade in" id="sys_modal"><img src="/assets/ajax-loader.gif" style="margin-top: 25%;margin-left: 50%;"></div>').appendTo('body');
});
jQuery(document).ajaxComplete(function(){
$("#sys_modal").hide().remove();
});

View File

@ -0,0 +1,137 @@
/*!
* jQuery imagesLoaded plugin v2.0.1
* http://github.com/desandro/imagesloaded
*
* MIT License. by Paul Irish et al.
*/
/*jshint curly: true, eqeqeq: true, noempty: true, strict: true, undef: true, browser: true */
/*global jQuery: false */
;(function($, undefined) {
'use strict';
// blank image data-uri bypasses webkit log warning (thx doug jones)
var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
$.fn.imagesLoaded = function( callback ) {
var $this = this,
deferred = $.isFunction($.Deferred) ? $.Deferred() : 0,
hasNotify = $.isFunction(deferred.notify),
$images = $this.find('img').add( $this.filter('img') ),
loaded = [],
proper = [],
broken = [];
function doneLoading() {
var $proper = $(proper),
$broken = $(broken);
if ( deferred ) {
if ( broken.length ) {
deferred.reject( $images, $proper, $broken );
} else {
deferred.resolve( $images );
}
}
if ( $.isFunction( callback ) ) {
callback.call( $this, $images, $proper, $broken );
}
}
function imgLoaded( img, isBroken ) {
// don't proceed if BLANK image, or image is already loaded
if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) {
return;
}
// store element in loaded images array
loaded.push( img );
// keep track of broken and properly loaded images
if ( isBroken ) {
broken.push( img );
} else {
proper.push( img );
}
// cache image and its state for future calls
$.data( img, 'imagesLoaded', { isBroken: isBroken, src: img.src } );
// trigger deferred progress method if present
if ( hasNotify ) {
deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] );
}
// call doneLoading and clean listeners if all images are loaded
if ( $images.length === loaded.length ){
setTimeout( doneLoading );
$images.unbind( '.imagesLoaded' );
}
}
// if no images, trigger immediately
if ( !$images.length ) {
doneLoading();
} else {
$images.bind( 'load.imagesLoaded error.imagesLoaded', function( event ){
// trigger imgLoaded
imgLoaded( event.target, event.type === 'error' );
}).each( function( i, el ) {
var src = el.src;
// find out if this image has been already checked for status
// if it was, and src has not changed, call imgLoaded on it
var cached = $.data( el, 'imagesLoaded' );
if ( cached && cached.src === src ) {
imgLoaded( el, cached.isBroken );
return;
}
// if complete is true and browser supports natural sizes, try
// to check for image status manually
if ( el.complete && el.naturalWidth !== undefined ) {
imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 );
return;
}
// cached images don't fire load sometimes, so we reset src, but only when
// dealing with IE, or image is complete (loaded) and failed manual check
// webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
if ( el.readyState || el.complete ) {
el.src = BLANK;
el.src = src;
}
});
}
return deferred ? deferred.promise( $this ) : $this;
};
})(jQuery);
$(document).ready(function() {
$('.upload-picture').find('img').imagesLoaded(function(){
var picH = $('.upload-picture').width()/$('.upload-picture').find('img').width()*$('.upload-picture').find('img').height();
var imgMarginTop = ($('.upload-picture').height()-picH)/2;
var d = $('.upload-picture').height();
if(imgMarginTop>0){
imgMarginTop = 0;
d = picH;
$('.upload-picture').css({height:d})
}
$('.upload-picture').find('img').css({marginTop:imgMarginTop})
$('.upload-picture').each(function (i){
$(this).mouseenter(function(){
var h= picH;
$(this).stop().animate({height:h}, 500);
$(this).find('img').stop().animate({marginTop:0}, 500);
});
$(this).mouseleave(function(){
$(this).stop().animate({height:d}, 500);
$(this).find('img').stop().animate({marginTop:imgMarginTop}, 500);
});
});
});
});

View File

@ -0,0 +1,20 @@
//Preview need a link in form as Ex and a corresponding PUT action in controller
//Ex preview trigger:
// <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%>
$(document).ready(function() {
$("a.preview_trigger").click(function(){
$("#main-wrap").after("<span id='show_preview'></span>");
$.ajax({
type: 'PUT',
url:$(this).attr("href"),
data:$(this).parents("form").serialize(),
success: function (msg) {
$("#"+start_modal_with_id).modal('show'); },
error: function(){
alert("ERROR");
}
});
return false;
});
});

View File

@ -1,4 +1,7 @@
$(document).ready(function() {
permissionCheckbox();
});
function permissionCheckbox(){
$('.check[checked="checked"]').parents(".checkbox").addClass("checked")
$(".checkbox").click(function(){
if($(this).children(".check").attr("checked")){
@ -16,4 +19,4 @@ $(document).ready(function() {
placement: 'bottom',
delay: { show: 100, hide: 300 },
});
});
};

View File

@ -8,24 +8,29 @@ $.extend($.expr[':'], {
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}
});
var interval,sval;
$(document).ready(function(){
$("#user_filter").keyup(function(){
if($(this).val()){
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").length
if(totalfoundbyname!=0){
$("div#users_checkbox_ary label.member-name:not(:containsi("+$(this).val()+"))").parent().parent().slideUp();
//$("div#users_checkbox_ary label.member-name:not(:containsi("+$(this).val()+"))").parent().popover('hide');
$("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").parent().parent().slideDown();
$("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").parent().popover('toggle');
}else if(totalfoundbyname==0){
$("div#users_checkbox_ary div.for_unit:not(:containsi("+$(this).val()+"))").parent().slideUp();
//$("div#users_checkbox_ary div.for_unit:not(:containsi("+$(this).val()+"))").popover('hide');
$("div#users_checkbox_ary div.for_unit:containsi("+$(this).val()+")").parent().slideDown();
$("div#users_checkbox_ary div.for_unit:containsi("+$(this).val()+")").popover('toggle');
}
}else{
$(".checkbox").popover('hide');
$("div.checkblock").slideDown();
$("#user_filter").keyup(function(e){
if((e.which>96 && e.which<123) || (e.which>64 && e.which<92) || (e.which == 32) || (e.which == 8)){
sval = $(this).val();
$(".checkbox").popover("hide");
$("div.checkblock").hide();
clearInterval(interval);
interval = setInterval(waitForSearch,1000);
}
})
})
var waitForSearch = function(){
if(sval){
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+sval+")").length
if(totalfoundbyname!=0){
$("div#users_checkbox_ary label.member-name:containsi("+sval+")").parent().parent().show();
}else if(totalfoundbyname==0){
$("div#users_checkbox_ary div.for_unit:containsi("+sval+")").parent().show();
}
}else{
$(".checkbox").popover('hide');
$("div.checkblock").show();
}
clearInterval(interval);
}

View File

@ -0,0 +1,211 @@
/*
* Tiny Scrollbar 1.8
* http://www.baijs.nl/tinyscrollbar/
*
* Copyright 2012, Maarten Baijs
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/gpl-2.0.php
*
* Date: 26 / 07 / 2012
* Depends on library: jQuery
*
*/
( function( $ )
{
$.tiny = $.tiny || { };
$.tiny.scrollbar = {
options: {
axis : 'y' // vertical or horizontal scrollbar? ( x || y ).
, wheel : 40 // how many pixels must the mouswheel scroll at a time.
, scroll : true // enable or disable the mousewheel.
, lockscroll : true // return scrollwheel to browser if there is no more content.
, size : 'auto' // set the size of the scrollbar to auto or a fixed number.
, sizethumb : 'auto' // set the size of the thumb to auto or a fixed number.
, onMove : function(){}
}
};
$.fn.tinyscrollbar = function( params )
{
var options = $.extend( {}, $.tiny.scrollbar.options, params );
this.each( function()
{
$( this ).data('tsb', new Scrollbar( $( this ), options ) );
});
return this;
};
$.fn.tinyscrollbar_update = function(sScroll)
{
return $( this ).data( 'tsb' ).update( sScroll );
};
function Scrollbar( root, options )
{
var oSelf = this
, oWrapper = root
, oViewport = { obj: $( '.viewport', root ) }
, oContent = { obj: $( '.overview', root ) }
, oScrollbar = { obj: $( '.scrollbar', root ) }
, oTrack = { obj: $( '.track', oScrollbar.obj ) }
, oThumb = { obj: $( '.thumb', oScrollbar.obj ) }
, sAxis = options.axis === 'x'
, sDirection = sAxis ? 'left' : 'top'
, sSize = sAxis ? 'Width' : 'Height'
, iScroll = 0
, iPosition = { start: 0, now: 0 }
, iMouse = {}
, touchEvents = ( 'ontouchstart' in document.documentElement ) ? true : false
;
function initialize()
{
oSelf.update();
setEvents();
return oSelf;
}
this.update = function( sScroll )
{
oViewport[ options.axis ] = oViewport.obj[0][ 'offset'+ sSize ];
oContent[ options.axis ] = oContent.obj[0][ 'scroll'+ sSize ];
oContent.ratio = oViewport[ options.axis ] / oContent[ options.axis ];
oScrollbar.obj.toggleClass( 'disable', oContent.ratio >= 1 );
oTrack[ options.axis ] = options.size === 'auto' ? oViewport[ options.axis ] : options.size;
oThumb[ options.axis ] = Math.min( oTrack[ options.axis ], Math.max( 0, ( options.sizethumb === 'auto' ? ( oTrack[ options.axis ] * oContent.ratio ) : options.sizethumb ) ) );
oScrollbar.ratio = options.sizethumb === 'auto' ? ( oContent[ options.axis ] / oTrack[ options.axis ] ) : ( oContent[ options.axis ] - oViewport[ options.axis ] ) / ( oTrack[ options.axis ] - oThumb[ options.axis ] );
iScroll = ( sScroll === 'relative' && oContent.ratio <= 1 ) ? Math.min( ( oContent[ options.axis ] - oViewport[ options.axis ] ), Math.max( 0, iScroll )) : 0;
iScroll = ( sScroll === 'bottom' && oContent.ratio <= 1 ) ? ( oContent[ options.axis ] - oViewport[ options.axis ] ) : isNaN( parseInt( sScroll, 10 ) ) ? iScroll : parseInt( sScroll, 10 );
setSize();
};
function setSize()
{
var sCssSize = sSize.toLowerCase();
oThumb.obj.css( sDirection, iScroll / oScrollbar.ratio );
oContent.obj.css( sDirection, -iScroll );
iMouse.start = oThumb.obj.offset()[ sDirection ];
oScrollbar.obj.css( sCssSize, oTrack[ options.axis ] );
oTrack.obj.css( sCssSize, oTrack[ options.axis ] );
oThumb.obj.css( sCssSize, oThumb[ options.axis ] );
}
function setEvents()
{
if( ! touchEvents )
{
oThumb.obj.bind( 'mousedown', start );
oTrack.obj.bind( 'mouseup', drag );
}
else
{
oViewport.obj[0].ontouchstart = function( event )
{
if( 1 === event.touches.length )
{
start( event.touches[ 0 ] );
event.stopPropagation();
}
};
}
if( options.scroll && window.addEventListener )
{
oWrapper[0].addEventListener( 'DOMMouseScroll', wheel, false );
oWrapper[0].addEventListener( 'mousewheel', wheel, false );
}
else if( options.scroll )
{
oWrapper[0].onmousewheel = wheel;
}
}
function start( event )
{
var oThumbDir = parseInt( oThumb.obj.css( sDirection ), 10 );
iMouse.start = sAxis ? event.pageX : event.pageY;
iPosition.start = oThumbDir == 'auto' ? 0 : oThumbDir;
if( ! touchEvents )
{
$( document ).bind( 'mousemove', drag );
$( document ).bind( 'mouseup', end );
oThumb.obj.bind( 'mouseup', end );
}
else
{
document.ontouchmove = function( event )
{
event.preventDefault();
drag( event.touches[ 0 ] );
};
document.ontouchend = end;
}
}
function wheel( event )
{
if( oContent.ratio < 1 )
{
var oEvent = event || window.event
, iDelta = oEvent.wheelDelta ? oEvent.wheelDelta / 120 : -oEvent.detail / 3
;
iScroll -= iDelta * options.wheel;
iScroll = Math.min( ( oContent[ options.axis ] - oViewport[ options.axis ] ), Math.max( 0, iScroll ));
oThumb.obj.css( sDirection, iScroll / oScrollbar.ratio );
oContent.obj.css( sDirection, -iScroll );
if( options.lockscroll || ( iScroll !== ( oContent[ options.axis ] - oViewport[ options.axis ] ) && iScroll !== 0 ) )
{
oEvent = $.event.fix( oEvent );
oEvent.preventDefault();
}
}
options.onMove.call(this,iScroll);
}
function drag( event )
{
if( oContent.ratio < 1 )
{
if( ! touchEvents )
{
iPosition.now = Math.min( ( oTrack[ options.axis ] - oThumb[ options.axis ] ), Math.max( 0, ( iPosition.start + ( ( sAxis ? event.pageX : event.pageY ) - iMouse.start))));
}
else
{
iPosition.now = Math.min( ( oTrack[ options.axis ] - oThumb[ options.axis ] ), Math.max( 0, ( iPosition.start + ( iMouse.start - ( sAxis ? event.pageX : event.pageY ) ))));
}
iScroll = iPosition.now * oScrollbar.ratio;
oContent.obj.css( sDirection, -iScroll );
oThumb.obj.css( sDirection, iPosition.now );
}
}
function end()
{
$( document ).unbind( 'mousemove', drag );
$( document ).unbind( 'mouseup', end );
oThumb.obj.unbind( 'mouseup', end );
document.ontouchmove = document.ontouchend = null;
}
return initialize();
}
}(jQuery));

View File

@ -1 +1,118 @@
(function(a){function b(b,c){function w(a){if(!(g.ratio>=1)){o.now=Math.min(i[c.axis]-j[c.axis],Math.max(0,o.start+((k?a.pageX:a.pageY)-p.start)));n=o.now*h.ratio;g.obj.css(l,-n);j.obj.css(l,o.now)}return false}function v(b){a(document).unbind("mousemove",w);a(document).unbind("mouseup",v);j.obj.unbind("mouseup",v);document.ontouchmove=j.obj[0].ontouchend=document.ontouchend=null;return false}function u(b){if(!(g.ratio>=1)){var b=b||window.event;var d=b.wheelDelta?b.wheelDelta/120:-b.detail/3;n-=d*c.wheel;n=Math.min(g[c.axis]-f[c.axis],Math.max(0,n));j.obj.css(l,n/h.ratio);g.obj.css(l,-n);b=a.event.fix(b);b.preventDefault()}}function t(b){p.start=k?b.pageX:b.pageY;var c=parseInt(j.obj.css(l));o.start=c=="auto"?0:c;a(document).bind("mousemove",w);document.ontouchmove=function(b){a(document).unbind("mousemove");w(b.touches[0])};a(document).bind("mouseup",v);j.obj.bind("mouseup",v);j.obj[0].ontouchend=document.ontouchend=function(b){a(document).unbind("mouseup");j.obj.unbind("mouseup");v(b.touches[0])};return false}function s(){j.obj.bind("mousedown",t);j.obj[0].ontouchstart=function(a){a.preventDefault();j.obj.unbind("mousedown");t(a.touches[0]);return false};i.obj.bind("mouseup",w);if(c.scroll&&this.addEventListener){e[0].addEventListener("DOMMouseScroll",u,false);e[0].addEventListener("mousewheel",u,false)}else if(c.scroll){e[0].onmousewheel=u}}function r(){j.obj.css(l,n/h.ratio);g.obj.css(l,-n);p["start"]=j.obj.offset()[l];var a=m.toLowerCase();h.obj.css(a,i[c.axis]);i.obj.css(a,i[c.axis]);j.obj.css(a,j[c.axis])}function q(){d.update();s();return d}var d=this;var e=b;var f={obj:a(".viewport",b)};var g={obj:a(".overview",b)};var h={obj:a(".scrollbar",b)};var i={obj:a(".track",h.obj)};var j={obj:a(".thumb",h.obj)};var k=c.axis=="x",l=k?"left":"top",m=k?"Width":"Height";var n,o={start:0,now:0},p={};this.update=function(a){f[c.axis]=f.obj[0]["offset"+m];g[c.axis]=g.obj[0]["scroll"+m];g.ratio=f[c.axis]/g[c.axis];h.obj.toggleClass("disable",g.ratio>=1);i[c.axis]=c.size=="auto"?f[c.axis]:c.size;j[c.axis]=Math.min(i[c.axis],Math.max(0,c.sizethumb=="auto"?i[c.axis]*g.ratio:c.sizethumb));h.ratio=c.sizethumb=="auto"?g[c.axis]/i[c.axis]:(g[c.axis]-f[c.axis])/(i[c.axis]-j[c.axis]);n=a=="relative"&&g.ratio<=1?Math.min(g[c.axis]-f[c.axis],Math.max(0,n)):0;n=a=="bottom"&&g.ratio<=1?g[c.axis]-f[c.axis]:isNaN(parseInt(a))?n:parseInt(a);r()};return q()}a.tiny=a.tiny||{};a.tiny.scrollbar={options:{axis:"y",wheel:40,scroll:true,size:"auto",sizethumb:"auto"}};a.fn.tinyscrollbar=function(c){var c=a.extend({},a.tiny.scrollbar.options,c);this.each(function(){a(this).data("tsb",new b(a(this),c))});return this};a.fn.tinyscrollbar_update=function(b){return a(this).data("tsb").update(b)};})(jQuery)
(function(a){
function b(b,c){
function w(a){
if(!(g.ratio>=1)){
o.now=Math.min(i[c.axis]-j[c.axis],Math.max(0,o.start+((k?a.pageX:a.pageY)-p.start)));
n=o.now*h.ratio;g.obj.css(l,-n);
j.obj.css(l,o.now)
}
return false
}
function v(b){
a(document).unbind("mousemove",w);
a(document).unbind("mouseup",v);
j.obj.unbind("mouseup",v);
document.ontouchmove=j.obj[0].ontouchend=document.ontouchend=null;
return false
}
function u(b){
if(!(g.ratio>=1)){
var b=b||window.event;
var d=b.wheelDelta?b.wheelDelta/120:-b.detail/3;
n-=d*c.wheel;
n=Math.min(g[c.axis]-f[c.axis],Math.max(0,n));
j.obj.css(l,n/h.ratio);
g.obj.css(l,-n);
b=a.event.fix(b);
b.preventDefault()
}
}
function t(b){
p.start=k?b.pageX:b.pageY;
var c=parseInt(j.obj.css(l));
o.start=c=="auto"?0:c;
a(document).bind("mousemove",w);
document.ontouchmove=function(b){
a(document).unbind("mousemove");
w(b.touches[0])
};
a(document).bind("mouseup",v);
j.obj.bind("mouseup",v);
j.obj[0].ontouchend=document.ontouchend=function(b){
a(document).unbind("mouseup");
j.obj.unbind("mouseup");
v(b.touches[0])
};
return false
}
function s(){
j.obj.bind("mousedown",t);
j.obj[0].ontouchstart=function(a){
a.preventDefault();
j.obj.unbind("mousedown");
t(a.touches[0]);
return false
};
i.obj.bind("mouseup",w);
if(c.scroll&&this.addEventListener){
e[0].addEventListener("DOMMouseScroll",u,false);
e[0].addEventListener("mousewheel",u,false)
}else if(c.scroll){
e[0].onmousewheel=u
}
}
function r(){
j.obj.css(l,n/h.ratio);
g.obj.css(l,-n);
p["start"]=j.obj.offset()[l];
var a=m.toLowerCase();
h.obj.css(a,i[c.axis]);
i.obj.css(a,i[c.axis]);
j.obj.css(a,j[c.axis])
}
function q(){
d.update();
s();
return d
}
var d=this;
var e=b;
var f={obj:a(".viewport",b)};
var g={obj:a(".overview",b)};
var h={obj:a(".scrollbar",b)};
var i={obj:a(".track",h.obj)};
var j={obj:a(".thumb",h.obj)};
var k=c.axis=="x",
l=k?"left":"top",
m=k?"Width":"Height";
var n,
o={start:0,now:0},
p={};
this.update=function(a){
f[c.axis]=f.obj[0]["offset"+m];
g[c.axis]=g.obj[0]["scroll"+m];
g.ratio=f[c.axis]/g[c.axis];
h.obj.toggleClass("disable",g.ratio>=1);
i[c.axis]=c.size=="auto"?f[c.axis]:c.size;
j[c.axis]=Math.min(i[c.axis],Math.max(0,c.sizethumb=="auto"?i[c.axis]*g.ratio:c.sizethumb));
h.ratio=c.sizethumb=="auto"?g[c.axis]/i[c.axis]:(g[c.axis]-f[c.axis])/(i[c.axis]-j[c.axis]);
n=a=="relative"&&g.ratio<=1?Math.min(g[c.axis]-f[c.axis],Math.max(0,n)):0;
n=a=="bottom"&&g.ratio<=1?g[c.axis]-f[c.axis]:isNaN(parseInt(a))?n:parseInt(a);
r()
};
return q()
}
a.tiny=a.tiny||{};
a.tiny.scrollbar={options:{axis:"y",wheel:40,scroll:true,size:"auto",sizethumb:"auto"}};
a.fn.tinyscrollbar=function(c){
var c=a.extend({},a.tiny.scrollbar.options,c);
this.each(function(){
a(this).data("tsb",new b(a(this),c))
});
return this
};
a.fn.tinyscrollbar_update=function(b){
return a(this).data("tsb").update(b)
};
})
(jQuery)

View File

@ -0,0 +1,56 @@
<%#= encoding: utf-8 %>
$(function() {
var content_holder, content;
var selector = 'a[contenteditable="true"]';
// prevent clicks inside editable area to fire
// a click event on the body
// and therefor saving our content before we even edit it
$(".nav-tabs").find(".icons-pencil").click(function(){
$(this).css({
"display" : "none"
})
$(this).next().attr("contenteditable",true).addClass("edit");
// $(selector).click(function(e) {
// e.stopPropagation();
// });
// initialize the "save" function
$(selector).focus(function(e) {
content_holder = $(this);
content = content_holder.html();
// one click outside the editable area saves the content
$(selector).keypress( function(e) {
// but not if the content didn't change
//alert('out!!');
if(e.keyCode == 13){
$(".nav-tabs>li>a").removeClass("edit");
$(this).prev(".icons-pencil").css({
"display" : "block"
})
e.preventDefault();
// if ($(e.target).is(selector) || content == content_holder.html()) {
// return;
// }
$.ajax({
url: content_holder.data('edit-url'),
type: 'POST',
dataType: 'json',
data: { body: content_holder.html() },
success: function(json) {
$(selector).attr("contenteditable",false)
alert("<%= I18n.t('admin.contenteditable.update_done') %>");
//content_holder.effect('highlight', {'color': '#0f0'}, 3000);
},
error: function() {
alert("<%= I18n.t('admin.contenteditable.update_failed') %>");
//content_holder.effect('highlight', {'color': '#f00'}, 3000);
content_holder.html(content);
}
});
}
});
});
});
});

View File

@ -0,0 +1,391 @@
/*
* jQuery UI Nested Sortable
* v 1.3.4 / 28 apr 2011
* http://mjsarfatti.com/sandbox/nestedSortable
*
* Depends:
* jquery.ui.sortable.js 1.8+
*
* License CC BY-SA 3.0
* Copyright 2010-2011, Manuele J Sarfatti
*/
(function($) {
$.widget("ui.nestedSortable", $.extend({}, $.ui.sortable.prototype, {
options: {
tabSize: 20,
disableNesting: 'ui-nestedSortable-no-nesting',
errorClass: 'ui-nestedSortable-error',
listType: 'ol',
maxLevels: 0,
revertOnError: 1
},
_create: function() {
this.element.data('sortable', this.element.data('nestedSortable'));
return $.ui.sortable.prototype._create.apply(this, arguments);
},
destroy: function() {
this.element
.removeData("nestedSortable")
.unbind(".nestedSortable");
return $.ui.sortable.prototype.destroy.apply(this, arguments);
},
_mouseDrag: function(event) {
//Compute the helpers position
this.position = this._generatePosition(event);
this.positionAbs = this._convertPositionTo("absolute");
if (!this.lastPositionAbs) {
this.lastPositionAbs = this.positionAbs;
}
//Do scrolling
if(this.options.scroll) {
var o = this.options, scrolled = false;
if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
} else {
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
}
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this, event);
}
//Regenerate the absolute position used for position checks
this.positionAbs = this._convertPositionTo("absolute");
//Set the helper position
if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
//Rearrange
for (var i = this.items.length - 1; i >= 0; i--) {
//Cache variables and intersection, continue if no intersection
var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
if (!intersection) continue;
if(itemElement != this.currentItem[0] //cannot intersect with itself
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
&& !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
&& (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
//&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
) {
$(itemElement).mouseenter();
this.direction = intersection == 1 ? "down" : "up";
if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
$(itemElement).mouseleave();
this._rearrange(event, item);
} else {
break;
}
// Clear emtpy ul's/ol's
this._clearEmpty(itemElement);
this._trigger("change", event, this._uiHash());
break;
}
}
var parentItem = (this.placeholder[0].parentNode.parentNode
&& $(this.placeholder[0].parentNode.parentNode).closest('.ui-sortable').length)
? $(this.placeholder[0].parentNode.parentNode)
: null,
level = this._getLevel(this.placeholder),
childLevels = this._getChildLevels(this.helper),
previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null;
if (previousItem != null) {
while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0]) {
if (previousItem[0].previousSibling) {
previousItem = $(previousItem[0].previousSibling);
} else {
previousItem = null;
break;
}
}
}
newList = document.createElement(o.listType);
this.beyondMaxLevels = 0;
// If the item is moved to the left, send it to its parent level
if (parentItem != null && this.positionAbs.left < parentItem.offset().left) {
parentItem.after(this.placeholder[0]);
this._clearEmpty(parentItem[0]);
this._trigger("change", event, this._uiHash());
}
// If the item is below another one and is moved to the right, make it a children of it
else if (previousItem != null && this.positionAbs.left > previousItem.offset().left + o.tabSize) {
this._isAllowed(previousItem, level+childLevels+1);
if (!previousItem.children(o.listType).length) {
previousItem[0].appendChild(newList);
}
previousItem.children(o.listType)[0].appendChild(this.placeholder[0]);
this._trigger("change", event, this._uiHash());
}
else {
this._isAllowed(parentItem, level+childLevels);
}
//Post events to containers
this._contactContainers(event);
//Interconnect with droppables
if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
//Call callbacks
this._trigger('sort', event, this._uiHash());
this.lastPositionAbs = this.positionAbs;
return false;
},
_mouseStop: function(event, noPropagation) {
// If the item is in a position not allowed, send it back
if (this.beyondMaxLevels) {
this.placeholder.removeClass(this.options.errorClass);
if (this.options.revertOnError) {
if (this.domPosition.prev) {
$(this.domPosition.prev).after(this.placeholder);
} else {
$(this.domPosition.parent).prepend(this.placeholder);
}
this._trigger("revert", event, this._uiHash());
} else {
var parent = this.placeholder.parent().closest(this.options.items);
for (var i = this.beyondMaxLevels - 1; i > 0; i--) {
parent = parent.parent().closest(this.options.items);
}
parent.after(this.placeholder);
this._trigger("change", event, this._uiHash());
}
}
// Clean last empty ul/ol
for (var i = this.items.length - 1; i >= 0; i--) {
var item = this.items[i].item[0];
this._clearEmpty(item);
}
$.ui.sortable.prototype._mouseStop.apply(this, arguments);
},
serialize: function(o) {
var items = this._getItemsAsjQuery(o && o.connected),
str = []; o = o || {};
$(items).each(function() {
var res = ($(o.item || this).attr(o.attribute || 'id') || '')
.match(o.expression || (/(.+)[-=_](.+)/)),
pid = ($(o.item || this).parent(o.listType)
.parent('li')
.attr(o.attribute || 'id') || '')
.match(o.expression || (/(.+)[-=_](.+)/));
if (res) {
str.push(((o.key || res[1]) + '[' + (o.key && o.expression ? res[1] : res[2]) + ']')
+ '='
+ (pid ? (o.key && o.expression ? pid[1] : pid[2]) : 'root'));
}
});
if(!str.length && o.key) {
str.push(o.key + '=');
}
return str.join('&');
},
toHierarchy: function(o) {
o = o || {};
var sDepth = o.startDepthCount || 0,
ret = [];
$(this.element).children('li').each(function () {
var level = _recursiveItems($(this));
ret.push(level);
});
return ret;
function _recursiveItems(li) {
var id = ($(li).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
if (id) {
var item = {"id" : id[2]};
if ($(li).children(o.listType).children('li').length > 0) {
item.children = [];
$(li).children(o.listType).children('li').each(function() {
var level = _recursiveItems($(this));
item.children.push(level);
});
}
return item;
}
}
},
toArray: function(o) {
o = o || {};
var sDepth = o.startDepthCount || 0,
ret = [],
left = 2;
ret.push({
"item_id": 'root',
"parent_id": 'none',
"depth": sDepth,
"left": '1',
"right": ($('li', this.element).length + 1) * 2
});
$(this.element).children('li').each(function () {
left = _recursiveArray(this, sDepth + 1, left);
});
ret = ret.sort(function(a,b){ return (a.left - b.left); });
return ret;
function _recursiveArray(item, depth, left) {
var right = left + 1,
id,
pid;
if ($(item).children(o.listType).children('li').length > 0) {
depth ++;
$(item).children(o.listType).children('li').each(function () {
right = _recursiveArray($(this), depth, right);
});
depth --;
}
id = ($(item).attr(o.attribute || 'id')).match(o.expression || (/(.+)[-=_](.+)/));
if (depth === sDepth + 1) {
pid = 'root';
} else {
var parentItem = ($(item).parent(o.listType)
.parent('li')
.attr(o.attribute || 'id'))
.match(o.expression || (/(.+)[-=_](.+)/));
pid = parentItem[2];
}
if (id) {
ret.push({"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right});
}
left = right + 1;
return left;
}
},
_clearEmpty: function(item) {
var emptyList = $(item).children(this.options.listType);
if (emptyList.length && !emptyList.children().length) {
emptyList.remove();
}
},
_getLevel: function(item) {
var level = 1;
if (this.options.listType) {
var list = item.closest(this.options.listType);
while (!list.is('.ui-sortable')) {
level++;
list = list.parent().closest(this.options.listType);
}
}
return level;
},
_getChildLevels: function(parent, depth) {
var self = this,
o = this.options,
result = 0;
depth = depth || 0;
$(parent).children(o.listType).children(o.items).each(function (index, child) {
result = Math.max(self._getChildLevels(child, depth + 1), result);
});
return depth ? result + 1 : result;
},
_isAllowed: function(parentItem, levels) {
var o = this.options;
// Are we trying to nest under a no-nest or are we nesting too deep?
if (parentItem == null || !(parentItem.hasClass(o.disableNesting))) {
if (o.maxLevels < levels && o.maxLevels != 0) {
this.placeholder.addClass(o.errorClass);
this.beyondMaxLevels = levels - o.maxLevels;
} else {
this.placeholder.removeClass(o.errorClass);
this.beyondMaxLevels = 0;
}
} else {
this.placeholder.addClass(o.errorClass);
if (o.maxLevels < levels && o.maxLevels != 0) {
this.beyondMaxLevels = levels - o.maxLevels;
} else {
this.beyondMaxLevels = 1;
}
}
}
}));
$.ui.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.ui.nestedSortable.prototype.options);
})(jQuery);

View File

@ -6,4 +6,3 @@
//
//= require jquery
//= require jquery_ujs
//= require announcement_link

View File

@ -6,6 +6,7 @@
//
//= require jquery
//= require jquery_ujs
//= require jquery.form
//= require bootstrap
//= require jquery.isotope.min
//= require jquery.tinyscrollbar.min
@ -14,3 +15,6 @@
//= require tinymce_orbit
//= require orbit-bar-search
//= require side_bar_history
//= require rss
//= require ajax_form
//= require inc/ajax_setting

View File

@ -0,0 +1,19 @@
$('.news_bulletin_links_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
$('.news_bulletin_files_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
$(document).on('click', '.action a.remove_existing_record', function(){
$(this).next('.should_destroy').attr('value', 1);
$("tr #" + $(this).prev().attr('value')).hide();
});
$(document).on('click', '.quick_edit_cancel', function(){
tr = $(this).attr('rel');
$('#' + tr).hide();
$("tr#news_bulletin_file_" + $(this).prev().attr('value')).hide();
$("tr#news_bulletin_link_" + $(this).prev().attr('value')).hide();
});

View File

@ -14,9 +14,9 @@ $(document).ready(function(){
placement: "left"
});
$(document).on('click', '.privacy', function() {
console.log($(this).val());
switch ($(this).val()) {
case 'true':
$(this).parents('.controls').children('.select-role').slideUp(300);
@ -47,14 +47,19 @@ $(document).ready(function(){
/*tinyscrollbar&windows-Size*/
resize();
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2;
$('#main-sidebar').css("height", viewportheight-30);
$('#main-sidebar .viewport').css("height", viewportheight-30);
$('.post-title').css("width", viewportwidth-495);
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2,
$subWiget = $('#sub-wiget').width()+18;
$orbitBar = $('#orbit-bar').height(),
$mainSidebar = $('#main-sidebar').width()+5,
$formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right"));
$('#main-sidebar').css("height", viewportheight-$orbitBar);
$('#main-sidebar .viewport').css("height", viewportheight-$orbitBar);
$('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
$('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
$('#main-sidebar').tinyscrollbar();
$('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
$('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
$('.detal-list').tinyscrollbar();
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
mainTablePosition();
/*isotope*/
@ -68,12 +73,18 @@ $(document).ready(function(){
});
$(window).resize(function(){
resize();
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2;
$('#main-sidebar').css("height", viewportheight-30);
$('#main-sidebar .viewport').css("height", viewportheight-30);
$('.post-title').css("width", viewportwidth-495);
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2,
$subWiget = $('#sub-wiget').width()+18;
$orbitBar = $('#orbit-bar').height(),
$mainSidebar = $('#main-sidebar').width()+5,
$formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right"));
$('#main-sidebar').css("height", viewportheight-$orbitBar);
$('#main-sidebar .viewport').css("height", viewportheight-$orbitBar);
$('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
$('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
$('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
$('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
mainTablePosition();
});
/*main-table position*/
@ -101,5 +112,4 @@ $(window).scroll(function () {
$(".table-label").css({left:$winLeft*-1} );
//$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} );
//$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} );
//console.log($mainWrapMarginLeft+($winLeft*-1)+5);
});

View File

@ -1,3 +1,9 @@
$(document).ready(function(){
$('.search').tooltip({
placement: "bottom"
});
});
$(document).on('click', '.orbit-bar-search', function (){
if ($(this).parents('.search').hasClass('visible')){
$(this).parents('.search').stop().animate({

View File

@ -6,57 +6,79 @@ var orbitTimeline = function(dom){
this.dom = $("#"+dom);
this.timelineHtml = $("<div class='t_bottom t_scale' id='timeline_scale'></div>");
//this.marker = t.timelineHtml.find("#timline_marker");
this.scale = t.timelineHtml.find("#timeline_scale");
this.scale = "";
//this.container = t.timelineHtml.find("#t_container");
this.events = new Array;
this.monthList = ["","January","February","March","April","May","June","July","August","September","October","November","December"];
this.dt = new Date();
this.fromdate = [t.dt.getFullYear(),t.dt.getMonth()+1];
this.ajaxload = true;
this.initialize = function(){
t.dom.html(t.timelineHtml);
$("div.scrollbar").hide();
t.constructTimeScale(function(timelineScale){
console.log(timelineScale);
$("#timeline_scale").html(timelineScale);
var totalyearwidth =timelineScale.find(".year").length * 100;
var totalyearwidth =timelineScale.find(".year").length * 200;
var totalul = 0;
$(".t_scale").css({"min-width":$(".tinycanvas .viewport").width()+200 + "px"})
for(eve in t.events){
t.makeBubble(t.events[eve]);
totalul = $("#scale_wrapper ul").length
$(".t_scale").width((totalul*350) + totalyearwidth);
}
$('.tinycanvas').tinyscrollbar({ axis: 'x'});
$('.tinycanvas').tinyscrollbar({
axis: 'x',
onMove: function(x){
var limit = $("#timeline_scale").width() - $(".tinycanvas .scrollbar").width();
if(t.ajaxload){
if((limit - x) < 10){
t.eventAjaxLoad(function(){
var totalul = 0;
for(eve in t.events){
t.makeBubble(t.events[eve]);
totalul = $("#scale_wrapper ul").length
$(".t_scale").width((totalul*350) + totalyearwidth);
}
$('.tinycanvas').tinyscrollbar_update(x);
});
}
}
}
});
});
}
this.constructTimeScale = function(callbackFn){
var mon ="",year="";
var mon ="",year="",formname;
var scale = $("<div id='scale_wrapper'></div>");
$.getJSON("desktop_orbit/getevents",{"event":"papers"},function(journals){
$.each(journals,function(x,journal){
$.each(journal.papers,function(i,paper){
$.getJSON("desktop_orbit/eventajaxload",{"event":"papers","from":t.fromdate},function(papersArray){
$.each(papersArray,function(i,pa){
$.each(pa.papers,function(i,paper){
var dt = new Date(paper.created_at);
var cur_mon = paper.created_at.substr(5,2);
var cur_year = dt.getFullYear();
var cdt = paper.created_at.substr(0,7).replace("-","");
var formname = (cur_mon.charAt(0) == "0"?cur_mon.charAt(1) : cur_mon)
var bubbleData = {"fulldate" : t.monthList[parseInt(formname)] +", " + dt.getDate() + ", " + cur_year,"title":paper.title,"jtitle":journal.title,"coauthors":paper.coauthors,"abstract":paper.abstract,"timestamp":cdt}
formname = (cur_mon.charAt(0) == "0"?cur_mon.charAt(1) : cur_mon)
var bubbleData = {"fulldate" : t.monthList[parseInt(formname)] +", " + dt.getDate() + ", " + cur_year,"title":paper.title,"jtitle":"Harry","coauthors":paper.coauthors,"abstract":paper.abstract,"timestamp":cdt}
t.events.push(bubbleData);
if(cur_year != year){
year = cur_year;
scale.append($("<div class='scale_region year'>"+(year+1)+"</div>"));
scale.append($("<div class='scale_region year'>"+(year+1)+"</div><div data-content='"+year+"'></div>"));
}
if(cur_mon != mon){
mon = cur_mon;
console.log(parseInt(cur_mon));
scale.append($("<div class='scale_region month' data-content='"+cdt+"'><div class='month_heading'>"+t.monthList[parseInt(formname)]+"</div><div class='bubble_list'></div></div>"))
var yr = scale.find("div[data-content="+year+"]");
yr.append($("<div class='scale_region month' data-content='"+cdt+"'><div class='month_heading'>"+t.monthList[parseInt(formname)]+"</div><div class='bubble_list'></div></div>"))
}
});
})
scale.append($("<div class='scale_region year'>"+year+"</div>"));
});
scale.append($("<div class='scale_region year'>"+year+"</div><div data-content='"+(year-1)+"'></div>"));
t.fromdate = [year,formname-1];
if(typeof callbackFn == "function"){
callbackFn.call(this,scale);
}
})
});
}
this.makeBubble = function(bubbleData){
var totalul = $("#scale_wrapper").find("div[data-content="+bubbleData.timestamp+"] ul").length;
@ -87,4 +109,45 @@ var orbitTimeline = function(dom){
});
})//.mouseout(function(){t.oapi.toolPopup("destroy");})
}
this.eventAjaxLoad = function(callbackFn){
t.events = [];
var mon ="",year="",formname;
var scale = $("#scale_wrapper");
t.ajaxload = false;
$.getJSON("desktop_orbit/eventajaxload",{"from":t.fromdate},function(papersArray){
$.each(papersArray,function(i,pa){
$.each(pa.papers,function(i,paper){
var dt = new Date(paper.created_at);
var cur_mon = paper.created_at.substr(5,2);
var cur_year = dt.getFullYear();
var cdt = paper.created_at.substr(0,7).replace("-","");
formname = (cur_mon.charAt(0) == "0"?cur_mon.charAt(1) : cur_mon)
var bubbleData = {"fulldate" : t.monthList[parseInt(formname)] +", " + dt.getDate() + ", " + cur_year,"title":paper.title,"jtitle":"Harry","coauthors":paper.coauthors,"abstract":paper.abstract,"timestamp":cdt}
t.events.push(bubbleData);
if(cur_year != year){
year = cur_year;
if(scale.find("div[data-content="+year+"]").length == 0){
scale.append($("<div class='scale_region year'>"+(year+1)+"</div><div data-content='"+year+"'></div>"));
}
}
if(cur_mon != mon){
mon = cur_mon;
var yr = scale.find("div[data-content="+year+"]");
yr.append($("<div class='scale_region month' data-content='"+cdt+"'><div class='month_heading'>"+t.monthList[parseInt(formname)]+"</div><div class='bubble_list'></div></div>"))
}
});
});
if(papersArray.length != 0){
if(scale.find("div[data-content="+(year-1)+"]").length == 0)
scale.append($("<div class='scale_region year'>"+year+"</div><div data-content='"+(year-1)+"'></div>"));
t.ajaxload = true;
t.fromdate = [year,formname-1];
}
if(typeof callbackFn == "function"){
callbackFn.call(this,scale);
}
})
}
}

View File

@ -24,7 +24,36 @@ $("#module_app_list select").live('change', function() {
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets');
});
$("#tag_list select").live('change', function() {
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_r_tag_options');
});
$('.part_kind').live('click', function() {
$('.part_kind_partial').hide();
$('#part_' + $(this).attr('value')).show();
});
$(document).ready(function(){
bindTreeDragHandle();
});
var bindTreeDragHandle = function(){
$('ol.sortable').nestedSortable({
disableNesting: 'no-nest',
forcePlaceholderSize: true,
handle: 'i',
helper: 'clone',
items: 'li',
maxLevels: 3,
opacity: .5,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
stop: function(event, ui) {
$.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: ui.item.parent().closest('li').attr('id'), position: ui.item.index() } );
}
});
}

View File

@ -1,28 +1,19 @@
var history_edited = false;
// $('#back_sidebar a, #back_main a.nav').live('click',
// function () {
// $.getScript(this.href);
// history.pushState(null, document.title, this.href);
// history_edited = true;
// return false;
// }
// );
$('#back_main a.reload').live('click',
function () {
$.getScript(this.href);
history.replaceState(null, document.title, this.href);
history_edited = true;
return false;
}
);
// $('#back_main a.reload').live('click',
// function () {
// $.getScript(this.href);
// history.replaceState(null, document.title, this.href);
// history_edited = true;
// return false;
// }
// );
// $('.form').live('submit', function () {
// $.post(this.action, $(this).serialize(), null, 'script');
// history_edited = true;
// return false;
// });
$('#back_main form').live('submit', function () {
$.post(this.action, $(this).serialize(), null, 'script');
history_edited = true;
return false;
});
$(document).on('click', '.js_history',
function () {

View File

@ -5,6 +5,17 @@
// the compiled file.
//
//= require jquery
//= require jquery.ui.draggable
//= require jquery.ui.droppable
//= require jquery.ui.sortable
//= require jquery_ujs
//= require page_edit
//= require bootstrap
//= require jquery.isotope.min
//= require jquery.tinyscrollbar.min
//= require orbit-1.0
//= require orbit-bar-search
//= require side_bar_history
//= require page_edit
//= require tinymce-jquery
//= require tinymce_orbit
//= require lib/jquery.ui.nestedSortable.js

View File

@ -0,0 +1,7 @@
$(document).on('click', '.list-remove', function(){
$('#delete_all').submit();
});
$(document).on('click', '#check_all', function(){
$('.checkbox_in_list').attr("checked", this.checked);
});

View File

@ -1,25 +0,0 @@
$(function() {
$('.tinymce_textarea').tinymce({
theme: 'advanced',
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Skin options
skin : "o2k7",
skin_variant : "silver",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "js/template_list.js",
external_link_list_url : "js/link_list.js",
external_image_list_url : "js/image_list.js",
media_external_list_url : "js/media_list.js"
});
});

View File

@ -0,0 +1,90 @@
function load_tinymce() {
$('.tinymce_textarea').tinymce({
// General options
theme: 'advanced',
file_browser_callback : 'myFileBrowser',
plugins : "autolink,lists,pagebreak,style,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Skin options
skin : "o2k7",
skin_variant : "silver",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "js/template_list.js",
// external_link_list_url : "js/link_list.js",
// external_image_list_url : "js/image_list.js",
// media_external_list_url : "js/media_list.js"
// Style formats
style_formats : [
{title : 'Bold text', inline : 'b'},
{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
{title : 'Example 1', inline : 'span', classes : 'example1'},
{title : 'Example 2', inline : 'span', classes : 'example2'},
{title : 'Table styles'},
{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
],
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
}
function myFileBrowser(field_name, url, type, win) {
var cmsURL = window.location.toString();
cmsURL = cmsURL.split("/");
cmsURL = "<%= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>";
console.log(cmsURL);
// script URL - use an absolute path!
if (cmsURL.indexOf("?") < 0) {
//add the type as the only query parameter
cmsURL = cmsURL + "?type=" + type;
}
else {
//add the type as an additional query parameter
// (PHP session ID is now included if there is one at all)
cmsURL = cmsURL + "&type=" + type;
}
tinyMCE.activeEditor.windowManager.open({
file : cmsURL,
title : 'File Browser',
width : 530, // Your dimensions may differ - toy around with them!
height : 350,
resizable : "no",
inline : "no", // This parameter only has an effect if you use the inlinepopups plugin!
close_previous : "no"
}, {
window : win,
input : field_name,
alt : "alt",
title : "title"
});
return false;
}
function ajaxSave() {
var ed = tinyMCE.get('content');
// Do you ajax call here, window.setTimeout fakes ajax call
ed.setProgressState(1); // Show progress
window.setTimeout(function() {
ed.setProgressState(0); // Hide progress
alert(ed.getContent());
}, 3000);
}
$(document).ready(function() {
load_tinymce();
});

View File

@ -0,0 +1,4 @@
.banner-preview {
width: auto;
left: 35%;
}

View File

@ -0,0 +1,34 @@
#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);
}

View File

@ -1,3 +1,5 @@
/*bootstrap-orbit*/
h1, h2, h3, h4, h5, h6 {
font-weight:normal ;
}
@ -110,6 +112,18 @@ table .span1-3 {
.qe-block .form-horizontal .form-actions {
text-align:right;
}
.form-actions form {
margin-bottom: 0;
}
.form-actions form input {
margin-bottom: 0;
}
.modal.fade {
top: -50%;
}
.form-search button {
margin-bottom: 0;
}
.modal form {
margin-bottom: 0;
}

View File

@ -1,3 +1,4 @@
/*bootstrap*/
/*!
* Bootstrap v2.0.0
*
@ -65,6 +66,7 @@ textarea {
margin: 0;
font-size: 100%;
vertical-align: middle;
margin-bottom: 10px;
}
button, input {
*overflow: visible;
@ -538,7 +540,7 @@ select,
width: 210px;
height: 18px;
padding: 4px;
margin-bottom: 9px;
/*margin-bottom: 9px;*/
font-size: 13px;
line-height: 18px;
color: #555555;
@ -2664,18 +2666,23 @@ button.btn.small, input[type="submit"].btn.small {
display: inline;
}
.pagination .page{
/*.pagination .page{
float: left;
padding: 0 14px;
line-height: 34px;
text-decoration: none;
border: 1px solid #ddd;
border-left-width: 0;
}
}*/
.pagination a {
float: left;
padding: 0 14px;
line-height: 34px;
text-decoration: none;
border: 1px solid #DDD;
border-left-width: 0;
}
.pagination .next{
/*.pagination .next{
float: left;
padding: 0 14px;
line-height: 34px;
@ -2690,12 +2697,15 @@ button.btn.small, input[type="submit"].btn.small {
text-decoration: none;
border: 1px solid #ddd;
border-left-width: 0;
}
}*/
.pagination .current{
border-left-width: 1px;
}
.pagination a {
background-color: #FFFFFF;
}
.pagination a:hover, .pagination .active a {
background-color: #f5f5f5;
background-color: #e8e8e8;
}
.pagination .active a {
color: #999999;

View File

@ -1,3 +1,5 @@
/*permission-checkbox*/
.checkblock {
display: inline-block;
float: left;
@ -8,37 +10,40 @@
}
.checkbox{
padding: 5px;
margin: 5px 5px 10px;
margin: 10px;
display: inline-block;
color:#777777;
text-shadow: 0 1px 0px rgba(255,255,255,.4);
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
height: 30px;
position: relative;
cursor: pointer;
border-style: solid;
border-width: 0px 1px 1px 0;
border-color: #dfdfdf;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) );
background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
.checkbox .check-icon {
display: none;
position: absolute;
width: 26px;
height: 26px;
background: url('img/check.png') no-repeat left top;
width: 32px;
height: 32px;
background: url(<%= asset_path 'check.png' %>) no-repeat left top;
right: -10px;
top: -5px;
top: 15px;
}
.checkbox .member-name {
cursor: pointer;
font-family: helvetica;
font-size: 12px;
line-height: 30px;
line-height: 15px;
padding: 0 10px 0 40px;
color: #333333;
display: inline-block;
@ -75,3 +80,6 @@ img.member-img {
.popover-content p {
font-size: 12px;
}
.preview_trigger {
margin: 5px 10px 0 0;
}

View File

@ -1,16 +1,11 @@
/*isotope*/
#isotope {
margin-top: 2px;
background-color:#f4f4f4;
}
.isotope-item {
z-index: 2;
}
.isotope-hidden.isotope-item {
pointer-events: none;
z-index: 1;
}
/**** Isotope CSS3 transitions ****/
.isotope,
@ -46,28 +41,27 @@
transition-duration: 0s;
}
.w-a {
width: 388px;
width: 398px;
}
.w-b {
width: 802px;
width: 812px;
}
.h-a {
height: 315px;
}
.h-b {
height: 699px;
height: 703px;
}
.item {
margin: 5px 0 15px 15px;
}
.item h3 {
margin: 5px 0;
margin: 20px 0 5px;
}
.item h3 [class^="icons-"] {
margin: 3px 5px 0 3px;
margin: 1px 5px 0 3px;
}
.item .detail {
padding: 5px;
border: 1px solid rgba(0, 0, 0, 0.1);
background-color: #FFFFFF;
border-radius: 5px;
@ -75,12 +69,11 @@
-moz-border-radius: 5px;
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);
}
.item .detail .totle {
font-size: 50px;
padding:10px 5px 20px 0;
margin: 0px;
padding:10px 5px 30px 0;
margin: 0;
text-align: right;
border-bottom:1px solid #d9d9d9;
}
@ -90,20 +83,60 @@
color: #333;
padding-left: 5px;
text-align:left;
margin-bottom: -7px;
}
.item .detail .table {
margin-bottom: 0;
}
.item .detail .table th, .item .detail .table td {
border-top: none;
border-bottom: 1px solid #DDDDDD;
}
.item .detail .table tr th {
background-color: #F2F2F2;
border-bottom: 1px solid #AAAAAA;
}
.item .detail .table tr td:first-child {
color: #666;;
}
.item .detail .table tr td:last-child {
.item .detail .table tr td:last-child, .item .detail .table tr th:last-child {
text-align:right;
padding-right: 15px;
}
.item .h-a .my_scroll .viewport {
height: 248px;
height: 210px;
}
.item .h-b .my_scroll .viewport {
height: 632px;
height: 594px;
}
.item .isotope-hidden.isotope-item {
pointer-events: none;
z-index: 1;
}
.item .my_scroll {
position: relative;
}
.item .my_scroll .scrollbar {
right: 3px;
top: 0;
position: absolute;
z-index: 10;
}
.item .my_scroll .track {
background-color: transparent;
}
.detail.noStatistics {
overflow: hidden;
}
.detail.noStatistics.h-a {
height: 315px;
}
.detail.noStatistics.h-a .my_scroll .viewport {
height: 280px;
}
.detail.noStatistics.h-b {
height: 704px;
}
.detail.noStatistics.h-b .my_scroll .viewport {
height: 670px;
}

View File

@ -1,8 +1,5 @@
.list-remove {
position: relative;
top: 2px;
left: 2px;
}
/*list*/
.table th.select {
border-bottom:2px solid #0088CC;
}
@ -25,7 +22,7 @@
.main-list .nav-pills > li > a {
border-radius: 5px 5px 5px 5px;
margin: 2px;
padding:5px
padding:5px;
}
.main-list tbody .quick-edit {
position:relative;
@ -38,6 +35,9 @@
width: 350px;
left: -8px;
}
.main-list tr:first-child td {
border-top: 1px solid #DDDDDD;
}
.main-list td {
background-color: #FFFFFF;
border-bottom: 1px solid #DDDDDD;
@ -54,6 +54,11 @@
position: relative;
height: 40px;
}
.main-list .label-group .label {
margin-bottom: 1px;
display: inline-block;
padding: 0 3px;
}
.main-list .label-td {
background-color: rgba(255, 255, 255, 1);
height: 40px;
@ -65,9 +70,8 @@
}
.main-list .label-td:hover {
height: auto;
text-align: center;
padding: 5px 5px 8px;
left: -6px;
left: -40px;
top: -6px;
border: 1px solid rgba(0, 0, 0, 0.2);
box-shadow: 0px 5px 10px rgba(0,0,0,0.2);
@ -77,6 +81,10 @@
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
z-index: 5;
width: 200px;
}
.qe-edit-div .table-condensed {
background-color: #F2F2F2;
}
.table-label {
background-color: #F2F2F2;
@ -96,6 +104,19 @@
.qe-block td {
height:auto;
padding: 0;
/*background-color: #dedede;*/
}
.qe-block legend {
padding-left: 8px;
margin-bottom: 0;
padding-bottom: 0;
}
.qe-block .control-group {
margin-bottom: 0;
}
.qe-block .controls, .qe-block .control-label {
margin-top: 10px;
margin-bottom: 10px;
}
.qe-block .table td, .qe-block .table th {
padding: 8px;
@ -112,9 +133,6 @@ legend {
margin-bottom: 15px;
padding-bottom: 5px;
}
.upload-picture {
margin-left: 20px;
}
.subnav {
-moz-border-radius: 0;
-webkit-border-radius: 0;
@ -149,3 +167,37 @@ legend {
display: block;
text-align:center;
}
.sort-header th {
padding: 0 8px;
vertical-align: inherit;
position: relative;
}
.sort-header th a {
display: block;
padding: 10px 0;
white-space: nowrap;
}
.sort-header th a:hover {
text-decoration: none;
}
.list-remove {
position: absolute;
top: 0;
padding-top: 9px !important;
left: 25px;
}
.form-fixed {
position: fixed;
margin: 0;
padding: 10px;
bottom: 0;
z-index: 2;
}
.form-fixed .btn {
margin-top: 4px;
}
.paginationFixed {
}
.paginationFixed .pagination {
margin-top: 0 !important;
}

View File

@ -1,5 +1,7 @@
/*message*/
.error{
color:red;
color: #B94A48;
}
.notice, .message{

View File

@ -6,10 +6,10 @@
*= require_self
*= require message
*= require bootstrap
*= require style
*= require bootstrap-orbit
*= require list
*= require widget
*= require style
*= require widgets
*= require scroll_style
*= require isotope
*/

View File

@ -1,5 +1,4 @@
.t_scale{
min-width:2000px;
height:516px;
bottom:0;
}

View File

@ -1,3 +1,6 @@
/*reset*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
-webkit-text-size-adjust:none;
}

View File

@ -1,3 +1,5 @@
/*scroll_style*/
@charset "UTF-8";
/* CSS Document */
.my_scroll {

View File

@ -1,15 +1,36 @@
/*sidebar*/
#back_sidebar {
background: url(<%= asset_path "75.png" %>) repeat scroll left top transparent;
box-shadow: 3px 0 4px #472A12;
border-right: 1px solid #121212;
height: 100%;
left: 0;
position: fixed;
top: 0;
width: 220px;
.nav-list {
padding: 0px 0px 100px 5px;
}
.nav-list li {
position: relative;
}
.nav-list ol {
margin-left: 20px;
}
.nav-list ol li {
padding: 5px 0;
list-style: none;
}
.nav-list ol li a {
font-size: 13px;
padding: 3px 0px;
display: block;
}
.nav-list>li>ol {
margin-left: 0;
}
.nav-list>li>.with_action {
padding-left: 0;
}
.nav-list>li>.with_action>.quick-edit {
margin: 0 0 0 3px !important;
}
.nav-list>li>.with_action>i {
display: none;
}
/*
#back_sidebar h1 {
background: url(<%= asset_path "h1_bg.png" %>) repeat-x scroll left top transparent;
border-bottom: 1px solid #1B1B1B;
@ -92,3 +113,79 @@
#sidebar .translations_setup {
margin-top: 42px;
}
#main-sidebar{
left:0;
}
#main-sidebar .list{
}
#main-sidebar li{
position:relative;
}
#main-sidebar li a{
border-bottom: 1px solid #CCCCCC;
display: block;
padding: 10px 0 10px 10px;
}
#main-sidebar ul ul li a{
padding: 10px 0 10px 20px;
}*/
.with_action:hover .hide {
display: block;
}
#main-sidebar .quick-edit {
background: none repeat scroll 0 0 #FFFFFF;
border: 1px solid #DDDDDD;
border-radius: 5px 5px 5px 5px;
margin: 0 0 0 20px;
padding: 0;
z-index:1;
position: absolute;
left: -3px;
width: 70px;
}
#main-sidebar .quick-edit a {
display: block;
line-height: 22px;
border-bottom: medium none;
font-size:12px;
margin: 0;
padding: 3px 5px;
}
#main-sidebar .quick-edit a:first-child {
border-radius: 5px 5px 0px 0px;
}
#main-sidebar .quick-edit a:last-child {
border-radius: 0px 0px 5px 5px;
}
#main-sidebar .quick-edit a:hover {
background-color: #DDDDDD;
}
ol.nav>li>.icons-moves {
display: none;
}
.sortable i {
position: absolute;
left: 0px;
top: 6px;
margin-right: 0;
opacity: 0.3;
filter: alpha(opacity=30);
}
.sortable i:hover {
cursor:move;
opacity: 0.7;
filter: alpha(opacity=70);
}
.with_action {
padding-left: 20px;
}
.placeholder {
background-color: rgba(0,136,204,.6);
border-radius: 3px;
}
.ui-nestedSortable-error {
background: rgba(255,206,206,.6);
color: #8a1f11;
}

View File

@ -1,3 +1,5 @@
/*site_assets*/
.assets_setup{
padding:42px 0 0 0;
}

View File

@ -1,3 +1,5 @@
/*site_designs*/
.designs_setup{
padding:42px 0 0 0;
}

View File

@ -5,6 +5,10 @@
*= require reset
*= require_self
*= require message
*= require bootstrap
*= require style
*= require bootstrap-orbit
*= require scroll_style
*= require site_items
*= require sidebar
*/

View File

@ -1,10 +1,12 @@
/*site_items*/
html, body{
height: 100%;
margin: 0;
padding: 0;
}
html{
background: url(<%= asset_path "body.jpg" %>) no-repeat fixed 0 0 transparent;
background-size: cover;
}
@ -172,8 +174,6 @@ body{
.main {
background: none repeat scroll 0 0 #FFFFFF;
height: 100%;
margin-left: 220px;
padding: 0 40px;
position: relative;
}
.main_list {

View File

@ -1,3 +1,5 @@
/*style*/
@import url(http://fonts.googleapis.com/css?family=Cuprum);
@font-face{
font-family: 'WebSymbolsRegular';
@ -9,7 +11,7 @@
}
.login-logo {
text-indent: -9999px;
background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 40px;
background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 80px;
padding-top: 40px;
height: 160px;
}
@ -60,8 +62,8 @@
margin-right: -20px;
}
#orbit-bar .search-query {
padding: 4px 9px;
height: 12px;
padding: 7px 9px 5px;
height: 10px;
margin-top: 3px;
border: 1px solid #333333;
font-size: 11px;
@ -117,7 +119,8 @@
background-position: -10px -10px;
}
#orbit-bar .nav > li > a.orbit-bar-desktop {
background-position: -106px -9px;
background-position: -73px -42px;
width: 48px;
}
#orbit-bar .nav > li > a.orbit-bar-member {
background-position: -4px -37px;
@ -241,7 +244,7 @@
padding-right: 4px;
border-right: 1px solid rgba(0,0,0,.2);
position:fixed;
top: 32px;
top: 31px;
z-index: 88;
}
#main-sidebar .nav {
@ -262,6 +265,10 @@
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;
@ -280,17 +287,18 @@
background-color: #FFF;
margin-left:160px;
padding-top: 32px;
padding-bottom: 18px;
/*padding-bottom: 18px;*/
position: relative;
min-height: 100%;
padding-bottom: 45px;
/*min-height: 100%;*/
}
#main-wrap > .form-actions {
/*#main-wrap > .form-actions {
background-color: #FFF;
text-align: center;
padding: 17px 20px 0;
margin: 0;
border-top: none;
}
}*/
#main-wrap .subnav {
height: auto;
min-height: 36px;
@ -318,6 +326,9 @@
font-size: 12px;
color: #999;
}
.form-actions .btn {
margin-bottom: 0;
}
#sub-wiget {
clear: right;
float: right;
@ -336,7 +347,7 @@
text-align: right;
padding-left: 10px;
padding-right: 10px;
margin-bottom: 0;
margin-bottom: -50px;
clear: both;
}
#poststuff form {
@ -368,7 +379,7 @@
#post-body .editor {
}
#post-body-content {
margin-right: 320px;
/*margin-right: 320px;*/
padding: 8px 0 8px 6px;
}
.filter .accordion-heading > a:hover {
@ -434,6 +445,26 @@
.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;
@ -540,12 +571,56 @@
padding: 5px;
}
.popover-content {
border-radius: 3px;
-webkit-border-radius: 0 0 3px 3px;
-moz-border-radius: 0 0 3px 3px;
border-radius: 0 0 3px 3px;
padding: 5px;
}
.popover-title {
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);
@ -582,6 +657,76 @@
.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;
@ -664,15 +809,99 @@
.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 -66px;
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;
@ -733,20 +962,110 @@
.icons-page-copy {
background-position: -64px -128px;
}
.icons- {
background-position: -0px -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;
@ -776,21 +1095,90 @@
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-upload {
background-position: -448px -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- {
background-position: -0px -288px;
.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 {
@ -818,14 +1206,50 @@
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- {
background-position: -0px -352px;
.icons-star {
background-position: -448px -352px;
}
/*13*/
.icons- {
@ -861,12 +1285,63 @@
.icons-plus {
background-position: -288px -576px;
}
/*20*/
.icons-power {
background-position: -0px -608px;
}
/*20*/
.icons- {
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- {

View File

@ -1,3 +1,6 @@
/*Widget*/
.widget-size-300 {
width:298px;
}
@ -81,7 +84,7 @@
border-radius: 0 3px 3px 0;
text-align: left;
margin: 0;
width: 182px;
width: 193px;
}
.file-upload .upload {
margin:0;
@ -92,12 +95,24 @@
opacity:.0;
font-size: 60px;
left: -595px/9;
filter: alpha(opacity: 0);
filter: alpha(opacity= 0);
outline: none;
}
.file-upload .upload:focus {
position:absolute;
}
.file-upload .input-medium {
border-radius: 3px 3px 3px 3px !important;
width: 267px;
position: relative;
z-index: 5;
display: block;
clear: both;
}
.file-upload .control-label {
margin-top: 0;
margin-bottom: 5px;
}
.upload-picture {
margin-bottom: 5px;
text-align: center;
@ -117,12 +132,6 @@
margin : 0px 0 5px;
padding: 5px 10px;
}
.file-upload .input-medium {
border-radius: 3px 3px 3px 3px !important;
width: 267px;
position: relative;
z-index: 5;
}
#widget-link table {
margin-bottom:0
}

View File

@ -1,8 +1,14 @@
class Admin::AdBannersController < ApplicationController
class Admin::AdBannersController < OrbitBackendController
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :for_app_manager,:except => [:index,:show,:update,:realtime_preview]
before_filter :for_app_sub_manager
def rename
@ad_banner = AdBanner.find(params[:id])
@ad_banner.title = params[:body]
render :json => {:success =>@ad_banner.save!}
end
def destroy
@ad_banner = AdBanner.find(params[:id])
@ad_banner.destroy
@ -22,9 +28,14 @@ class Admin::AdBannersController < ApplicationController
def create
@ad_banner = AdBanner.new(params[:ad_banner])
@ad_banner.save
redirect_to admin_ad_banners_url
if @ad_banner.save
@active = @ad_banner
respond_to do |format|
format.js {render 'new_created_node'}
end
else
render 'create_error_msg'
end
end
def edit
@ -39,8 +50,9 @@ class Admin::AdBannersController < ApplicationController
redirect_to admin_ad_banners_url
end
def destroy_ad_image
def realtime_preview
@ad_banner = AdBanner.find( params[:id] ).preview_clone
@ad_banner.update_attributes(params[:ad_banner])#.update_attributes(params[:ad_images])
end
def index

View File

@ -1,7 +1,7 @@
class Admin::AdImagesController < ApplicationController
class Admin::AdImagesController < OrbitBackendController
layout 'new_admin'
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :for_app_sub_manager
def edit
@ad_banner = AdBanner.find params[:ad_banner_id]
@ -18,7 +18,10 @@ class Admin::AdImagesController < ApplicationController
end
def new
@ad_image =AdImage.new
ad_banner = AdBanner.find params[:ad_banner_id]
@ad_image =ad_banner.ad_images.build
@ad_image.post_date = Date.today
@ad_image.unpost_date = Date.today + 30
#render :action => 'new',:url=> {:ad_banner_id => params.has_key?(:ad_banner_id)? params[:ad_banner_id],nil}
end

View File

@ -0,0 +1,64 @@
class Admin::AssetCategoriesController < OrbitBackendController
def index
@asset_categories = AssetCategory.all
@asset_category = AssetCategory.new
@url = admin_asset_categories_path
end
def show
@asset_category = AssetCategory.find(params[:id])
end
def new
@asset_category = AssetCategory.new
end
def edit
@asset_category = AssetCategory.find(params[:id])
@url = admin_asset_categories_path(@asset_category)
end
def create
@asset_category = AssetCategory.new(params[:asset_category])
respond_to do |format|
if @asset_category.save
format.html { redirect_to(admin_asset_categories_url, :notice => t('announcement.create_asset_category_success')) }
format.js
else
format.html { render :action => "new" }
format.js { render action: "new" }
end
end
end
def update
@asset_category = AssetCategory.find(params[:id])
@url = admin_asset_categories_path(@asset_category)
respond_to do |format|
if @asset_category.update_attributes(params[:asset_category])
# format.html { redirect_to(panel_announcement_back_end_asset_category_url(@asset_category), :notice => t('asset_category.update_asset_category_success')) }
# format.html { redirect_to(panel_announcement_back_end_asset_categories_url, :notice => t('asset_category.update_asset_category_success')) }
# format.xml { head :ok }
format.js
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
end
end
end
def destroy
@asset_category = AssetCategory.find(params[:id])
@asset_category.destroy
respond_to do |format|
format.html { redirect_to(admin_asset_categories_url) }
format.js
end
end
end

View File

@ -0,0 +1,8 @@
class Admin::AssetTagsController < Admin::TagsController
def initialize
super
@app_title = 'asset'
end
end

View File

@ -1,11 +1,7 @@
class Admin::AssetsController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :is_admin?
class Admin::AssetsController < OrbitBackendController
def index
@assets = Asset.all.entries
@assets = (params[:sort] || @filter) ? get_sorted_and_filtered("asset") : Asset.all.page(params[:page]).per(10)
end
def show
@ -14,6 +10,8 @@ class Admin::AssetsController < ApplicationController
def new
@asset = Asset.new
@asset_categories = AssetCategory.all
@tags = AssetTag.all
respond_to do |format|
format.html {}
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} }
@ -22,6 +20,8 @@ class Admin::AssetsController < ApplicationController
def edit
@asset = Asset.find(params[:id])
@asset_categories = AssetCategory.all
@tags = AssetTag.all
respond_to do |format|
format.html {}
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} }
@ -30,15 +30,29 @@ class Admin::AssetsController < ApplicationController
def create
@asset = Asset.new(params[:asset])
if @asset.save
@asset.filename = @asset.title[I18n.locale] rescue nil
if @asset.filename && @asset.save
respond_to do |format|
format.html { redirect_to admin_assets_url }
format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'append', :id => 'asset_tbody', :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} }
format.js {
if params[:uploader]
render 'create'
else
render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil}
end
}
end
else
flash[:error] = t(:create_fail)
@asset_categories = AssetCategory.all
@tags = AssetTag.all
respond_to do |format|
format.html { render :action => :new }
format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/new', :locals => {:is_html => false}} }
format.js {
if params[:uploader]
render 'file_upload'
else
render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/new', :locals => {:is_html => false}}
end
}
end
end
end
@ -51,6 +65,9 @@ class Admin::AssetsController < ApplicationController
format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} }
end
else
flash[:error] = t(:update_fail)
@asset_categories = AssetCategory.all
@tags = AssetTag.all
respond_to do |format|
format.html { render :action => :edit }
format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/edit', :locals => {:is_html => false}} }
@ -67,4 +84,23 @@ class Admin::AssetsController < ApplicationController
end
end
def delete
if params[:to_delete]
asset = Asset.any_in(:_id => params[:to_delete]).delete_all
end
redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
def file_upload
@asset = Asset.new
@asset_categories = AssetCategory.all
@tags = AssetTag.all
render :layout => false
end
def file_select
@assets = Asset.all
render :layout => false
end
end

View File

@ -2,9 +2,52 @@ class Admin::DashboardsController < ApplicationController
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
# before_filter :is_admin?
def index
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'news_bulletin', 'page_context', 'web_link')
@recent_updated = get_recently_updated('bulletin', 'news_bulletin', 'page_context', 'web_link')
@most_visited = get_most_visited('bulletin', 'news_bulletin', 'page_context')
end
protected
def get_module_app_count(*args)
a = {}
total = 0
args.each do |module_app|
module_app_class = module_app.classify.constantize
count = module_app_class.count
a.merge!(module_app => count)
total += count
end
[a.sort {|a,b| b[1]<=>a[1]}, total]
end
def get_recently_updated(*args)
a = {}
args.each do |module_app|
module_app_class = module_app.classify.constantize
objects = module_app_class.order_by(:updated_at, :desc).limit(10)
objects.each do |object|
a.merge!(object => object.updated_at) unless (object.archived rescue nil)
end
end
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
sorted_objects[0..9]
end
def get_most_visited(*args)
a = {}
args.each do |module_app|
module_app_class = module_app.classify.constantize
objects = module_app_class.order_by(:view_count, :desc).limit(10)
objects.each do |object|
a.merge!(object => object.view_count) if object.view_count > 0 && (!object.archived rescue true)
end
end
sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
sorted_objects[0..9]
end
end

View File

@ -1,4 +1,4 @@
class Admin::DesignsController < ApplicationController
class Admin::DesignsController < OrbitBackendController
require "net/http"
require "uri"
require 'zip/zip'
@ -6,6 +6,7 @@ class Admin::DesignsController < ApplicationController
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :for_admin_only
def upload_package
if !params[:design].nil?
@ -24,7 +25,7 @@ class Admin::DesignsController < ApplicationController
end
def index
@designs = Design.all.entries
@designs = params[:sort] ? get_sorted_and_filtered("designs") : Design.all
end
def new
@ -84,6 +85,13 @@ class Admin::DesignsController < ApplicationController
end
end
def delete
if params[:to_delete]
designs = Design.any_in(:_id => params[:to_delete]).delete_all
end
redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end
protected
def unzip_design(file, zip_name)

View File

@ -21,7 +21,6 @@ class Admin::InfosController < ApplicationController
def edit
@attribute = Info.find(params[:id])
@i18n_variable = @attribute.i18n_variable
render :template => 'admin/attributes/edit'
end

View File

@ -16,6 +16,12 @@ class Admin::ItemsController < ApplicationController
end
end
def update_position
item = Item.find(params[:id])
item.shift_to(params[:parent_id], params[:position])
render :nothing => true
end
protected
def find_snippets

View File

@ -65,9 +65,11 @@ class Admin::LinksController < ApplicationController
end
def delete
@item = Link.find(params[:id])
@item.destroy
respond_to do |format|
format.html {}
format.js { destroy }
format.js { @item = @item.parent }
end
end

View File

@ -2,7 +2,7 @@ class Admin::ModuleAppsController < ApplicationController
before_filter :user_has_manager_privilege?, :only => [ :assign_manager, :remove_manager ]
before_filter :user_has_sub_manager_privilege?, :only => [ :assign_sub_manager, :remove_sub_manager ]
layout "admin"
layout "new_admin"
def index
@module_apps = ModuleApp.all.entries
@ -11,12 +11,26 @@ class Admin::ModuleAppsController < ApplicationController
def reload_frontend_pages
@module_app = ModuleApp.find(params[:id])
@categories = @module_app.key.eql?('announcement') ? BulletinCategory.all : nil
case @module_app.key
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'news'
@categories = NewsBulletinCategory.all
@tags = NewsTag.all
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
end
respond_to do |format|
format.js {}
end
end
def module_auth_proc
@module_app = ModuleApp.find(params[:id])
end
def edit
@module_app = ModuleApp.find(params[:id])
end

View File

@ -0,0 +1,67 @@
class Admin::ModuleAppsNewInterfaceController < OrbitBackendController
before_filter :authenticate_user!
before_filter :is_admin?
include AdminHelper
layout "new_admin"
def setting
@sys_users = User.all(conditions: {admin: false}).includes(:avatar)
@module_app = ModuleApp.find(params[:module_app_id])
@options_from_collection_for_select_bulletin_categorys = [@module_app].collect{|ma| [ma.title,ma.id] }
# if params.has_key? :category
# @bulletin_category = BulletinCategory.find params[:category][:id]
# else
# @bulletin_category = @bulletin_categorys.first
# end
@users_array = @module_app.managing_users rescue []
respond_to do |format|
format.html
format.js
end
end
def update_setting
module_app = update_setting_by_params
if module_app.save!
flash[:notice] = t("admin.object_auth.update_done")
else
flash[:notice] = t("admin.object_auth.update_failed")
end
end
def user_list
@module_app = ModuleApp.find params[:module_app][:id]
end
protected
def update_setting_by_params
user_sat = []
ma = ModuleApp.find params[:module_app][:id]
user_sat = User.find params[:users].keys if params.has_key? :users
users_to_new = user_sat - ma.managing_users
users_to_remove = ma.managing_users - user_sat
users_to_new.each do |new_user|
ma.assign_manager(new_user,current_user)
end
users_to_remove.each do |remove_user|
ma.remove_manager(remove_user)
end
ma
end
def get_categorys(id = nil)
@bulletin_categorys = []
if(is_manager? || is_admin?)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
elsif is_sub_manager?
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
end
end
end

View File

@ -1,6 +1,6 @@
class Admin::ObjectAuthsController < ApplicationController
include OrbitCoreLib::PermissionUnility
layout "admin"
layout "new_admin"
before_filter :force_order
# before_filter :is_admin? ,:only => :index

View File

@ -0,0 +1,69 @@
class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
include OrbitCoreLib::PermissionUnility
before_filter :force_order
def setting
@sys_users = User.all(conditions: {admin: false}).includes(:avatar)
@ob_auth = ObjectAuth.find params[:object_auth_id]
@options_from_collection_for_select_ob_auth = [@ob_auth].collect{|oa| [oa.auth_obj.pp_object,oa.id] }
@users_array = @ob_auth.privilege_users rescue []
respond_to do |format|
format.html
format.js
end
end
def update_setting
ob_auth = update_setting_by_params
if ob_auth.save!
flash[:notice] = t("admin.object_auth.update_done")
else
flash[:notice] = t("admin.object_auth.update_failed")
end
end
def user_list
@ob_auth = ObjectAuth.find params[:ob_auth][:id]
end
protected
def update_setting_by_params
user_sat = []
oa = ObjectAuth.find params[:ob_auth][:id]
user_sat += User.find params[:users].keys if params.has_key? :users
users_to_new = user_sat - oa.auth_users
users_to_remove = oa.auth_users - user_sat
users_to_new.each do |new_user|
oa.add_user_to_privilege_list(new_user)
end
users_to_remove.each do |remove_user|
oa.remove_user_from_privilege_list(remove_user)
end
oa
end
# def get_categorys(id = nil)
# @bulletin_categorys = []
# if(is_manager? || is_admin?)
# @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
# elsif is_sub_manager?
# @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
# end
# end
def force_order
authenticate_user!
check_if_user_can_do_object_auth
end
def check_if_user_can_do_object_auth
unless check_permission(:manager)
render :nothing => true, :status => 403
end
end
end

View File

@ -22,15 +22,20 @@ class Admin::PagePartsController < ApplicationController
def edit
@part = PagePart.find(params[:id])
@module_apps = ModuleApp.all(:conditions => {:enable_frontend => true})
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@module_app = @part.module_app ? @part.module_app : @module_apps[0]
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
@tag_objects = @r_tag.classify.constantize.all
@tag_objects = @r_tag.classify.constantize.all rescue nil
case @module_app.key
when 'bulletin'
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'news'
@categories = NewsBulletinCategory.all
@tags = NewsTag.all
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
end
end
@ -41,8 +46,8 @@ class Admin::PagePartsController < ApplicationController
def update
@part = PagePart.find(params[:id])
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')
@part.save
respond_to do |format|
format.html {
redirect_to admin_page_url( @part.page )
@ -67,12 +72,34 @@ class Admin::PagePartsController < ApplicationController
case @module_app.key
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'news'
@categories = NewsBulletinCategory.all
@tags = NewsTag.all
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
end
respond_to do |format|
format.js {}
end
end
def reload_r_tag_options
@r_tag = (ModuleApp.find(params[:id]) rescue nil) || params[:id]
@tag_objects = @r_tag.classify.constantize.all rescue nil
respond_to do |format|
format.js {}
end
end
protected
def set_children_sub_menu(part)
part.page.children.each do |child|
child_part = child.page_parts.detect{ |x| x.name.eql?(part.name) } rescue nil
child_part.update_attributes(:kind => part.kind, :public_r_tag => part.public_r_tag, :public_r_tag_object_id => part.public_r_tag_object_id) rescue nil
end
end
end

View File

@ -20,24 +20,38 @@ class Admin::PagesController < ApplicationController
def new
@item = Page.new
@item.parent = Item.find(params[:parent_id]) rescue nil
@apps = ModuleApp.all
@apps = ModuleApp.excludes(app_pages: nil).entries
@designs = Design.all.entries
@design = Design.first
end
def edit
@item = Page.find(params[:id])
@apps = ModuleApp.all
@apps = ModuleApp.excludes(app_pages: nil).entries
@designs = Design.all.entries
@design = @item.design ? @item.design : @designs.first
@app_frontend_urls = @item.module_app.app_pages if @item.module_app
@categories = BulletinCategory.all if @item.module_app && @item.module_app.key.eql?('announcement')
if @item.module_app
case @item.module_app.key
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'news'
@categories = NewsBulletinCategory.all
@tags = NewsTag.all
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
end
else
@categories = nil
end
end
def create
@item = Page.new(params[:page])
if @item.module_app.key == 'page_content'
if @item.module_app && @item.module_app.key == 'page_content'
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
end
@ -85,14 +99,16 @@ class Admin::PagesController < ApplicationController
format.html {
redirect_to admin_items_url( :parent_id => @item.parent_id )
}
format.js {}
format.js { redirect_to admin_items_url }
end
end
def delete
@item = Page.find(params[:id])
@item.destroy
respond_to do |format|
format.html {}
format.js { destroy }
format.js { @item = @item.parent }
end
end

View File

@ -21,7 +21,6 @@ class Admin::RolesController < ApplicationController
def edit
@attribute = Role.find(params[:id])
@i18n_variable = @attribute.i18n_variable
render :template => 'admin/attributes/edit'
end

View File

@ -1,16 +1,48 @@
class Admin::SitesController < ApplicationController
layout "admin"
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :get_site
def index
@site = Site.first
redirect_to :action => :new unless @site
# def index
# @site = Site.first
# # redirect_to :action => :new unless @site
# end
# def new
# @site = Site.new
# end
def update
@site.update_attributes(params[:site])
redirect_to :back
end
def new
@site = Site.new
def site_info
end
def system_info
end
def language
end
def mail_setting
end
def ui_theme
end
private
def get_site
@site ||= Site.first
end
end

View File

@ -8,6 +8,10 @@ class ApplicationController < ActionController::Base
helper :all
before_filter :set_locale, :set_site
def set_current_user
User.current = current_user
end
def front_end_available(module_app_title='')
app_controller = ModuleApp.first(conditions: {:key => module_app_title} )
unless app_controller.enable_frontend?
@ -39,15 +43,65 @@ class ApplicationController < ActionController::Base
@parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil
end
def auth_failed_in_backend
#redirect_to admin_dashboards_url
redirect_to root_path
end
# Check if the current_user is admin
def is_admin?
redirect_to root_url unless current_user.admin?
current_user.admin? ? true : auth_failed_in_backend
end
def is_manager?
@module_app.managing_users.include?(current_user) || is_admin?
end
def for_admin_only
if is_admin?
true
else
flash[:error] = t("admin.access.denied.not_admin")
auth_failed_in_backend
end
end
def for_app_manager
if is_manager?
true
else
flash[:error] = t("admin.access.denied.app.not_manager")
auth_failed_in_backend
end
end
def for_app_sub_manager
if (@module_app.sub_managing_users.include?(current_user) || is_manager?)
true
else
flash[:error] = t("admin.access.denied.app.not_sub_manager")
auth_failed_in_backend
end
end
def for_app_user
if (@module_app.app_auth.auth_users.include?(current_user) || for_app_sub_manager )
true
else
flash[:error] = t("admin.access.denied.app.not_authed_user")
auth_failed_in_backend
end
end
def check_object_premission(obj,title)
flash[:error] = t("admin.access.denied.object")
auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_user) || is_manager? || is_admin? )
end
# Render the page
def render_page(id = nil)
def render_page
if @item
render :text => process_page(@item, id), :layout => 'page_layout'
render :text => parse_page_noko(@item), :layout => 'page_layout'
else
render :text => '404 Not Found'
end
@ -78,8 +132,8 @@ class ApplicationController < ActionController::Base
# set site if exist or create site
@site = Site.first || Site.create({:valid_locales => [], :in_use_locales => []})
session[:site] = @site.id
@site_in_use_locales = @site.in_use_locales
@site_valid_locales = @site.valid_locales
@site_in_use_locales = site_locales_default_head(@site.in_use_locales)
@site_valid_locales = site_locales_default_head(@site.valid_locales)
end
def set_current_item
@ -103,7 +157,7 @@ class ApplicationController < ActionController::Base
end
def get_homepage
Item.first(:conditions => {:parent_id => nil})
Page.root
end
def layout_by_resource
@ -114,4 +168,14 @@ class ApplicationController < ActionController::Base
end
end
def site_locales_default_head(locales)
if locales[0].eql? I18n.locale.to_s
locales
else
a = Array.new(locales)
shift_out = a.delete(I18n.locale.to_s)
[shift_out] + a
end
end
end

View File

@ -7,12 +7,43 @@ class DesktopOrbitController< ApplicationController
def getevents
@event = params["event"]
@data = Array.new
@fromdate = params["from"]
case @event
when "papers"
@journals = current_user.journals
@journals.each do |journal|
@data << {"title"=> journal.title,"papers"=> journal.papers}
@data = current_user.papers.where(:created_at.gt => Date.new(Integer(@fromdate[0]),Integer(@fromdate[1])-1),:created_at.lt => Date.new(Integer(@fromdate[0]),Integer(@fromdate[1])+1)).desc(:created_at)
end
render :json=>@data.to_json
end
def eventajaxload
@limit = 15
@fromdate = params["from"]
@fromdate[0] = Integer(@fromdate[0])
@fromdate[1] = Integer(@fromdate[1])
@totalpapers = 0
@lastpaper = current_user.papers.all.desc(:created_at).last
@date = Date.new(Integer(@lastpaper.created_at.strftime("%Y")),Integer(@lastpaper.created_at.strftime("%m")))
@data = Array.new
while @totalpapers < @limit
if Date.new(@date.year,@date.month-1) > Date.new(@fromdate[0],@fromdate[1])
break
end
if(@fromdate[1] == 12)
@papers = current_user.papers.where(:created_at.gt => Date.new(@fromdate[0],@fromdate[1]),:created_at.lt => Date.new(@fromdate[0]+1,1)).desc(:created_at)
else
@papers = current_user.papers.where(:created_at.gt => Date.new(@fromdate[0],@fromdate[1]),:created_at.lt => Date.new(@fromdate[0],@fromdate[1]+1)).desc(:created_at)
end
if(@papers.length > 0)
@data << {"papers" => @papers}
end
@totalpapers = @totalpapers + @papers.length
@fromdate[1] = @fromdate[1]-1
if(@fromdate[1] == 0)
@fromdate[1] = 12
@fromdate[0] = @fromdate[0] - 1
end
end
render :json=>@data.to_json
end

View File

@ -24,7 +24,7 @@ class DesktopPublicationsController< ApplicationController
end
def create_journal
Journal.create(user_id: current_user.id, title: "Google")
Journal.create(user_id: current_user.id, title: "Ice Cream Sandwich")
b = Array.new
b << {"success"=>"true"}
render :json=>b.to_json
@ -47,4 +47,15 @@ class DesktopPublicationsController< ApplicationController
b << {"success"=>"true"}
render :json=>b.to_json
end
def update_journal
@journal = Journal.find("4ff2d6ebbd98eb02b9000017")
@papers = @journal.papers
@papers.each do |paper|
paper.update_attributes(:user_id => current_user.id)
end
b = Array.new
b << {"success"=>"true"}
render :json=>b.to_json
end
end

View File

@ -1,6 +1,8 @@
class OrbitBackendController< ApplicationController
before_filter :force_order,:except => [:public]
before_filter :setup_vars
before_filter :set_current_user
# before_filter {|c| c.front_end_available(@app_title)}
# before_filter :check_user_can_use
include OrbitCoreLib::PermissionUnility
@ -10,6 +12,8 @@ class OrbitBackendController< ApplicationController
def setup_vars
@app_title = request.fullpath.split('/')[2]
@app_title = request.fullpath.split('/')[1] if(@app_title == "back_end")
@app_title.gsub!(/[?].*/,'')
@module_app = ModuleApp.first(conditions: {:key => @app_title} )
end
@ -22,8 +26,164 @@ class OrbitBackendController< ApplicationController
def check_user_can_use
unless check_permission
redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
#redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
redirect_to root_url
end
end
def get_sorted_and_filtered(object_class, query=nil)
objects = get_objects(object_class, query)
object_class = object_class.classify.constantize
if !params[:sort].blank?
options = params[:sort_options]
options = [options] if !options.class.eql?(Array)
options.each do |option|
if object_class.fields.include?(option)
case object_class.fields[option].type.to_s
when 'BigDecimal', 'Boolean', 'Date', 'DateTime', 'Float', 'Integer', 'String', 'Symbol', 'Time'
(objects = objects.order_by(option, params[:direction])) rescue nil
when 'Object'
objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option)
end
elsif object_class.relations.include?(option)
case object_class.relations[option].macro
when :references_one
a = Array.new
objects.each { |object| a << [get_string_value_from_object(object), object] }
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
objects = sorted.collect {|x| x[1] }
when :references_many, :references_and_referenced_in_many
objects = get_objects_from_self(object_class, objects, option)
when :referenced_in
objects = get_objects_from_referenced_objects(object_class.relations[option].class_name.constantize, objects, "#{option}_id")
end
end
end
end
if @filter
@filter.each do |key, value|
case key
when 'status'
a = Array.new
objects.each do |object|
value.each do |v|
a << object if object[v]
end
end
objects = a.uniq
when 'categories'
a = Array.new
objects.each do |object|
a << object if (value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s) rescue nil)
end
objects = a.uniq
when 'tags'
a = Array.new
objects.each do |object|
object.tags.each do |tag|
a << object if value.include?(tag.id.to_s)
end
end
objects = a.uniq
end if value.size > 0
end
end
Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10)
end
def get_string_value_from_object(object)
s = object[I18n.locale] rescue nil
s = object.i18n_variable unless s rescue nil
s = object.name unless s rescue nil
s = object.title unless s rescue nil
if s
case s.class.to_s
when "String"
s.downcase rescue ''
when "I18nVariable"
s[I18n.locale].downcase rescue ''
else
nil
end
end
end
def get_objects_from_referenced_objects(object_class, objects, option)
referer_ids = objects.distinct(option)
referenced_objects = object_class.find(referer_ids) rescue nil
if referenced_objects
a = Array.new
referenced_objects.each { |referer| a << [get_string_value_from_object(referer), referer.id] }
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
sorted_objects = sorted.collect {|x| objects.where(option => x[1]).entries }
sorted_objects.flatten!
sorted_objects.uniq!
get_with_nil(objects, option, sorted_objects)
else
objects
end
end
def get_objects_from_self(object_class, objects, option)
referenced_class = object_class.relations[option].class_name.constantize
referenced_objects = referenced_class.all rescue nil
if referenced_objects
reverse_relation = nil
referenced_class.relations.each { |relation| reverse_relation = relation[1].name.to_s if relation[1].class_name.eql?(object_class.to_s) }
a = Array.new
referenced_objects.each { |referenced_object| a << [get_string_value_from_object(referenced_object), referenced_object] }
a.compact!
sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse!
sorted_objects = Array.new
sorted.each {|x| sorted_objects << x[1].send(reverse_relation) }
sorted_objects.flatten!
sorted_objects.uniq!
get_with_nil(objects, option, sorted_objects)
else
objects
end
end
def get_with_nil(objects, option, sorted_objects)
tmp = Array.new
objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).blank? || (object.send(option).size == 0 rescue nil)) }
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
sorted_tmp = sorted.collect {|a| a[1] }
a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp)
a.flatten
end
def get_viewable(object_class)
objects = get_objects(object_class).order_by(:created_at, :desc)
Kaminari.paginate_array(objects).page(params[:page]).per(10)
end
def get_objects(object_class, query=nil)
object_class = object_class.classify.constantize
if query
objects = object_class.all.where(query)
else
objects = object_class.all
end
objects
end
def filter_authorized_objects(objects)
if(!is_admin? || !is_manager?)
objects.delete_if{ |object|
if object.is_pending == true
if check_permission(:manager)
object.create_user_id != current_user.id
else
!object.send("#{object.class.to_s.underscore}_category").authed_users('fact_check').include?(current_user) rescue false
end
else
false
end
}
end
objects
end
end

View File

@ -1,7 +1,7 @@
class OrbitFrontendComponentController< ApplicationController
before_filter :setup_vars
before_filter {|c| c.front_end_available(@app_title)}
layout :false
layout "module_widget"
def setup_vars
@app_title = request.fullpath.split('/')[2]

View File

@ -7,6 +7,7 @@ class PagesController < ApplicationController
def index
@item = Page.find_by_name('home')
if @item
impressionist(@item)
render_page
else
render :text => 'You need a home page'
@ -15,13 +16,14 @@ class PagesController < ApplicationController
def show
#begin
@item = Item.first(:conditions => {:full_name => params[:page_name]})
if @item && @item.is_published
@item = Item.first(:conditions => {:path => params[:page_name]})
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
impressionist(@item)
case @item._type
when 'Page'
render_page(params[:id])
render_page
when 'Link'
redirect_to "http://#{@item[:url]}"
redirect_to @item[:url]
end
else
render :file => "#{Rails.root}/public/404.html", :status => :not_found
@ -32,15 +34,19 @@ class PagesController < ApplicationController
end
def index_from_link
if params[:page]
redirect_to "/#{@item.full_name}?page=#{params[:page]}"
else
redirect_to "/#{@item.full_name}"
end
url = "/#{@item.path}"
options = ''
options << "?page_main=#{params[:page_main]}" unless params[:page_main].blank?
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
redirect_to url + options
end
def show_from_link
redirect_to "/#{@item.full_name}?id=#{params[:id]}"
url = "/#{@item.path}?id=#{params[:id]}"
options = ''
options << "&preview=#{params[:preview]}" unless params[:preview].blank?
redirect_to url + options
end
def load_orbit_bar
@ -51,11 +57,7 @@ class PagesController < ApplicationController
def get_item
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
if params[:category_id]
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]})
else
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]})
end
end
end

View File

@ -11,6 +11,21 @@ module Admin::AdBannerHelper
printable_ad_images.shuffle!
end
def sub_manager?(ad_banner)
ad_banner.authed_users(:edit).include?(current_user)
end
def show_ad_banner_permission_link(ad_banner)
type = 'edit'
oa = ad_banner.get_object_auth_by_title(type)
if oa.nil?
ad_banner.object_auths.new(title: type ).save
oa = ad_banner.get_object_auth_by_title(type)
end
# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
link_to t('admin.ad.cate_auth'),admin_object_auth_ob_auth_path(oa),:class => "btn btn-warning"
end
end

View File

@ -1,7 +1,3 @@
module Admin::AdImagesHelper
def active_when_default_locale_eq locale
locale.to_sym == I18n.default_locale ? 'active': ''
end
end

View File

@ -0,0 +1,11 @@
module Admin::AssetHelper
def show_all_fields(asset, field)
a = []
@site_valid_locales.each do |locale|
a << asset.send(field)[locale] rescue nil
end
a.join(' - ')
end
end

View File

@ -0,0 +1,29 @@
module Admin::DashboardHelper
def get_link(title)
case title
when 'bulletin'
panel_announcement_front_end_bulletins_path
when 'news_bulletin'
panel_news_front_end_news_bulletins_path
when'page_context'
panel_page_content_front_end_page_contexts_path
when'web_link'
panel_web_resource_front_end_web_links_path
end
end
def get_link_to_object(object)
case object._type.underscore
when 'bulletin'
panel_announcement_front_end_bulletin_path(object)
when 'news_bulletin'
panel_news_front_end_news_bulletin_path(object)
when'page_context'
"/#{object.page.path}"
when'web_link'
panel_web_resource_front_end_web_link_path(object)
end
end
end

View File

@ -8,30 +8,37 @@ module Admin::ItemHelper
dest = admin_page_path(node)
when 'Link'
dest = admin_link_path(node)
no_nested = 'no-nest'
end
ret << "<ul class='list'>"
ret << "<li>"
ret << (link_to node.i18n_variable[I18n.locale], dest)
ret << ' | ' << (link_to t('admin.edit'), eval("edit_admin_#{node._type.downcase}_path(node)")) if node._type.eql?('Page')
ret << ' | ' << (link_to t('admin.new_page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page') if node._type.eql?('Page')
ret << ' | ' << (link_to t('admin.new_link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link') if node._type.eql?('Page')
ret << ' | ' << (link_to t(:delete), eval("delete_admin_#{node._type.downcase}_path(node, :authenticity_token => form_authenticity_token)"), :confirm => t('sure?'), :class => 'delete')
ret << "<li id='#{node.id}' class='#{no_nested}'>"
# ret << "<i class='icons-moves'></i>"
ret << "<div class='with_action'><i class='icons-moves'></i>"
ret << (link_to node.i18n_variable[I18n.locale], dest, :class => 'js_history')
ret << "<div class='quick-edit hide'>"
ret << (link_to t('admin.edit'), eval("edit_admin_#{node._type.downcase}_path(node)"), :class => 'js_history') if node._type.eql?('Page')
ret << (link_to t('admin.new_page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page js_history') if node._type.eql?('Page')
ret << (link_to t('admin.new_link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link js_history') if node._type.eql?('Page')
ret << (link_to t(:delete), eval("delete_admin_#{node._type.downcase}_path(node, :authenticity_token => form_authenticity_token)"), :confirm => t('sure?'), :class => 'delete js_history')
ret << "</div>"
ret << "</div>"
ret << render_children(node)
ret << "</li>"
ret << "</ul>"
end
ret.html_safe
end
def render_children(parent)
if children = parent.children
children = parent.children
if !parent.children.entries.blank?
ret = ''
ret << "<ul>"
ret << "<ol class='#{'sortable' if parent.parent.nil?}'>"
children.each do |child|
ret << render_node_and_children(child)
end
ret << "</ul>"
ret << '</ol>'
ret
else
''
end
end

View File

@ -14,6 +14,7 @@ module Admin::ModuleAppHelper
end
def get_auth_by(manager_obj)
"-AuthBy: " +( manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name)
showing_name = manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name
t("admin.user_role.auth.auth_by",:user_display_name => showing_name)
end
end

View File

@ -0,0 +1,18 @@
module Admin::PageContentHelper
include ActionView::Helpers::UrlHelper
def show_page_context_edit_auth_link(page_context)
type = 'Edit'
# debugger
# a=1
oa = page_context.get_object_auth_by_title(type)
if oa.nil?
page_context.object_auths.new(title: type ).save rescue
oa = page_context.get_object_auth_by_title(type)
end
# link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa)
link_to t('admin.page_context.ob_auth.edit'),admin_object_auth_ob_auth_path(oa)
end
end

View File

@ -0,0 +1,11 @@
module Admin::WebLinkHelper
def show_web_link_permission_link(web_link)
type = 'edit'
oa = web_link.get_object_auth_by_title(type)
if oa.nil?
web_link.object_auths.new(title: type ).save
oa = web_link.get_object_auth_by_title(type)
end
link_to t('admin.web_link.cate_auth'),admin_object_auth_ob_auth_path(oa)
end
end

View File

@ -2,12 +2,6 @@ module ApplicationHelper
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
def site_valid_locales_default_head
index = @site_valid_locales.rindex I18n.default_locale.to_s
shift_out = @site_valid_locales.shift(index)
@site_valid_locales += shift_out
end
def colorize_in_use_locale(locale)
@site_in_use_locales.include?(locale)? 'green' : 'red'
end
@ -74,78 +68,99 @@ module ApplicationHelper
end
end
def active_for_ob_auths_object(object_class,field = :object_auth_id)
unless active_for_action("object_auths_new_interface","setting").nil?
ob_auth = ObjectAuth.find params[field]
ob_auth.obj_authable_type == object_class.to_s ? 'active' : nil
end
end
def active_for_ob_auth(ob_auth_title,field = :object_auth_id)
unless active_for_action("module_apps_new_interface","setting").nil?
oa_auth = ObjectAuth.find params[field]
oa_auth.title == ob_auth_title ? 'active' : nil
end
end
def active_for_app_auth(app_title ='', opt={:controller_name => 'module_apps_new_interface',:action_name=>'setting',:field => :module_app_id})
unless active_for_action(opt[:controller_name],opt[:action_name]).nil?
app = ModuleApp.find params[opt[:field]]
app.title == app_title ? 'active' : nil
else
nil
end
end
def active_for_controllers(*controller_names)
controller_names.include?(controller.controller_name) ? 'active' : nil
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? 'active' : nil
end
def visible_for_controllers(*controller_names)
controller_names.include?(controller.controller_name) ? '' : 'hide'
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? '' : 'hide'
end
def active_for_action(controller_name, action_name)
((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil
end
def sortable(column)
direction = (column == params[:sort] && params[:direction] == "asc") ? "desc" : "asc"
{:sort => column, :direction => direction}
end
def is_sort_active?(name)
res = ''
res << ' select' if params[:sort].eql?(name)
res << ' active' if params[:sort].eql?(name) && params[:direction].eql?('asc')
res
end
def is_sort?(name)
' web-symbol' if params[:sort].eql?(name)
end
def is_filter_active?(type, id)
' active' if (@filter[type].include?(id.to_s) rescue nil)
end
def process_page(page, id)
parse_page_noko(page, id)
end
def page_metas(page)
tmp_meta = {}
metas = ''
@site.page_metas.each do |meta|
@site.site_metas.each do |meta|
name, content = meta.get_name_content
metas << "<meta name=#{name} content=#{content} />\n"
tmp_meta.merge!(name => content)
end rescue nil
return metas
page.page_metas.each do |meta|
name, content = meta.get_name_content
tmp_meta.merge!(name => content)
end rescue nil
tmp_meta.each_pair{|name, content|
metas << "<meta name='#{name}' content='#{content}' />\n"
} if !tmp_meta.blank?
metas
end
def page_title(page)
"<title>#{page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]}</title>\n"
res = "<title>"
page_title = page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]
if page.root? && @site.title
res << @site.title[I18n.locale]
elsif @site.title && @site.title_always_on
res << @site.title[I18n.locale] + ' - ' + page_title
else
res << page_title
end
res << "</title>\n"
end
def page_stylesheets(page)
def page_stylesheets(page, edit=nil)
stylesheets = ''
stylesheets << "<link href='/assets/bootstrap.css.erb' rel='stylesheet' type='text/css' />\n"
unless edit
stylesheets << "<link href='/assets/bootstrap.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/style.css.erb' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
end
stylesheets << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.reset_css
stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.default_css
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme
stylesheets
end
def page_javascripts(page)
def page_javascripts(page, edit=nil)
javascripts = ''
unless edit
javascripts << "<script type='text/javascript' src='/static/jquery.js'></script>\n"
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/bootstrap.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/jquery.tinyscrollbar.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/jquery.isotope.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-member.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
end
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/event.js'></script>\n"
page.design.javascripts.each do |js|
# javascripts << "<script type='text/javascript' src='#{js.file.url}'></script>"
@ -153,4 +168,48 @@ module ApplicationHelper
javascripts
end
def active_when_current_locale_eq(locale)
locale.to_sym == I18n.locale ? 'active in': ''
end
def at_least_module_manager
is_manager? || is_admin?
end
def dislpay_view_count(object)
"#{t(:view_count)}: #{object.view_count}"
end
def display_visitors(options={})
Impression.where(options).and(:referrer.ne => nil).distinct(:session_hash).count
end
def display_visitors_today
display_visitors(created_at: {'$gte' => Date.today.beginning_of_day, '$lte' => Date.today.end_of_day})
end
def display_visitors_this_week
display_visitors(created_at: {'$gte' => Date.today.beginning_of_week, '$lte' => Date.today.end_of_week})
end
def display_visitors_this_month
display_visitors(created_at: {'$gte' => Date.today.beginning_of_month, '$lte' => Date.today.end_of_month})
end
def display_visitors_this_year
display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year})
end
def at_least_module_manager
is_manager? || is_admin?
end
def display_date_time(object)
object.strftime("%Y-%m-%d %H:%M")
end
def display_date(object)
object.strftime("%Y-%m-%d")
end
end

View File

@ -0,0 +1,45 @@
module OrbitBackendHelper
def sortable(column)
direction = (column == params[:sort] && params[:direction] == "asc") ? "desc" : "asc"
{:sort => column, :direction => direction}
end
def is_sort_active?(name)
res = ''
res << ' select' if params[:sort].eql?(name)
res << ' active' if params[:sort].eql?(name) && params[:direction].eql?('asc')
res
end
def is_sort?(name)
' web-symbol' if params[:sort].eql?(name)
end
def is_filter_active?(type, id)
' active' if (@filter[type].include?(id.to_s) rescue nil)
end
def render_sort_bar(delete_all, *titles)
content_tag :table, :class => "table main-list" do
content_tag :thead do
content_tag :tr, :class => "sort-header" do
concat (content_tag :th, :class => "span1 strong" do
concat check_box_tag :check_all
concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove"
end) if (delete_all && (is_admin? || (is_manager? rescue nil)))
titles.each do |title|
concat render_title(title[0], title[1], title[2], title[3])
end
end
end
end
end
def render_title(title, fields, span, translation)
content_tag :th, :class => "sort #{span} #{is_sort_active?(title)}" do
link_to (t(translation) + content_tag(:b, nil, :class => is_sort?(title))).html_safe, url_for({:filter => @filter}.merge(sortable(title).merge(:sort_options => fields))), :class => 'js_history'
end
end
end

15
app/jobs/fetch_time.rb Normal file
View File

@ -0,0 +1,15 @@
# require 'open-uri'
# require 'nokogiri'
class FetchTime < Resque::Plugins::RestrictionJob
restrict :per_300 => 10
@queue = :low
def self.perform()
# sleep 10
doc = Nokogiri::HTML(open('http://www.timeanddate.com/worldclock/city.html?n=241'))
CronMail.time_check(doc.at('#ct').children.first.text).deliver
puts "Mail Sent"
true
end
end

12
app/jobs/nccu_calendar.rb Normal file
View File

@ -0,0 +1,12 @@
class NccuCalendar
require 'open-uri'
@queue = :high
def self.perform()
File.open(File.join(Rails.root, 'public/static', 'nccu_calendar.rss'),'w') do |file|
file << open('http://events.nccu.edu.tw/Feed').read
CronMail.time_check("NCCU Calendar synced").deliver
end
puts "NccuCalendar Synced"
end
end

View File

@ -0,0 +1,8 @@
class RestartServer
@queue = :high
def self.perform()
CronMail.time_check("Going to restarting Orbit").deliver
%x[touch #{Rails.root}/tmp/restart]
end
end

16
app/jobs/sync_db.rb Normal file
View File

@ -0,0 +1,16 @@
class SyncDb
@queue = :high
def self.perform()
self.start_sync
end
def self.start_sync
task = 'mid_site:sync'
args = []
%x[rake #{task} --trace >> #{Rails.root}/log/rake.log]
User.all.each{|ur| ur.create_dept_cache}
puts "SyncDb Synced"
end
end

33
app/mailer/cron_mail.rb Normal file
View File

@ -0,0 +1,33 @@
class CronMail < ActionMailer::Base
default :from => "orbit_test@rulingcom.com"
def get_settings
# @@smtp_settings = {
# :address => "smtp.gmail.com",
# :port => '587',
# :domain => "smtp.gmail.com",
# :authentication => "plain",
# :user_name => "redmine@rulingcom.com",
# :password => "rulingredmine",
# :tls => true,
# :enable_starttls_auto => true
# }
@@smtp_settings = {
:address => @site['mail_settings']['address'],
:port => @site['mail_settings']['port'],
:domain => @site['mail_settings']['domain'],
:authentication => @site['mail_settings']['authentication'],
:user_name => @site['mail_settings']['user_name'],
:password => @site['mail_settings']['password'],
:tls => @site['mail_settings']['tls'],
:enable_starttls_auto => @site['mail_settings']['enable_starttls_auto']
}
end
def time_check(msg)
get_settings
#attachments["rails.png"] = File.read("#{Rails.root}/public/images/rails.png")
mail(:to => "Chris <chris@rulingcom.com>", :subject => msg)
end
end

View File

@ -2,18 +2,42 @@ class AdBanner
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include OrbitCoreLib::ObjectAuthable
field :title
field :transition_sec,type: Integer
field :transition_msec,type: Integer
field :ad_fx #TODO Design should explain
field :best_size,:default => ''
before_save :save_or_destroy
validates_uniqueness_of :title
validates :title , :length => { :minimum => 2 }
has_many :ad_images , dependent: :delete
FX_TYPES = ["blindX","blindY","blindZ","cover","curtainX","curtainY","fade","fadeZoom","growX","growY","scrollUp","scrollDown","scrollLeft","scrollRight","scrollHorz","scrollVert","shuffle","slideX","slideY","toss","turnUp","turnDown","turnLeft","turnRight","uncover","wipe","zoom"]
attr_writer :transition_sec
AfterObjectAuthUrl = '/panel/page_content/back_end/page_contexts'
APP_NAME = 'ad_banners'
ObjectAuthTitlesOptions = %W{edit}
def pp_object
title
end
def transition_sec
self.transition_msec/1000 rescue nil
end
def transition_sec=(sec)
self.transition_msec = sec.to_i*1000
end
def preview_clone
preview_banner = self.clone
preview_banner.ad_images = self.ad_images
preview_banner
end
# def new_ad_images(*attrs)
# debugger
# a=1

View File

@ -24,16 +24,15 @@ class AdImage
# validates_numericality_of :weight, greater_than_or_equal_to: 1,less_than_or_equal_to: 10
# validates_format_of :out_link, with: /(http:\/\/.*|)/ ,:message => 'Need a valid URL'
# validates_presence_of :post_date,:message => 'Need a valid post date'
attr_reader :parse_post_date,:parse_unpost_date
def parse_post_date=(att)
self.post_date = (Date.parse att rescue nil)
self.post_date = (Date.parse att.gsub(/\s+/, "") rescue nil)
end
def parse_unpost_date=(att)
self.unpost_date = (Date.parse att rescue nil)
self.unpost_date = (Date.parse att.gsub(/\s+/, "") rescue nil)
end
def display?

Some files were not shown because too many files have changed in this diff Show More