diff --git a/.gitignore b/.gitignore
index df0dc67c..41292061 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,8 +10,7 @@ uploads/**/*
*.swp
-public/javascripts
-public/stylesheets
+public/assets
config/application.rb
.rvmrc
diff --git a/Gemfile b/Gemfile
index d3340984..abf87c59 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,55 +1,62 @@
-source 'http://rubygems.org'
-gem 'rails', '>=3.1.0', '<3.2.0'
-
-gem "brakeman"
-
-gem 'bson_ext'
-gem 'carrierwave'
-gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
-gem 'devise', '1.5.3'
-gem 'exception_notification' # Send error trace
-gem 'execjs'
-gem 'jquery-rails'
-
-gem 'kaminari'
-
-gem 'mini_magick'
-gem 'mongoid'
-gem "mongo_session_store-rails3"
-gem 'nokogiri'
-gem 'radius'
-gem 'rake'
-gem 'ruby-debug19'
-gem 'rubyzip'
-gem 'sinatra'
-#gem 'sinatra-contrib'
-gem 'sprockets'
-gem 'tinymce-rails'
-gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")
-gem 'mongoid-encryptor', :require => 'mongoid/encryptor'
-#gem 'contacts'
-
-# Gems used only for assets and not required
-# in production environments by default.
-group :assets do
- gem 'sass-rails'
- gem 'coffee-rails'
- gem 'uglifier'
-end
-
-
-group :test, :development do
- #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"
- gem "factory_girl_rails"
- gem "shoulda-matchers"
- gem "simplecov"
- gem "delorean"
- gem "watchr"
- #gem "spork"
- # gem "capybara"
- # gem 'yard'
- # gem "bluecloth"
-end
+source 'http://rubygems.org'
+gem 'rails', '>=3.1.0', '<3.2.0'
+
+gem "brakeman"
+
+gem 'bson_ext'
+gem 'carrierwave'
+gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
+gem 'devise', '1.5.3'
+gem 'exception_notification' # Send error trace
+gem 'execjs'
+gem 'jquery-rails'
+gem 'jquery-ui-rails'
+
+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'
+#gem 'sinatra-contrib'
+gem 'sprockets'
+gem 'tinymce-rails'
+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
+ gem 'sass-rails'
+ gem 'coffee-rails'
+ gem 'uglifier'
+end
+
+
+group :test, :development do
+ 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"
+ gem "factory_girl_rails"
+ gem "shoulda-matchers"
+ gem "simplecov"
+ gem "delorean"
+ gem "watchr"
+ gem "spork"
+ # gem "capybara"
+ # gem 'yard'
+ # gem "bluecloth"
+end
diff --git a/Gemfile.lock b/Gemfile.lock
index 5d5b90ff..65c9dbe8 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,267 +1,301 @@
-GEM
- remote: http://rubygems.org/
- specs:
- actionmailer (3.1.4)
- actionpack (= 3.1.4)
- mail (~> 2.3.0)
- actionpack (3.1.4)
- activemodel (= 3.1.4)
- activesupport (= 3.1.4)
- builder (~> 3.0.0)
- erubis (~> 2.7.0)
- i18n (~> 0.6)
- rack (~> 1.3.6)
- rack-cache (~> 1.1)
- rack-mount (~> 0.8.2)
- rack-test (~> 0.6.1)
- sprockets (~> 2.0.3)
- activemodel (3.1.4)
- activesupport (= 3.1.4)
- builder (~> 3.0.0)
- i18n (~> 0.6)
- activerecord (3.1.4)
- activemodel (= 3.1.4)
- activesupport (= 3.1.4)
- arel (~> 2.2.3)
- tzinfo (~> 0.3.29)
- activeresource (3.1.4)
- activemodel (= 3.1.4)
- activesupport (= 3.1.4)
- activesupport (3.1.4)
- multi_json (~> 1.0)
- archive-tar-minitar (0.5.2)
- arel (2.2.3)
- bcrypt-ruby (3.0.1)
- bcrypt-ruby (3.0.1-x86-mingw32)
- brakeman (1.5.1)
- activesupport
- erubis (~> 2.6)
- haml (~> 3.0)
- i18n
- ruby2ruby (~> 1.2)
- ruport (~> 1.6)
- sass (~> 3.0)
- bson (1.6.1)
- bson_ext (1.6.1)
- bson (~> 1.6.1)
- builder (3.0.0)
- carrierwave (0.5.8)
- activesupport (~> 3.0)
- carrierwave-mongoid (0.1.3)
- carrierwave (>= 0.5.6)
- mongoid (~> 2.1)
- chronic (0.6.7)
- coffee-rails (3.1.1)
- coffee-script (>= 2.2.0)
- railties (~> 3.1.0)
- coffee-script (2.2.0)
- coffee-script-source
- execjs
- coffee-script-source (1.2.0)
- color (1.4.1)
- columnize (0.3.6)
- database_cleaner (0.7.1)
- delorean (1.2.0)
- chronic
- devise (1.5.3)
- bcrypt-ruby (~> 3.0)
- orm_adapter (~> 0.0.3)
- warden (~> 1.1)
- diff-lcs (1.1.3)
- encrypted_strings (0.3.3)
- erubis (2.7.0)
- exception_notification (2.5.2)
- actionmailer (>= 3.0.4)
- execjs (1.3.0)
- multi_json (~> 1.0)
- factory_girl (2.6.3)
- activesupport (>= 2.3.9)
- factory_girl_rails (1.7.0)
- factory_girl (~> 2.6.0)
- railties (>= 3.0.0)
- fastercsv (1.5.4)
- haml (3.1.4)
- hike (1.2.1)
- hoe (2.16.1)
- rake (~> 0.8)
- i18n (0.6.0)
- jquery-rails (1.0.19)
- railties (~> 3.0)
- thor (~> 0.14)
- 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)
- i18n (>= 0.4.0)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- mime-types (1.17.2)
- mini_magick (3.4)
- subexec (~> 0.2.1)
- mongo (1.6.1)
- bson (~> 1.6.1)
- mongo_session_store-rails3 (3.0.5)
- actionpack (>= 3.0)
- mongo
- mongoid (2.4.6)
- activemodel (~> 3.1)
- mongo (~> 1.3)
- tzinfo (~> 0.3.22)
- mongoid-encryptor (0.0.5)
- activesupport (~> 3.0)
- encrypted_strings (~> 0.3.3)
- mongoid (~> 2)
- multi_json (1.1.0)
- nokogiri (1.5.2)
- nokogiri (1.5.2-x86-mingw32)
- orm_adapter (0.0.6)
- pdf-writer (1.1.8)
- color (>= 1.4.0)
- transaction-simple (~> 1.3)
- polyglot (0.3.3)
- rack (1.3.6)
- rack-cache (1.2)
- rack (>= 0.4)
- rack-mount (0.8.3)
- rack (>= 1.0.0)
- rack-protection (1.2.0)
- rack
- rack-ssl (1.3.2)
- rack
- rack-test (0.6.1)
- rack (>= 1.0)
- radius (0.7.3)
- rails (3.1.4)
- actionmailer (= 3.1.4)
- actionpack (= 3.1.4)
- activerecord (= 3.1.4)
- activeresource (= 3.1.4)
- activesupport (= 3.1.4)
- bundler (~> 1.0)
- railties (= 3.1.4)
- railties (3.1.4)
- actionpack (= 3.1.4)
- activesupport (= 3.1.4)
- rack-ssl (~> 1.3.2)
- rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (~> 0.14.6)
- rake (0.9.2.2)
- rdoc (3.12)
- json (~> 1.4)
- rspec (2.8.0)
- rspec-core (~> 2.8.0)
- rspec-expectations (~> 2.8.0)
- rspec-mocks (~> 2.8.0)
- rspec-core (2.8.0)
- rspec-expectations (2.8.0)
- diff-lcs (~> 1.1.2)
- rspec-mocks (2.8.0)
- rspec-rails (2.8.1)
- actionpack (>= 3.0)
- activesupport (>= 3.0)
- railties (>= 3.0)
- rspec (~> 2.8.0)
- ruby-debug-base19 (0.11.25)
- columnize (>= 0.3.1)
- linecache19 (>= 0.5.11)
- ruby_core_source (>= 0.1.4)
- ruby-debug19 (0.11.6)
- columnize (>= 0.3.1)
- linecache19 (>= 0.5.11)
- ruby-debug-base19 (>= 0.11.19)
- ruby2ruby (1.3.1)
- ruby_parser (~> 2.0)
- sexp_processor (~> 3.0)
- ruby_core_source (0.1.5)
- archive-tar-minitar (>= 0.5.2)
- ruby_parser (2.3.1)
- sexp_processor (~> 3.0)
- rubyzip (0.9.6.1)
- ruport (1.6.3)
- fastercsv
- pdf-writer (= 1.1.8)
- sass (3.1.15)
- sass-rails (3.1.5)
- actionpack (~> 3.1.0)
- railties (~> 3.1.0)
- sass (~> 3.1.10)
- tilt (~> 1.3.2)
- sexp_processor (3.1.0)
- shoulda-matchers (1.0.0)
- simplecov (0.6.1)
- multi_json (~> 1.0)
- simplecov-html (~> 0.5.3)
- simplecov-html (0.5.3)
- sinatra (1.3.2)
- rack (~> 1.3, >= 1.3.6)
- rack-protection (~> 1.2)
- tilt (~> 1.3, >= 1.3.3)
- 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)
- railties (>= 3.1)
- transaction-simple (1.4.0)
- hoe (>= 1.1.7)
- treetop (1.4.10)
- polyglot
- polyglot (>= 0.3.1)
- tzinfo (0.3.32)
- uglifier (1.2.3)
- execjs (>= 0.3.0)
- multi_json (>= 1.0.2)
- warden (1.1.1)
- rack (>= 1.0)
- watchr (0.7)
-
-PLATFORMS
- ruby
- x86-mingw32
-
-DEPENDENCIES
- brakeman
- bson_ext
- carrierwave
- carrierwave-mongoid
- coffee-rails
- database_cleaner
- delorean
- devise (= 1.5.3)
- exception_notification
- execjs
- factory_girl_rails
- jquery-rails
- kaminari
- mini_magick
- mongo_session_store-rails3
- mongoid
- mongoid-encryptor
- nokogiri
- radius
- rails (>= 3.1.0, < 3.2.0)
- rake
- rspec (~> 2.0)
- rspec-rails (~> 2.0)
- ruby-debug19
- rubyzip
- sass-rails
- shoulda-matchers
- simplecov
- sinatra
- sprockets
- therubyracer
- tinymce-rails
- uglifier
- watchr
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.4)
+ actionpack (= 3.1.4)
+ mail (~> 2.3.0)
+ actionpack (3.1.4)
+ activemodel (= 3.1.4)
+ activesupport (= 3.1.4)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.6)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.3)
+ activemodel (3.1.4)
+ activesupport (= 3.1.4)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.4)
+ activemodel (= 3.1.4)
+ activesupport (= 3.1.4)
+ arel (~> 2.2.3)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.4)
+ activemodel (= 3.1.4)
+ activesupport (= 3.1.4)
+ activesupport (3.1.4)
+ multi_json (~> 1.0)
+ archive-tar-minitar (0.5.2)
+ arel (2.2.3)
+ bcrypt-ruby (3.0.1)
+ bcrypt-ruby (3.0.1-x86-mingw32)
+ brakeman (1.5.1)
+ activesupport
+ erubis (~> 2.6)
+ haml (~> 3.0)
+ i18n
+ ruby2ruby (~> 1.2)
+ ruport (~> 1.6)
+ sass (~> 3.0)
+ bson (1.6.1)
+ bson_ext (1.6.1)
+ bson (~> 1.6.1)
+ builder (3.0.0)
+ carrierwave (0.5.8)
+ activesupport (~> 3.0)
+ carrierwave-mongoid (0.1.3)
+ carrierwave (>= 0.5.6)
+ mongoid (~> 2.1)
+ chronic (0.6.7)
+ coffee-rails (3.1.1)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.1.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.2.0)
+ color (1.4.1)
+ columnize (0.3.6)
+ database_cleaner (0.7.1)
+ delorean (1.2.0)
+ chronic
+ devise (1.5.3)
+ bcrypt-ruby (~> 3.0)
+ orm_adapter (~> 0.0.3)
+ warden (~> 1.1)
+ diff-lcs (1.1.3)
+ encrypted_strings (0.3.3)
+ erubis (2.7.0)
+ exception_notification (2.5.2)
+ actionmailer (>= 3.0.4)
+ execjs (1.3.0)
+ multi_json (~> 1.0)
+ factory_girl (2.6.3)
+ activesupport (>= 2.3.9)
+ factory_girl_rails (1.7.0)
+ factory_girl (~> 2.6.0)
+ railties (>= 3.0.0)
+ fastercsv (1.5.4)
+ haml (3.1.4)
+ 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)
+ linecache19 (0.5.12)
+ ruby_core_source (>= 0.1.4)
+ mail (2.3.3)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.17.2)
+ mini_magick (3.4)
+ subexec (~> 0.2.1)
+ mongo (1.6.1)
+ bson (~> 1.6.1)
+ mongo_session_store-rails3 (3.0.5)
+ actionpack (>= 3.0)
+ mongo
+ mongoid (2.4.6)
+ activemodel (~> 3.1)
+ mongo (~> 1.3)
+ tzinfo (~> 0.3.22)
+ mongoid-encryptor (0.0.5)
+ 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)
+ orm_adapter (0.0.6)
+ pdf-writer (1.1.8)
+ color (>= 1.4.0)
+ transaction-simple (~> 1.3)
+ polyglot (0.3.3)
+ rack (1.3.6)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-mount (0.8.3)
+ rack (>= 1.0.0)
+ rack-protection (1.2.0)
+ rack
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ radius (0.7.3)
+ rails (3.1.4)
+ actionmailer (= 3.1.4)
+ actionpack (= 3.1.4)
+ activerecord (= 3.1.4)
+ activeresource (= 3.1.4)
+ activesupport (= 3.1.4)
+ bundler (~> 1.0)
+ railties (= 3.1.4)
+ railties (3.1.4)
+ actionpack (= 3.1.4)
+ activesupport (= 3.1.4)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ 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)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.8.0)
+ rspec-rails (2.8.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.8.0)
+ ruby-debug-base19 (0.11.25)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug19 (0.11.6)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby-debug-base19 (>= 0.11.19)
+ ruby2ruby (1.3.1)
+ ruby_parser (~> 2.0)
+ sexp_processor (~> 3.0)
+ ruby_core_source (0.1.5)
+ archive-tar-minitar (>= 0.5.2)
+ 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)
+ sass (3.1.15)
+ sass-rails (3.1.5)
+ actionpack (~> 3.1.0)
+ railties (~> 3.1.0)
+ sass (~> 3.1.10)
+ tilt (~> 1.3.2)
+ sexp_processor (3.1.0)
+ shoulda-matchers (1.0.0)
+ simplecov (0.6.1)
+ multi_json (~> 1.0)
+ simplecov-html (~> 0.5.3)
+ simplecov-html (0.5.3)
+ sinatra (1.3.2)
+ 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)
+ thor (0.14.6)
+ tilt (1.3.3)
+ tinymce-rails (3.4.8)
+ railties (>= 3.1)
+ transaction-simple (1.4.0)
+ hoe (>= 1.1.7)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.32)
+ 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
+ x86-mingw32
+
+DEPENDENCIES
+ brakeman
+ bson_ext
+ carrierwave
+ carrierwave-mongoid
+ coffee-rails
+ database_cleaner
+ delorean
+ devise (= 1.5.3)
+ exception_notification
+ execjs
+ factory_girl_rails
+ impressionist!
+ jquery-rails
+ 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
+ rubyzip
+ sass-rails
+ shoulda-matchers
+ simplecov
+ sinatra
+ spork
+ sprockets
+ tinymce-rails
+ uglifier
+ watchr
diff --git a/Rakefile b/Rakefile
index 9a495de7..e0dc9c5b 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,7 +1,9 @@
+# /usr/bin/ruby -Ku
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
+require 'resque/tasks'
require 'rake/dsl_definition'
require 'rake'
diff --git a/app/assets/fonts/widget.css b/app/assets/fonts/widget.css
deleted file mode 100644
index fe83b22d..00000000
--- a/app/assets/fonts/widget.css
+++ /dev/null
@@ -1,79 +0,0 @@
-.widget-size-300 {
- width:298px;
-}
-.widget-box {
- background-color: #FFF;
- overflow: hidden;
- min-width: 300px;
- border: 1px solid #DDD;
- border-radius: 5px;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- margin: 0 0 5px 5px;
- position:relative;
-}
-.widget-box .widget-title {
- background: #999;
- color: #FFF;
- padding-left: 5px;
- border-radius: 5px 5px 0 0;
- -moz-border-radius: 5px 5px 0 0;
- -webkit-border-radius: 5px 5px 0 0;
-}
-.widget-box .widget-content {
- padding: 10px;
-}
-.widget-box .form-horizontal .control-group > label {
- width: 50px;
-}
-.widget-box .form-horizontal .controls {
- margin-left: 60px;
-}
-.widget-action {
- position:absolute;
- right:1px;
- top:6px;
-}
-.action {
- float: left;
- display:inline-block;
- margin-right: 5px;
- opacity: 0.8;
- filter: alpha(opacity=80);
-}
-.action:hover {
- opacity: 1;
- filter: alpha(opacity=100);
- cursor: pointer;
-}
-.select-role {
- display:none;
- padding: 10px 0 0;
-}
-.file-upload {
- position:relative;
-}
-.file-upload .file-name {
- display: inline-block;
- margin: 0 0 5px 5px;
- white-space: nowrap;
- width: 140px;
-}
-.file-upload .upload {
- margin:0;
- padding:0;
- position:absolute;
- top:0;
- left:0;
- opacity:.0;
- filter: alpha(opacity=100);
-}
-.file-upload .upload:focus {
- position:absolute;
-}
-.upload-picture {
- margin-right: 5px;
-}
-#widget-link table {
- margin-bottom:0
-}
\ No newline at end of file
diff --git a/app/assets/images/-sign-in-logo.png b/app/assets/images/-sign-in-logo.png
new file mode 100644
index 00000000..53756c7c
Binary files /dev/null and b/app/assets/images/-sign-in-logo.png differ
diff --git a/app/assets/images/Thumbs.db b/app/assets/images/Thumbs.db
new file mode 100644
index 00000000..20b6d49e
Binary files /dev/null and b/app/assets/images/Thumbs.db differ
diff --git a/app/assets/images/ajax-loader.gif b/app/assets/images/ajax-loader.gif
new file mode 100644
index 00000000..5f117fd8
Binary files /dev/null and b/app/assets/images/ajax-loader.gif differ
diff --git a/app/assets/images/check.png b/app/assets/images/check.png
index e415c89b..0972e33a 100644
Binary files a/app/assets/images/check.png and b/app/assets/images/check.png differ
diff --git a/app/assets/images/editicon.png b/app/assets/images/editicon.png
new file mode 100644
index 00000000..cef3e600
Binary files /dev/null and b/app/assets/images/editicon.png differ
diff --git a/app/assets/images/icons_pack.png b/app/assets/images/icons_pack.png
index 39669303..16ac9872 100644
Binary files a/app/assets/images/icons_pack.png and b/app/assets/images/icons_pack.png differ
diff --git a/app/assets/images/icons_pack_white.png b/app/assets/images/icons_pack_white.png
index 70fe3d85..e7360702 100644
Binary files a/app/assets/images/icons_pack_white.png and b/app/assets/images/icons_pack_white.png differ
diff --git a/app/assets/images/ncculogo.ico b/app/assets/images/ncculogo.ico
new file mode 100644
index 00000000..3aa5e1c6
Binary files /dev/null and b/app/assets/images/ncculogo.ico differ
diff --git a/app/assets/images/orbit-bar.png b/app/assets/images/orbit-bar.png
index 160b9d78..4b2a5585 100644
Binary files a/app/assets/images/orbit-bar.png and b/app/assets/images/orbit-bar.png differ
diff --git a/app/assets/images/sign-in-logo.png b/app/assets/images/sign-in-logo.png
index 53756c7c..a3148bab 100644
Binary files a/app/assets/images/sign-in-logo.png and b/app/assets/images/sign-in-logo.png differ
diff --git a/app/assets/javascripts/ajax_form.js b/app/assets/javascripts/ajax_form.js
index c026e518..d9b5abfe 100644
--- a/app/assets/javascripts/ajax_form.js
+++ b/app/assets/javascripts/ajax_form.js
@@ -1,4 +1,4 @@
-$('#submit_button').live('click', function(){
+$(document).on('click', '#ajax_form_submit', function(){
$('#ajaxForm').ajaxSubmit({
beforeSubmit: function(a,f,o) {
o.dataType = 'script';
diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb
index abb908b4..cf2dfd69 100644
--- a/app/assets/javascripts/bulletin_form.js.erb
+++ b/app/assets/javascripts/bulletin_form.js.erb
@@ -6,23 +6,14 @@ $('.bulletin_files_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
-$('.action a.remove_existing_record').live('click', function(){
+$(document).on('click', '.action a.remove_existing_record', function(){
$(this).next('.should_destroy').attr('value', 1);
- //$("#bulletin_" + $(this).prev().attr('value')).hide();
- $("tr#bulletin_" + $(this).prev().attr('value')).hide();
+ $("tr #" + $(this).prev().attr('value')).hide();
});
-$('.quick_edit_cancel').live('click', function(){
+$(document).on('click', '.quick_edit_cancel', function(){
tr = $(this).attr('rel');
$('#' + tr).hide();
$("tr#bulletin_file_" + $(this).prev().attr('value')).hide();
$("tr#bulletin_link_" + $(this).prev().attr('value')).hide();
-});
-
-$(document).on('click', '.list-remove', function(){
- $('#delete_bulletins').submit();
-});
-
-$(document).on('click', '#check_all_bulletins', function(){
- $('.checkbox_in_list').attr("checked", this.checked);
});
\ No newline at end of file
diff --git a/app/assets/javascripts/desktop.js b/app/assets/javascripts/desktop.js
index 281a0b3d..7bfcb0b5 100644
--- a/app/assets/javascripts/desktop.js
+++ b/app/assets/javascripts/desktop.js
@@ -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
diff --git a/app/assets/javascripts/event.js b/app/assets/javascripts/event.js
index afe558d8..7db3e47c 100644
--- a/app/assets/javascripts/event.js
+++ b/app/assets/javascripts/event.js
@@ -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){
diff --git a/app/assets/javascripts/inc/ajax_setting.js b/app/assets/javascripts/inc/ajax_setting.js
new file mode 100644
index 00000000..c23a73bf
--- /dev/null
+++ b/app/assets/javascripts/inc/ajax_setting.js
@@ -0,0 +1,7 @@
+jQuery(document).ajaxStart(function(){
+ $('
').appendTo('body');
+});
+
+jQuery(document).ajaxComplete(function(){
+ $("#sys_modal").hide().remove();
+});
diff --git a/app/assets/javascripts/inc/jquery.imagesloaded.js b/app/assets/javascripts/inc/jquery.imagesloaded.js
new file mode 100644
index 00000000..5b35bb9c
--- /dev/null
+++ b/app/assets/javascripts/inc/jquery.imagesloaded.js
@@ -0,0 +1,137 @@
+/*!
+ * jQuery imagesLoaded plugin v2.0.1
+ * http://github.com/desandro/imagesloaded
+ *
+ * MIT License. by Paul Irish et al.
+ */
+
+/*jshint curly: true, eqeqeq: true, noempty: true, strict: true, undef: true, browser: true */
+/*global jQuery: false */
+
+;(function($, undefined) {
+'use strict';
+
+// blank image data-uri bypasses webkit log warning (thx doug jones)
+var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
+
+$.fn.imagesLoaded = function( callback ) {
+ var $this = this,
+ deferred = $.isFunction($.Deferred) ? $.Deferred() : 0,
+ hasNotify = $.isFunction(deferred.notify),
+ $images = $this.find('img').add( $this.filter('img') ),
+ loaded = [],
+ proper = [],
+ broken = [];
+
+ function doneLoading() {
+ var $proper = $(proper),
+ $broken = $(broken);
+
+ if ( deferred ) {
+ if ( broken.length ) {
+ deferred.reject( $images, $proper, $broken );
+ } else {
+ deferred.resolve( $images );
+ }
+ }
+
+ if ( $.isFunction( callback ) ) {
+ callback.call( $this, $images, $proper, $broken );
+ }
+ }
+
+ function imgLoaded( img, isBroken ) {
+ // don't proceed if BLANK image, or image is already loaded
+ if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) {
+ return;
+ }
+
+ // store element in loaded images array
+ loaded.push( img );
+
+ // keep track of broken and properly loaded images
+ if ( isBroken ) {
+ broken.push( img );
+ } else {
+ proper.push( img );
+ }
+
+ // cache image and its state for future calls
+ $.data( img, 'imagesLoaded', { isBroken: isBroken, src: img.src } );
+
+ // trigger deferred progress method if present
+ if ( hasNotify ) {
+ deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] );
+ }
+
+ // call doneLoading and clean listeners if all images are loaded
+ if ( $images.length === loaded.length ){
+ setTimeout( doneLoading );
+ $images.unbind( '.imagesLoaded' );
+ }
+ }
+
+ // if no images, trigger immediately
+ if ( !$images.length ) {
+ doneLoading();
+ } else {
+ $images.bind( 'load.imagesLoaded error.imagesLoaded', function( event ){
+ // trigger imgLoaded
+ imgLoaded( event.target, event.type === 'error' );
+ }).each( function( i, el ) {
+ var src = el.src;
+
+ // find out if this image has been already checked for status
+ // if it was, and src has not changed, call imgLoaded on it
+ var cached = $.data( el, 'imagesLoaded' );
+ if ( cached && cached.src === src ) {
+ imgLoaded( el, cached.isBroken );
+ return;
+ }
+
+ // if complete is true and browser supports natural sizes, try
+ // to check for image status manually
+ if ( el.complete && el.naturalWidth !== undefined ) {
+ imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 );
+ return;
+ }
+
+ // cached images don't fire load sometimes, so we reset src, but only when
+ // dealing with IE, or image is complete (loaded) and failed manual check
+ // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f
+ if ( el.readyState || el.complete ) {
+ el.src = BLANK;
+ el.src = src;
+ }
+ });
+ }
+
+ return deferred ? deferred.promise( $this ) : $this;
+};
+
+})(jQuery);
+
+$(document).ready(function() {
+ $('.upload-picture').find('img').imagesLoaded(function(){
+ var picH = $('.upload-picture').width()/$('.upload-picture').find('img').width()*$('.upload-picture').find('img').height();
+ var imgMarginTop = ($('.upload-picture').height()-picH)/2;
+ var d = $('.upload-picture').height();
+ if(imgMarginTop>0){
+ imgMarginTop = 0;
+ d = picH;
+ $('.upload-picture').css({height:d})
+ }
+ $('.upload-picture').find('img').css({marginTop:imgMarginTop})
+ $('.upload-picture').each(function (i){
+ $(this).mouseenter(function(){
+ var h= picH;
+ $(this).stop().animate({height:h}, 500);
+ $(this).find('img').stop().animate({marginTop:0}, 500);
+ });
+ $(this).mouseleave(function(){
+ $(this).stop().animate({height:d}, 500);
+ $(this).find('img').stop().animate({marginTop:imgMarginTop}, 500);
+ });
+ });
+ });
+});
\ No newline at end of file
diff --git a/app/assets/javascripts/inc/modal-preview.js b/app/assets/javascripts/inc/modal-preview.js
new file mode 100644
index 00000000..959f04b2
--- /dev/null
+++ b/app/assets/javascripts/inc/modal-preview.js
@@ -0,0 +1,20 @@
+//Preview need a link in form as Ex and a corresponding PUT action in controller
+//Ex preview trigger:
+// <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%>
+
+$(document).ready(function() {
+ $("a.preview_trigger").click(function(){
+ $("#main-wrap").after(" ");
+ $.ajax({
+ type: 'PUT',
+ url:$(this).attr("href"),
+ data:$(this).parents("form").serialize(),
+ success: function (msg) {
+ $("#"+start_modal_with_id).modal('show'); },
+ error: function(){
+ alert("ERROR");
+ }
+ });
+ return false;
+ });
+});
\ No newline at end of file
diff --git a/app/assets/javascripts/inc/permission-checkbox.js b/app/assets/javascripts/inc/permission-checkbox.js
index fc91b857..23716f68 100644
--- a/app/assets/javascripts/inc/permission-checkbox.js
+++ b/app/assets/javascripts/inc/permission-checkbox.js
@@ -1,4 +1,7 @@
$(document).ready(function() {
+ permissionCheckbox();
+});
+function permissionCheckbox(){
$('.check[checked="checked"]').parents(".checkbox").addClass("checked")
$(".checkbox").click(function(){
if($(this).children(".check").attr("checked")){
@@ -16,4 +19,4 @@ $(document).ready(function() {
placement: 'bottom',
delay: { show: 100, hide: 300 },
});
-});
\ No newline at end of file
+};
\ No newline at end of file
diff --git a/app/assets/javascripts/inc/search.js b/app/assets/javascripts/inc/search.js
index 979b5621..50f3835f 100644
--- a/app/assets/javascripts/inc/search.js
+++ b/app/assets/javascripts/inc/search.js
@@ -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);
}
})
-})
\ No newline at end of file
+})
+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);
+}
\ No newline at end of file
diff --git a/app/assets/javascripts/jquery.tinyscrollbar.js b/app/assets/javascripts/jquery.tinyscrollbar.js
new file mode 100644
index 00000000..e9aeffde
--- /dev/null
+++ b/app/assets/javascripts/jquery.tinyscrollbar.js
@@ -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));
\ No newline at end of file
diff --git a/app/assets/javascripts/jquery.tinyscrollbar.min.js b/app/assets/javascripts/jquery.tinyscrollbar.min.js
index 98786a77..e385ff8e 100644
--- a/app/assets/javascripts/jquery.tinyscrollbar.min.js
+++ b/app/assets/javascripts/jquery.tinyscrollbar.min.js
@@ -1 +1,118 @@
-(function(a){function b(b,c){function w(a){if(!(g.ratio>=1)){o.now=Math.min(i[c.axis]-j[c.axis],Math.max(0,o.start+((k?a.pageX:a.pageY)-p.start)));n=o.now*h.ratio;g.obj.css(l,-n);j.obj.css(l,o.now)}return false}function v(b){a(document).unbind("mousemove",w);a(document).unbind("mouseup",v);j.obj.unbind("mouseup",v);document.ontouchmove=j.obj[0].ontouchend=document.ontouchend=null;return false}function u(b){if(!(g.ratio>=1)){var b=b||window.event;var d=b.wheelDelta?b.wheelDelta/120:-b.detail/3;n-=d*c.wheel;n=Math.min(g[c.axis]-f[c.axis],Math.max(0,n));j.obj.css(l,n/h.ratio);g.obj.css(l,-n);b=a.event.fix(b);b.preventDefault()}}function t(b){p.start=k?b.pageX:b.pageY;var c=parseInt(j.obj.css(l));o.start=c=="auto"?0:c;a(document).bind("mousemove",w);document.ontouchmove=function(b){a(document).unbind("mousemove");w(b.touches[0])};a(document).bind("mouseup",v);j.obj.bind("mouseup",v);j.obj[0].ontouchend=document.ontouchend=function(b){a(document).unbind("mouseup");j.obj.unbind("mouseup");v(b.touches[0])};return false}function s(){j.obj.bind("mousedown",t);j.obj[0].ontouchstart=function(a){a.preventDefault();j.obj.unbind("mousedown");t(a.touches[0]);return false};i.obj.bind("mouseup",w);if(c.scroll&&this.addEventListener){e[0].addEventListener("DOMMouseScroll",u,false);e[0].addEventListener("mousewheel",u,false)}else if(c.scroll){e[0].onmousewheel=u}}function r(){j.obj.css(l,n/h.ratio);g.obj.css(l,-n);p["start"]=j.obj.offset()[l];var a=m.toLowerCase();h.obj.css(a,i[c.axis]);i.obj.css(a,i[c.axis]);j.obj.css(a,j[c.axis])}function q(){d.update();s();return d}var d=this;var e=b;var f={obj:a(".viewport",b)};var g={obj:a(".overview",b)};var h={obj:a(".scrollbar",b)};var i={obj:a(".track",h.obj)};var j={obj:a(".thumb",h.obj)};var k=c.axis=="x",l=k?"left":"top",m=k?"Width":"Height";var n,o={start:0,now:0},p={};this.update=function(a){f[c.axis]=f.obj[0]["offset"+m];g[c.axis]=g.obj[0]["scroll"+m];g.ratio=f[c.axis]/g[c.axis];h.obj.toggleClass("disable",g.ratio>=1);i[c.axis]=c.size=="auto"?f[c.axis]:c.size;j[c.axis]=Math.min(i[c.axis],Math.max(0,c.sizethumb=="auto"?i[c.axis]*g.ratio:c.sizethumb));h.ratio=c.sizethumb=="auto"?g[c.axis]/i[c.axis]:(g[c.axis]-f[c.axis])/(i[c.axis]-j[c.axis]);n=a=="relative"&&g.ratio<=1?Math.min(g[c.axis]-f[c.axis],Math.max(0,n)):0;n=a=="bottom"&&g.ratio<=1?g[c.axis]-f[c.axis]:isNaN(parseInt(a))?n:parseInt(a);r()};return q()}a.tiny=a.tiny||{};a.tiny.scrollbar={options:{axis:"y",wheel:40,scroll:true,size:"auto",sizethumb:"auto"}};a.fn.tinyscrollbar=function(c){var c=a.extend({},a.tiny.scrollbar.options,c);this.each(function(){a(this).data("tsb",new b(a(this),c))});return this};a.fn.tinyscrollbar_update=function(b){return a(this).data("tsb").update(b)};})(jQuery)
\ No newline at end of file
+(function(a){
+ function b(b,c){
+ function w(a){
+ if(!(g.ratio>=1)){
+ o.now=Math.min(i[c.axis]-j[c.axis],Math.max(0,o.start+((k?a.pageX:a.pageY)-p.start)));
+ n=o.now*h.ratio;g.obj.css(l,-n);
+ j.obj.css(l,o.now)
+ }
+ return false
+ }
+ function v(b){
+ a(document).unbind("mousemove",w);
+ a(document).unbind("mouseup",v);
+ j.obj.unbind("mouseup",v);
+ document.ontouchmove=j.obj[0].ontouchend=document.ontouchend=null;
+ return false
+ }
+ function u(b){
+ if(!(g.ratio>=1)){
+ var b=b||window.event;
+ var d=b.wheelDelta?b.wheelDelta/120:-b.detail/3;
+ n-=d*c.wheel;
+ n=Math.min(g[c.axis]-f[c.axis],Math.max(0,n));
+ j.obj.css(l,n/h.ratio);
+ g.obj.css(l,-n);
+ b=a.event.fix(b);
+ b.preventDefault()
+ }
+ }
+ function t(b){
+ p.start=k?b.pageX:b.pageY;
+ var c=parseInt(j.obj.css(l));
+ o.start=c=="auto"?0:c;
+ a(document).bind("mousemove",w);
+ document.ontouchmove=function(b){
+ a(document).unbind("mousemove");
+ w(b.touches[0])
+ };
+ a(document).bind("mouseup",v);
+ j.obj.bind("mouseup",v);
+ j.obj[0].ontouchend=document.ontouchend=function(b){
+ a(document).unbind("mouseup");
+ j.obj.unbind("mouseup");
+ v(b.touches[0])
+ };
+ return false
+ }
+ function s(){
+ j.obj.bind("mousedown",t);
+ j.obj[0].ontouchstart=function(a){
+ a.preventDefault();
+ j.obj.unbind("mousedown");
+ t(a.touches[0]);
+ return false
+ };
+ i.obj.bind("mouseup",w);
+ if(c.scroll&&this.addEventListener){
+ e[0].addEventListener("DOMMouseScroll",u,false);
+ e[0].addEventListener("mousewheel",u,false)
+ }else if(c.scroll){
+ e[0].onmousewheel=u
+ }
+ }
+ function r(){
+ j.obj.css(l,n/h.ratio);
+ g.obj.css(l,-n);
+ p["start"]=j.obj.offset()[l];
+ var a=m.toLowerCase();
+ h.obj.css(a,i[c.axis]);
+ i.obj.css(a,i[c.axis]);
+ j.obj.css(a,j[c.axis])
+ }
+ function q(){
+ d.update();
+ s();
+ return d
+ }
+ var d=this;
+ var e=b;
+ var f={obj:a(".viewport",b)};
+ var g={obj:a(".overview",b)};
+ var h={obj:a(".scrollbar",b)};
+ var i={obj:a(".track",h.obj)};
+ var j={obj:a(".thumb",h.obj)};
+ var k=c.axis=="x",
+ l=k?"left":"top",
+ m=k?"Width":"Height";
+ var n,
+ o={start:0,now:0},
+ p={};
+ this.update=function(a){
+ f[c.axis]=f.obj[0]["offset"+m];
+ g[c.axis]=g.obj[0]["scroll"+m];
+ g.ratio=f[c.axis]/g[c.axis];
+ h.obj.toggleClass("disable",g.ratio>=1);
+ i[c.axis]=c.size=="auto"?f[c.axis]:c.size;
+ j[c.axis]=Math.min(i[c.axis],Math.max(0,c.sizethumb=="auto"?i[c.axis]*g.ratio:c.sizethumb));
+ h.ratio=c.sizethumb=="auto"?g[c.axis]/i[c.axis]:(g[c.axis]-f[c.axis])/(i[c.axis]-j[c.axis]);
+ n=a=="relative"&&g.ratio<=1?Math.min(g[c.axis]-f[c.axis],Math.max(0,n)):0;
+ n=a=="bottom"&&g.ratio<=1?g[c.axis]-f[c.axis]:isNaN(parseInt(a))?n:parseInt(a);
+ r()
+ };
+ return q()
+ }
+ a.tiny=a.tiny||{};
+ a.tiny.scrollbar={options:{axis:"y",wheel:40,scroll:true,size:"auto",sizethumb:"auto"}};
+ a.fn.tinyscrollbar=function(c){
+ var c=a.extend({},a.tiny.scrollbar.options,c);
+ this.each(function(){
+ a(this).data("tsb",new b(a(this),c))
+ });
+ return this
+ };
+ a.fn.tinyscrollbar_update=function(b){
+ return a(this).data("tsb").update(b)
+ };
+})
+(jQuery)
\ No newline at end of file
diff --git a/app/assets/javascripts/lib/contenteditable.js.erb b/app/assets/javascripts/lib/contenteditable.js.erb
new file mode 100644
index 00000000..40c19dd3
--- /dev/null
+++ b/app/assets/javascripts/lib/contenteditable.js.erb
@@ -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);
+ }
+ });
+ }
+ });
+ });
+});
+});
\ No newline at end of file
diff --git a/app/assets/javascripts/lib/jquery.ui.nestedSortable.js b/app/assets/javascripts/lib/jquery.ui.nestedSortable.js
new file mode 100755
index 00000000..aad83af5
--- /dev/null
+++ b/app/assets/javascripts/lib/jquery.ui.nestedSortable.js
@@ -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);
\ No newline at end of file
diff --git a/vendor/built_in_modules/announcement/app/assets/javascripts/module_widget.js b/app/assets/javascripts/module.js.erb
similarity index 93%
rename from vendor/built_in_modules/announcement/app/assets/javascripts/module_widget.js
rename to app/assets/javascripts/module.js.erb
index 9c429aac..fc19b8e6 100644
--- a/vendor/built_in_modules/announcement/app/assets/javascripts/module_widget.js
+++ b/app/assets/javascripts/module.js.erb
@@ -6,4 +6,3 @@
//
//= require jquery
//= require jquery_ujs
-//= require announcement_link
\ No newline at end of file
diff --git a/app/assets/javascripts/new_admin.js b/app/assets/javascripts/new_admin.js
index 45bfcbbc..949753a9 100644
--- a/app/assets/javascripts/new_admin.js
+++ b/app/assets/javascripts/new_admin.js
@@ -6,6 +6,7 @@
//
//= require jquery
//= require jquery_ujs
+//= require jquery.form
//= require bootstrap
//= require jquery.isotope.min
//= require jquery.tinyscrollbar.min
@@ -13,4 +14,7 @@
//= require tinymce-jquery
//= require tinymce_orbit
//= require orbit-bar-search
-//= require side_bar_history
\ No newline at end of file
+//= require side_bar_history
+//= require rss
+//= require ajax_form
+//= require inc/ajax_setting
diff --git a/app/assets/javascripts/news_bulletin_form.js b/app/assets/javascripts/news_bulletin_form.js
new file mode 100644
index 00000000..6f0f9ac5
--- /dev/null
+++ b/app/assets/javascripts/news_bulletin_form.js
@@ -0,0 +1,19 @@
+$('.news_bulletin_links_block a.delete').live('click', function(){
+ $(this).parents('.list_item').remove();
+});
+
+$('.news_bulletin_files_block a.delete').live('click', function(){
+ $(this).parents('.list_item').remove();
+});
+
+$(document).on('click', '.action a.remove_existing_record', function(){
+ $(this).next('.should_destroy').attr('value', 1);
+ $("tr #" + $(this).prev().attr('value')).hide();
+});
+
+$(document).on('click', '.quick_edit_cancel', function(){
+ tr = $(this).attr('rel');
+ $('#' + tr).hide();
+ $("tr#news_bulletin_file_" + $(this).prev().attr('value')).hide();
+ $("tr#news_bulletin_link_" + $(this).prev().attr('value')).hide();
+});
\ No newline at end of file
diff --git a/app/assets/javascripts/orbit-1.0.js b/app/assets/javascripts/orbit-1.0.js
index 5f69b297..b1ac9993 100644
--- a/app/assets/javascripts/orbit-1.0.js
+++ b/app/assets/javascripts/orbit-1.0.js
@@ -14,9 +14,9 @@ $(document).ready(function(){
placement: "left"
});
+
$(document).on('click', '.privacy', function() {
- console.log($(this).val());
switch ($(this).val()) {
case 'true':
$(this).parents('.controls').children('.select-role').slideUp(300);
@@ -47,14 +47,19 @@ $(document).ready(function(){
/*tinyscrollbar&windows-Size*/
resize();
- var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2;
- $('#main-sidebar').css("height", viewportheight-30);
- $('#main-sidebar .viewport').css("height", viewportheight-30);
- $('.post-title').css("width", viewportwidth-495);
+ var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2,
+ $subWiget = $('#sub-wiget').width()+18;
+ $orbitBar = $('#orbit-bar').height(),
+ $mainSidebar = $('#main-sidebar').width()+5,
+ $formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right"));
+ $('#main-sidebar').css("height", viewportheight-$orbitBar);
+ $('#main-sidebar .viewport').css("height", viewportheight-$orbitBar);
+ $('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
+ $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
- $('#main-sidebar').tinyscrollbar();
+ $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
+ $('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
$('.detal-list').tinyscrollbar();
- $('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
mainTablePosition();
/*isotope*/
@@ -68,12 +73,18 @@ $(document).ready(function(){
});
$(window).resize(function(){
resize();
- var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2;
- $('#main-sidebar').css("height", viewportheight-30);
- $('#main-sidebar .viewport').css("height", viewportheight-30);
- $('.post-title').css("width", viewportwidth-495);
- $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
- $('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
+ var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2,
+ $subWiget = $('#sub-wiget').width()+18;
+ $orbitBar = $('#orbit-bar').height(),
+ $mainSidebar = $('#main-sidebar').width()+5,
+ $formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right"));
+ $('#main-sidebar').css("height", viewportheight-$orbitBar);
+ $('#main-sidebar .viewport').css("height", viewportheight-$orbitBar);
+ $('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
+ $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16);
+ $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
+ $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
+ $('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)});
mainTablePosition();
});
/*main-table position*/
@@ -101,5 +112,4 @@ $(window).scroll(function () {
$(".table-label").css({left:$winLeft*-1} );
//$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} );
//$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} );
- //console.log($mainWrapMarginLeft+($winLeft*-1)+5);
});
diff --git a/app/assets/javascripts/orbit-bar-search.js b/app/assets/javascripts/orbit-bar-search.js
index 26f44d84..7ef1dd05 100644
--- a/app/assets/javascripts/orbit-bar-search.js
+++ b/app/assets/javascripts/orbit-bar-search.js
@@ -1,3 +1,9 @@
+
+$(document).ready(function(){
+ $('.search').tooltip({
+ placement: "bottom"
+ });
+});
$(document).on('click', '.orbit-bar-search', function (){
if ($(this).parents('.search').hasClass('visible')){
$(this).parents('.search').stop().animate({
diff --git a/app/assets/javascripts/orbitTimeline.js b/app/assets/javascripts/orbitTimeline.js
index 5eecb48c..fd412139 100644
--- a/app/assets/javascripts/orbitTimeline.js
+++ b/app/assets/javascripts/orbitTimeline.js
@@ -6,57 +6,79 @@ var orbitTimeline = function(dom){
this.dom = $("#"+dom);
this.timelineHtml = $("
");
//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 = $("
");
- $.getJSON("desktop_orbit/getevents",{"event":"papers"},function(journals){
- $.each(journals,function(x,journal){
- $.each(journal.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}
- t.events.push(bubbleData);
- if(cur_year != year){
- year = cur_year;
- scale.append($(""+(year+1)+"
"));
- }
- if(cur_mon != mon){
- mon = cur_mon;
- console.log(parseInt(cur_mon));
- scale.append($(""+t.monthList[parseInt(formname)]+"
"))
- }
+ $.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("-","");
+ 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($(""+(year+1)+"
"));
+ }
+ if(cur_mon != mon){
+ mon = cur_mon;
+ var yr = scale.find("div[data-content="+year+"]");
+ yr.append($(""+t.monthList[parseInt(formname)]+"
"))
+ }
+ });
});
+ scale.append($(""+year+"
"));
+ t.fromdate = [year,formname-1];
+ if(typeof callbackFn == "function"){
+ callbackFn.call(this,scale);
+ }
})
- scale.append($(""+year+"
"));
- 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($(""+(year+1)+"
"));
+ }
+ }
+ if(cur_mon != mon){
+ mon = cur_mon;
+ var yr = scale.find("div[data-content="+year+"]");
+ yr.append($(""+t.monthList[parseInt(formname)]+"
"))
+ }
+ });
+ });
+ if(papersArray.length != 0){
+ if(scale.find("div[data-content="+(year-1)+"]").length == 0)
+ scale.append($(""+year+"
"));
+ t.ajaxload = true;
+ t.fromdate = [year,formname-1];
+ }
+ if(typeof callbackFn == "function"){
+ callbackFn.call(this,scale);
+ }
+ })
+
+ }
}
\ No newline at end of file
diff --git a/app/assets/javascripts/orbit_bar.js b/app/assets/javascripts/orbit_bar.js
index 06c3113d..e9b1b4ea 100644
--- a/app/assets/javascripts/orbit_bar.js
+++ b/app/assets/javascripts/orbit_bar.js
@@ -4,4 +4,4 @@ $(document).ready(function() {
$('body').prepend($(this).html());
$(this).remove();
});
-});
\ No newline at end of file
+});
diff --git a/app/assets/javascripts/page_edit.js b/app/assets/javascripts/page_edit.js.erb
similarity index 52%
rename from app/assets/javascripts/page_edit.js
rename to app/assets/javascripts/page_edit.js.erb
index 31a7d600..d7aaccd0 100644
--- a/app/assets/javascripts/page_edit.js
+++ b/app/assets/javascripts/page_edit.js.erb
@@ -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() } );
+ }
+ });
+}
\ No newline at end of file
diff --git a/app/assets/javascripts/side_bar_history.js b/app/assets/javascripts/side_bar_history.js
index 4b5da1d4..f23fd6cc 100644
--- a/app/assets/javascripts/side_bar_history.js
+++ b/app/assets/javascripts/side_bar_history.js
@@ -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 () {
diff --git a/app/assets/javascripts/site_editor.js b/app/assets/javascripts/site_editor.js
index 98405564..5d77e701 100644
--- a/app/assets/javascripts/site_editor.js
+++ b/app/assets/javascripts/site_editor.js
@@ -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 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 side_bar_history
\ No newline at end of file
+//= require tinymce-jquery
+//= require tinymce_orbit
+//= require lib/jquery.ui.nestedSortable.js
\ No newline at end of file
diff --git a/app/assets/javascripts/sort_header.js b/app/assets/javascripts/sort_header.js
new file mode 100644
index 00000000..25a16344
--- /dev/null
+++ b/app/assets/javascripts/sort_header.js
@@ -0,0 +1,7 @@
+$(document).on('click', '.list-remove', function(){
+ $('#delete_all').submit();
+});
+
+$(document).on('click', '#check_all', function(){
+ $('.checkbox_in_list').attr("checked", this.checked);
+});
\ No newline at end of file
diff --git a/app/assets/javascripts/tinymce_orbit.js b/app/assets/javascripts/tinymce_orbit.js
deleted file mode 100644
index 60492914..00000000
--- a/app/assets/javascripts/tinymce_orbit.js
+++ /dev/null
@@ -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"
- });
-});
\ No newline at end of file
diff --git a/app/assets/javascripts/tinymce_orbit.js.erb b/app/assets/javascripts/tinymce_orbit.js.erb
new file mode 100644
index 00000000..f12bfa3d
--- /dev/null
+++ b/app/assets/javascripts/tinymce_orbit.js.erb
@@ -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();
+});
diff --git a/app/assets/stylesheets/admin/ad_banner_preview.css.erb b/app/assets/stylesheets/admin/ad_banner_preview.css.erb
new file mode 100644
index 00000000..f46be689
--- /dev/null
+++ b/app/assets/stylesheets/admin/ad_banner_preview.css.erb
@@ -0,0 +1,4 @@
+.banner-preview {
+ width: auto;
+ left: 35%;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/banner_nav.css b/app/assets/stylesheets/banner_nav.css
new file mode 100644
index 00000000..ed613576
--- /dev/null
+++ b/app/assets/stylesheets/banner_nav.css
@@ -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);
+}
diff --git a/app/assets/stylesheets/bootstrap-orbit.css b/app/assets/stylesheets/bootstrap-orbit.css
index 34425d50..2ce9bc9c 100644
--- a/app/assets/stylesheets/bootstrap-orbit.css
+++ b/app/assets/stylesheets/bootstrap-orbit.css
@@ -1,3 +1,5 @@
+/*bootstrap-orbit*/
+
h1, h2, h3, h4, h5, h6 {
font-weight:normal ;
}
@@ -110,6 +112,18 @@ table .span1-3 {
.qe-block .form-horizontal .form-actions {
text-align:right;
}
+.form-actions form {
+ margin-bottom: 0;
+}
+.form-actions form input {
+ margin-bottom: 0;
+}
.modal.fade {
top: -50%;
+}
+.form-search button {
+ margin-bottom: 0;
+}
+.modal form {
+ margin-bottom: 0;
}
\ No newline at end of file
diff --git a/app/assets/stylesheets/bootstrap.css.erb b/app/assets/stylesheets/bootstrap.css.erb
index ee2ae5a4..62a0afe8 100644
--- a/app/assets/stylesheets/bootstrap.css.erb
+++ b/app/assets/stylesheets/bootstrap.css.erb
@@ -1,3 +1,4 @@
+/*bootstrap*/
/*!
* Bootstrap v2.0.0
*
@@ -65,6 +66,7 @@ textarea {
margin: 0;
font-size: 100%;
vertical-align: middle;
+ margin-bottom: 10px;
}
button, input {
*overflow: visible;
@@ -538,7 +540,7 @@ select,
width: 210px;
height: 18px;
padding: 4px;
- margin-bottom: 9px;
+ /*margin-bottom: 9px;*/
font-size: 13px;
line-height: 18px;
color: #555555;
@@ -2664,18 +2666,23 @@ button.btn.small, input[type="submit"].btn.small {
display: inline;
}
-.pagination .page{
+/*.pagination .page{
float: left;
padding: 0 14px;
line-height: 34px;
text-decoration: none;
border: 1px solid #ddd;
border-left-width: 0;
-}
+}*/
.pagination a {
float: left;
+ padding: 0 14px;
+ line-height: 34px;
+ text-decoration: none;
+ border: 1px solid #DDD;
+ border-left-width: 0;
}
-.pagination .next{
+/*.pagination .next{
float: left;
padding: 0 14px;
line-height: 34px;
@@ -2690,12 +2697,15 @@ button.btn.small, input[type="submit"].btn.small {
text-decoration: none;
border: 1px solid #ddd;
border-left-width: 0;
-}
+}*/
.pagination .current{
border-left-width: 1px;
}
+.pagination a {
+ background-color: #FFFFFF;
+}
.pagination a:hover, .pagination .active a {
- background-color: #f5f5f5;
+ background-color: #e8e8e8;
}
.pagination .active a {
color: #999999;
diff --git a/app/assets/stylesheets/inc/permission-checkbox.css b/app/assets/stylesheets/inc/permission-checkbox.css.erb
similarity index 84%
rename from app/assets/stylesheets/inc/permission-checkbox.css
rename to app/assets/stylesheets/inc/permission-checkbox.css.erb
index 0adf7225..a5a50a17 100644
--- a/app/assets/stylesheets/inc/permission-checkbox.css
+++ b/app/assets/stylesheets/inc/permission-checkbox.css.erb
@@ -1,3 +1,5 @@
+/*permission-checkbox*/
+
.checkblock {
display: inline-block;
float: left;
@@ -8,37 +10,40 @@
}
.checkbox{
padding: 5px;
- margin: 5px 5px 10px;
+ margin: 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;
@@ -74,4 +79,7 @@ img.member-img {
}
.popover-content p {
font-size: 12px;
+}
+.preview_trigger {
+ margin: 5px 10px 0 0;
}
\ No newline at end of file
diff --git a/app/assets/stylesheets/isotope.css b/app/assets/stylesheets/isotope.css
index 1d659c5e..3e7bf739 100644
--- a/app/assets/stylesheets/isotope.css
+++ b/app/assets/stylesheets/isotope.css
@@ -1,16 +1,11 @@
+/*isotope*/
+
#isotope {
margin-top: 2px;
- background-color:#f4f4f4;
}
.isotope-item {
z-index: 2;
}
-
-.isotope-hidden.isotope-item {
- pointer-events: none;
- z-index: 1;
-}
-
/**** Isotope CSS3 transitions ****/
.isotope,
@@ -46,28 +41,27 @@
transition-duration: 0s;
}
.w-a {
- width: 388px;
+ width: 398px;
}
.w-b {
- width: 802px;
+ width: 812px;
}
.h-a {
height: 315px;
}
.h-b {
- height: 699px;
+ height: 703px;
}
.item {
margin: 5px 0 15px 15px;
}
.item h3 {
- margin: 5px 0;
+ margin: 20px 0 5px;
}
.item h3 [class^="icons-"] {
- margin: 3px 5px 0 3px;
+ margin: 1px 5px 0 3px;
}
.item .detail {
- padding: 5px;
border: 1px solid rgba(0, 0, 0, 0.1);
background-color: #FFFFFF;
border-radius: 5px;
@@ -75,12 +69,11 @@
-moz-border-radius: 5px;
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);
- -moz-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);
}
.item .detail .totle {
font-size: 50px;
- padding:10px 5px 20px 0;
- margin: 0px;
+ padding:10px 5px 30px 0;
+ margin: 0;
text-align: right;
border-bottom:1px solid #d9d9d9;
}
@@ -90,20 +83,60 @@
color: #333;
padding-left: 5px;
text-align:left;
+ margin-bottom: -7px;
+}
+.item .detail .table {
+ margin-bottom: 0;
}
.item .detail .table th, .item .detail .table td {
border-top: none;
border-bottom: 1px solid #DDDDDD;
}
+.item .detail .table tr th {
+ background-color: #F2F2F2;
+ border-bottom: 1px solid #AAAAAA;
+}
.item .detail .table tr td:first-child {
color: #666;;
}
-.item .detail .table tr td:last-child {
+.item .detail .table tr td:last-child, .item .detail .table tr th:last-child {
text-align:right;
+ padding-right: 15px;
}
.item .h-a .my_scroll .viewport {
- height: 248px;
+ height: 210px;
}
.item .h-b .my_scroll .viewport {
- height: 632px;
+ height: 594px;
+}
+.item .isotope-hidden.isotope-item {
+ pointer-events: none;
+ z-index: 1;
+}
+.item .my_scroll {
+ position: relative;
+}
+.item .my_scroll .scrollbar {
+ right: 3px;
+ top: 0;
+ position: absolute;
+ z-index: 10;
+}
+.item .my_scroll .track {
+ background-color: transparent;
+}
+.detail.noStatistics {
+ overflow: hidden;
+}
+.detail.noStatistics.h-a {
+ height: 315px;
+}
+.detail.noStatistics.h-a .my_scroll .viewport {
+ height: 280px;
+}
+.detail.noStatistics.h-b {
+ height: 704px;
+}
+.detail.noStatistics.h-b .my_scroll .viewport {
+ height: 670px;
}
\ No newline at end of file
diff --git a/app/assets/stylesheets/list.css b/app/assets/stylesheets/list.css
index 11f17a55..4d7c11b1 100644
--- a/app/assets/stylesheets/list.css
+++ b/app/assets/stylesheets/list.css
@@ -1,151 +1,203 @@
-.list-remove {
- position: relative;
- top: 2px;
- left: 2px;
-}
-.table th.select {
- border-bottom:2px solid #0088CC;
-}
-.main-list {
- margin-bottom: 0;
-}
-.main-wrap>.main-list thead th {
- background-color: transparent;
- border-right: medium none;
-}
-.main-list thead th:last-child {
- border-right: none;
-}
-.main-list .span1 {
- min-width: 32px;
-}
-.main-list .span7 {
- min-width: 300px;
-}
-.main-list .nav-pills > li > a {
- border-radius: 5px 5px 5px 5px;
- margin: 2px;
- padding:5px
-}
-.main-list tbody .quick-edit {
- position:relative;
- height:20px;
-}
-.main-list tbody .quick-edit .nav {
- /*left: -55px;*/
- position: absolute;
- /*top: -3px;*/
- width: 350px;
- left: -8px;
-}
-.main-list td {
- background-color: #FFFFFF;
- border-bottom: 1px solid #DDDDDD;
- border-top: medium none;
-}
-.main-list .nav {
- margin-top: 0;
- margin-bottom: 3px;
-}
-.main-list tr.with_action:hover .hide {
- display:block !important;
-}
-.main-list .label-group {
- position: relative;
- height: 40px;
-}
-.main-list .label-td {
- background-color: rgba(255, 255, 255, 1);
- height: 40px;
- overflow: hidden;
- position: absolute;
- width: 100%;
- left: 0;
- z-index: 1;
-}
-.main-list .label-td:hover {
- height: auto;
- text-align: center;
- padding: 5px 5px 8px;
- left: -6px;
- top: -6px;
- border: 1px solid rgba(0, 0, 0, 0.2);
- box-shadow: 0px 5px 10px rgba(0,0,0,0.2);
- -moz-box-shadow: 0px 5px 10px rgba(0,0,0,0.2);
- -webkit-box-shadow: 0px 5px 10px rgba(0,0,0,0.2);
- border-radius: 3px;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- z-index: 5;
-}
-.table-label {
- background-color: #F2F2F2;
- position: relative;
-}
-.table-label .main-list thead th {
- background-color: #F2F2F2;
- border-right: 1px solid #DDDDDD;
- border-top: 1px solid #DDDDDD !important;
-}
-.route-group .route {
- padding: 0;
-}
-.route-group .route .breadcrumb {
- border-width: 0!important;
-}
-.qe-block td {
- height:auto;
- padding: 0;
-}
-.qe-block .table td, .qe-block .table th {
- padding: 8px;
-}
-.qe-block .form-horizontal {
- margin-bottom: 0;
-}
-.qe-block .form-actions {
- margin-bottom: 0;
-}
-legend {
- font-size: 15px;
- line-height: 30px;
- margin-bottom: 15px;
- padding-bottom: 5px;
-}
-.upload-picture {
- margin-left: 20px;
-}
-.subnav {
- -moz-border-radius: 0;
- -webkit-border-radius: 0;
- border-radius: 0;
- border-left: none;
- border-right: none;
- position: fixed;
- top: 30px;
- z-index: 50;
-}
-.subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover {
- -moz-border-radius: 0;
- -webkit-border-radius: 0;
- border-radius: 0;
-}
-.dropdown-menu.tags {
- max-width: none;
-}
-.dropdown-menu.tags .tags-cloud {
- width: 300px;
- padding:10px;
-}
-.dropdown-menu.tags .tags-cloud .active {
- background-color: #0088CC;
- color: #FFFFFF;
-}
-.dropdown-menu.tags .tags-cloud a {
- display: inline-block;
- margin-bottom: 3px;
-}
-.dropdown-menu.tags li:last-child a {
- display: block;
- text-align:center;
+/*list*/
+
+.table th.select {
+ border-bottom:2px solid #0088CC;
+}
+.main-list {
+ margin-bottom: 0;
+}
+.main-wrap>.main-list thead th {
+ background-color: transparent;
+ border-right: medium none;
+}
+.main-list thead th:last-child {
+ border-right: none;
+}
+.main-list .span1 {
+ min-width: 32px;
+}
+.main-list .span7 {
+ min-width: 300px;
+}
+.main-list .nav-pills > li > a {
+ border-radius: 5px 5px 5px 5px;
+ margin: 2px;
+ padding:5px;
+}
+.main-list tbody .quick-edit {
+ position:relative;
+ height:20px;
+}
+.main-list tbody .quick-edit .nav {
+ /*left: -55px;*/
+ position: absolute;
+ /*top: -3px;*/
+ 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;
+ border-top: medium none;
+}
+.main-list .nav {
+ margin-top: 0;
+ margin-bottom: 3px;
+}
+.main-list tr.with_action:hover .hide {
+ display:block !important;
+}
+.main-list .label-group {
+ 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;
+ overflow: hidden;
+ position: absolute;
+ width: 100%;
+ left: 0;
+ z-index: 1;
+}
+.main-list .label-td:hover {
+ height: auto;
+ padding: 5px 5px 8px;
+ left: -40px;
+ top: -6px;
+ border: 1px solid rgba(0, 0, 0, 0.2);
+ box-shadow: 0px 5px 10px rgba(0,0,0,0.2);
+ -moz-box-shadow: 0px 5px 10px rgba(0,0,0,0.2);
+ -webkit-box-shadow: 0px 5px 10px rgba(0,0,0,0.2);
+ border-radius: 3px;
+ -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;
+ position: relative;
+}
+.table-label .main-list thead th {
+ background-color: #F2F2F2;
+ border-right: 1px solid #DDDDDD;
+ border-top: 1px solid #DDDDDD !important;
+}
+.route-group .route {
+ padding: 0;
+}
+.route-group .route .breadcrumb {
+ border-width: 0!important;
+}
+.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;
+}
+.qe-block .form-horizontal {
+ margin-bottom: 0;
+}
+.qe-block .form-actions {
+ margin-bottom: 0;
+}
+legend {
+ font-size: 15px;
+ line-height: 30px;
+ margin-bottom: 15px;
+ padding-bottom: 5px;
+}
+.subnav {
+ -moz-border-radius: 0;
+ -webkit-border-radius: 0;
+ border-radius: 0;
+ border-left: none;
+ border-right: none;
+ position: fixed;
+ top: 30px;
+ z-index: 50;
+}
+.subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover {
+ -moz-border-radius: 0;
+ -webkit-border-radius: 0;
+ border-radius: 0;
+}
+.dropdown-menu.tags {
+ max-width: none;
+}
+.dropdown-menu.tags .tags-cloud {
+ width: 300px;
+ padding:10px;
+}
+.dropdown-menu.tags .tags-cloud .active {
+ background-color: #0088CC;
+ color: #FFFFFF;
+}
+.dropdown-menu.tags .tags-cloud a {
+ display: inline-block;
+ margin-bottom: 3px;
+}
+.dropdown-menu.tags li:last-child a {
+ display: block;
+ text-align:center;
+}
+.sort-header th {
+ padding: 0 8px;
+ vertical-align: inherit;
+ position: relative;
+}
+.sort-header th a {
+ display: block;
+ padding: 10px 0;
+ white-space: nowrap;
+}
+.sort-header th a:hover {
+ text-decoration: none;
+}
+.list-remove {
+ position: absolute;
+ top: 0;
+ padding-top: 9px !important;
+ left: 25px;
+}
+.form-fixed {
+ position: fixed;
+ margin: 0;
+ padding: 10px;
+ bottom: 0;
+ z-index: 2;
+}
+.form-fixed .btn {
+ margin-top: 4px;
+}
+.paginationFixed {
+}
+.paginationFixed .pagination {
+ margin-top: 0 !important;
}
\ No newline at end of file
diff --git a/app/assets/stylesheets/message.css b/app/assets/stylesheets/message.css
index ad67f31a..7206bd72 100644
--- a/app/assets/stylesheets/message.css
+++ b/app/assets/stylesheets/message.css
@@ -1,5 +1,7 @@
+/*message*/
+
.error{
- color:red;
+ color: #B94A48;
}
.notice, .message{
diff --git a/app/assets/stylesheets/new_admin.css.erb b/app/assets/stylesheets/new_admin.css.erb
index d81761bc..99542101 100644
--- a/app/assets/stylesheets/new_admin.css.erb
+++ b/app/assets/stylesheets/new_admin.css.erb
@@ -6,10 +6,10 @@
*= require_self
*= require message
*= require bootstrap
+ *= require style
*= require bootstrap-orbit
*= require list
- *= require widget
- *= require style
+ *= require widgets
*= require scroll_style
*= require isotope
-*/
\ No newline at end of file
+*/
diff --git a/app/assets/stylesheets/orbitTimeline.css b/app/assets/stylesheets/orbitTimeline.css
index feb007a6..2718b69d 100644
--- a/app/assets/stylesheets/orbitTimeline.css
+++ b/app/assets/stylesheets/orbitTimeline.css
@@ -1,5 +1,4 @@
.t_scale{
- min-width:2000px;
height:516px;
bottom:0;
}
diff --git a/app/assets/stylesheets/reset.css.erb b/app/assets/stylesheets/reset.css.erb
index 5c0a9cd5..f0a027a3 100644
--- a/app/assets/stylesheets/reset.css.erb
+++ b/app/assets/stylesheets/reset.css.erb
@@ -1,3 +1,6 @@
+/*reset*/
+
+
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
-webkit-text-size-adjust:none;
}
diff --git a/app/assets/stylesheets/scroll_style.css b/app/assets/stylesheets/scroll_style.css
index 2f79f62b..849fbc13 100644
--- a/app/assets/stylesheets/scroll_style.css
+++ b/app/assets/stylesheets/scroll_style.css
@@ -1,3 +1,5 @@
+/*scroll_style*/
+
@charset "UTF-8";
/* CSS Document */
.my_scroll {
diff --git a/app/assets/stylesheets/sidebar.css.erb b/app/assets/stylesheets/sidebar.css.erb
index f5a5d572..1a77e0e7 100644
--- a/app/assets/stylesheets/sidebar.css.erb
+++ b/app/assets/stylesheets/sidebar.css.erb
@@ -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;
@@ -91,4 +112,80 @@
}
#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;
}
\ No newline at end of file
diff --git a/app/assets/stylesheets/site_assets.css.erb b/app/assets/stylesheets/site_assets.css.erb
index cd5e882d..41c14933 100644
--- a/app/assets/stylesheets/site_assets.css.erb
+++ b/app/assets/stylesheets/site_assets.css.erb
@@ -1,3 +1,5 @@
+/*site_assets*/
+
.assets_setup{
padding:42px 0 0 0;
}
\ No newline at end of file
diff --git a/app/assets/stylesheets/site_designs.css.erb b/app/assets/stylesheets/site_designs.css.erb
index cf8442d0..805468cc 100644
--- a/app/assets/stylesheets/site_designs.css.erb
+++ b/app/assets/stylesheets/site_designs.css.erb
@@ -1,3 +1,5 @@
+/*site_designs*/
+
.designs_setup{
padding:42px 0 0 0;
}
diff --git a/app/assets/stylesheets/site_editor.css.erb b/app/assets/stylesheets/site_editor.css.erb
index 1e16ea3f..e36d0b7b 100644
--- a/app/assets/stylesheets/site_editor.css.erb
+++ b/app/assets/stylesheets/site_editor.css.erb
@@ -5,6 +5,10 @@
*= require reset
*= require_self
*= require message
+ *= require bootstrap
+ *= require style
+ *= require bootstrap-orbit
+ *= require scroll_style
*= require site_items
*= require sidebar
*/
\ No newline at end of file
diff --git a/app/assets/stylesheets/site_items.css.erb b/app/assets/stylesheets/site_items.css.erb
index 4e23bd4c..6fcef6bd 100644
--- a/app/assets/stylesheets/site_items.css.erb
+++ b/app/assets/stylesheets/site_items.css.erb
@@ -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 {
diff --git a/app/assets/stylesheets/style.css.erb b/app/assets/stylesheets/style.css.erb
index 0440dcde..4f28c2d9 100644
--- a/app/assets/stylesheets/style.css.erb
+++ b/app/assets/stylesheets/style.css.erb
@@ -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- {
diff --git a/app/assets/stylesheets/widget.css b/app/assets/stylesheets/widgets.css
similarity index 90%
rename from app/assets/stylesheets/widget.css
rename to app/assets/stylesheets/widgets.css
index f1c4d615..86088fee 100644
--- a/app/assets/stylesheets/widget.css
+++ b/app/assets/stylesheets/widgets.css
@@ -1,3 +1,6 @@
+/*Widget*/
+
+
.widget-size-300 {
width:298px;
}
@@ -58,7 +61,7 @@
cursor: pointer;
}
.select-role {
- display:none;
+ display:none;
padding: 10px 0;
}
.file-upload {
@@ -81,7 +84,7 @@
border-radius: 0 3px 3px 0;
text-align: left;
margin: 0;
- width: 182px;
+ width: 193px;
}
.file-upload .upload {
margin:0;
@@ -92,12 +95,24 @@
opacity:.0;
font-size: 60px;
left: -595px/9;
- filter: alpha(opacity: 0);
+ filter: alpha(opacity= 0);
outline: none;
}
.file-upload .upload:focus {
position:absolute;
}
+.file-upload .input-medium {
+ border-radius: 3px 3px 3px 3px !important;
+ width: 267px;
+ position: relative;
+ z-index: 5;
+ display: block;
+ clear: both;
+}
+.file-upload .control-label {
+ margin-top: 0;
+ margin-bottom: 5px;
+}
.upload-picture {
margin-bottom: 5px;
text-align: center;
@@ -117,12 +132,6 @@
margin : 0px 0 5px;
padding: 5px 10px;
}
-.file-upload .input-medium {
- border-radius: 3px 3px 3px 3px !important;
- width: 267px;
- position: relative;
- z-index: 5;
-}
#widget-link table {
margin-bottom:0
}
diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb
index 95ce7e7c..f43c19e5 100644
--- a/app/controllers/admin/ad_banners_controller.rb
+++ b/app/controllers/admin/ad_banners_controller.rb
@@ -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,13 +50,14 @@ class Admin::AdBannersController < ApplicationController
redirect_to admin_ad_banners_url
end
- def destroy_ad_image
-
+ def realtime_preview
+ @ad_banner = AdBanner.find( params[:id] ).preview_clone
+ @ad_banner.update_attributes(params[:ad_banner])#.update_attributes(params[:ad_images])
end
def index
@ad_banners = AdBanner.all
- @active = @ad_banners.first
+ @active = @ad_banners.first
end
end
\ No newline at end of file
diff --git a/app/controllers/admin/ad_images_controller.rb b/app/controllers/admin/ad_images_controller.rb
index 3fb681da..e3cef303 100644
--- a/app/controllers/admin/ad_images_controller.rb
+++ b/app/controllers/admin/ad_images_controller.rb
@@ -1,8 +1,8 @@
-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]
@ad_image = @ad_banner.ad_images.find params[: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
diff --git a/app/controllers/admin/asset_categories_controller.rb b/app/controllers/admin/asset_categories_controller.rb
new file mode 100644
index 00000000..9ce6bb48
--- /dev/null
+++ b/app/controllers/admin/asset_categories_controller.rb
@@ -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
diff --git a/app/controllers/admin/asset_tags_controller.rb b/app/controllers/admin/asset_tags_controller.rb
new file mode 100644
index 00000000..ea3fc41e
--- /dev/null
+++ b/app/controllers/admin/asset_tags_controller.rb
@@ -0,0 +1,8 @@
+class Admin::AssetTagsController < Admin::TagsController
+
+ def initialize
+ super
+ @app_title = 'asset'
+ end
+
+end
\ No newline at end of file
diff --git a/app/controllers/admin/assets_controller.rb b/app/controllers/admin/assets_controller.rb
index 1591cf39..58f4a746 100644
--- a/app/controllers/admin/assets_controller.rb
+++ b/app/controllers/admin/assets_controller.rb
@@ -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}} }
@@ -66,5 +83,24 @@ class Admin::AssetsController < ApplicationController
format.js { render 'js/remove_element', :locals => {:id => "asset_#{@asset.id}"} }
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
diff --git a/app/controllers/admin/dashboards_controller.rb b/app/controllers/admin/dashboards_controller.rb
index 7b761361..991f19af 100644
--- a/app/controllers/admin/dashboards_controller.rb
+++ b/app/controllers/admin/dashboards_controller.rb
@@ -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
diff --git a/app/controllers/admin/designs_controller.rb b/app/controllers/admin/designs_controller.rb
index 519b36a5..84f2b770 100644
--- a/app/controllers/admin/designs_controller.rb
+++ b/app/controllers/admin/designs_controller.rb
@@ -1,11 +1,12 @@
-class Admin::DesignsController < ApplicationController
+class Admin::DesignsController < OrbitBackendController
require "net/http"
require "uri"
require 'zip/zip'
layout "new_admin"
before_filter :authenticate_user!
- before_filter :is_admin?
+ before_filter :is_admin?
+ before_filter :for_admin_only
def upload_package
if !params[:design].nil?
@@ -24,7 +25,7 @@ class Admin::DesignsController < ApplicationController
end
def index
- @designs = Design.all.entries
+ @designs = params[:sort] ? get_sorted_and_filtered("designs") : Design.all
end
def new
@@ -83,6 +84,13 @@ class Admin::DesignsController < ApplicationController
render :action => 'new'
end
end
+
+ def delete
+ if params[:to_delete]
+ designs = Design.any_in(:_id => params[:to_delete]).delete_all
+ end
+ redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
+ end
protected
diff --git a/app/controllers/admin/infos_controller.rb b/app/controllers/admin/infos_controller.rb
index bc86b662..21306c6e 100644
--- a/app/controllers/admin/infos_controller.rb
+++ b/app/controllers/admin/infos_controller.rb
@@ -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
diff --git a/app/controllers/admin/items_controller.rb b/app/controllers/admin/items_controller.rb
index 33bc0fd2..1ea40640 100644
--- a/app/controllers/admin/items_controller.rb
+++ b/app/controllers/admin/items_controller.rb
@@ -15,6 +15,12 @@ class Admin::ItemsController < ApplicationController
@item = get_homepage
end
end
+
+ def update_position
+ item = Item.find(params[:id])
+ item.shift_to(params[:parent_id], params[:position])
+ render :nothing => true
+ end
protected
diff --git a/app/controllers/admin/links_controller.rb b/app/controllers/admin/links_controller.rb
index 533ff829..c233c18f 100644
--- a/app/controllers/admin/links_controller.rb
+++ b/app/controllers/admin/links_controller.rb
@@ -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
diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb
index 13075a42..1393bf32 100644
--- a/app/controllers/admin/module_apps_controller.rb
+++ b/app/controllers/admin/module_apps_controller.rb
@@ -2,7 +2,7 @@ class Admin::ModuleAppsController < ApplicationController
before_filter :user_has_manager_privilege?, :only => [ :assign_manager, :remove_manager ]
before_filter :user_has_sub_manager_privilege?, :only => [ :assign_sub_manager, :remove_sub_manager ]
- layout "admin"
+ layout "new_admin"
def index
@module_apps = ModuleApp.all.entries
@@ -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
diff --git a/app/controllers/admin/module_apps_new_interface_controller.rb b/app/controllers/admin/module_apps_new_interface_controller.rb
new file mode 100644
index 00000000..d9989fab
--- /dev/null
+++ b/app/controllers/admin/module_apps_new_interface_controller.rb
@@ -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
\ No newline at end of file
diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb
index e8779dc4..ab343360 100644
--- a/app/controllers/admin/object_auths_controller.rb
+++ b/app/controllers/admin/object_auths_controller.rb
@@ -1,6 +1,6 @@
class Admin::ObjectAuthsController < ApplicationController
include OrbitCoreLib::PermissionUnility
- layout "admin"
+ layout "new_admin"
before_filter :force_order
# before_filter :is_admin? ,:only => :index
diff --git a/app/controllers/admin/object_auths_new_interface_controller.rb b/app/controllers/admin/object_auths_new_interface_controller.rb
new file mode 100644
index 00000000..42e82b47
--- /dev/null
+++ b/app/controllers/admin/object_auths_new_interface_controller.rb
@@ -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
\ No newline at end of file
diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb
index bb759403..9ef2aa1b 100644
--- a/app/controllers/admin/page_parts_controller.rb
+++ b/app/controllers/admin/page_parts_controller.rb
@@ -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
diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb
index 411297ce..5fc6cb77 100644
--- a/app/controllers/admin/pages_controller.rb
+++ b/app/controllers/admin/pages_controller.rb
@@ -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
diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb
index 65c86f36..d02224a5 100644
--- a/app/controllers/admin/roles_controller.rb
+++ b/app/controllers/admin/roles_controller.rb
@@ -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
diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb
index 9475e708..1a19aebd 100644
--- a/app/controllers/admin/sites_controller.rb
+++ b/app/controllers/admin/sites_controller.rb
@@ -1,16 +1,48 @@
class Admin::SitesController < ApplicationController
- layout "admin"
+ layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
+ before_filter :get_site
- def index
- @site = Site.first
- redirect_to :action => :new unless @site
+ # def index
+ # @site = Site.first
+ # # redirect_to :action => :new unless @site
+ # end
+
+ # def new
+ # @site = Site.new
+ # end
+
+ def update
+ @site.update_attributes(params[:site])
+ redirect_to :back
end
-
- def new
- @site = Site.new
+
+ def site_info
+
+ end
+
+ def system_info
+
+ end
+
+ def language
+
+ end
+
+ def mail_setting
+
+ end
+
+ def ui_theme
+
+ end
+
+ private
+
+ def get_site
+ @site ||= Site.first
end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index fb82774e..5fd9de5c 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -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
diff --git a/app/controllers/desktop_orbit_controller.rb b/app/controllers/desktop_orbit_controller.rb
index 0aaf3a6a..29761bfb 100644
--- a/app/controllers/desktop_orbit_controller.rb
+++ b/app/controllers/desktop_orbit_controller.rb
@@ -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
diff --git a/app/controllers/desktop_publications_controller.rb b/app/controllers/desktop_publications_controller.rb
index 7e3b3feb..f09520a2 100644
--- a/app/controllers/desktop_publications_controller.rb
+++ b/app/controllers/desktop_publications_controller.rb
@@ -1,50 +1,61 @@
-class DesktopPublicationsController< ApplicationController
- def journal_p
- render "desktop/journal_p", :layout => false
- end
-
- def journal_p_list
- render "desktop/journal_pages/list", :layout => false
- end
-
- def journal_p_add
- render "desktop/journal_pages/add", :layout => false
- end
-
- def books
- render "desktop/books", :layout => false
- end
-
- def books_list
- render "desktop/books/list", :layout => false
- end
-
- def books_add
- render "desktop/books/add", :layout => false
- end
-
- def create_journal
- Journal.create(user_id: current_user.id, title: "Google")
- b = Array.new
- b << {"success"=>"true"}
- render :json=>b.to_json
- end
-
- def getjournals
- @journals = current_user.journals
- data = Array.new
- @journals.each do |journal|
- @papers = journal.papers.all
- data << {"title" => journal.title, "papers" => @papers}
- end
- render :json=>data.to_json
- end
-
- def delete_journal
- @journals = Journal.find("")
- @journals.delete
- b = Array.new
- b << {"success"=>"true"}
- render :json=>b.to_json
- end
-end
+class DesktopPublicationsController< ApplicationController
+ def journal_p
+ render "desktop/journal_p", :layout => false
+ end
+
+ def journal_p_list
+ render "desktop/journal_pages/list", :layout => false
+ end
+
+ def journal_p_add
+ render "desktop/journal_pages/add", :layout => false
+ end
+
+ def books
+ render "desktop/books", :layout => false
+ end
+
+ def books_list
+ render "desktop/books/list", :layout => false
+ end
+
+ def books_add
+ render "desktop/books/add", :layout => false
+ end
+
+ def create_journal
+ Journal.create(user_id: current_user.id, title: "Ice Cream Sandwich")
+ b = Array.new
+ b << {"success"=>"true"}
+ render :json=>b.to_json
+ end
+
+ def getjournals
+ @journals = current_user.journals
+ data = Array.new
+ @journals.each do |journal|
+ @papers = journal.papers.all
+ data << {"title" => journal.title, "papers" => @papers}
+ end
+ render :json=>data.to_json
+ end
+
+ def delete_journal
+ @journals = Journal.find("")
+ @journals.delete
+ b = Array.new
+ 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
diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb
index fe37db82..28f99fa2 100644
--- a/app/controllers/orbit_backend_controller.rb
+++ b/app/controllers/orbit_backend_controller.rb
@@ -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,9 +12,11 @@ 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
-
+
private
def force_order
@@ -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
\ No newline at end of file
diff --git a/app/controllers/orbit_frontend_component_controller.rb b/app/controllers/orbit_frontend_component_controller.rb
index 185dbce6..09621e5f 100644
--- a/app/controllers/orbit_frontend_component_controller.rb
+++ b/app/controllers/orbit_frontend_component_controller.rb
@@ -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]
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index 4860ea2e..8758563e 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -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'
@@ -14,33 +15,38 @@ class PagesController < ApplicationController
end
def show
- #begin
- @item = Item.first(:conditions => {:full_name => params[:page_name]})
- if @item && @item.is_published
- case @item._type
- when 'Page'
- render_page(params[:id])
- when 'Link'
- redirect_to "http://#{@item[:url]}"
- end
- else
- render :file => "#{Rails.root}/public/404.html", :status => :not_found
- end
+ #begin
+ @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
+ when 'Link'
+ redirect_to @item[:url]
+ end
+ else
+ render :file => "#{Rails.root}/public/404.html", :status => :not_found
+ end
#rescue
# render :file => "#{Rails.root}/public/404.html", :status => :not_found
#end
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
+ @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]})
end
end
diff --git a/app/helpers/admin/ad_banner_helper.rb b/app/helpers/admin/ad_banner_helper.rb
index eff12427..ecba9b3b 100644
--- a/app/helpers/admin/ad_banner_helper.rb
+++ b/app/helpers/admin/ad_banner_helper.rb
@@ -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
\ No newline at end of file
diff --git a/app/helpers/admin/ad_images_helper.rb b/app/helpers/admin/ad_images_helper.rb
index 1f2422fc..b09bd263 100644
--- a/app/helpers/admin/ad_images_helper.rb
+++ b/app/helpers/admin/ad_images_helper.rb
@@ -1,7 +1,3 @@
module Admin::AdImagesHelper
- def active_when_default_locale_eq locale
- locale.to_sym == I18n.default_locale ? 'active': ''
- end
-
end
diff --git a/app/helpers/admin/asset_helper.rb b/app/helpers/admin/asset_helper.rb
new file mode 100644
index 00000000..818a2340
--- /dev/null
+++ b/app/helpers/admin/asset_helper.rb
@@ -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
\ No newline at end of file
diff --git a/app/helpers/admin/dashboard_helper.rb b/app/helpers/admin/dashboard_helper.rb
new file mode 100644
index 00000000..dfe5763f
--- /dev/null
+++ b/app/helpers/admin/dashboard_helper.rb
@@ -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
\ No newline at end of file
diff --git a/app/helpers/admin/item_helper.rb b/app/helpers/admin/item_helper.rb
index d7a3455b..78e911b9 100644
--- a/app/helpers/admin/item_helper.rb
+++ b/app/helpers/admin/item_helper.rb
@@ -8,31 +8,38 @@ module Admin::ItemHelper
dest = admin_page_path(node)
when 'Link'
dest = admin_link_path(node)
+ no_nested = 'no-nest'
end
- ret << ""
- ret << ""
- 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 << " "
+ # ret << " "
+ ret << ""
+ ret << (link_to node.i18n_variable[I18n.locale], dest, :class => 'js_history')
+ ret << "
"
+ 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 << "
"
+ ret << "
"
ret << render_children(node)
ret << " "
- ret << " "
end
ret.html_safe
end
def render_children(parent)
- if children = parent.children
+ children = parent.children
+ if !parent.children.entries.blank?
ret = ''
- ret << ""
+ ret << ""
children.each do |child|
ret << render_node_and_children(child)
end
- ret << " "
+ ret << ''
ret
+ else
+ ''
end
end
-end
\ No newline at end of file
+end
diff --git a/app/helpers/admin/module_app_helper.rb b/app/helpers/admin/module_app_helper.rb
index 0a636e9c..3ac82364 100644
--- a/app/helpers/admin/module_app_helper.rb
+++ b/app/helpers/admin/module_app_helper.rb
@@ -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
diff --git a/app/helpers/admin/page_content_helper.rb b/app/helpers/admin/page_content_helper.rb
new file mode 100644
index 00000000..9f2b22e0
--- /dev/null
+++ b/app/helpers/admin/page_content_helper.rb
@@ -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
\ No newline at end of file
diff --git a/app/helpers/admin/web_link_helper.rb b/app/helpers/admin/web_link_helper.rb
new file mode 100644
index 00000000..813bc48c
--- /dev/null
+++ b/app/helpers/admin/web_link_helper.rb
@@ -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
\ No newline at end of file
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e45fa4d6..0ed5a1bd 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,13 +1,7 @@
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 << " \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 << " \n"
+ } if !tmp_meta.blank?
+ metas
end
def page_title(page)
- "#{page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]} \n"
+ res = ""
+ 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 << " \n"
end
- def page_stylesheets(page)
+ def page_stylesheets(page, edit=nil)
stylesheets = ''
- stylesheets << " \n"
- stylesheets << " \n"
- stylesheets << " \n"
+ unless edit
+ stylesheets << " \n"
+ stylesheets << " \n"
+ stylesheets << " \n"
+ end
stylesheets << " \n" if page.design.reset_css
+ stylesheets << " \n"
stylesheets << " \n" if page.design.default_css
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
stylesheets << " \n" if theme
stylesheets
end
- def page_javascripts(page)
+ def page_javascripts(page, edit=nil)
javascripts = ''
- javascripts << "\n"
+ unless edit
+ javascripts << "\n"
+ javascripts << "\n"
+ javascripts << "\n"
+ javascripts << "\n"
+ javascripts << "\n"
+ javascripts << "\n"
+ javascripts << "\n"
+ end
javascripts << "\n"
javascripts << "\n"
- javascripts << "\n"
- javascripts << "\n"
- javascripts << "\n"
- javascripts << "\n"
- javascripts << "\n"
- javascripts << "\n"
javascripts << "\n"
page.design.javascripts.each do |js|
# javascripts << ""
@@ -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
diff --git a/app/helpers/orbit_backend_helper.rb b/app/helpers/orbit_backend_helper.rb
new file mode 100644
index 00000000..5d47e414
--- /dev/null
+++ b/app/helpers/orbit_backend_helper.rb
@@ -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
\ No newline at end of file
diff --git a/app/jobs/fetch_time.rb b/app/jobs/fetch_time.rb
new file mode 100644
index 00000000..5fce3036
--- /dev/null
+++ b/app/jobs/fetch_time.rb
@@ -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
diff --git a/app/jobs/nccu_calendar.rb b/app/jobs/nccu_calendar.rb
new file mode 100644
index 00000000..1848c691
--- /dev/null
+++ b/app/jobs/nccu_calendar.rb
@@ -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
diff --git a/app/jobs/restart_server.rb b/app/jobs/restart_server.rb
new file mode 100644
index 00000000..53167fea
--- /dev/null
+++ b/app/jobs/restart_server.rb
@@ -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
diff --git a/app/jobs/sync_db.rb b/app/jobs/sync_db.rb
new file mode 100644
index 00000000..4f47b8d0
--- /dev/null
+++ b/app/jobs/sync_db.rb
@@ -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
diff --git a/app/mailer/cron_mail.rb b/app/mailer/cron_mail.rb
new file mode 100644
index 00000000..bda1d063
--- /dev/null
+++ b/app/mailer/cron_mail.rb
@@ -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 ", :subject => msg)
+ end
+end
\ No newline at end of file
diff --git a/app/models/ad_banner.rb b/app/models/ad_banner.rb
index 3e09280f..18c6d448 100644
--- a/app/models/ad_banner.rb
+++ b/app/models/ad_banner.rb
@@ -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
diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb
index 3eb63511..9d7fe55b 100644
--- a/app/models/ad_image.rb
+++ b/app/models/ad_image.rb
@@ -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?
diff --git a/app/models/asset.rb b/app/models/asset.rb
index c44e8be1..e20fcb9e 100644
--- a/app/models/asset.rb
+++ b/app/models/asset.rb
@@ -3,11 +3,43 @@ class Asset
include Mongoid::Document
include Mongoid::Timestamps
- mount_uploader :data, AssetUploader
+ mount_uploader :data, FileAssetUploader
field :filename
field :description
+
+ has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
+ has_one :description, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
- validates_presence_of :filename, :data
+ validates_presence_of :title, :data, :description
+
+ belongs_to :asset_category
+ belongs_to :assetable, polymorphic: true
+ has_and_belongs_to_many :tags, :class_name => "AssetTag"
+
+ before_save :set_key
+
+ def title
+ @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
+ end
+
+ def description
+ @description ||= I18nVariable.first(:conditions => {:key => 'description', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
+ end
+
+ def sorted_tags
+ tags.order_by(I18n.locale, :asc)
+ end
+
+ protected
+
+ def set_key
+ if title && title.new_record?
+ title.key = 'title'
+ end
+ if description && description.new_record?
+ description.key = 'description'
+ end
+ end
end
diff --git a/app/models/meta.rb b/app/models/asset_category.rb
similarity index 54%
rename from app/models/meta.rb
rename to app/models/asset_category.rb
index dbeac167..89bceaf7 100644
--- a/app/models/meta.rb
+++ b/app/models/asset_category.rb
@@ -1,15 +1,16 @@
-class Meta
-
+class AssetCategory
include Mongoid::Document
include Mongoid::Timestamps
-
+
field :key
- field :value, :default => nil
-
+ field :display
+
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
-
- def get_name_content
- [self.key, self.value ? self.value : self.i18n_variable[I18n.locale]]
+
+ has_many :assets
+
+ def self.from_id(id)
+ AssetCategory.find(id) rescue nil
end
-end
+end
\ No newline at end of file
diff --git a/app/models/asset_tag.rb b/app/models/asset_tag.rb
new file mode 100644
index 00000000..344a8e2e
--- /dev/null
+++ b/app/models/asset_tag.rb
@@ -0,0 +1,5 @@
+class AssetTag < Tag
+
+ has_and_belongs_to_many :assets
+
+end
\ No newline at end of file
diff --git a/app/models/design/design.rb b/app/models/design/design.rb
index 2a25dd11..58f95bd4 100644
--- a/app/models/design/design.rb
+++ b/app/models/design/design.rb
@@ -3,10 +3,10 @@ class Design
include Mongoid::Timestamps
include ParserLayout
- field :title
- field :author
- field :intro
- field :version
+ field :title, :type => String
+ field :author, :type => String
+ field :intro, :type => String
+ field :version, :type => String
has_many :pages
diff --git a/app/models/item.rb b/app/models/item.rb
index 44c6762d..8dd5c0b4 100644
--- a/app/models/item.rb
+++ b/app/models/item.rb
@@ -2,56 +2,65 @@ class Item
include Mongoid::Document
include Mongoid::Timestamps
+ include Mongoid::Tree
+ include Mongoid::Tree::Ordering
- field :name, :index => true
- field :full_name, :index => true
- field :position, :type => Integer
- field :is_published, :type => Boolean, :default => false, :index => true
+ field :name
+ field :path
+ field :is_published, :type => Boolean, :default => false
+ field :enabled_for, :type => Array, :default => nil
+ field :menu_enabled_for, :type => Array, :default => nil
+
+ has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
validates :name, :exclusion => { :in => LIST[:forbidden_item_names] }
validates_uniqueness_of :name, :scope => :parent_id
- validates_presence_of :name, :full_name, :position
+ validates_presence_of :name
+ validates_associated :parent, :children
- belongs_to :parent, :class_name => "Item"
- has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
- has_many :children, :class_name => "Item", :as => 'parent'
+ before_destroy :destroy_children
+ after_rearrange :rebuild_path
- before_validation :setup_default_value
def self.find_by_name(item_name)
Item.first(:conditions => { :name => item_name, :is_published => true })
end
-
- # Get an array of ancestors
- def ancestors
- node, nodes = self, []
- nodes << node = node.parent while !node.parent.blank? rescue nil
- nodes.reverse
- end
-
- # Build the url from the array of ancestors
- def url
- urls = ancestors.map{ |a| a.name } << self.name
- urls.join("/")
+
+ def visible_children
+ objects = self.children
+ a = []
+ if objects
+ objects.each do |object|
+ a << object if object.menu_enabled_for.nil? ? true : object.menu_enabled_for.include?(I18n.locale.to_s)
+ end
+ end
+ a
end
+
+ def shift_to(new_parent, position)
+ unless self.parent_id.to_s.eql?(new_parent) && self.position.eql?(position.to_i)
+ new_parent = Item.find(new_parent)
+ current_position_sibling = find_by_parent_and_position(new_parent, position.to_i)
+ if current_position_sibling
+ current_position_sibling.at_bottom? ? move_below(current_position_sibling) : move_above(current_position_sibling)
+ elsif self.parent != new_parent
+ self.parent = new_parent
+ save!
+ end
+ end
+ end
protected
- def setup_default_value
- # Set the position value within the parent scope
- if self.position.blank?
- max_page = Item.where(:parent_id => self.parent_id).count
- self.position = (max_page)? max_page + 1 : 1
- end
-
- # Build the full_name from the ancestors array
- full_node = self.ancestors.map{ |a| a.name }.push( self.name )
- # Remove root node if not root
- full_node.shift if full_node.size >= 2
- self.full_name = full_node.join("/")
+ def rebuild_path
+ self.path = (self.ancestors_and_self - [Item.root]).collect{|x| x.name unless x.root?}.join('/')
end
-
+
+ def find_by_parent_and_position(parent, position)
+ parent.children.detect{|child| child.position == position}
+ end
+
# Enable the validation for parent_id
def validates_presence_of_parent_id?
true
diff --git a/app/models/journal.rb b/app/models/journal.rb
index 88497f61..b1a65284 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -11,7 +11,7 @@ class Journal
before_create :initialize_paper
def initialize_paper
- for i in 0..5
+ for i in 0..11
self.papers.build
end
end
diff --git a/app/models/link.rb b/app/models/link.rb
index 4301ead4..ccd79c89 100644
--- a/app/models/link.rb
+++ b/app/models/link.rb
@@ -2,10 +2,20 @@ class Link < Item
field :url
- validates_presence_of :url
+ validates :url, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
+
+ before_validation :add_http
def link
ApplicationController.helpers.link_to(self.name, self.url)
end
+
+ protected
+
+ def add_http
+ unless self.url[/^http:\/\//] || self.url[/^https:\/\//]
+ self.url = 'http://' + self.url
+ end
+ end
end
diff --git a/app/models/meta/meta.rb b/app/models/meta/meta.rb
index 411a4f0c..cd713d83 100644
--- a/app/models/meta/meta.rb
+++ b/app/models/meta/meta.rb
@@ -7,5 +7,13 @@ class Meta
field :value, :default => nil
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
+
+ def get_name_content
+ [self.key, get_content]
+ end
+
+ def get_content
+ self.value ? self.value : self.i18n_variable[I18n.locale]
+ end
end
diff --git a/app/models/object_auth.rb b/app/models/object_auth.rb
index ae3fd701..d5cc48de 100644
--- a/app/models/object_auth.rb
+++ b/app/models/object_auth.rb
@@ -2,6 +2,7 @@ class ObjectAuth < PrototypeAuth
include OrbitCoreLib::ObjectTokenUnility
validates_uniqueness_of :title ,:scope => [:obj_authable_type,:obj_authable_id] #{ |c| }
belongs_to :obj_authable, polymorphic: true
+ after_save :check_user_has_app_auth
# > - Something.find_with_auth(query)
# > - or Something.find(query).auth
def auth_obj
@@ -9,4 +10,15 @@ class ObjectAuth < PrototypeAuth
class_obj.find self.obj_authable_id
end
+ def check_user_has_app_auth
+ sub_managing_users = auth_obj.app_auth.sub_managing_users rescue []
+ app_auth = auth_obj.app_auth
+ self.auth_users.each do |auth_user|
+ if !sub_managing_users.include? auth_user && !auth_user.admin?
+ app_auth.assign_sub_manager(auth_user,User.current)
+ app_auth.save!
+ end
+ end
+ end
+
end
\ No newline at end of file
diff --git a/app/models/page.rb b/app/models/page.rb
index d98f3a4e..970df4cf 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -1,8 +1,14 @@
class Page < Item
+ include Impressionist::Impressionable
+
+ is_impressionable :counter_cache => { :column_name => :view_count }
field :content
field :app_frontend_url
field :theme_id, :type => BSON::ObjectId, :default => nil
+ field :category
+ field :tag
+ field :view_count, :type => Integer, :default => 0
belongs_to :design
belongs_to :module_app
@@ -15,10 +21,6 @@ class Page < Item
before_save :create_parts, :set_key
# embeds_many :custom_images, :class_name => 'Image', as: :design_image
-
- def is_home?
- self.parent ? false : true
- end
def title
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
@@ -28,8 +30,20 @@ class Page < Item
def create_parts
page_design = self.design
+ parent = self.parent
+ menu_part = parent.page_parts.detect{|page_part| page_part.kind.eql?('public_r_tag') && page_part.public_r_tag.eql?('sub_menu') && page_part.public_r_tag_object_id.eql?(parent.id.to_s)} if parent
page_design.layout.layout_parts.each do |layout_part|
- self.page_parts.new(:name => layout_part.name) unless self.page_parts.detect{|page_part| page_part.name.eql?(layout_part.name)}
+ current_part = self.page_parts.detect{|page_part| page_part.name.eql?(layout_part.name)}
+ current_part = self.page_parts.build(:name => layout_part.name) unless current_part
+ if menu_part && current_part.name.eql?(menu_part.name)
+ if current_part.new_record?
+ current_part.kind = menu_part.kind
+ current_part.public_r_tag = menu_part.public_r_tag
+ current_part.public_r_tag_object_id = menu_part.public_r_tag_object_id
+ else
+ current_part.update_attributes(:kind => menu_part.kind, :public_r_tag => menu_part.public_r_tag, :public_r_tag_object_id => menu_part.public_r_tag_object_id)
+ end
+ end
end
end
diff --git a/app/models/page_part.rb b/app/models/page_part.rb
index 9fe91e86..52eafdf3 100644
--- a/app/models/page_part.rb
+++ b/app/models/page_part.rb
@@ -7,12 +7,31 @@ class PagePart
field :content
field :kind
field :public_r_tag
- field :public_r_tag_object_id, :type => BSON::ObjectId, :default => nil
+ field :public_r_tag_object_id, :default => nil
+ field :public_r_tag_option, :default => nil
field :widget_path
- has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
+ has_one :i18n_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
+ has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
belongs_to :page
belongs_to :module_app
+ before_save :set_key
+
+ def i18n_variable
+ @i18n_variable ||= I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
+ end
+
+ def title
+ @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
+ end
+
+ protected
+
+ def set_key
+ title.key = 'title' if title && (title.key.blank? rescue true)
+ i18n_variable.key = 'i18n_variable' if i18n_variable && (i18n_variable.key.blank? rescue true)
+ end
+
end
\ No newline at end of file
diff --git a/app/models/paper.rb b/app/models/paper.rb
index b085aaa7..a92dde1f 100644
--- a/app/models/paper.rb
+++ b/app/models/paper.rb
@@ -7,9 +7,9 @@ class Paper
field :abstract, default: "The concept of microstructure engineering has gained increasingly attention with the goal to quantitatively link the operational parameters of an industrial process to the properties of its product. The key component of this concept is to accurately model the microstructure evolution along the processing path. Modelling of recrystallization in Cuinterconnects will be presented as an example of a conventional process model. Further, the potential of developing next generation process models will be discussed by using models across different length and time scale. The multi-scale modelling approach will be illustrated with a case study for phase transformation in Fe-Mn alloys."
field :level, default: "SCI"
field :coauthors, default: "Allen, Shelly, Eric, Manson, Chris, Clara, Anna, Albee, Vincent, Devin, Chunchi, Ika, Jaoshua, Ray, Matt, Lin, Spen"
- field :created_at, type: Date, default: ->{12.months.ago}
-
+ field :created_at, type: Date
belongs_to :journal
+
end
\ No newline at end of file
diff --git a/app/models/site.rb b/app/models/site.rb
index 8f367c0a..55d6bfaf 100644
--- a/app/models/site.rb
+++ b/app/models/site.rb
@@ -1,5 +1,7 @@
class Site
+ METAS = ['description', 'keywords']
+
include Mongoid::Document
include Mongoid::Timestamps
@@ -9,12 +11,20 @@ class Site
field :roaming_id
field :private_key, :type => Binary
field :public_key, :type => Binary
+ field :title_always_on, :type => Boolean, :default => false
+
+ field :mail_settings, :type => Hash
field :school
field :department
+ has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
+ has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
+ has_one :sub_menu, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_many :site_metas, :autosave => true, :dependent => :destroy
+ before_save :set_key
+
def generate_keys
private_key = OpenSSL::PKey::RSA.generate(2048)
self.public_key = private_key.public_key.to_s
@@ -26,9 +36,43 @@ class Site
end
def up_to_date?
- p res = %x(git remote show origin)
res = res.split('rails_3_1').pop.gsub('(', '').gsub(')','').strip rescue nil
res.eql?('local out of date') ? false : true
end
+
+ def title
+ @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
+ end
+
+ def footer
+ @footer ||= I18nVariable.first(:conditions => {:key => 'footer', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
+ end
+
+ def sub_menu
+ @sub_menu ||= I18nVariable.first(:conditions => {:key => 'sub_menu', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
+ end
+
+ METAS.each do |meta|
+ define_method meta do
+ fetch_meta = self.site_metas.where(key: meta).limit(1)
+ fetch_meta.blank? ? nil : fetch_meta[0].i18n_variable
+ end
+ define_method "#{meta}=" do |values|
+ if a = self.send(meta)
+ a.update_attributes(values)
+ else
+ a = self.site_metas.build(key: meta)
+ a.build_i18n_variable(values)
+ end
+ end
+ end
+
+ protected
+
+ def set_key
+ title.key = 'title' if title && (title.key.blank? rescue true)
+ footer.key = 'footer' if footer && (footer.key.blank? rescue true)
+ sub_menu.key = 'sub_menu' if sub_menu && (sub_menu.key.blank? rescue true)
+ end
end
diff --git a/app/models/tag.rb b/app/models/tag.rb
index f77f24c1..f621de6a 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -3,6 +3,8 @@ class Tag
include Mongoid::Document
include Mongoid::Timestamps
+ field :key
+
belongs_to :module_app
end
diff --git a/app/models/user/user.rb b/app/models/user/user.rb
index c33d64fc..0f808a06 100644
--- a/app/models/user/user.rb
+++ b/app/models/user/user.rb
@@ -2,7 +2,7 @@ class User
include Mongoid::Document
include Mongoid::Timestamps
-
+
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable
mount_uploader :avatar, AvatarUploader
@@ -10,6 +10,10 @@ class User
field :admin, :type => Boolean, :default => true
field :active_role
+ # field :cache_dept
+ # has_one :cache_dept, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
+ field :cache_dept,type: Hash
+
has_many :attribute_values, :autosave => true, :dependent => :destroy
has_many :app_auths,as: :privilege_apps,:inverse_of => :privilege_lists
has_many :blocked_apps, :inverse_of => :blocked_users, :class_name => "AppAuth"
@@ -19,10 +23,35 @@ class User
has_one :desktop, :autosave => true, :dependent => :destroy
has_many :other_accounts, :autosave => true, :dependent => :destroy
has_many :journals, :autosave => true, :dependent => :destroy
-
+ has_many :papers, :autosave => true, :dependent => :destroy
+
belongs_to :role
has_and_belongs_to_many :sub_roles
accepts_nested_attributes_for :attribute_values, :allow_destroy => true
+
+ def create_dept_cache
+ dept_hash = {}
+
+ VALID_LOCALES.each do |loc|
+ locale = loc.to_sym
+ # debugger
+ # if(self.cache_dept.nil?)
+ # self.build_cache_dept key: "dept_cache_user_#{self.id}"
+ # end
+ dept_hash[locale] = sub_roles.collect{|sr| sr.i18n_variable[locale]}.join(',')
+ # self.cache_dept[locale] = sub_roles.collect{|sr| sr.i18n_variable[locale]}.join(',')
+ end
+ self.cache_dept = dept_hash
+ self.save!
+ end
+
+ def self.current
+ Thread.current[:user]
+ end
+
+ def self.current=(user)
+ Thread.current[:user] = user
+ end
before_create :initialize_desktop
diff --git a/app/uploaders/asset_uploader.rb b/app/uploaders/asset_uploader.rb
index 1e07bca6..7b5749c9 100644
--- a/app/uploaders/asset_uploader.rb
+++ b/app/uploaders/asset_uploader.rb
@@ -49,7 +49,7 @@ class AssetUploader < CarrierWave::Uploader::Base
# Override the filename of the uploaded files:
# def filename
- # "something.jpg" if original_filename
+ # model.filename
# end
end
diff --git a/app/uploaders/file_asset_uploader.rb b/app/uploaders/file_asset_uploader.rb
new file mode 100644
index 00000000..1f60f00b
--- /dev/null
+++ b/app/uploaders/file_asset_uploader.rb
@@ -0,0 +1,55 @@
+# encoding: utf-8
+
+class FileAssetUploader < CarrierWave::Uploader::Base
+ require 'mime/types'
+
+ process :set_content_type
+
+ def set_content_type(*args)
+ content_type = file.content_type == ('binary/octet-stream' || 'application/octet-stream') || file.content_type.blank? ? MIME::Types.type_for(original_filename).first.to_s : file.content_type
+ self.file.instance_variable_set(:@content_type, content_type)
+ end
+
+ # Include RMagick or ImageScience support:
+ # include CarrierWave::RMagick
+ # include CarrierWave::ImageScience
+
+ # Choose what kind of storage to use for this uploader:
+ # storage :file
+ # storage :s3
+
+ # Override the directory where uploaded files will be stored.
+ # This is a sensible default for uploaders that are meant to be mounted:
+ def store_dir
+ "assets/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
+ end
+
+ # Provide a default URL as a default if there hasn't been a file uploaded:
+ # def default_url
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
+ # end
+
+ # Process files as they are uploaded:
+ # process :scale => [200, 300]
+ #
+ # def scale(width, height)
+ # # do something
+ # end
+
+ # Create different versions of your uploaded files:
+ # version :thumb do
+ # process :scale => [50, 50]
+ # end
+
+ # Add a white list of extensions which are allowed to be uploaded.
+ # For images you might use something like this:
+ # def extension_white_list
+ # %w(jpg jpeg gif png)
+ # end
+
+ # Override the filename of the uploaded files:
+ # def filename
+ # model.filename.force_encoding("UTF-8")
+ # end
+
+end
diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb
index d9b1b902..d65a17e0 100644
--- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb
+++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb
@@ -1,19 +1,39 @@
-
-" id=<%= ad_banner_tab.title %>>
-
尺寸:
-
+
" id=<%= ad_banner_tab.title.dehumanize %>>
+<% if at_least_module_manager || sub_manager?(ad_banner_tab)%>
<%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%>
- <%= f.label :ad_fx, t('admin.ad.ab_fx') %>
- <%= f.select :ad_fx ,AdBanner::FX_TYPES %>
- <%= f.label :transition_sec, t('admin.ad.transition_sec') %>
- <%= f.text_field :transition_sec,:placeholder=>"3秒請輸入3000",:class=> "span3" %> <%= t("admin.ad.trans_unit_sec") %>
- <%= f.submit %>
- <%= f.submit 'Cancel',:type=>'reset' %>
-
- <%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %>
- <%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %>
- <%= link_to 'Add AdImage',new_admin_ad_banner_ad_image_path(ad_banner_tab) %>
-
+
+
+ <%= f.label :ad_fx, t('admin.ad.ab_fx') %>
+ <%= f.select :ad_fx ,AdBanner::FX_TYPES %>
+ <%= f.label :transition_sec, t('admin.ad.transition_sec') %>
+ <%= f.text_field :transition_sec,:placeholder=>t('admin.ad.sec_place_holder'),:class=> "span3" %> <%= t("admin.ad.trans_unit_sec") %>
+ <%if at_least_module_manager%>
+ <%= f.label :best_size, t('admin.ad.best_size') %>
+ <%= f.text_field :best_size %> Ex: 500px x 300px
+ <% end -%>
+
+ <%= f.submit t("admin.ad.update_banner"), :class => 'btn' %>
+ <%= f.submit t("cancel"),:type=>'reset', :class => 'btn' %>
+
<% end -%>
- <%= render :partial => 'preview_block',:locals=> {:ad_banner =>ad_banner_tab} %>
+<% end -%>
+
<%= t("admin.ad.picture_list")%>
+
+ <%if (at_least_module_manager || ad_banner_tab.cur_user_is_sub_manager_of(:edit) )%>
+ <%= content_tag :div ,:class=>'adbanner-action' do%>
+ <%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%>
+ <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.id) , :class=>'preview_trigger btn btn-success'%>
+ <% end -%>
+ <% end -%>
+
+ <%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %>
+
+ <% if at_least_module_manager %>
+ <%= show_ad_banner_permission_link ad_banner_tab%>
+ <%= link_to t('admin.ad.delete_banner'),admin_ad_banner_path(ad_banner_tab),:class => 'btn',:method => :delete,:confirm => t('sure?') %>
+ <% end -%>
+
+ <%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %>
+
+ <%#= render :partial => 'preview_block',:locals=> {:ad_banner =>ad_banner_tab} %>
diff --git a/app/views/admin/ad_banners/_ad_image_update.html.erb b/app/views/admin/ad_banners/_ad_image_update.html.erb
index b2dfdc73..0b4277a0 100644
--- a/app/views/admin/ad_banners/_ad_image_update.html.erb
+++ b/app/views/admin/ad_banners/_ad_image_update.html.erb
@@ -1,12 +1,13 @@
-
- <%= image_tag ad_image.file rescue nil %>
+
+ <%= image_tag ad_image.file rescue nil%>
- <%= ad_image.display? ? '[Showing]' : '[NotShawing]' %>
+ <%= ad_image.display? ? "[#{t('admin.ad.showing')}]" : "[#{t('admin.ad.not_showing')}]" %>
<%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %>
-
- <%= link_to 'Edit',edit_admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn btn-primary' %>
- <%= link_to 'Del',admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn',:method => :delete,:confirm => t('sure?') %>
-
-
-
+ <%if at_least_module_manager || sub_manager?(ad_image.ad_banner) %>
+
+ <%= link_to t('edit'),edit_admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn btn-primary' %>
+ <%= link_to t('delete'),admin_ad_banner_ad_image_path(ad_banner,ad_image),:class => 'btn',:method => :delete,:confirm => t('sure?') %>
+
+ <% end -%>
+
\ No newline at end of file
diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb
index 8e8de1d9..68e0a9c6 100644
--- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb
+++ b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb
@@ -1,10 +1,10 @@
-
+
<%= form_for(:ad_banner,:remote => true, :url => admin_ad_banners_path) do |f| %>
@@ -21,6 +21,13 @@
<%= f.text_field :transition_sec %> <%= t("admin.ad.trans_unit_sec") %>
+
+
+ <%= f.label :best_size, t('admin.ad.best_size'),:class => "control-label" %>
+
+ <%= f.text_field :best_size %> Ex: 500px x 300px
+
+
<%= f.label :ad_fx, t('admin.ad.ab_fx') %>
@@ -28,28 +35,12 @@
<%= f.select :ad_fx ,AdBanner::FX_TYPES %>
-
-
+
+
<% end %>
-
diff --git a/app/views/admin/ad_banners/_modal_preview.html.erb b/app/views/admin/ad_banners/_modal_preview.html.erb
new file mode 100644
index 00000000..ffc84107
--- /dev/null
+++ b/app/views/admin/ad_banners/_modal_preview.html.erb
@@ -0,0 +1,36 @@
+<% if ad_banner -%>
+
+
+
+
+
+ <% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
+ <%= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || " ")) %>
+ <% end -%>
+
+
+
+
+
+
+
+
+
+
+
+<% end -%>
diff --git a/app/views/admin/ad_banners/_preview_block.html.erb b/app/views/admin/ad_banners/_preview_block.html.erb
index 4e8432b6..47646f6f 100644
--- a/app/views/admin/ad_banners/_preview_block.html.erb
+++ b/app/views/admin/ad_banners/_preview_block.html.erb
@@ -1,7 +1,7 @@
<% if ad_banner -%>
<%= link_to 'Preview',"#slideshow-#{ad_banner.title.dehumanize}",:class=>"btn btn-primary btn-large",:data=>{:toggle=>'modal'} %>
-