Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34788cd7f7 | ||
|
|
8f25dc2871 | ||
|
|
82988a2029 | ||
|
|
e5fccb33bf | ||
|
|
d832f4c4b1 | ||
|
|
59af75e50a | ||
|
|
67cd34ab27 | ||
|
|
4a736cc92c | ||
|
|
9b96f2eeb0 | ||
|
|
74b89f1fac | ||
|
|
62e9acdbb8 | ||
|
|
4a897b68cf | ||
|
|
d3fc6e5956 | ||
|
|
71acee200c | ||
|
|
63156c7a95 | ||
|
|
5156701094 | ||
|
|
1266cd1384 | ||
|
|
f3f4dc842c | ||
|
|
13144f62fb | ||
|
|
6d951f8d9c | ||
|
|
d0364c788b | ||
|
|
e2ec8f134e | ||
|
|
83a8433e52 | ||
|
|
8f65da0a04 | ||
|
|
ad8bb72b07 | ||
|
|
06a8b9073e | ||
|
|
f9485c1f86 | ||
|
|
627425b72e | ||
|
|
9cb2a5b211 | ||
|
|
75f5404b7a | ||
|
|
bd3a922073 | ||
|
|
9fbb2917b1 | ||
|
|
bd6d94a143 | ||
|
|
8684388ab9 | ||
|
|
5e05f5d02b | ||
|
|
6607f6b66e | ||
|
|
63fab74a25 | ||
|
|
48969b70b5 | ||
|
|
88c8ca68d0 | ||
|
|
3eeda5410c | ||
|
|
660960f316 | ||
|
|
696134aa18 | ||
|
|
2777b92589 | ||
|
|
5432238816 | ||
|
|
4e12c0bb5b | ||
|
|
d68f324ca3 | ||
|
|
50f5d12da3 | ||
|
|
d635c892cf | ||
|
|
26bc837c76 | ||
|
|
8247f077df | ||
|
|
70de1cea9d | ||
|
|
0f18cdfe8e | ||
|
|
0d1426cab8 | ||
|
|
b57b899dba | ||
|
|
1305b9f1ef | ||
|
|
21009961ef | ||
|
|
1edc134691 | ||
|
|
e89615a6f3 | ||
|
|
0c29701f9b | ||
|
|
580be0b34b | ||
|
|
c361a7a201 | ||
|
|
b7bf180df2 | ||
|
|
71dad22b04 | ||
|
|
883496ede1 | ||
|
|
0a1ebf18e3 | ||
|
|
3f9cdec426 | ||
|
|
24b9f4015b | ||
|
|
1237a111ca | ||
|
|
64e14d42e2 | ||
|
|
cc7a4ffb6d | ||
|
|
da40c2b669 | ||
|
|
bf5416095e | ||
|
|
8cd27e26e2 | ||
|
|
d98d008806 | ||
|
|
cd26b880fb | ||
|
|
7c398ce4fe | ||
|
|
d766eea9f4 | ||
|
|
d5dc3ef793 | ||
|
|
b3366b48a1 | ||
|
|
36e7e3d3e8 | ||
|
|
06c2240d34 | ||
|
|
c4e8ed96a9 | ||
|
|
8ad015af7f | ||
|
|
1857ad428c | ||
|
|
134b639465 | ||
|
|
45136f915d | ||
|
|
2c3924d92c | ||
|
|
41b562d3f7 | ||
|
|
4074ac677d | ||
|
|
e1c57c6843 | ||
|
|
915ea066d6 | ||
|
|
e7aa7ea1fa | ||
|
|
1ccfd6e48c | ||
|
|
23516277f3 | ||
|
|
87bc2852b3 | ||
|
|
27b86b078a | ||
|
|
8f393e1079 | ||
|
|
353039dcd0 | ||
|
|
d8dd68b4df | ||
|
|
aa8523c8cf | ||
|
|
69ef8fa747 | ||
|
|
473baa9b95 | ||
|
|
1592aaff89 | ||
|
|
030d994180 | ||
|
|
a88ad35641 | ||
|
|
a63193dc65 | ||
|
|
452bddb587 | ||
|
|
371485e420 | ||
|
|
69b3625861 | ||
|
|
72d1427854 | ||
|
|
079b9145c3 | ||
|
|
3102a46219 | ||
|
|
653a098ab6 | ||
|
|
426edea485 | ||
|
|
2e5b2555c6 | ||
|
|
2593707d8c | ||
|
|
b20955579e | ||
|
|
1ebda22f0e | ||
|
|
c511aeb8de | ||
|
|
26d3a89d30 | ||
|
|
91f80a0952 | ||
|
|
f333fe9e21 | ||
|
|
33f256bd16 | ||
|
|
fde9fd7ffe | ||
|
|
d977b83d06 | ||
|
|
a1eae7543e | ||
|
|
8d9bf62909 | ||
|
|
2f480c31bf | ||
|
|
19d33f78bd | ||
|
|
37c91664d3 | ||
|
|
eb853f773d | ||
|
|
d701d9d6ad | ||
|
|
75eeec737c | ||
|
|
36c3635bbb | ||
|
|
fa1c731ad3 | ||
|
|
2c24e788b0 | ||
|
|
26a8be2f0f | ||
|
|
fa51d16879 | ||
|
|
ceff21fd1f | ||
|
|
1357124f6f | ||
|
|
8c3fb43bf5 | ||
|
|
71e8b3c042 | ||
|
|
b37643147f | ||
|
|
ec57cbff1c | ||
|
|
7d6df11873 | ||
|
|
8043573370 | ||
|
|
f025c98ffa | ||
|
|
3a91c92bf7 | ||
|
|
b1d8a87256 | ||
|
|
c7ac4e2485 | ||
|
|
3467868607 | ||
|
|
ceac2b842c | ||
|
|
c763817ebf | ||
|
|
3c3bba514a | ||
|
|
837dc3ea7b | ||
|
|
ea5d89e0e1 | ||
|
|
aea15fa622 | ||
|
|
c1316f72a0 | ||
|
|
d996b91b54 | ||
|
|
07b3857465 | ||
|
|
8751b15385 | ||
|
|
6a40a9555a | ||
|
|
869f3b6815 | ||
|
|
465d417c35 | ||
|
|
eaf7577810 | ||
|
|
22358bd862 | ||
|
|
300de76c3a | ||
|
|
d3f0a10187 | ||
|
|
256c51a970 | ||
|
|
b674f47528 | ||
|
|
c1bd135595 | ||
|
|
96fc5ceea3 | ||
|
|
e48a1ffece | ||
|
|
e20df41db5 | ||
|
|
e68793afc3 | ||
|
|
2f7389ae24 | ||
|
|
110eab0496 | ||
|
|
ccd760445d | ||
|
|
c7effcc96c | ||
|
|
f3e1f4057d | ||
|
|
e353961b21 | ||
|
|
75e27ed849 | ||
|
|
8541033ba9 | ||
|
|
467c2e8a3c | ||
|
|
b0640f925b | ||
|
|
841fa10c55 | ||
|
|
dcc5fc39a7 | ||
|
|
97df100c64 | ||
|
|
ce180839f0 | ||
|
|
0904978292 | ||
|
|
ddd9a9668e | ||
|
|
a468b69013 | ||
|
|
b6c8a88b73 | ||
|
|
5b7ac1a22b | ||
|
|
d5109c837c | ||
|
|
c63ac751ea | ||
|
|
8c1e65994a | ||
|
|
f9a148c901 | ||
|
|
5ea0c5bd5c | ||
|
|
d2f131d160 | ||
|
|
8d71c377f2 | ||
|
|
ec173c4ce1 | ||
|
|
ba7d6558ee | ||
|
|
88c57e0b0c | ||
|
|
d4962d20b3 | ||
|
|
21bf3a0ccd | ||
|
|
cf0d7cfc64 | ||
|
|
15347f25dc | ||
|
|
443d1c4fbe | ||
|
|
7ba0977e16 | ||
|
|
531cee70d2 | ||
|
|
b659c7021d | ||
|
|
515185d87c | ||
|
|
adc15951bb | ||
|
|
32c259ac9e | ||
|
|
51640423a7 | ||
|
|
dd206437d8 | ||
|
|
7729161123 | ||
|
|
f2706ff2c1 | ||
|
|
5c94200b77 | ||
|
|
6b8b749b0f | ||
|
|
253cca06cc | ||
|
|
30824d1620 | ||
|
|
704db56925 | ||
|
|
06fd305bf9 | ||
|
|
c0f1614cb9 | ||
|
|
3e0b7d81ae | ||
|
|
2806dd35a9 | ||
|
|
54a35b30be | ||
|
|
37aa950028 | ||
|
|
3d0a1cef56 | ||
|
|
4a5256bf4f | ||
|
|
5b368235e8 | ||
|
|
b8da40b4ae | ||
|
|
287e77836d | ||
|
|
3e6c2b1ec2 | ||
|
|
f2247aab32 | ||
|
|
ef2c732d2e | ||
|
|
1096db79b6 | ||
|
|
88d55989de | ||
|
|
c2331695cd | ||
|
|
127ab3845c | ||
|
|
aefd62da2a | ||
|
|
167a71272a | ||
|
|
caf0426bd4 | ||
|
|
7d077a92a5 | ||
|
|
64101109dd | ||
|
|
3e567223e3 | ||
|
|
79ef86f2c9 | ||
|
|
d047a3d62a |
No files matched your search
@@ -4,6 +4,8 @@
|
|||||||
.rvmrc
|
.rvmrc
|
||||||
|
|
||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
|
Procfile
|
||||||
|
log/*
|
||||||
|
|
||||||
db/*.sqlite3
|
db/*.sqlite3
|
||||||
log/*.log
|
log/*.log
|
||||||
@@ -11,13 +13,16 @@ public/assets
|
|||||||
public/index.html
|
public/index.html
|
||||||
public/panel/**/*
|
public/panel/**/*
|
||||||
public/uploads/**/*
|
public/uploads/**/*
|
||||||
solr
|
solr/data
|
||||||
tmp/**/*
|
tmp/**/*
|
||||||
uploads/**/*
|
uploads/**/*
|
||||||
|
config/*.god
|
||||||
|
log/*.gz
|
||||||
|
tmp/restart.txt
|
||||||
*.swp
|
*.swp
|
||||||
*.pid
|
*.pid
|
||||||
*.lck
|
*.lck
|
||||||
|
|
||||||
.sass-cache/*
|
.sass-cache/*
|
||||||
*.supported
|
*.supported
|
||||||
|
mongoid.yml
|
||||||
@@ -14,7 +14,11 @@ gem 'execjs'
|
|||||||
gem 'jquery-rails', '2.1.4'
|
gem 'jquery-rails', '2.1.4'
|
||||||
gem 'jquery-ui-rails'
|
gem 'jquery-ui-rails'
|
||||||
gem "select2-rails", '3.3.1'
|
gem "select2-rails", '3.3.1'
|
||||||
gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
|
gem 'kaminari'
|
||||||
|
gem "acts_as_unvlogable"
|
||||||
|
gem 'youtube_it'
|
||||||
|
gem 'gotcha'
|
||||||
|
|
||||||
|
|
||||||
# gem "memcached", "~> 1.4.3"
|
# gem "memcached", "~> 1.4.3"
|
||||||
# gem "memcache-client"
|
# gem "memcache-client"
|
||||||
@@ -25,6 +29,9 @@ gem 'mongoid-tree', :require => 'mongoid/tree'
|
|||||||
gem "mongo_session_store-rails3", '3.0.6'
|
gem "mongo_session_store-rails3", '3.0.6'
|
||||||
gem 'nokogiri'
|
gem 'nokogiri'
|
||||||
|
|
||||||
|
# import csv
|
||||||
|
gem 'roo'
|
||||||
|
|
||||||
gem 'fb_graph'
|
gem 'fb_graph'
|
||||||
gem 'rack-gridfs'
|
gem 'rack-gridfs'
|
||||||
gem 'radius'
|
gem 'radius'
|
||||||
@@ -35,7 +42,7 @@ gem 'resque-scheduler' # job scheduling
|
|||||||
gem 'resque-restriction'
|
gem 'resque-restriction'
|
||||||
#gem 'rb-readline'
|
#gem 'rb-readline'
|
||||||
# gem 'ruby-debug19'
|
# gem 'ruby-debug19'
|
||||||
gem 'rubyzip'
|
gem 'rubyzip','0.9.9'
|
||||||
|
|
||||||
gem 'sunspot_mongo'
|
gem 'sunspot_mongo'
|
||||||
gem 'sunspot_solr'
|
gem 'sunspot_solr'
|
||||||
@@ -46,14 +53,14 @@ gem 'sinatra'
|
|||||||
gem 'sprockets'
|
gem 'sprockets'
|
||||||
gem 'social-share-button'
|
gem 'social-share-button'
|
||||||
|
|
||||||
gem 'tinymce-rails'
|
gem 'tinymce-rails', '3.5.8.3'
|
||||||
gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")
|
gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")
|
||||||
gem 'libv8', '~> 3.11.8' if RUBY_PLATFORM.downcase.include?("linux")
|
gem 'libv8', '~> 3.11.8' if RUBY_PLATFORM.downcase.include?("linux")
|
||||||
gem 'mongoid-encryptor', :require => 'mongoid/encryptor'
|
gem 'mongoid-encryptor', :require => 'mongoid/encryptor'
|
||||||
gem 'rb-readline' if RUBY_PLATFORM.downcase.include?("linux")
|
gem 'rb-readline','~> 0.4.2' if RUBY_PLATFORM.downcase.include?("linux")
|
||||||
|
|
||||||
|
|
||||||
gem "impressionist", :git => 'git://github.com/charlotte-ruby/impressionist.git'
|
gem "impressionist",'1.2.0'
|
||||||
#gem 'contacts'
|
#gem 'contacts'
|
||||||
#gem 'event-calendar', :require => 'event_calendar'#, :git => 'git://github.com/elevation/event_calendar.git'
|
#gem 'event-calendar', :require => 'event_calendar'#, :git => 'git://github.com/elevation/event_calendar.git'
|
||||||
|
|
||||||
@@ -63,6 +70,8 @@ gem 'chinese_pinyin', '0.4.1'
|
|||||||
gem 'rmmseg-cpp-huacnlee', '0.2.9'
|
gem 'rmmseg-cpp-huacnlee', '0.2.9'
|
||||||
gem 'redis-namespace'
|
gem 'redis-namespace'
|
||||||
gem 'redis-search'
|
gem 'redis-search'
|
||||||
|
gem 'syslog-logger'
|
||||||
|
gem "recaptcha", :require => "recaptcha/rails"
|
||||||
|
|
||||||
# Gems used only for assets and not required
|
# Gems used only for assets and not required
|
||||||
# in production environments by default.
|
# in production environments by default.
|
||||||
|
|||||||
@@ -1,407 +0,0 @@
|
|||||||
GIT
|
|
||||||
remote: git://github.com/amatsuda/kaminari.git
|
|
||||||
revision: 2e09b5374fec33b57c6387ca7bac89ecaa60c9eb
|
|
||||||
specs:
|
|
||||||
kaminari (0.14.1)
|
|
||||||
actionpack (>= 3.0.0)
|
|
||||||
activesupport (>= 3.0.0)
|
|
||||||
|
|
||||||
GIT
|
|
||||||
remote: git://github.com/charlotte-ruby/impressionist.git
|
|
||||||
revision: 0894f6a550a33f83f4937d655e9f0774521781e4
|
|
||||||
specs:
|
|
||||||
impressionist (1.2.0)
|
|
||||||
httpclient (~> 2.2)
|
|
||||||
nokogiri (~> 1.5)
|
|
||||||
|
|
||||||
GEM
|
|
||||||
remote: http://rubygems.org/
|
|
||||||
specs:
|
|
||||||
actionmailer (3.2.12)
|
|
||||||
actionpack (= 3.2.12)
|
|
||||||
mail (~> 2.4.4)
|
|
||||||
actionpack (3.2.12)
|
|
||||||
activemodel (= 3.2.12)
|
|
||||||
activesupport (= 3.2.12)
|
|
||||||
builder (~> 3.0.0)
|
|
||||||
erubis (~> 2.7.0)
|
|
||||||
journey (~> 1.0.4)
|
|
||||||
rack (~> 1.4.5)
|
|
||||||
rack-cache (~> 1.2)
|
|
||||||
rack-test (~> 0.6.1)
|
|
||||||
sprockets (~> 2.2.1)
|
|
||||||
activemodel (3.2.12)
|
|
||||||
activesupport (= 3.2.12)
|
|
||||||
builder (~> 3.0.0)
|
|
||||||
activerecord (3.2.12)
|
|
||||||
activemodel (= 3.2.12)
|
|
||||||
activesupport (= 3.2.12)
|
|
||||||
arel (~> 3.0.2)
|
|
||||||
tzinfo (~> 0.3.29)
|
|
||||||
activeresource (3.2.12)
|
|
||||||
activemodel (= 3.2.12)
|
|
||||||
activesupport (= 3.2.12)
|
|
||||||
activesupport (3.2.12)
|
|
||||||
i18n (~> 0.6)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
arel (3.0.2)
|
|
||||||
attr_required (0.0.5)
|
|
||||||
bcrypt-ruby (3.0.0)
|
|
||||||
binding_of_caller (0.7.1)
|
|
||||||
debug_inspector (>= 0.0.1)
|
|
||||||
bourne (1.1.2)
|
|
||||||
mocha (= 0.10.5)
|
|
||||||
brakeman (1.9.2)
|
|
||||||
erubis (~> 2.6)
|
|
||||||
fastercsv (~> 1.5)
|
|
||||||
haml (~> 3.0)
|
|
||||||
highline (~> 1.6)
|
|
||||||
multi_json (~> 1.2)
|
|
||||||
ruby2ruby (~> 2.0)
|
|
||||||
ruby_parser (~> 3.1.1)
|
|
||||||
sass (~> 3.0)
|
|
||||||
terminal-table (~> 1.4)
|
|
||||||
bson (1.8.2)
|
|
||||||
bson_ext (1.8.2)
|
|
||||||
bson (~> 1.8.2)
|
|
||||||
builder (3.0.4)
|
|
||||||
capybara (2.0.2)
|
|
||||||
mime-types (>= 1.16)
|
|
||||||
nokogiri (>= 1.3.3)
|
|
||||||
rack (>= 1.0.0)
|
|
||||||
rack-test (>= 0.5.4)
|
|
||||||
selenium-webdriver (~> 2.0)
|
|
||||||
xpath (~> 1.0.0)
|
|
||||||
carrierwave (0.6.2)
|
|
||||||
activemodel (>= 3.2.0)
|
|
||||||
activesupport (>= 3.2.0)
|
|
||||||
carrierwave-mongoid (0.2.2)
|
|
||||||
carrierwave (~> 0.6.1)
|
|
||||||
mongoid (~> 2.1)
|
|
||||||
childprocess (0.3.8)
|
|
||||||
ffi (~> 1.0, >= 1.0.11)
|
|
||||||
chinese_pinyin (0.4.1)
|
|
||||||
chronic (0.9.0)
|
|
||||||
coderay (1.0.9)
|
|
||||||
coffee-rails (3.2.2)
|
|
||||||
coffee-script (>= 2.2.0)
|
|
||||||
railties (~> 3.2.0)
|
|
||||||
coffee-script (2.2.0)
|
|
||||||
coffee-script-source
|
|
||||||
execjs
|
|
||||||
coffee-script-source (1.4.0)
|
|
||||||
columnize (0.3.6)
|
|
||||||
database_cleaner (0.9.1)
|
|
||||||
debug_inspector (0.0.2)
|
|
||||||
debugger (1.2.4)
|
|
||||||
columnize (>= 0.3.1)
|
|
||||||
debugger-linecache (~> 1.1.1)
|
|
||||||
debugger-ruby_core_source (~> 1.1.7)
|
|
||||||
debugger-linecache (1.1.2)
|
|
||||||
debugger-ruby_core_source (>= 1.1.1)
|
|
||||||
debugger-ruby_core_source (1.1.8)
|
|
||||||
delorean (2.1.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 (3.0.1)
|
|
||||||
actionmailer (>= 3.0.4)
|
|
||||||
execjs (1.4.0)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
factory_girl (4.2.0)
|
|
||||||
activesupport (>= 3.0.0)
|
|
||||||
factory_girl_rails (4.2.1)
|
|
||||||
factory_girl (~> 4.2.0)
|
|
||||||
railties (>= 3.0.0)
|
|
||||||
faker (1.1.2)
|
|
||||||
i18n (~> 0.5)
|
|
||||||
fastercsv (1.5.5)
|
|
||||||
fattr (2.2.1)
|
|
||||||
fb_graph (2.6.4)
|
|
||||||
httpclient (>= 2.2.0.2)
|
|
||||||
multi_json (>= 1.3)
|
|
||||||
rack-oauth2 (>= 0.14.4)
|
|
||||||
tzinfo
|
|
||||||
ffi (1.4.0)
|
|
||||||
haml (3.1.8)
|
|
||||||
highline (1.6.15)
|
|
||||||
hike (1.2.1)
|
|
||||||
httpclient (2.3.2)
|
|
||||||
i18n (0.6.1)
|
|
||||||
journey (1.0.4)
|
|
||||||
jquery-rails (2.1.4)
|
|
||||||
railties (>= 3.0, < 5.0)
|
|
||||||
thor (>= 0.14, < 2.0)
|
|
||||||
jquery-ui-rails (4.0.1)
|
|
||||||
jquery-rails
|
|
||||||
railties (>= 3.1.0)
|
|
||||||
json (1.7.7)
|
|
||||||
mail (2.4.4)
|
|
||||||
i18n (>= 0.4.0)
|
|
||||||
mime-types (~> 1.16)
|
|
||||||
treetop (~> 1.4.8)
|
|
||||||
metaclass (0.0.1)
|
|
||||||
method_source (0.8.1)
|
|
||||||
mime-types (1.21)
|
|
||||||
mini_magick (3.5.0)
|
|
||||||
subexec (~> 0.2.1)
|
|
||||||
mocha (0.10.5)
|
|
||||||
metaclass (~> 0.0.1)
|
|
||||||
mongo (1.8.2)
|
|
||||||
bson (~> 1.8.2)
|
|
||||||
mongo_session_store-rails3 (3.0.6)
|
|
||||||
actionpack (>= 3.0)
|
|
||||||
mongo
|
|
||||||
mongoid (2.6.0)
|
|
||||||
activemodel (~> 3.1)
|
|
||||||
mongo (~> 1.7)
|
|
||||||
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.6.1)
|
|
||||||
net-ldap (0.3.1)
|
|
||||||
nokogiri (1.5.6)
|
|
||||||
options (2.3.0)
|
|
||||||
fattr
|
|
||||||
orm_adapter (0.0.7)
|
|
||||||
polyglot (0.3.3)
|
|
||||||
pr_geohash (1.0.0)
|
|
||||||
progress_bar (0.4.0)
|
|
||||||
highline (~> 1.6.1)
|
|
||||||
options (~> 2.3.0)
|
|
||||||
pry (0.9.12)
|
|
||||||
coderay (~> 1.0.5)
|
|
||||||
method_source (~> 0.8)
|
|
||||||
slop (~> 3.4)
|
|
||||||
pry-debugger (0.2.1)
|
|
||||||
debugger (~> 1.2.0)
|
|
||||||
pry (~> 0.9.10)
|
|
||||||
pry-remote (0.1.6)
|
|
||||||
pry (~> 0.9)
|
|
||||||
slop (~> 3.0)
|
|
||||||
pry-stack_explorer (0.4.9)
|
|
||||||
binding_of_caller (>= 0.7)
|
|
||||||
pry (~> 0.9.11)
|
|
||||||
rack (1.4.5)
|
|
||||||
rack-cache (1.2)
|
|
||||||
rack (>= 0.4)
|
|
||||||
rack-gridfs (0.4.1)
|
|
||||||
mime-types
|
|
||||||
mongo (~> 1.2)
|
|
||||||
rack
|
|
||||||
rack-oauth2 (1.0.0)
|
|
||||||
activesupport (>= 2.3)
|
|
||||||
attr_required (>= 0.0.5)
|
|
||||||
httpclient (>= 2.2.0.2)
|
|
||||||
i18n
|
|
||||||
multi_json (>= 1.3.6)
|
|
||||||
rack (>= 1.1)
|
|
||||||
rack-protection (1.3.2)
|
|
||||||
rack
|
|
||||||
rack-ssl (1.3.3)
|
|
||||||
rack
|
|
||||||
rack-test (0.6.2)
|
|
||||||
rack (>= 1.0)
|
|
||||||
radius (0.7.3)
|
|
||||||
rails (3.2.12)
|
|
||||||
actionmailer (= 3.2.12)
|
|
||||||
actionpack (= 3.2.12)
|
|
||||||
activerecord (= 3.2.12)
|
|
||||||
activeresource (= 3.2.12)
|
|
||||||
activesupport (= 3.2.12)
|
|
||||||
bundler (~> 1.0)
|
|
||||||
railties (= 3.2.12)
|
|
||||||
railties (3.2.12)
|
|
||||||
actionpack (= 3.2.12)
|
|
||||||
activesupport (= 3.2.12)
|
|
||||||
rack-ssl (~> 1.3.2)
|
|
||||||
rake (>= 0.8.7)
|
|
||||||
rdoc (~> 3.4)
|
|
||||||
thor (>= 0.14.6, < 2.0)
|
|
||||||
rake (10.0.3)
|
|
||||||
rdoc (3.12.1)
|
|
||||||
json (~> 1.4)
|
|
||||||
redis (3.0.2)
|
|
||||||
redis-namespace (1.2.1)
|
|
||||||
redis (~> 3.0.0)
|
|
||||||
redis-search (0.9.0)
|
|
||||||
chinese_pinyin (>= 0.3.0)
|
|
||||||
redis (>= 2.1.1)
|
|
||||||
redis-namespace (>= 1.0.2)
|
|
||||||
resque (1.23.0)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
redis-namespace (~> 1.0)
|
|
||||||
sinatra (>= 0.9.2)
|
|
||||||
vegas (~> 0.1.2)
|
|
||||||
resque-restriction (0.3.0)
|
|
||||||
resque (>= 1.7.0)
|
|
||||||
resque-scheduler (2.0.0)
|
|
||||||
redis (>= 2.0.1)
|
|
||||||
resque (>= 1.20.0)
|
|
||||||
rufus-scheduler
|
|
||||||
rmmseg-cpp-huacnlee (0.2.9)
|
|
||||||
rsolr (1.0.8)
|
|
||||||
builder (>= 2.1.2)
|
|
||||||
rspec (2.12.0)
|
|
||||||
rspec-core (~> 2.12.0)
|
|
||||||
rspec-expectations (~> 2.12.0)
|
|
||||||
rspec-mocks (~> 2.12.0)
|
|
||||||
rspec-core (2.12.2)
|
|
||||||
rspec-expectations (2.12.1)
|
|
||||||
diff-lcs (~> 1.1.3)
|
|
||||||
rspec-mocks (2.12.2)
|
|
||||||
rspec-rails (2.12.2)
|
|
||||||
actionpack (>= 3.0)
|
|
||||||
activesupport (>= 3.0)
|
|
||||||
railties (>= 3.0)
|
|
||||||
rspec-core (~> 2.12.0)
|
|
||||||
rspec-expectations (~> 2.12.0)
|
|
||||||
rspec-mocks (~> 2.12.0)
|
|
||||||
ruby2ruby (2.0.3)
|
|
||||||
ruby_parser (~> 3.1)
|
|
||||||
sexp_processor (~> 4.0)
|
|
||||||
ruby_parser (3.1.1)
|
|
||||||
sexp_processor (~> 4.1)
|
|
||||||
rubyzip (0.9.9)
|
|
||||||
rufus-scheduler (2.0.17)
|
|
||||||
tzinfo (>= 0.3.23)
|
|
||||||
sass (3.2.5)
|
|
||||||
sass-rails (3.2.6)
|
|
||||||
railties (~> 3.2.0)
|
|
||||||
sass (>= 3.1.10)
|
|
||||||
tilt (~> 1.3)
|
|
||||||
select2-rails (3.3.1)
|
|
||||||
sass-rails (>= 3.2)
|
|
||||||
thor (~> 0.14)
|
|
||||||
selenium-webdriver (2.30.0)
|
|
||||||
childprocess (>= 0.2.5)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
rubyzip
|
|
||||||
websocket (~> 1.0.4)
|
|
||||||
sexp_processor (4.1.5)
|
|
||||||
shoulda-matchers (1.4.2)
|
|
||||||
activesupport (>= 3.0.0)
|
|
||||||
bourne (~> 1.1.2)
|
|
||||||
simplecov (0.7.1)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
simplecov-html (~> 0.7.1)
|
|
||||||
simplecov-html (0.7.1)
|
|
||||||
sinatra (1.3.4)
|
|
||||||
rack (~> 1.4)
|
|
||||||
rack-protection (~> 1.3)
|
|
||||||
tilt (~> 1.3, >= 1.3.3)
|
|
||||||
slop (3.4.3)
|
|
||||||
social-share-button (0.1.1)
|
|
||||||
spork (0.9.2)
|
|
||||||
sprockets (2.2.2)
|
|
||||||
hike (~> 1.2)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
rack (~> 1.0)
|
|
||||||
tilt (~> 1.1, != 1.3.0)
|
|
||||||
subexec (0.2.2)
|
|
||||||
sunspot (1.3.3)
|
|
||||||
pr_geohash (~> 1.0)
|
|
||||||
rsolr (~> 1.0.7)
|
|
||||||
sunspot-rails-tester (0.0.4)
|
|
||||||
sunspot_rails (~> 1.2)
|
|
||||||
sunspot_mongo (1.0.1)
|
|
||||||
sunspot_rails
|
|
||||||
sunspot_rails (1.3.3)
|
|
||||||
nokogiri
|
|
||||||
sunspot (= 1.3.3)
|
|
||||||
sunspot_solr (1.3.3)
|
|
||||||
terminal-table (1.4.5)
|
|
||||||
thor (0.17.0)
|
|
||||||
tilt (1.3.3)
|
|
||||||
tinymce-rails (3.5.8)
|
|
||||||
railties (>= 3.1.1)
|
|
||||||
treetop (1.4.12)
|
|
||||||
polyglot
|
|
||||||
polyglot (>= 0.3.1)
|
|
||||||
tzinfo (0.3.35)
|
|
||||||
uglifier (1.3.0)
|
|
||||||
execjs (>= 0.3.0)
|
|
||||||
multi_json (~> 1.0, >= 1.0.2)
|
|
||||||
vegas (0.1.11)
|
|
||||||
rack (>= 1.0.0)
|
|
||||||
warden (1.2.1)
|
|
||||||
rack (>= 1.0)
|
|
||||||
watchr (0.7)
|
|
||||||
websocket (1.0.7)
|
|
||||||
xpath (1.0.0)
|
|
||||||
nokogiri (~> 1.3)
|
|
||||||
|
|
||||||
PLATFORMS
|
|
||||||
ruby
|
|
||||||
|
|
||||||
DEPENDENCIES
|
|
||||||
brakeman
|
|
||||||
bson_ext
|
|
||||||
capybara
|
|
||||||
carrierwave
|
|
||||||
carrierwave-mongoid
|
|
||||||
chinese_pinyin (= 0.4.1)
|
|
||||||
coffee-rails
|
|
||||||
database_cleaner
|
|
||||||
debugger
|
|
||||||
delorean
|
|
||||||
devise (= 1.5.3)
|
|
||||||
exception_notification
|
|
||||||
execjs
|
|
||||||
factory_girl_rails
|
|
||||||
faker
|
|
||||||
fb_graph
|
|
||||||
impressionist!
|
|
||||||
jquery-rails (= 2.1.4)
|
|
||||||
jquery-ui-rails
|
|
||||||
kaminari!
|
|
||||||
mime-types
|
|
||||||
mini_magick
|
|
||||||
mongo_session_store-rails3 (= 3.0.6)
|
|
||||||
mongoid (> 2.1, < 3.0.0)
|
|
||||||
mongoid-encryptor
|
|
||||||
mongoid-tree
|
|
||||||
net-ldap (~> 0.3.1)
|
|
||||||
nokogiri
|
|
||||||
progress_bar
|
|
||||||
pry
|
|
||||||
pry-debugger
|
|
||||||
pry-remote
|
|
||||||
pry-stack_explorer
|
|
||||||
rack-gridfs
|
|
||||||
radius
|
|
||||||
rails (~> 3.2.9)
|
|
||||||
rake
|
|
||||||
redis (>= 2.1.1)
|
|
||||||
redis-namespace
|
|
||||||
redis-search
|
|
||||||
resque
|
|
||||||
resque-restriction
|
|
||||||
resque-scheduler
|
|
||||||
rmmseg-cpp-huacnlee (= 0.2.9)
|
|
||||||
rspec (~> 2.0)
|
|
||||||
rspec-rails (~> 2.0)
|
|
||||||
rubyzip
|
|
||||||
sass-rails
|
|
||||||
select2-rails (= 3.3.1)
|
|
||||||
shoulda-matchers
|
|
||||||
simplecov
|
|
||||||
sinatra
|
|
||||||
social-share-button
|
|
||||||
spork
|
|
||||||
sprockets
|
|
||||||
sunspot-rails-tester
|
|
||||||
sunspot_mongo
|
|
||||||
sunspot_solr
|
|
||||||
tinymce-rails
|
|
||||||
uglifier
|
|
||||||
watchr
|
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 524 B |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 738 B |
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
orbitDesktop.prototype.themefolder = "desktop_themes";
|
orbitDesktop.prototype.themefolder = "desktop_themes";
|
||||||
orbitDesktopAPI.prototype.notifyImgPath = "/assets/";
|
orbitDesktopAPI.prototype.notifyImgPath = "/assets/";
|
||||||
alert("<%= @desktop.inspect %>")
|
// alert("<%= @desktop.inspect %>")
|
||||||
var od = new orbitDesktop("#ajax_container");
|
var od = new orbitDesktop("#ajax_container");
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
getEvent(selet);
|
|
||||||
function resetText() {
|
function resetText() {
|
||||||
$events.find('li').find($mon).html('');
|
$events.find('li').find($mon).html('');
|
||||||
$events.find('li').find($day).html('');
|
$events.find('li').find($day).html('');
|
||||||
@@ -63,60 +63,4 @@ $(document).ready(function(){
|
|||||||
$events.find('li').find($link_text).attr('href', '');
|
$events.find('li').find($link_text).attr('href', '');
|
||||||
$events.find('li').find($time).html('');
|
$events.find('li').find($time).html('');
|
||||||
}
|
}
|
||||||
function getEvent(selet){
|
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: "/static/nccu_calendar.xml",
|
|
||||||
dataType: "xml",
|
|
||||||
timeout: 1000,
|
|
||||||
error: function(xml){
|
|
||||||
$events.find('.links_next').addClass('disabled')
|
|
||||||
$events.find('.error_mag').show();
|
|
||||||
$events.find('ul').hide();
|
|
||||||
$events.find('.error_mag').html("讀取錯誤");
|
|
||||||
},
|
|
||||||
success: function(xml) {
|
|
||||||
xmlLength = $(xml).find('entry').length;
|
|
||||||
$(xml).find('entry').slice(selet, selet+objLength).each(function(i){
|
|
||||||
title_text = $(this).find('title').text()
|
|
||||||
link_text = $(this).find('link').attr('href')
|
|
||||||
summary_text = $(this).find('summary').text()
|
|
||||||
indexA = summary_text.indexOf("-");
|
|
||||||
indexB = summary_text.indexOf(" ");
|
|
||||||
indexC = summary_text.indexOf("/");
|
|
||||||
//清除前後空白字元
|
|
||||||
summary_text = jQuery.trim(summary_text);
|
|
||||||
//篩選標題
|
|
||||||
title_text = title_text.slice(0, 16)
|
|
||||||
if (summary_text.length == 31) {
|
|
||||||
startDate_text = summary_text.slice(0, indexA);
|
|
||||||
startMon_text = startDate_text.slice((indexC+1), (indexC+3));
|
|
||||||
startDay_text = startDate_text.slice(7);
|
|
||||||
endDate_text = summary_text.slice((indexA+1), indexB);
|
|
||||||
time_text = summary_text.slice((indexB+1));
|
|
||||||
} else {
|
|
||||||
startDate_text = summary_text.slice(0, indexB);
|
|
||||||
startMon_text = startDate_text.slice((indexC+1), (indexC+3));
|
|
||||||
startDay_text = startDate_text.slice(7);
|
|
||||||
endDate_text = '';
|
|
||||||
time_text = summary_text.slice((indexB+1));
|
|
||||||
}
|
|
||||||
if(startMon_text.slice(0, 1) == '0'){
|
|
||||||
startMon_text = month[startMon_text.slice(1)-1];
|
|
||||||
} else {
|
|
||||||
startMon_text = month[startMon_text-1];
|
|
||||||
}
|
|
||||||
$events.find('li').eq(i).find($mon).html(startMon_text);
|
|
||||||
$events.find('li').eq(i).find($day).html(startDay_text);
|
|
||||||
$events.find('li').eq(i).find($link_text).html(title_text+"…");
|
|
||||||
$events.find('li').eq(i).find($link_text).attr('href', link_text);
|
|
||||||
$events.find('li').eq(i).find($time).html('時間:'+time_text);
|
|
||||||
//console.log();
|
|
||||||
/*$('<li></li>')
|
|
||||||
.html('<div class="event_date"><span class="mon">'+startMon_text+'</span><span class="day">'+startDay_text+'</div>')
|
|
||||||
.appendTo('.events ul');*/
|
|
||||||
});//close each(
|
|
||||||
}
|
|
||||||
}); //close $.ajax(
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
!function ($) {
|
||||||
|
$.fn.cardCheck = function(param) {
|
||||||
|
_defaultSettings = {
|
||||||
|
check: '',
|
||||||
|
};
|
||||||
|
_set = $.extend(_defaultSettings, param);
|
||||||
|
$card = $(this);
|
||||||
|
$check = _set.check;
|
||||||
|
$check.each(function(){
|
||||||
|
if($(this).attr('checked')) {
|
||||||
|
$(this).parent($card).addClass("active");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$card.on('click', function() {
|
||||||
|
$(this).toggleClass('active')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}(window.jQuery);
|
||||||
|
$(function(){
|
||||||
|
$('.checkbox-card > li').cardCheck({
|
||||||
|
check: $('.checkbox-card > li input[type="checkbox"]'),
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,752 @@
|
|||||||
|
/*! nanoScrollerJS - v0.7.2
|
||||||
|
* http://jamesflorentino.github.com/nanoScrollerJS/
|
||||||
|
* Copyright (c) 2013 James Florentino; Licensed MIT */
|
||||||
|
|
||||||
|
|
||||||
|
(function($, window, document) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var BROWSER_IS_IE7, BROWSER_SCROLLBAR_WIDTH, DOMSCROLL, DOWN, DRAG, KEYDOWN, KEYUP, MOUSEDOWN, MOUSEMOVE, MOUSEUP, MOUSEWHEEL, NanoScroll, PANEDOWN, RESIZE, SCROLL, SCROLLBAR, TOUCHMOVE, UP, WHEEL, defaults, getBrowserScrollbarWidth;
|
||||||
|
defaults = {
|
||||||
|
/**
|
||||||
|
a classname for the pane element.
|
||||||
|
@property paneClass
|
||||||
|
@type String
|
||||||
|
@default 'pane'
|
||||||
|
*/
|
||||||
|
|
||||||
|
paneClass: 'pane',
|
||||||
|
/**
|
||||||
|
a classname for the slider element.
|
||||||
|
@property sliderClass
|
||||||
|
@type String
|
||||||
|
@default 'slider'
|
||||||
|
*/
|
||||||
|
|
||||||
|
sliderClass: 'slider',
|
||||||
|
/**
|
||||||
|
a classname for the content element.
|
||||||
|
@property contentClass
|
||||||
|
@type String
|
||||||
|
@default 'content'
|
||||||
|
*/
|
||||||
|
|
||||||
|
contentClass: 'content',
|
||||||
|
/**
|
||||||
|
a setting to enable native scrolling in iOS devices.
|
||||||
|
@property iOSNativeScrolling
|
||||||
|
@type Boolean
|
||||||
|
@default false
|
||||||
|
*/
|
||||||
|
|
||||||
|
iOSNativeScrolling: false,
|
||||||
|
/**
|
||||||
|
a setting to prevent the rest of the page being
|
||||||
|
scrolled when user scrolls the `.content` element.
|
||||||
|
@property preventPageScrolling
|
||||||
|
@type Boolean
|
||||||
|
@default false
|
||||||
|
*/
|
||||||
|
|
||||||
|
preventPageScrolling: false,
|
||||||
|
/**
|
||||||
|
a setting to disable binding to the resize event.
|
||||||
|
@property disableResize
|
||||||
|
@type Boolean
|
||||||
|
@default false
|
||||||
|
*/
|
||||||
|
|
||||||
|
disableResize: false,
|
||||||
|
/**
|
||||||
|
a setting to make the scrollbar always visible.
|
||||||
|
@property alwaysVisible
|
||||||
|
@type Boolean
|
||||||
|
@default false
|
||||||
|
*/
|
||||||
|
|
||||||
|
alwaysVisible: false,
|
||||||
|
/**
|
||||||
|
a default timeout for the `flash()` method.
|
||||||
|
@property flashDelay
|
||||||
|
@type Number
|
||||||
|
@default 1500
|
||||||
|
*/
|
||||||
|
|
||||||
|
flashDelay: 1500,
|
||||||
|
/**
|
||||||
|
a minimum height for the `.slider` element.
|
||||||
|
@property sliderMinHeight
|
||||||
|
@type Number
|
||||||
|
@default 20
|
||||||
|
*/
|
||||||
|
|
||||||
|
sliderMinHeight: 20,
|
||||||
|
/**
|
||||||
|
a maximum height for the `.slider` element.
|
||||||
|
@property sliderMaxHeight
|
||||||
|
@type Number
|
||||||
|
@default null
|
||||||
|
*/
|
||||||
|
|
||||||
|
sliderMaxHeight: null
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
@property SCROLLBAR
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
SCROLLBAR = 'scrollbar';
|
||||||
|
/**
|
||||||
|
@property SCROLL
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
SCROLL = 'scroll';
|
||||||
|
/**
|
||||||
|
@property MOUSEDOWN
|
||||||
|
@type String
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
MOUSEDOWN = 'mousedown';
|
||||||
|
/**
|
||||||
|
@property MOUSEMOVE
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
MOUSEMOVE = 'mousemove';
|
||||||
|
/**
|
||||||
|
@property MOUSEWHEEL
|
||||||
|
@type String
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
MOUSEWHEEL = 'mousewheel';
|
||||||
|
/**
|
||||||
|
@property MOUSEUP
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
MOUSEUP = 'mouseup';
|
||||||
|
/**
|
||||||
|
@property RESIZE
|
||||||
|
@type String
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
RESIZE = 'resize';
|
||||||
|
/**
|
||||||
|
@property DRAG
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
DRAG = 'drag';
|
||||||
|
/**
|
||||||
|
@property UP
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
UP = 'up';
|
||||||
|
/**
|
||||||
|
@property PANEDOWN
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
PANEDOWN = 'panedown';
|
||||||
|
/**
|
||||||
|
@property DOMSCROLL
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
DOMSCROLL = 'DOMMouseScroll';
|
||||||
|
/**
|
||||||
|
@property DOWN
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
DOWN = 'down';
|
||||||
|
/**
|
||||||
|
@property WHEEL
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
WHEEL = 'wheel';
|
||||||
|
/**
|
||||||
|
@property KEYDOWN
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
KEYDOWN = 'keydown';
|
||||||
|
/**
|
||||||
|
@property KEYUP
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
KEYUP = 'keyup';
|
||||||
|
/**
|
||||||
|
@property TOUCHMOVE
|
||||||
|
@type String
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
TOUCHMOVE = 'touchmove';
|
||||||
|
/**
|
||||||
|
@property BROWSER_IS_IE7
|
||||||
|
@type Boolean
|
||||||
|
@static
|
||||||
|
@final
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
BROWSER_IS_IE7 = window.navigator.appName === 'Microsoft Internet Explorer' && /msie 7./i.test(window.navigator.appVersion) && window.ActiveXObject;
|
||||||
|
/**
|
||||||
|
@property BROWSER_SCROLLBAR_WIDTH
|
||||||
|
@type Number
|
||||||
|
@static
|
||||||
|
@default null
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
BROWSER_SCROLLBAR_WIDTH = null;
|
||||||
|
/**
|
||||||
|
Returns browser's native scrollbar width
|
||||||
|
@method getBrowserScrollbarWidth
|
||||||
|
@return {Number} the scrollbar width in pixels
|
||||||
|
@static
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
getBrowserScrollbarWidth = function() {
|
||||||
|
var outer, outerStyle, scrollbarWidth;
|
||||||
|
outer = document.createElement('div');
|
||||||
|
outerStyle = outer.style;
|
||||||
|
outerStyle.position = 'absolute';
|
||||||
|
outerStyle.width = '100px';
|
||||||
|
outerStyle.height = '100px';
|
||||||
|
outerStyle.overflow = SCROLL;
|
||||||
|
outerStyle.top = '-9999px';
|
||||||
|
document.body.appendChild(outer);
|
||||||
|
scrollbarWidth = outer.offsetWidth - outer.clientWidth;
|
||||||
|
document.body.removeChild(outer);
|
||||||
|
return scrollbarWidth;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
@class NanoScroll
|
||||||
|
@param element {HTMLElement|Node} the main element
|
||||||
|
@param options {Object} nanoScroller's options
|
||||||
|
@constructor
|
||||||
|
*/
|
||||||
|
|
||||||
|
NanoScroll = (function() {
|
||||||
|
|
||||||
|
function NanoScroll(el, options) {
|
||||||
|
this.el = el;
|
||||||
|
this.options = options;
|
||||||
|
BROWSER_SCROLLBAR_WIDTH || (BROWSER_SCROLLBAR_WIDTH = getBrowserScrollbarWidth());
|
||||||
|
this.$el = $(this.el);
|
||||||
|
this.doc = $(document);
|
||||||
|
this.win = $(window);
|
||||||
|
this.$content = this.$el.children("." + options.contentClass);
|
||||||
|
this.$content.attr('tabindex', 0);
|
||||||
|
this.content = this.$content[0];
|
||||||
|
if (this.options.iOSNativeScrolling && (this.el.style.WebkitOverflowScrolling != null)) {
|
||||||
|
this.nativeScrolling();
|
||||||
|
} else {
|
||||||
|
this.generate();
|
||||||
|
}
|
||||||
|
this.createEvents();
|
||||||
|
this.addEvents();
|
||||||
|
this.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Prevents the rest of the page being scrolled
|
||||||
|
when user scrolls the `.content` element.
|
||||||
|
@method preventScrolling
|
||||||
|
@param event {Event}
|
||||||
|
@param direction {String} Scroll direction (up or down)
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.preventScrolling = function(e, direction) {
|
||||||
|
if (!this.isActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.type === DOMSCROLL) {
|
||||||
|
if (direction === DOWN && e.originalEvent.detail > 0 || direction === UP && e.originalEvent.detail < 0) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
} else if (e.type === MOUSEWHEEL) {
|
||||||
|
if (!e.originalEvent || !e.originalEvent.wheelDelta) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (direction === DOWN && e.originalEvent.wheelDelta < 0 || direction === UP && e.originalEvent.wheelDelta > 0) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Enable iOS native scrolling
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.nativeScrolling = function() {
|
||||||
|
this.$content.css({
|
||||||
|
WebkitOverflowScrolling: 'touch'
|
||||||
|
});
|
||||||
|
this.iOSNativeScrolling = true;
|
||||||
|
this.isActive = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Updates those nanoScroller properties that
|
||||||
|
are related to current scrollbar position.
|
||||||
|
@method updateScrollValues
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.updateScrollValues = function() {
|
||||||
|
var content;
|
||||||
|
content = this.content;
|
||||||
|
this.maxScrollTop = content.scrollHeight - content.clientHeight;
|
||||||
|
this.contentScrollTop = content.scrollTop;
|
||||||
|
if (!this.iOSNativeScrolling) {
|
||||||
|
this.maxSliderTop = this.paneHeight - this.sliderHeight;
|
||||||
|
this.sliderTop = this.contentScrollTop * this.maxSliderTop / this.maxScrollTop;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Creates event related methods
|
||||||
|
@method createEvents
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.createEvents = function() {
|
||||||
|
var _this = this;
|
||||||
|
this.events = {
|
||||||
|
down: function(e) {
|
||||||
|
_this.isBeingDragged = true;
|
||||||
|
_this.offsetY = e.pageY - _this.slider.offset().top;
|
||||||
|
_this.pane.addClass('active');
|
||||||
|
_this.doc.bind(MOUSEMOVE, _this.events[DRAG]).bind(MOUSEUP, _this.events[UP]);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
drag: function(e) {
|
||||||
|
_this.sliderY = e.pageY - _this.$el.offset().top - _this.offsetY;
|
||||||
|
_this.scroll();
|
||||||
|
_this.updateScrollValues();
|
||||||
|
if (_this.contentScrollTop >= _this.maxScrollTop) {
|
||||||
|
_this.$el.trigger('scrollend');
|
||||||
|
} else if (_this.contentScrollTop === 0) {
|
||||||
|
_this.$el.trigger('scrolltop');
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
up: function(e) {
|
||||||
|
_this.isBeingDragged = false;
|
||||||
|
_this.pane.removeClass('active');
|
||||||
|
_this.doc.unbind(MOUSEMOVE, _this.events[DRAG]).unbind(MOUSEUP, _this.events[UP]);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
resize: function(e) {
|
||||||
|
_this.reset();
|
||||||
|
},
|
||||||
|
panedown: function(e) {
|
||||||
|
_this.sliderY = (e.offsetY || e.originalEvent.layerY) - (_this.sliderHeight * 0.5);
|
||||||
|
_this.scroll();
|
||||||
|
_this.events.down(e);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
scroll: function(e) {
|
||||||
|
if (_this.isBeingDragged) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_this.updateScrollValues();
|
||||||
|
if (!_this.iOSNativeScrolling) {
|
||||||
|
_this.sliderY = _this.sliderTop;
|
||||||
|
_this.slider.css({
|
||||||
|
top: _this.sliderTop
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (e == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_this.contentScrollTop >= _this.maxScrollTop) {
|
||||||
|
if (_this.options.preventPageScrolling) {
|
||||||
|
_this.preventScrolling(e, DOWN);
|
||||||
|
}
|
||||||
|
_this.$el.trigger('scrollend');
|
||||||
|
} else if (_this.contentScrollTop === 0) {
|
||||||
|
if (_this.options.preventPageScrolling) {
|
||||||
|
_this.preventScrolling(e, UP);
|
||||||
|
}
|
||||||
|
_this.$el.trigger('scrolltop');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
wheel: function(e) {
|
||||||
|
if (e == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_this.sliderY += -e.wheelDeltaY || -e.delta;
|
||||||
|
_this.scroll();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Adds event listeners with jQuery.
|
||||||
|
@method addEvents
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.addEvents = function() {
|
||||||
|
var events;
|
||||||
|
this.removeEvents();
|
||||||
|
events = this.events;
|
||||||
|
if (!this.options.disableResize) {
|
||||||
|
this.win.bind(RESIZE, events[RESIZE]);
|
||||||
|
}
|
||||||
|
if (!this.iOSNativeScrolling) {
|
||||||
|
this.slider.bind(MOUSEDOWN, events[DOWN]);
|
||||||
|
this.pane.bind(MOUSEDOWN, events[PANEDOWN]).bind("" + MOUSEWHEEL + " " + DOMSCROLL, events[WHEEL]);
|
||||||
|
}
|
||||||
|
this.$content.bind("" + SCROLL + " " + MOUSEWHEEL + " " + DOMSCROLL + " " + TOUCHMOVE, events[SCROLL]);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Removes event listeners with jQuery.
|
||||||
|
@method removeEvents
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.removeEvents = function() {
|
||||||
|
var events;
|
||||||
|
events = this.events;
|
||||||
|
this.win.unbind(RESIZE, events[RESIZE]);
|
||||||
|
if (!this.iOSNativeScrolling) {
|
||||||
|
this.slider.unbind();
|
||||||
|
this.pane.unbind();
|
||||||
|
}
|
||||||
|
this.$content.unbind("" + SCROLL + " " + MOUSEWHEEL + " " + DOMSCROLL + " " + TOUCHMOVE, events[SCROLL]);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Generates nanoScroller's scrollbar and elements for it.
|
||||||
|
@method generate
|
||||||
|
@chainable
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.generate = function() {
|
||||||
|
var contentClass, cssRule, options, paneClass, sliderClass;
|
||||||
|
options = this.options;
|
||||||
|
paneClass = options.paneClass, sliderClass = options.sliderClass, contentClass = options.contentClass;
|
||||||
|
if (!this.$el.find("" + paneClass).length && !this.$el.find("" + sliderClass).length) {
|
||||||
|
this.$el.append("<div class=\"" + paneClass + "\"><div class=\"" + sliderClass + "\" /></div>");
|
||||||
|
}
|
||||||
|
this.pane = this.$el.children("." + paneClass);
|
||||||
|
this.slider = this.pane.find("." + sliderClass);
|
||||||
|
if (BROWSER_SCROLLBAR_WIDTH) {
|
||||||
|
cssRule = this.$el.css('direction') === 'rtl' ? {
|
||||||
|
left: -BROWSER_SCROLLBAR_WIDTH
|
||||||
|
} : {
|
||||||
|
right: -BROWSER_SCROLLBAR_WIDTH
|
||||||
|
};
|
||||||
|
this.$el.addClass('has-scrollbar');
|
||||||
|
}
|
||||||
|
if (cssRule != null) {
|
||||||
|
this.$content.css(cssRule);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
@method restore
|
||||||
|
@private
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.restore = function() {
|
||||||
|
this.stopped = false;
|
||||||
|
this.pane.show();
|
||||||
|
this.addEvents();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Resets nanoScroller's scrollbar.
|
||||||
|
@method reset
|
||||||
|
@chainable
|
||||||
|
@example
|
||||||
|
$(".nano").nanoScroller();
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.reset = function() {
|
||||||
|
var content, contentHeight, contentStyle, contentStyleOverflowY, paneBottom, paneHeight, paneOuterHeight, paneTop, sliderHeight;
|
||||||
|
if (this.iOSNativeScrolling) {
|
||||||
|
this.contentHeight = this.content.scrollHeight;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.$el.find("." + this.options.paneClass).length) {
|
||||||
|
this.generate().stop();
|
||||||
|
}
|
||||||
|
if (this.stopped) {
|
||||||
|
this.restore();
|
||||||
|
}
|
||||||
|
content = this.content;
|
||||||
|
contentStyle = content.style;
|
||||||
|
contentStyleOverflowY = contentStyle.overflowY;
|
||||||
|
if (BROWSER_IS_IE7) {
|
||||||
|
this.$content.css({
|
||||||
|
height: this.$content.height()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
contentHeight = content.scrollHeight + BROWSER_SCROLLBAR_WIDTH;
|
||||||
|
paneHeight = this.pane.outerHeight();
|
||||||
|
paneTop = parseInt(this.pane.css('top'), 10);
|
||||||
|
paneBottom = parseInt(this.pane.css('bottom'), 10);
|
||||||
|
paneOuterHeight = paneHeight + paneTop + paneBottom;
|
||||||
|
sliderHeight = Math.round(paneOuterHeight / contentHeight * paneOuterHeight);
|
||||||
|
if (sliderHeight < this.options.sliderMinHeight) {
|
||||||
|
sliderHeight = this.options.sliderMinHeight;
|
||||||
|
} else if ((this.options.sliderMaxHeight != null) && sliderHeight > this.options.sliderMaxHeight) {
|
||||||
|
sliderHeight = this.options.sliderMaxHeight;
|
||||||
|
}
|
||||||
|
if (contentStyleOverflowY === SCROLL && contentStyle.overflowX !== SCROLL) {
|
||||||
|
sliderHeight += BROWSER_SCROLLBAR_WIDTH;
|
||||||
|
}
|
||||||
|
this.maxSliderTop = paneOuterHeight - sliderHeight;
|
||||||
|
this.contentHeight = contentHeight;
|
||||||
|
this.paneHeight = paneHeight;
|
||||||
|
this.paneOuterHeight = paneOuterHeight;
|
||||||
|
this.sliderHeight = sliderHeight;
|
||||||
|
this.slider.height(sliderHeight);
|
||||||
|
this.events.scroll();
|
||||||
|
this.pane.show();
|
||||||
|
this.isActive = true;
|
||||||
|
if ((content.scrollHeight === content.clientHeight) || (this.pane.outerHeight(true) >= content.scrollHeight && contentStyleOverflowY !== SCROLL)) {
|
||||||
|
this.pane.hide();
|
||||||
|
this.isActive = false;
|
||||||
|
} else if (this.el.clientHeight === content.scrollHeight && contentStyleOverflowY === SCROLL) {
|
||||||
|
this.slider.hide();
|
||||||
|
} else {
|
||||||
|
this.slider.show();
|
||||||
|
}
|
||||||
|
this.pane.css({
|
||||||
|
opacity: (this.options.alwaysVisible ? 1 : ''),
|
||||||
|
visibility: (this.options.alwaysVisible ? 'visible' : '')
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
@method scroll
|
||||||
|
@private
|
||||||
|
@example
|
||||||
|
$(".nano").nanoScroller({ scroll: 'top' });
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.scroll = function() {
|
||||||
|
if (!this.isActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.sliderY = Math.max(0, this.sliderY);
|
||||||
|
this.sliderY = Math.min(this.maxSliderTop, this.sliderY);
|
||||||
|
this.$content.scrollTop((this.paneHeight - this.contentHeight + BROWSER_SCROLLBAR_WIDTH) * this.sliderY / this.maxSliderTop * -1);
|
||||||
|
if (!this.iOSNativeScrolling) {
|
||||||
|
this.slider.css({
|
||||||
|
top: this.sliderY
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Scroll at the bottom with an offset value
|
||||||
|
@method scrollBottom
|
||||||
|
@param offsetY {Number}
|
||||||
|
@chainable
|
||||||
|
@example
|
||||||
|
$(".nano").nanoScroller({ scrollBottom: value });
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.scrollBottom = function(offsetY) {
|
||||||
|
if (!this.isActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.reset();
|
||||||
|
this.$content.scrollTop(this.contentHeight - this.$content.height() - offsetY).trigger(MOUSEWHEEL);
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Scroll at the top with an offset value
|
||||||
|
@method scrollTop
|
||||||
|
@param offsetY {Number}
|
||||||
|
@chainable
|
||||||
|
@example
|
||||||
|
$(".nano").nanoScroller({ scrollTop: value });
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.scrollTop = function(offsetY) {
|
||||||
|
if (!this.isActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.reset();
|
||||||
|
this.$content.scrollTop(+offsetY).trigger(MOUSEWHEEL);
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Scroll to an element
|
||||||
|
@method scrollTo
|
||||||
|
@param node {Node} A node to scroll to.
|
||||||
|
@chainable
|
||||||
|
@example
|
||||||
|
$(".nano").nanoScroller({ scrollTo: $('#a_node') });
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.scrollTo = function(node) {
|
||||||
|
if (!this.isActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.reset();
|
||||||
|
this.scrollTop($(node).get(0).offsetTop);
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
To stop the operation.
|
||||||
|
This option will tell the plugin to disable all event bindings and hide the gadget scrollbar from the UI.
|
||||||
|
@method stop
|
||||||
|
@chainable
|
||||||
|
@example
|
||||||
|
$(".nano").nanoScroller({ stop: true });
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.stop = function() {
|
||||||
|
this.stopped = true;
|
||||||
|
this.removeEvents();
|
||||||
|
this.pane.hide();
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
To flash the scrollbar gadget for an amount of time defined in plugin settings (defaults to 1,5s).
|
||||||
|
Useful if you want to show the user (e.g. on pageload) that there is more content waiting for him.
|
||||||
|
@method flash
|
||||||
|
@chainable
|
||||||
|
@example
|
||||||
|
$(".nano").nanoScroller({ flash: true });
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
NanoScroll.prototype.flash = function() {
|
||||||
|
var _this = this;
|
||||||
|
if (!this.isActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.reset();
|
||||||
|
this.pane.addClass('flashed');
|
||||||
|
setTimeout(function() {
|
||||||
|
_this.pane.removeClass('flashed');
|
||||||
|
}, this.options.flashDelay);
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
return NanoScroll;
|
||||||
|
|
||||||
|
})();
|
||||||
|
$.fn.nanoScroller = function(settings) {
|
||||||
|
return this.each(function() {
|
||||||
|
var options, scrollbar;
|
||||||
|
if (!(scrollbar = this.nanoscroller)) {
|
||||||
|
options = $.extend({}, defaults, settings);
|
||||||
|
this.nanoscroller = scrollbar = new NanoScroll(this, options);
|
||||||
|
}
|
||||||
|
if (settings && typeof settings === "object") {
|
||||||
|
$.extend(scrollbar.options, settings);
|
||||||
|
if (settings.scrollBottom) {
|
||||||
|
return scrollbar.scrollBottom(settings.scrollBottom);
|
||||||
|
}
|
||||||
|
if (settings.scrollTop) {
|
||||||
|
return scrollbar.scrollTop(settings.scrollTop);
|
||||||
|
}
|
||||||
|
if (settings.scrollTo) {
|
||||||
|
return scrollbar.scrollTo(settings.scrollTo);
|
||||||
|
}
|
||||||
|
if (settings.scroll === 'bottom') {
|
||||||
|
return scrollbar.scrollBottom(0);
|
||||||
|
}
|
||||||
|
if (settings.scroll === 'top') {
|
||||||
|
return scrollbar.scrollTop(0);
|
||||||
|
}
|
||||||
|
if (settings.scroll && settings.scroll instanceof $) {
|
||||||
|
return scrollbar.scrollTo(settings.scroll);
|
||||||
|
}
|
||||||
|
if (settings.stop) {
|
||||||
|
return scrollbar.stop();
|
||||||
|
}
|
||||||
|
if (settings.flash) {
|
||||||
|
return scrollbar.flash();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return scrollbar.reset();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
})(jQuery, window, document);
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
$(".select_user_modal").on('click', function(){
|
||||||
|
var ids = [];
|
||||||
|
var users = $(this).siblings('#selected_users').children('span.selected_user');
|
||||||
|
users.each(function(i) {
|
||||||
|
ids.push(users.eq(i).attr('user_id'));
|
||||||
|
});
|
||||||
|
$("#main-wrap").after("<span id='select_user'></span>");
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: $(this).attr("rel"),
|
||||||
|
dataType: 'script',
|
||||||
|
data: {field: $(this).attr("field"), ids: ids},
|
||||||
|
success: function (msg) {
|
||||||
|
$("#select_user_modal").modal('show'); },
|
||||||
|
error: function(){
|
||||||
|
alert("ERROR");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$(document).on('click', ".remove_user", function(){
|
||||||
|
$(this).parent().remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<%#= encoding: utf-8 %>
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
$(document).on('click', '.survey_question_item a.remove_existing_record_question', function(){
|
||||||
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||||
|
$(this).next('.should_destroy').val(1);
|
||||||
|
$(".survey_question_item#" + $(this).prev().attr('value')).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.survey_question_option_item a.remove_existing_record_option', function(){
|
||||||
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||||
|
$(this).next('.should_destroy').val(1);
|
||||||
|
$(".survey_question_option_item#" + $(this).prev().attr('value')).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.survey_question_radiogroup_item a.remove_existing_record_radiogroup', function(){
|
||||||
|
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||||
|
$(this).next('.should_destroy').val(1);
|
||||||
|
$(".survey_question_radiogroup_item#" + $(this).prev().attr('value')).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.survey_question_item .type-selector').live('change', function(){
|
||||||
|
$item = $(this).parents('.survey_question_item');
|
||||||
|
$item.find('.type-specify').hide();
|
||||||
|
$item.find('.type-specify.type-' + $(this).val()).show();
|
||||||
|
$item.find('.type-specify.hide-type-' + $(this).val()).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.survey_question_item .type-selector').trigger('change');
|
||||||
|
|
||||||
|
$('.survey_question_item .add_survey_question_option a.add').live('click', function(){
|
||||||
|
var new_id = $(this).prev().attr('value');
|
||||||
|
var old_id = new RegExp("new_survey_question_options", "g");
|
||||||
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||||
|
$_new = $($(this).next().html().replace(old_id, new_id));
|
||||||
|
$(this).parents('.survey_question_options_wrapper').find('tbody').append($_new);
|
||||||
|
$_new.find('a.delete_option').on('click', function(){
|
||||||
|
$(this).parents('.survey_question_option_item').remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.survey_question_item .add_survey_question_radiogroup a.add').live('click', function(){
|
||||||
|
var new_id = $(this).prev().attr('value');
|
||||||
|
var old_id = new RegExp("new_survey_question_radiogroups", "g");
|
||||||
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||||
|
$_new = $($(this).next().html().replace(old_id, new_id));
|
||||||
|
$(this).parents('.survey_question_radiogroups_wrapper').find('tbody').append($_new);
|
||||||
|
$_new.find('a.delete_radiogroup').on('click', function(){
|
||||||
|
$(this).parents('.survey_question_radiogroup_item').remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
@@ -9,7 +9,7 @@ function load_tinymce() {
|
|||||||
// Theme options
|
// Theme options
|
||||||
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
|
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_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_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen,|,template",
|
||||||
theme_advanced_toolbar_location : "top",
|
theme_advanced_toolbar_location : "top",
|
||||||
theme_advanced_toolbar_align : "left",
|
theme_advanced_toolbar_align : "left",
|
||||||
theme_advanced_statusbar_location : "bottom",
|
theme_advanced_statusbar_location : "bottom",
|
||||||
@@ -20,7 +20,7 @@ function load_tinymce() {
|
|||||||
skin_variant : "silver",
|
skin_variant : "silver",
|
||||||
font_size_style_values : "xx-small,x-small,small,medium,large,x-large,xx-large",
|
font_size_style_values : "xx-small,x-small,small,medium,large,x-large,xx-large",
|
||||||
// Drop lists for link/image/media/template dialogs
|
// Drop lists for link/image/media/template dialogs
|
||||||
template_external_list_url : "js/template_list.js",
|
template_external_list_url : "/tinymce/lists/template_list.js",
|
||||||
// external_link_list_url : "js/link_list.js",
|
// external_link_list_url : "js/link_list.js",
|
||||||
// external_image_list_url : "js/image_list.js",
|
// external_image_list_url : "js/image_list.js",
|
||||||
// media_external_list_url : "js/media_list.js"
|
// media_external_list_url : "js/media_list.js"
|
||||||
|
|||||||
@@ -5,3 +5,4 @@
|
|||||||
*= require_self
|
*= require_self
|
||||||
*= require social-share-button
|
*= require social-share-button
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#acknowledgement {
|
||||||
|
display: none;
|
||||||
|
padding: 20px;
|
||||||
|
margin: -20px 0 30px 0;
|
||||||
|
background-color: #fff;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 15px;
|
||||||
|
border: solid 2px #f0f0f0;
|
||||||
|
}
|
||||||
|
#aclnowledgement:after {
|
||||||
|
content: '';
|
||||||
|
display: table;
|
||||||
|
width: table;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ask-question {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* AQ form */
|
||||||
|
#new-ask-question {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
padding: 20px 0;
|
||||||
|
}
|
||||||
|
#new-ask-question .form-horizontal .control-label {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
#new-ask-question .form-horizontal .controls {
|
||||||
|
margin-left: 120px;
|
||||||
|
}
|
||||||
|
#new-ask-question .form-horizontal .controls textarea {
|
||||||
|
width: 80%;
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
#new-ask-question .form-horizontal .form-actions {
|
||||||
|
padding-left: 120px;
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
@@ -149,7 +149,7 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
|
|||||||
margin-top: 4px; }
|
margin-top: 4px; }
|
||||||
|
|
||||||
.select2-search input.select2-active {
|
.select2-search input.select2-active {
|
||||||
background: white image-url("select2-spinner.gif") no-repeat 100%; }
|
background: white url("select2/spinner.gif") no-repeat 100%; }
|
||||||
|
|
||||||
.select2-container-active .select2-choice,
|
.select2-container-active .select2-choice,
|
||||||
.select2-container-active .select2-choices {
|
.select2-container-active .select2-choices {
|
||||||
@@ -261,7 +261,7 @@ disabled look for disabled choices in the results dropdown
|
|||||||
display: none; }
|
display: none; }
|
||||||
|
|
||||||
.select2-more-results.select2-active {
|
.select2-more-results.select2-active {
|
||||||
background: #f4f4f4 image-url("select2-spinner.gif") no-repeat 100%; }
|
background: #f4f4f4 url("select2/spinner.gif") no-repeat 100%; }
|
||||||
|
|
||||||
.select2-more-results {
|
.select2-more-results {
|
||||||
background: #f4f4f4;
|
background: #f4f4f4;
|
||||||
@@ -323,7 +323,7 @@ disabled look for disabled choices in the results dropdown
|
|||||||
background: transparent !important; }
|
background: transparent !important; }
|
||||||
|
|
||||||
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
|
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
|
||||||
background: white image-url("select2-spinner.gif") no-repeat 100% !important; }
|
background: white url("select2/spinner.gif") no-repeat 100% !important; }
|
||||||
|
|
||||||
.select2-default {
|
.select2-default {
|
||||||
color: #999999 !important; }
|
color: #999999 !important; }
|
||||||
@@ -404,4 +404,4 @@ disabled look for disabled choices in the results dropdown
|
|||||||
background-size: 60px 40px !important; }
|
background-size: 60px 40px !important; }
|
||||||
|
|
||||||
.select2-search input {
|
.select2-search input {
|
||||||
background-position: 100% -21px !important; } }
|
background-position: 100% -21px !important; } }
|
||||||
@@ -12,6 +12,9 @@
|
|||||||
.main-list {
|
.main-list {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
#filter .main-list, #filter + .main-list {
|
||||||
|
table-layout: fixed;
|
||||||
|
}
|
||||||
.main-wrap>.main-list thead th {
|
.main-wrap>.main-list thead th {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border-right: medium none;
|
border-right: medium none;
|
||||||
@@ -36,7 +39,7 @@
|
|||||||
}
|
}
|
||||||
.main-list tbody .quick-edit .nav {
|
.main-list tbody .quick-edit .nav {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 350px;
|
width: 440px;
|
||||||
left: -8px;
|
left: -8px;
|
||||||
}
|
}
|
||||||
.main-list tbody .quick-edit .nav .dropdown-menu {
|
.main-list tbody .quick-edit .nav .dropdown-menu {
|
||||||
|
|||||||
@@ -0,0 +1,230 @@
|
|||||||
|
/* Member Filter */
|
||||||
|
#select_user #select_user_modal.modal {
|
||||||
|
width: 80%;
|
||||||
|
margin-left: -40%;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body {
|
||||||
|
max-height: 425px;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body form {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body form fieldset {
|
||||||
|
min-height: 360px;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body .radio.inline,
|
||||||
|
#select_user #select_user_modal .modal-body .checkbox.inline {
|
||||||
|
display: inline-block;
|
||||||
|
padding-top: 5px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
vertical-align: middle;
|
||||||
|
min-width: 100px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body .form-actions {
|
||||||
|
margin: 20px 0 0;
|
||||||
|
padding: 10px 0 0;
|
||||||
|
background-color: transparent;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body .tabs-left > .nano {
|
||||||
|
width: 160px;
|
||||||
|
min-height: 425px;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body .tabs-left > .nano .pane {
|
||||||
|
right: 6px;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs {
|
||||||
|
width: 140px;
|
||||||
|
float: left;
|
||||||
|
margin-bottom: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
border-right: 1px solid #ddd;
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li > a {
|
||||||
|
min-width: 74px;
|
||||||
|
margin-right: 0;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li > a {
|
||||||
|
margin-right: -1px;
|
||||||
|
-webkit-border-radius: 4px 0 0 4px;
|
||||||
|
-moz-border-radius: 4px 0 0 4px;
|
||||||
|
border-radius: 4px 0 0 4px;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li > a:hover {
|
||||||
|
border-color: #eeeeee #dddddd #eeeeee #eeeeee;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs .active > a,
|
||||||
|
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs .active > a:hover {
|
||||||
|
border-color: #ddd transparent #ddd #ddd;
|
||||||
|
*border-right-color: #ffffff;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .member-filter-options {
|
||||||
|
float: left;
|
||||||
|
display: inline-block;
|
||||||
|
width: 175px;
|
||||||
|
min-height: 425px;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding: 0 10px 0 0;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .member-filter-options select {
|
||||||
|
width: 165px;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .member-filter-options .btn {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
#select_user #select_user_modal .member-filter-result {
|
||||||
|
padding-left: 15px;
|
||||||
|
min-height: 360px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Check Box Card */
|
||||||
|
.checkbox-card {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.checkbox-card li {
|
||||||
|
position: relative;
|
||||||
|
list-style: none;
|
||||||
|
color: #FFFFFF;
|
||||||
|
width: 180px;
|
||||||
|
height: 40px;
|
||||||
|
margin: 0 10px 10px 0;
|
||||||
|
float: left;
|
||||||
|
display: inline-block;
|
||||||
|
background-color: #cccccc;
|
||||||
|
overflow: hidden;
|
||||||
|
-webkit-border-radius: 3px;
|
||||||
|
-moz-border-radius: 3px;
|
||||||
|
border-radius: 3px;
|
||||||
|
-webkit-transition: all .2s linear;
|
||||||
|
-moz-transition: all .2s linear;
|
||||||
|
-o-transition: all .2s linear;
|
||||||
|
transition: all .2s linear;
|
||||||
|
}
|
||||||
|
.checkbox-card li.mark {
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
||||||
|
filter: alpha(opacity=0);
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
.checkbox-card li:hover {
|
||||||
|
background-color: #0088cc;
|
||||||
|
}
|
||||||
|
.checkbox-card li:after {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
clear: both;
|
||||||
|
height: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
.checkbox-card li.active:before {
|
||||||
|
-webkit-text-size-adjust : none;
|
||||||
|
font-family: FontAwesome;
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
color: #FFF;
|
||||||
|
text-decoration: inherit;
|
||||||
|
content: "\f00c";
|
||||||
|
position: absolute;
|
||||||
|
right: 0px;
|
||||||
|
top: 0px;
|
||||||
|
line-height: 14px;
|
||||||
|
text-indent: 10px;
|
||||||
|
font-size: 10px;
|
||||||
|
width: 0px;
|
||||||
|
height: 0px;
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 0 22px 22px 0;
|
||||||
|
border-color: transparent #51a351 transparent transparent;
|
||||||
|
}
|
||||||
|
.checkbox-card li.active label {
|
||||||
|
}
|
||||||
|
.checkbox-card li label {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
overflow: hidden;
|
||||||
|
-webkit-border-radius: 3px;
|
||||||
|
-moz-border-radius: 3px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
.checkbox-card li input {
|
||||||
|
opacity: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
margin: 0;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
.checkbox-card li label span {
|
||||||
|
-webkit-text-size-adjust : none;
|
||||||
|
font-size: 10px;
|
||||||
|
display: block;
|
||||||
|
width: 130px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
color: #666666;
|
||||||
|
margin-top: -3px;
|
||||||
|
}
|
||||||
|
.checkbox-card li:hover label span,
|
||||||
|
.checkbox-card li:hover label span.user-name {
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
.checkbox-card li label span.user-name {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #363636;
|
||||||
|
padding: 2px 0 0;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.checkbox-card li .user-pic {
|
||||||
|
float: left;
|
||||||
|
margin-right: 5px;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
#selected_users .selected_user {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
#selected_users .selected_user .remove_user {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
.promoter {
|
||||||
|
border-color: #CCCCCC;
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 0 1px;
|
||||||
|
padding: 0 10px 5px 10px;
|
||||||
|
}
|
||||||
|
.promoter > div {
|
||||||
|
border-bottom: 1px solid #CCCCCC;
|
||||||
|
}
|
||||||
|
.promoter > div:after {
|
||||||
|
content: "";
|
||||||
|
clear: both;
|
||||||
|
display: block;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
.promoter > div > span {
|
||||||
|
display: block;
|
||||||
|
margin-left: 70px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
.promoter p {
|
||||||
|
width: 70px;
|
||||||
|
float: left;
|
||||||
|
text-align:right;
|
||||||
|
}*/
|
||||||
@@ -55,9 +55,9 @@
|
|||||||
width:100%;
|
width:100%;
|
||||||
}
|
}
|
||||||
#orbit-bar .orbit-logo .brand {
|
#orbit-bar .orbit-logo .brand {
|
||||||
background:url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px;
|
background: url(<%= asset_path 'ga-logo.png' %>) no-repeat center center;
|
||||||
text-indent:-9999px;
|
text-indent: -9999px;
|
||||||
padding:5px 20px 4px;
|
padding: 5px 20px 4px;
|
||||||
}
|
}
|
||||||
#orbit-bar .orbit-logo .brand:hover {
|
#orbit-bar .orbit-logo .brand:hover {
|
||||||
background-color:#009ddc;
|
background-color:#009ddc;
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
.o-question {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
.o-question input[type=checkbox], .o-question input[type=radio] {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.o-question textarea {
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
.o-question-topic {
|
||||||
|
font-size: 2em;
|
||||||
|
line-height: normal;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.5em 0;
|
||||||
|
}
|
||||||
|
.o-question-description {
|
||||||
|
font-size: 0.9em;
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
.o-question-list {
|
||||||
|
clear: both;
|
||||||
|
margin: 40px 0;
|
||||||
|
padding: 0;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.o-question-list > li {
|
||||||
|
margin: 0 0 0 40px;
|
||||||
|
padding: 16px 0;
|
||||||
|
border-top: solid 1px #eee;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.o-question-list > li .required-star {
|
||||||
|
position: absolute;
|
||||||
|
left: -42px;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
.o-question-list > li:first-child {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
.o-question-title {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 1.2em;
|
||||||
|
line-height: 1.5em;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.o-question-title + .o-question-description {
|
||||||
|
font-weight: normal;
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
padding: 16px;
|
||||||
|
position: relative;
|
||||||
|
margin-top: 20px;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
.o-question-title + .o-question-description:before {
|
||||||
|
display: block;
|
||||||
|
content: "";
|
||||||
|
border-left: 12px solid transparent;
|
||||||
|
border-right: 12px solid transparent;
|
||||||
|
border-bottom: 12px solid #f6f6f6;
|
||||||
|
position: absolute;
|
||||||
|
top: -12px;
|
||||||
|
left: 16px;
|
||||||
|
}
|
||||||
|
.o-question-title + input[type=text],
|
||||||
|
.o-question-title + textarea,
|
||||||
|
.o-question-title + select,
|
||||||
|
.o-question-description + input[type=text],
|
||||||
|
.o-question-description + textarea,
|
||||||
|
.o-question-description + select {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.o-question-title + input[type=text], .o-question-title + textarea {
|
||||||
|
border: solid 1px #ccc;
|
||||||
|
padding: 6px;
|
||||||
|
margin: 20px 0;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
.o-question-title + input[type=text] {
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
.o-question-title + textarea {
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
.o-question-group {
|
||||||
|
margin: 20px 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.o-question-option {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
.o-question-group.view-list {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
.o-question-group.view-list .o-question-option {}
|
||||||
|
.o-question-group.view-list > li {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
.o-question-group.view-list > li:first-child {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.o-question-group.view-list > li > * {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.o-question-group.view-list > li input + .o-question-option {
|
||||||
|
margin: 0 0 0 12px;
|
||||||
|
}
|
||||||
|
.o-question-group.view-dropdown {
|
||||||
|
height: 24px;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid {
|
||||||
|
border-collapse: collapse;
|
||||||
|
max-width: 90%;
|
||||||
|
min-width: 50%;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid th, .o-question-group.view-grid td {
|
||||||
|
padding: 6px;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid thead th {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid tbody th {}
|
||||||
|
.o-question-group.view-grid tbody .odd .o-question-title, .o-question-group.view-grid tbody .odd td {
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid .o-question-title {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid tbody .odd .o-question-title {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid tbody .odd td {}
|
||||||
|
.o-question-group.view-grid tbody tr:hover td {
|
||||||
|
background-color: #aaa;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid tbody td {
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.o-question-group.view-grid tbody td input {
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
.o-question-action {
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700);
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 50px 0;
|
||||||
|
background-color: #eee;
|
||||||
|
font-family: 'Open Sans', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
background: #FFFFFF none;
|
||||||
|
box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
|
||||||
|
margin: 0 auto;
|
||||||
|
overflow: hidden;
|
||||||
|
width: 980px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper > h1 {
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px;
|
||||||
|
font-family: 'Open Sans', sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
section {
|
||||||
|
border-top: dashed 3px #eee;
|
||||||
|
padding: 40px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
section:first-child {
|
||||||
|
border: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
section > h2 {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: bold;
|
||||||
|
border: solid 1px #ddd;
|
||||||
|
background-color: #2676C0;
|
||||||
|
color: #fff;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 16px;
|
||||||
|
box-shadow: 0 1px 1px #fff, 0 2px 6px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
.side {
|
||||||
|
float: right;
|
||||||
|
width: 189px;
|
||||||
|
padding-left: 20px;
|
||||||
|
border-left: solid 1px #eee;
|
||||||
|
}
|
||||||
|
.main {
|
||||||
|
float: left;
|
||||||
|
width: 710px;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
/*style*/
|
/*style*/
|
||||||
|
* {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
@font-face{
|
@font-face{
|
||||||
font-family: 'WebSymbolsRegular';
|
font-family: 'WebSymbolsRegular';
|
||||||
src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>);
|
src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Admin::AssetsController < OrbitBackendController
|
|||||||
def new
|
def new
|
||||||
@asset = Asset.new
|
@asset = Asset.new
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = get_tags
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {}
|
format.html {}
|
||||||
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} }
|
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/new'} }
|
||||||
@@ -21,7 +21,7 @@ class Admin::AssetsController < OrbitBackendController
|
|||||||
def edit
|
def edit
|
||||||
@asset = Asset.find(params[:id])
|
@asset = Asset.find(params[:id])
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = get_tags
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {}
|
format.html {}
|
||||||
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} }
|
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} }
|
||||||
@@ -46,7 +46,7 @@ class Admin::AssetsController < OrbitBackendController
|
|||||||
else
|
else
|
||||||
flash[:error] = t('create.fail')
|
flash[:error] = t('create.fail')
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = get_tags
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js {
|
format.js {
|
||||||
if params[:uploader]
|
if params[:uploader]
|
||||||
@@ -69,7 +69,7 @@ class Admin::AssetsController < OrbitBackendController
|
|||||||
else
|
else
|
||||||
flash[:error] = t('update.fail')
|
flash[:error] = t('update.fail')
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = get_tags
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :action => :edit }
|
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}} }
|
format.js { render 'js/reload_pop_up', :locals => {:value => @asset, :values => nil, :partial => 'admin/assets/edit', :locals => {:is_html => false}} }
|
||||||
@@ -96,7 +96,7 @@ class Admin::AssetsController < OrbitBackendController
|
|||||||
def file_upload
|
def file_upload
|
||||||
@asset = Asset.new
|
@asset = Asset.new
|
||||||
@asset_categories = AssetCategory.all
|
@asset_categories = AssetCategory.all
|
||||||
@tags = AssetTag.all
|
@tags = get_tags
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
class Admin::MailCronLogsController < OrbitBackendController
|
||||||
|
|
||||||
|
layout "new_admin"
|
||||||
|
before_filter :authenticate_user!
|
||||||
|
before_filter :is_admin?
|
||||||
|
|
||||||
|
def index
|
||||||
|
|
||||||
|
# @mail_cron_logs = MailCronLog.all.desc(:created_at).page(params[:page_main] ).per('20')
|
||||||
|
@mail_cron_logs = (params[:sort]) ? get_sorted_and_filtered("mail_cron_log") : get_viewable("mail_cron_log")
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
format.xml { render :xml => @mail_crons }
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@mail_cron_log = MailCronLog.find(params[:id])
|
||||||
|
@mail_cron_log.destroy
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to(admin_mail_cron_logs_url) }
|
||||||
|
# format.xml { head :ok }
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete
|
||||||
|
if params[:ids]
|
||||||
|
mail_cron_logs = MailCronLog.any_in(:_id => params[:ids]).destroy_all
|
||||||
|
end
|
||||||
|
redirect_to admin_mail_cron_logs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
class Admin::MailCronsController < OrbitBackendController
|
||||||
|
|
||||||
|
layout "new_admin"
|
||||||
|
before_filter :authenticate_user!
|
||||||
|
before_filter :is_admin?
|
||||||
|
|
||||||
|
def index
|
||||||
|
|
||||||
|
# @mail_crons = MailCron.all.asc(:mail_sentdate).page(params[:page_main] ).per('20')
|
||||||
|
@mail_crons = (params[:sort]) ? get_sorted_and_filtered("mail_cron") : get_viewable("mail_cron")
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
format.xml { render :xml => @mail_crons }
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@mail_cron = MailCron.new
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # new.html.erb
|
||||||
|
format.xml { render :xml => @mail_cron }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@mail_cron = MailCron.new(params[:mail_cron])
|
||||||
|
|
||||||
|
@mail_cron.create_user_id = current_user.id
|
||||||
|
@mail_cron.update_user_id = current_user.id
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @mail_cron.save
|
||||||
|
format.html { redirect_to(admin_mail_crons_url) }
|
||||||
|
format.xml { render :xml => @mail_cron, :status => :created, :location => @mail_cron }
|
||||||
|
else
|
||||||
|
format.html { render :action => "new" }
|
||||||
|
format.xml { render :xml => @mail_cron.errors, :status => :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@mail_cron = MailCron.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@datas = MailCron.where(:mail_sentdate.lte => Time.now, :mail_sent => false)
|
||||||
|
|
||||||
|
@datas.each do |mail_data|
|
||||||
|
|
||||||
|
@mail_j = 0
|
||||||
|
@read_mails = Array.new
|
||||||
|
|
||||||
|
@mails = mail_data.mail_to.split(",")
|
||||||
|
|
||||||
|
@mails.each do |send_mail|
|
||||||
|
|
||||||
|
@read_mails << send_mail
|
||||||
|
|
||||||
|
@mail_j += 1
|
||||||
|
|
||||||
|
if 0 == @mail_j % 30
|
||||||
|
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||||
|
@read_mails = Array.new
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if !@read_mails.join(',').blank?
|
||||||
|
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||||
|
@read_mails = Array.new
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
@mail_cron = MailCron.find(params[:id])
|
||||||
|
|
||||||
|
@mail_cron.update_user_id = current_user.id
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @mail_cron.update_attributes(params[:mail_cron])
|
||||||
|
format.html { redirect_to(admin_mail_crons_url) }
|
||||||
|
format.js { render 'toggle_enable' }
|
||||||
|
format.xml { head :ok }
|
||||||
|
else
|
||||||
|
format.html { render :action => "edit" }
|
||||||
|
format.xml { render :xml => @mail_cron.errors, :status => :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@mail_cron = MailCron.find(params[:id])
|
||||||
|
@mail_cron.destroy
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to(admin_mail_crons_url) }
|
||||||
|
# format.xml { head :ok }
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete
|
||||||
|
if params[:ids]
|
||||||
|
mail_crons = MailCron.any_in(:_id => params[:ids]).destroy_all
|
||||||
|
end
|
||||||
|
redirect_to admin_mail_crons_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
end
|
||||||
@@ -70,4 +70,30 @@ class Admin::MemberSelectsController < OrbitBackendController
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def select_members
|
||||||
|
selected_users = User.find(params[:ids]) rescue []
|
||||||
|
@field = params[:field]
|
||||||
|
roles = Role.all
|
||||||
|
@sorted_users = roles.inject({}) do |users, role|
|
||||||
|
users[role] = role.users.where(:email.not => /guest|rulingcom/) - selected_users
|
||||||
|
users
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_roles
|
||||||
|
roles = Role.find(params[:role_ids]) rescue []
|
||||||
|
@field = params[:field]
|
||||||
|
@users = roles.inject([]) do |users, role|
|
||||||
|
users += role.users.where(:email.not => /guest|rulingcom/).entries
|
||||||
|
users
|
||||||
|
end
|
||||||
|
render 'admin/member_selects/update_selected_users'
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_users
|
||||||
|
@users = User.find(params[:user_ids]) rescue []
|
||||||
|
@field = params[:field]
|
||||||
|
render 'admin/member_selects/update_selected_users'
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -22,6 +22,11 @@ class Admin::PagePartsController < OrbitBackendController
|
|||||||
@part = PagePart.find(params[:id])
|
@part = PagePart.find(params[:id])
|
||||||
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
||||||
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||||
|
if @r_tag.eql?('tag_cloud')
|
||||||
|
@tag_objects = ModuleApp.where(has_tag: true)
|
||||||
|
else
|
||||||
|
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
@module_apps = ModuleApp.for_widget_select
|
@module_apps = ModuleApp.for_widget_select
|
||||||
@categories = nil
|
@categories = nil
|
||||||
@@ -119,7 +124,11 @@ class Admin::PagePartsController < OrbitBackendController
|
|||||||
def reload_r_tag_options
|
def reload_r_tag_options
|
||||||
@part = PagePart.find params[:id]
|
@part = PagePart.find params[:id]
|
||||||
@r_tag = params[:type]
|
@r_tag = params[:type]
|
||||||
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
if params[:type].eql?('tag_cloud')
|
||||||
|
@tag_objects = ModuleApp.where(has_tag: true)
|
||||||
|
else
|
||||||
|
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||||
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js {}
|
format.js {}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,16 +2,10 @@ class Admin::TagsController < OrbitBackendController
|
|||||||
before_filter :force_order_for_visitor,:only=>[:index]
|
before_filter :force_order_for_visitor,:only=>[:index]
|
||||||
before_filter :force_order_for_user,:except => [:index]
|
before_filter :force_order_for_user,:except => [:index]
|
||||||
before_filter :for_app_sub_manager,:except => [:index]
|
before_filter :for_app_sub_manager,:except => [:index]
|
||||||
|
|
||||||
|
|
||||||
# layout 'new_admin'
|
|
||||||
# before_filter :authenticate_user!
|
|
||||||
# before_filter :is_admin?
|
|
||||||
# before_filter :set_module_app
|
# before_filter :set_module_app
|
||||||
|
|
||||||
def index
|
def index
|
||||||
get_tags
|
@tags = get_tags
|
||||||
@module_app_id = @module_app.id rescue nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@@ -23,12 +17,7 @@ class Admin::TagsController < OrbitBackendController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if params[:tag][:module_app_id].blank?
|
@tag = @module_app ? @module_app.tags.create(params[:tag]) : Tag.create(params[:tag])
|
||||||
@tag = Tag.create(params[:tag])
|
|
||||||
else
|
|
||||||
module_app = ModuleApp.find(params[:tag][:module_app_id])
|
|
||||||
@tag = eval("#{module_app.key.camelize}Tag").create(params[:tag])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@@ -47,15 +36,12 @@ class Admin::TagsController < OrbitBackendController
|
|||||||
protected
|
protected
|
||||||
|
|
||||||
def get_tags
|
def get_tags
|
||||||
@tags = (@module_app ? @module_app.tags : Tag.all)
|
@tags = @module_app.blank? ? Tag.all : @module_app.tags
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_vars
|
def setup_vars
|
||||||
@app_key = request.env['HTTP_REFERER'].split('/')[4]
|
@module_app = ModuleApp.find(params[:module_app_id]) if params[:module_app_id]
|
||||||
if @app_key
|
@module_app_id = @module_app.id rescue nil
|
||||||
@app_key.gsub!(/[?].*/, '')
|
|
||||||
@module_app = ModuleApp.first(conditions: {:key => @app_key})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
class Admin::UserActionsController < OrbitBackendController
|
||||||
|
layout "new_admin"
|
||||||
|
before_filter :authenticate_user!
|
||||||
|
before_filter :is_admin?
|
||||||
|
def index
|
||||||
|
@user_actions = UserAction.all
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -3,8 +3,8 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
include ParserFrontEnd, ParserBackEnd, ApplicationHelper
|
include ParserFrontEnd, ParserBackEnd, ApplicationHelper
|
||||||
include OrbitApp::ErrorHandlers::PageErrorHandler
|
include OrbitApp::ErrorHandlers::PageErrorHandler
|
||||||
include OrbitApp::ErrorHandlers::ObjectAuthErrorHandler
|
include OrbitApp::ErrorHandlers::ObjectAuthErrorHandler
|
||||||
include OrbitApp::ErrorHandlers::ModuleAppErrorHandler
|
include OrbitApp::ErrorHandlers::ModuleAppErrorHandler
|
||||||
|
|
||||||
rescue_from ObjectAuthError, :with => :render_object_auth_error
|
rescue_from ObjectAuthError, :with => :render_object_auth_error
|
||||||
rescue_from ModuleAppError, :with => :render_module_app_error
|
rescue_from ModuleAppError, :with => :render_module_app_error
|
||||||
@@ -29,15 +29,16 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
def set_current_user
|
def set_current_user
|
||||||
User.current = current_or_guest_user
|
User.current = current_or_guest_user
|
||||||
|
UserActionRecoder.perform(current_or_guest_user,params.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def front_end_available(module_app_title='')
|
def front_end_available(module_app_title='')
|
||||||
app_controller = ModuleApp.first(conditions: {:key => module_app_title} )
|
app_controller = ModuleApp.first(conditions: {:key => module_app_title} )
|
||||||
unless app_controller.enable_frontend?
|
unless app_controller.enable_frontend?
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_all_app_engines
|
def get_all_app_engines
|
||||||
ary = ["vender/plugins/new_blog"]
|
ary = ["vender/plugins/new_blog"]
|
||||||
app_engines = ary.collect{|t|
|
app_engines = ary.collect{|t|
|
||||||
@@ -50,23 +51,23 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
def flaten_controller
|
def flaten_controller
|
||||||
ary=[]
|
ary=[]
|
||||||
Find.find(File.join(Rails.root , 'vendor/plugins/')) { |name|
|
Find.find(File.join(Rails.root , 'vendor/plugins/')) { |name|
|
||||||
require_dependency(name) if /_controller\.rb$/ =~ name
|
require_dependency(name) if /_controller\.rb$/ =~ name
|
||||||
ary << name
|
ary << name
|
||||||
}
|
}
|
||||||
ary
|
ary
|
||||||
end
|
end
|
||||||
|
|
||||||
# Find the parent for the given item
|
# Find the parent for the given item
|
||||||
def find_parent_item
|
def find_parent_item
|
||||||
@parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil
|
@parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def auth_failed_in_backend
|
def auth_failed_in_backend
|
||||||
#redirect_to admin_dashboards_url
|
#redirect_to admin_dashboards_url
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def for_admin_only
|
def for_admin_only
|
||||||
if is_admin?
|
if is_admin?
|
||||||
true
|
true
|
||||||
@@ -75,7 +76,7 @@ class ApplicationController < ActionController::Base
|
|||||||
auth_failed_in_backend
|
auth_failed_in_backend
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def for_app_manager
|
def for_app_manager
|
||||||
if is_manager?
|
if is_manager?
|
||||||
true
|
true
|
||||||
@@ -84,7 +85,7 @@ class ApplicationController < ActionController::Base
|
|||||||
auth_failed_in_backend
|
auth_failed_in_backend
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def for_app_sub_manager
|
def for_app_sub_manager
|
||||||
if (@module_app.sub_managing_users.include?(current_or_guest_user) || is_manager?)
|
if (@module_app.sub_managing_users.include?(current_or_guest_user) || is_manager?)
|
||||||
true
|
true
|
||||||
@@ -107,9 +108,9 @@ class ApplicationController < ActionController::Base
|
|||||||
flash[:error] = t("access.denied.object")
|
flash[:error] = t("access.denied.object")
|
||||||
auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_or_guest_user) || is_manager? || is_admin? )
|
auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_or_guest_user) || is_manager? || is_admin? )
|
||||||
end
|
end
|
||||||
|
|
||||||
# Render the page
|
# Render the page
|
||||||
def render_page(args=nil)
|
def render_page(args={})
|
||||||
if @item
|
if @item
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :text => parse_page_content(@item,args), :layout => 'page_layout' }
|
format.html { render :text => parse_page_content(@item,args), :layout => 'page_layout' }
|
||||||
@@ -131,9 +132,9 @@ class ApplicationController < ActionController::Base
|
|||||||
@orig_url = "http://#{request.host_with_port}/#{@item.path}?id=#{@object.id}"
|
@orig_url = "http://#{request.host_with_port}/#{@item.path}?id=#{@object.id}"
|
||||||
render 'shared/render_share', :layout => false
|
render 'shared/render_share', :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
# Set I18n.locale
|
# Set I18n.locale
|
||||||
def set_locale
|
def set_locale
|
||||||
# update session if passed
|
# update session if passed
|
||||||
@@ -147,24 +148,24 @@ class ApplicationController < ActionController::Base
|
|||||||
else
|
else
|
||||||
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
|
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
|
||||||
condition = @site_in_use_locales.include?(browser_locale)
|
condition = @site_in_use_locales.include?(browser_locale)
|
||||||
end
|
end
|
||||||
session[:locale] = condition ? (browser_locale || session[:locale]) : I18n.default_locale.to_s
|
session[:locale] = condition ? (browser_locale || session[:locale]) : I18n.default_locale.to_s
|
||||||
I18n.locale = session[:locale].to_sym
|
I18n.locale = session[:locale].to_sym
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set the site variables
|
# Set the site variables
|
||||||
def set_site
|
def set_site
|
||||||
# set site if exist or create site
|
# set site if exist or create site
|
||||||
@site = Site.first || Site.create({:valid_locales => [], :in_use_locales => []})
|
@site = Site.first || Site.create({:valid_locales => VALID_LOCALES, :in_use_locales => VALID_LOCALES})
|
||||||
session[:site] = @site.id
|
session[:site] = @site.id
|
||||||
@site_in_use_locales = site_locales_default_head(@site.in_use_locales)
|
@site_in_use_locales = site_locales_default_head(@site.in_use_locales)
|
||||||
@site_valid_locales = site_locales_default_head(@site.valid_locales)
|
@site_valid_locales = site_locales_default_head(@site.valid_locales)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_current_item
|
def set_current_item
|
||||||
session[:current_page] = params[:id] || @item.id rescue nil
|
session[:current_page] = params[:id] || @item.id rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def decrypt_data(encrypted_data, encrypted_key, encrypted_iv)
|
def decrypt_data(encrypted_data, encrypted_key, encrypted_iv)
|
||||||
site = Site.find(session[:site])
|
site = Site.find(session[:site])
|
||||||
if encrypted_data
|
if encrypted_data
|
||||||
@@ -180,7 +181,7 @@ class ApplicationController < ActionController::Base
|
|||||||
''
|
''
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_homepage
|
def get_homepage
|
||||||
Page.root
|
Page.root
|
||||||
end
|
end
|
||||||
@@ -228,6 +229,174 @@ class ApplicationController < ActionController::Base
|
|||||||
redirect_to ret
|
redirect_to ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_sorted_and_filtered(object_class, query = nil, objects = 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)
|
||||||
|
if object_class.fields[option].type.to_s.eql?('Object') && !object_class.relations[option].nil?
|
||||||
|
objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option)
|
||||||
|
else
|
||||||
|
(objects = objects.order_by(option, params[:direction])) rescue nil
|
||||||
|
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
|
||||||
|
elsif option.eql?('tags')
|
||||||
|
tag_array = @module_app.tags.inject([]){ |result, value|
|
||||||
|
result << [value.name, value]
|
||||||
|
}
|
||||||
|
params[:direction].eql?('asc') ? tag_array.sort : tag_array.sort.reverse!
|
||||||
|
sorted_objects = Array.new
|
||||||
|
tag_array.each do |x|
|
||||||
|
taggings = x[1].taggings
|
||||||
|
taggings.each {|tagging| sorted_objects << tagging.taggable }
|
||||||
|
end
|
||||||
|
# debugger
|
||||||
|
sorted_objects.flatten!
|
||||||
|
sorted_objects.uniq!
|
||||||
|
objects = get_with_nil(objects, option, sorted_objects)
|
||||||
|
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_viewable(object_class, query=nil)
|
||||||
|
objects = get_objects(object_class,query).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
|
||||||
|
# debugger
|
||||||
|
# a=1
|
||||||
|
if query
|
||||||
|
if object_class.include?(Mongoid::Sortable)
|
||||||
|
objects = object_class.default_sort(params[:sort]).where(query)
|
||||||
|
else
|
||||||
|
objects = object_class.where(query)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if object_class.include?(Mongoid::Sortable)
|
||||||
|
objects = object_class.default_sort(params[:sort]).all
|
||||||
|
else
|
||||||
|
objects = object_class.all
|
||||||
|
end
|
||||||
|
end
|
||||||
|
objects
|
||||||
|
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.to_a.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_string_value_from_object(object)
|
||||||
|
s = object.name_translations[I18n.locale.to_s] unless s rescue nil
|
||||||
|
s = object.title_translations[I18n.locale.to_s] unless s rescue nil
|
||||||
|
s = object.name unless s rescue nil
|
||||||
|
s = object.title unless s rescue nil
|
||||||
|
s.downcase rescue ''
|
||||||
|
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 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
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|||||||
@@ -11,38 +11,40 @@ class DefaultWidgetController< OrbitWidgetController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def query_for_default_widget
|
def query_for_default_widget
|
||||||
|
@ori_class_name = @default_widget["query"].split('.')[0]
|
||||||
ori_class_name = @default_widget["query"].split('.')[0]
|
@result = eval(@default_widget["query"])
|
||||||
result = nil
|
|
||||||
result_objects = nil
|
|
||||||
|
|
||||||
if !params["tag_id"].blank?
|
if !params["tag_id"].blank?
|
||||||
@tags = Tag.find(params["tag_id"]) rescue nil
|
|
||||||
result_ids = nil
|
|
||||||
|
|
||||||
result_ids = @tags.collect{|tag| tag.send(ori_class_name.downcase.pluralize).entries.collect{|t| t.id}}
|
|
||||||
if params["category_id"].blank? #has tag no cate
|
if params["category_id"].blank? #has tag no cate
|
||||||
#nothing
|
@result.selector[:tagged_ids] = { "$in" => params['tag_id'] }
|
||||||
else #has tag and cate
|
else #has tag and cate
|
||||||
# result_ids = @tags.collect{|tag| tag.send(ori_class_name.downcase.pluralize).where(:#{get_category_field_name(ori_class_name)}.in=>params["category_id"]).available_for_lang(I18n.locale).can_display.collect{|t| t.id}}.flatten
|
@result.selector[get_category_field_name] = { "$in" => params['category_id'].collect{|t| BSON::ObjectId(t)}}
|
||||||
result_ids << eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id']).entries.collect{|t| t.id}")
|
@result.selector[:tagged_ids] = { "$in" => params['tag_id'] }
|
||||||
result_ids.flatten!
|
|
||||||
|
|
||||||
end
|
end
|
||||||
result = eval("#{ori_class_name}.where(:id=>result_ids)")
|
|
||||||
elsif params["category_id"].blank? #no tag no cate
|
elsif params["category_id"].blank? #no tag no cate
|
||||||
result = eval(@default_widget["query"])
|
|
||||||
else #no tag has cate
|
else #no tag has cate
|
||||||
result = eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id'])")
|
|
||||||
|
@result.selector[get_category_field_name] = { "$in" => params['category_id'].collect{|t| BSON::ObjectId(t)}}
|
||||||
end
|
end
|
||||||
date_now = Time.now
|
eval("@result.#{@default_widget[:sorting_query]}")
|
||||||
result.available_for_lang(I18n.locale).can_display.desc(:is_top, :postdate)
|
end
|
||||||
|
|
||||||
|
def search_result
|
||||||
|
@search = query_for_default_widget.solr_search do
|
||||||
|
fulltext params[:search_query]
|
||||||
|
end
|
||||||
|
search_result = @search.results.collect{|result| result.id}
|
||||||
|
@items = eval(@ori_class_name).all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result)
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_widget
|
def default_widget
|
||||||
if !params[:id].blank?
|
@search = params["search_query"].blank? ? false : true
|
||||||
|
if !params[:id].blank? and !params["clicked_field_name"].blank?
|
||||||
clicked_field_name = params["clicked_field_name"].to_sym
|
clicked_field_name = params["clicked_field_name"].to_sym
|
||||||
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
|
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
|
||||||
|
elsif !params[:id].blank? and params["preview"]
|
||||||
|
clicked_field_name = :title
|
||||||
|
@preview_pages = @page_part.module_app.widget_fields_link_method.find_all{|t| t[1].has_key?(:preview)}.collect{|t| t[0]}
|
||||||
|
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {preview: true,inner: #{params[:inner] || true},clicked_field_name: '#{@preview_pages.first.to_s}'})")
|
||||||
else
|
else
|
||||||
@tag_class = nil
|
@tag_class = nil
|
||||||
@default_widget = @page_part.module_app.get_default_widget
|
@default_widget = @page_part.module_app.get_default_widget
|
||||||
@@ -64,8 +66,13 @@ class DefaultWidgetController< OrbitWidgetController
|
|||||||
@fields = @page_part.widget_field
|
@fields = @page_part.widget_field
|
||||||
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
|
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
|
||||||
end
|
end
|
||||||
if @paginate
|
|
||||||
@data = query_for_default_widget.includes(@widget_image_field).page(params[:page_main]).per(@data_limit)
|
if @paginate || @search
|
||||||
|
if @search
|
||||||
|
@data = search_result.page(params[:page_main]).per(@data_limit) rescue []
|
||||||
|
else #regular listing
|
||||||
|
@data = query_for_default_widget.includes(@widget_image_field).page(params[:page_main]).per(@data_limit)
|
||||||
|
end
|
||||||
# @data = query_for_default_widget.limit(@data_limit).includes(@widget_image_field)
|
# @data = query_for_default_widget.limit(@data_limit).includes(@widget_image_field)
|
||||||
else
|
else
|
||||||
@data = query_for_default_widget.includes(@widget_image_field).limit(@data_limit)
|
@data = query_for_default_widget.includes(@widget_image_field).limit(@data_limit)
|
||||||
@@ -85,10 +92,10 @@ class DefaultWidgetController< OrbitWidgetController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_category_field_name(ori_class_name)
|
def get_category_field_name
|
||||||
ori_class_name = ori_class_name.constantize
|
@ori_class_name = @ori_class_name.constantize unless @ori_class_name.is_a? Class
|
||||||
ori_class_name.fields.each_key do |key|
|
@ori_class_name.fields.each_key do |key|
|
||||||
return key if key.include?('category_id')
|
return key.to_s if key.include?('category_id')
|
||||||
end
|
end
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ class FrontController < ApplicationController
|
|||||||
@ad_images = AdImage.all
|
@ad_images = AdImage.all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show_tag_cloud
|
||||||
|
module_app = ModuleApp.find(params[:id]) rescue nil
|
||||||
|
@tags = module_app.sorted_tags_for_cloud
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def menu_level(page, current_page, current, menu)
|
def menu_level(page, current_page, current, menu)
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
class OrbitBackendController < ApplicationController
|
class OrbitBackendController < ApplicationController
|
||||||
include OrbitCoreLib::AppBackendUtility
|
include OrbitCoreLib::AppBackendUtility
|
||||||
include OrbitCoreLib::PermissionUtility
|
include OrbitCoreLib::PermissionUtility
|
||||||
|
include OrbitTag::Tagging
|
||||||
include AdminHelper
|
include AdminHelper
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
layout 'new_admin'
|
layout 'new_admin'
|
||||||
|
|
||||||
def setup_vars
|
def setup_vars
|
||||||
@app_title ||= controller_path.split('/')[1].singularize
|
@app_title ||= controller_path.split('/')[1].singularize
|
||||||
@module_app ||= ModuleApp.first(conditions: {:key => @app_title} )
|
@module_app ||= ModuleApp.first(conditions: {:key => @app_title} )
|
||||||
@@ -23,163 +24,15 @@ class OrbitBackendController < ApplicationController
|
|||||||
|
|
||||||
def force_order_for_user
|
def force_order_for_user
|
||||||
setup_vars
|
setup_vars
|
||||||
set_current_user
|
set_current_user
|
||||||
authenticate_user!
|
authenticate_user!
|
||||||
check_user_can_use
|
check_user_can_use
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_user_can_use
|
def check_user_can_use
|
||||||
unless check_permission
|
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
|
redirect_to root_url
|
||||||
end
|
end
|
||||||
end
|
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)
|
|
||||||
if object_class.fields[option].type.to_s.eql?('Object') && !object_class.relations[option].nil?
|
|
||||||
objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option)
|
|
||||||
else
|
|
||||||
(objects = objects.order_by(option, params[:direction])) rescue nil
|
|
||||||
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.name_translations[I18n.locale.to_s] unless s rescue nil
|
|
||||||
s = object.title_translations[I18n.locale.to_s] unless s rescue nil
|
|
||||||
s = object.name unless s rescue nil
|
|
||||||
s = object.title unless s rescue nil
|
|
||||||
s.downcase rescue ''
|
|
||||||
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.to_a.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, query=nil)
|
|
||||||
objects = get_objects(object_class,query).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
|
|
||||||
# debugger
|
|
||||||
# a=1
|
|
||||||
if query
|
|
||||||
objects = object_class.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
|
|
||||||
@@ -7,4 +7,10 @@ class OrbitFrontendComponentController< ApplicationController
|
|||||||
@app_title = request.fullpath.split('/')[2]
|
@app_title = request.fullpath.split('/')[2]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def delay_impressionist(item)
|
||||||
|
user_id = current_user.nil? ? nil : current_user.id
|
||||||
|
Resque.enqueue(DelayedImpressionist,:request=>DelayImpressionistRequest.new(request),:obj=>item,:class=>item.class.to_s,:controller_name=>controller_name,:action_name=>action_name,:user=>user_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
class OrbitWidgetController< OrbitFrontendComponentController
|
class OrbitWidgetController< OrbitFrontendComponentController
|
||||||
|
include FrontEndArrayParamsHelper
|
||||||
|
before_filter {get_tags_and_cates(params)}
|
||||||
|
|
||||||
|
def get_tags_and_cates(params)
|
||||||
|
params = tags_and_cates(params)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -5,7 +5,7 @@ class PagesController < ApplicationController
|
|||||||
# caches_page :index
|
# caches_page :index
|
||||||
|
|
||||||
def check_frontend_open
|
def check_frontend_open
|
||||||
if Me.frontend_closed
|
if Me.frontend_closed and current_user.nil? #Need to be change
|
||||||
redirect_to '/admin/dashboards'
|
redirect_to '/admin/dashboards'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -14,10 +14,11 @@ class PagesController < ApplicationController
|
|||||||
@item = Page.find_by_name('home')
|
@item = Page.find_by_name('home')
|
||||||
|
|
||||||
if @item
|
if @item
|
||||||
impressionist(@item)
|
delayed_impressionist(@item)
|
||||||
render_page
|
render_page
|
||||||
else
|
else
|
||||||
render :text => t(:need_home)
|
redirect_to '/admin/dashboards',:notice=>t(:need_home)
|
||||||
|
# render :text => t(:need_home)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -25,13 +26,13 @@ class PagesController < ApplicationController
|
|||||||
#begin
|
#begin
|
||||||
@item = Item.first(:conditions => {:path => params[:page_name]})
|
@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))
|
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
|
||||||
impressionist(@item)
|
delayed_impressionist(@item)
|
||||||
case @item.class.to_s
|
case @item.class.to_s
|
||||||
when 'Page'
|
when 'Page'
|
||||||
if params[:clicked_field_name]
|
if params[:clicked_field_name]
|
||||||
render_page({"clicked_field_name"=>params["clicked_field_name"]}) unless save_from_no_lang_for_page
|
render_page({"clicked_field_name"=>params["clicked_field_name"]}) unless save_from_no_lang_for_page
|
||||||
else
|
else
|
||||||
render_page unless save_from_no_lang_for_page
|
render_page(params) unless save_from_no_lang_for_page
|
||||||
end
|
end
|
||||||
when 'Link'
|
when 'Link'
|
||||||
redirect_to(@item[:url]) unless save_from_no_lang_for_page
|
redirect_to(@item[:url]) unless save_from_no_lang_for_page
|
||||||
@@ -43,13 +44,13 @@ class PagesController < ApplicationController
|
|||||||
# render :file => "#{Rails.root}/public/404.html", :status => :not_found
|
# render :file => "#{Rails.root}/public/404.html", :status => :not_found
|
||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
|
|
||||||
def index_from_link
|
def index_from_link
|
||||||
url = "/#{@item.path}"
|
url = "/#{@item.path}"
|
||||||
options = ''
|
options = ''
|
||||||
options << "#{options.blank? ? '?' : '&'}page_main=#{params[:page_main]}" unless params[:page_main].blank?
|
options << "#{options.blank? ? '?' : '&'}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? ? '?' : '&'}#{convert_array_param('category_id', params[:category_id])}" unless params[:category_id].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
|
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('tag_id', params[:tag_id])}" unless params[:tag_id].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}search_query=#{params[:search_query]}" unless params[:search_query].blank?
|
options << "#{options.blank? ? '?' : '&'}search_query=#{params[:search_query]}" unless params[:search_query].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}name=#{params[:name]}" unless params[:name].blank?
|
options << "#{options.blank? ? '?' : '&'}name=#{params[:name]}" unless params[:name].blank?
|
||||||
uri = URI::escape(url + options)
|
uri = URI::escape(url + options)
|
||||||
@@ -61,8 +62,8 @@ class PagesController < ApplicationController
|
|||||||
url = "/#{@item.path}"
|
url = "/#{@item.path}"
|
||||||
options = ''
|
options = ''
|
||||||
options << "#{options.blank? ? '?' : '&'}id=#{params[:id]}" unless params[:id].blank?
|
options << "#{options.blank? ? '?' : '&'}id=#{params[:id]}" unless params[:id].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
|
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('category_id', params[:category_id])}" unless params[:category_id].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
|
options << "#{options.blank? ? '?' : '&'}#{convert_array_param('tag_id', params[:tag_id])}" unless params[:tag_id].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}preview=#{params[:preview]}" unless params[:preview].blank?
|
options << "#{options.blank? ? '?' : '&'}preview=#{params[:preview]}" unless params[:preview].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}controller_action=#{params[:controller_action]}" unless params[:controller_action].blank?
|
options << "#{options.blank? ? '?' : '&'}controller_action=#{params[:controller_action]}" unless params[:controller_action].blank?
|
||||||
options << "#{options.blank? ? '?' : '&'}clicked_field_name=#{params[:clicked_field_name]}" unless params[:clicked_field_name].blank?
|
options << "#{options.blank? ? '?' : '&'}clicked_field_name=#{params[:clicked_field_name]}" unless params[:clicked_field_name].blank?
|
||||||
@@ -81,23 +82,43 @@ class PagesController < ApplicationController
|
|||||||
elsif params[:same_page_id]
|
elsif params[:same_page_id]
|
||||||
@item = Item.find(params[:same_page_id])
|
@item = Item.find(params[:same_page_id])
|
||||||
else
|
else
|
||||||
category_ids = params[:category_id].is_a?(Array) ? params[:category_id] : [params[:category_id]]
|
category_ids = Array(params[:category_id]) unless params[:category_id].nil?
|
||||||
tag_ids = params[:tag_id].is_a?(Array) ? params[:tag_id] : [params[:tag_id]]
|
tag_ids = Array(params[:tag_id]) unless params[:tag_id].nil?
|
||||||
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||||
|
|
||||||
|
default_query = { is_published: true, module_app_id: module_app.id, :app_frontend_url.in => [params[:app_action], 'default_widget'] }
|
||||||
|
specific_categories = { :category => category_ids }
|
||||||
|
in_categories = { :category.in => category_ids }
|
||||||
|
nil_categories = { :category.in => [nil, []] }
|
||||||
|
specific_tags = { :tag => tag_ids }
|
||||||
|
in_tags = { :tag.in => tag_ids }
|
||||||
|
nil_tags = { :tag.in => [nil, []] }
|
||||||
|
|
||||||
if !category_ids.blank? && !tag_ids.blank?
|
if !category_ids.blank? && !tag_ids.blank?
|
||||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => tag_ids})
|
@item = Item.where(default_query.merge(specific_categories).merge(specific_tags)).first
|
||||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category.in => category_ids, :tag.in => [nil, []]}) unless @item
|
@item = Item.where(default_query.merge(specific_categories).merge(in_tags)).first unless @item
|
||||||
|
@item = Item.where(default_query.merge(specific_categories).merge(nil_tags)).first unless @item
|
||||||
|
@item = Item.where(default_query.merge(specific_tags).merge(in_categories)).first unless @item
|
||||||
|
@item = Item.where(default_query.merge(specific_tags).merge(nil_categories)).first unless @item
|
||||||
|
@item = Item.where(default_query.merge(in_categories).merge(in_tags)).first unless @item
|
||||||
|
@item = Item.where(default_query.merge(in_categories).merge(nil_tags)).first unless @item
|
||||||
|
@item = Item.where(default_query.merge(in_tags).merge(nil_categories)).first unless @item
|
||||||
elsif !category_ids.blank?
|
elsif !category_ids.blank?
|
||||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :category.in => category_ids).any_in(tag: [nil, []]).first
|
@item = Item.where(default_query.merge(specific_categories).merge(nil_tags)).first
|
||||||
|
@item = Item.where(default_query.merge(specific_categories)).first unless @item
|
||||||
|
@item = Item.where(default_query.merge(in_categories).merge(nil_tags)).first unless @item
|
||||||
|
@item = Item.where(default_query.merge(in_categories)).first unless @item
|
||||||
elsif !tag_ids.blank?
|
elsif !tag_ids.blank?
|
||||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], :tag.in => tag_ids).any_in(category: [nil, []]).first
|
@item = Item.where(default_query.merge(specific_tags).merge(nil_categories)).first
|
||||||
|
@item = Item.where(default_query.merge(specific_tags)).first unless @item
|
||||||
|
@item = Item.where(default_query.merge(in_tags).merge(nil_categories)).first unless @item
|
||||||
|
@item = Item.where(default_query.merge(in_tags)).first unless @item
|
||||||
end
|
end
|
||||||
@item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
|
@item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
|
||||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).all_of("tag" => {"$in" => [nil, []]},"category" => { "$in" => [nil, []]}).first unless @item
|
@item = Item.where(default_query.merge(nil_categories).merge(nil_tags)).first unless @item
|
||||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: 'default_widget').first unless @item
|
@item = Item.where(default_query).first unless @item
|
||||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item
|
|
||||||
end
|
end
|
||||||
raise PageError,'Missing Frontend Page' if @item.nil?
|
raise PageError, 'Missing Frontend Page' if @item.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_from_no_lang_for_page
|
def save_from_no_lang_for_page
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
class SamlLoginsController < ApplicationController
|
||||||
|
|
||||||
|
require "net/http"
|
||||||
|
require "uri"
|
||||||
|
require 'rexml/document'
|
||||||
|
include REXML
|
||||||
|
|
||||||
|
def index
|
||||||
|
|
||||||
|
if params[:wa] == "wsignoutcleanup1.0" #logout
|
||||||
|
|
||||||
|
redirect_to :root
|
||||||
|
|
||||||
|
else #login
|
||||||
|
|
||||||
|
|
||||||
|
@wresult = params[:wresult]
|
||||||
|
@wctx = params[:wctx]
|
||||||
|
|
||||||
|
@main_url = LIST[:sites][@wctx]['url']
|
||||||
|
@main_public_key = LIST[:sites][@wctx]['key']
|
||||||
|
|
||||||
|
@doc = REXML::Document.new @wresult
|
||||||
|
|
||||||
|
@main_public_key = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzKawlFWAMzA/uV/kcewd\nmtj8PcqxosmnSh7ZzJ0DumG2ieeP9oDBicqbqIEaeJVvrRzYJD2a+u8x5KKMKB8J\nHbMUpCBFlIpkDMjU/oZVMcYT9pcH51QWNvCgHG7prVykSGFz1JRvjSP6cwuZKBFd\nFFneOViETqoMIO1DbRLXsGfPvMOJY9C1xDwv1dLv0Wbj7M9N6eNz06a50bu3I4gl\nMumxWnZUabXL3G62S/Si4NM7J2jOUnkEOxJWOhcAX/iiqS9T8AHu84um2+mLQpfB\nJJFFIWCIAtU78VnIN5JSWwjFU5TsiSyCFYpGXKxUFD25cFmt3SfG0gwmrFis5Pdn\nhwIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||||
|
|
||||||
|
public_key = OpenSSL::PKey::RSA.new(@main_public_key)
|
||||||
|
encrypted_data = public_key.public_encrypt(@doc.elements["//saml:AttributeValue"].text)
|
||||||
|
|
||||||
|
redirect_to "http://#{@main_url}/user_login?" + { :wresult => encrypted_data }.to_param
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
class SessionsController < Devise::SessionsController
|
||||||
|
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
||||||
|
|
||||||
|
|
||||||
|
def create
|
||||||
|
@site = Site.first
|
||||||
|
|
||||||
|
private_key = OpenSSL::PKey::RSA.new(@site.private_key)
|
||||||
|
wresult = private_key.private_decrypt(request.params['wresult'])
|
||||||
|
|
||||||
|
@ids = wresult.split("@")
|
||||||
|
|
||||||
|
login_uid = @ids[0]
|
||||||
|
|
||||||
|
resource = User.first(conditions:{user_id: login_uid})
|
||||||
|
|
||||||
|
if !resource.blank?
|
||||||
|
resource_name = resource.class.to_s.downcase
|
||||||
|
sign_in(resource_name, resource)
|
||||||
|
session[:user_id_type] = "myntu"
|
||||||
|
redirect_to after_sign_in_path_for(resource)
|
||||||
|
else
|
||||||
|
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
||||||
|
redirect_to :root
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@user_id_type = session[:user_id_type]
|
||||||
|
sign_out
|
||||||
|
if @user_id_type == "myntu"
|
||||||
|
redirect_to "https://adfs.ntu.edu.tw/adfs/ls/?wa=wsignout1.0&wreply=https://galogin.ntu.edu.tw"
|
||||||
|
else
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -4,7 +4,7 @@ protected
|
|||||||
def get_categories_and_tags
|
def get_categories_and_tags
|
||||||
unless @selected[:module_app].nil?
|
unless @selected[:module_app].nil?
|
||||||
@categories = @selected[:module_app].get_categories
|
@categories = @selected[:module_app].get_categories
|
||||||
@tags = @selected[:module_app].get_tags
|
@tags = @selected[:module_app].tags
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -55,4 +55,4 @@ protected
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1,9 +1,21 @@
|
|||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
|
include OrbitApp::Module::VisitorCounter
|
||||||
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
|
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
|
||||||
|
|
||||||
|
|
||||||
|
def current_path(param_hash)
|
||||||
|
request.referer.include?('?') ? [request.referer,param_hash.to_param].join('&') : [request.referer,param_hash.to_param].join('?')
|
||||||
|
end
|
||||||
|
|
||||||
|
def delayed_impressionist(item)
|
||||||
|
user_id = current_user.nil? ? nil : current_user.id
|
||||||
|
Resque.enqueue(DelayedImpressionist,:request=>DelayImpressionistRequest.new(request),:obj=>item,:class=>item.class.to_s,:controller_name=>controller_name,:action_name=>action_name,:user=>user_id)
|
||||||
|
end
|
||||||
|
|
||||||
def check_user_role_enable(attribute_fields)
|
def check_user_role_enable(attribute_fields)
|
||||||
@user.attribute_values.collect{|t| attribute_fields.include?(t.attribute_field) }.include?(true) rescue false
|
@user.attribute_values.collect{|t| attribute_fields.include?(t.attribute_field) }.include?(true) rescue false
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_attribute_value(value)
|
def show_attribute_value(value)
|
||||||
if value.kind_of? Hash
|
if value.kind_of? Hash
|
||||||
result = []
|
result = []
|
||||||
@@ -18,7 +30,7 @@ module ApplicationHelper
|
|||||||
u = nil
|
u = nil
|
||||||
User.without_callback(:create, :before, :initialize_desktop) do
|
User.without_callback(:create, :before, :initialize_desktop) do
|
||||||
u = User.create(:name => "guest", :email => "guest_#{Time.now.to_i}#{rand(99)}@example.com")
|
u = User.create(:name => "guest", :email => "guest_#{Time.now.to_i}#{rand(99)}@example.com")
|
||||||
end
|
end
|
||||||
u.admin = false
|
u.admin = false
|
||||||
u.save(:validate => false)
|
u.save(:validate => false)
|
||||||
u
|
u
|
||||||
@@ -46,24 +58,24 @@ module ApplicationHelper
|
|||||||
|
|
||||||
def flash_messages
|
def flash_messages
|
||||||
return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)}
|
return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)}
|
||||||
formatted_messages = messages.map do |type|
|
formatted_messages = messages.map do |type|
|
||||||
content_tag :div, :class => type.to_s do
|
content_tag :div, :class => type.to_s do
|
||||||
message_for_item(flash[type], flash["#{type}_item".to_sym])
|
message_for_item(flash[type], flash["#{type}_item".to_sym])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
raw(formatted_messages.join)
|
raw(formatted_messages.join)
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_back(custom_class=nil)
|
def link_back(custom_class=nil)
|
||||||
case custom_class
|
case custom_class
|
||||||
when nil
|
when nil
|
||||||
link_to t('back'), get_go_back, :class => 'nav'
|
link_to t('back'), get_go_back, :class => 'nav'
|
||||||
else
|
else
|
||||||
link_to t('back'), get_go_back, :class => custom_class
|
link_to t('back'), get_go_back, :class => custom_class
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Clean the link back
|
# Clean the link back
|
||||||
def get_go_back
|
def get_go_back
|
||||||
begin
|
begin
|
||||||
@@ -104,28 +116,28 @@ module ApplicationHelper
|
|||||||
message % item
|
message % item
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_attribute(partial, f, attribute)
|
def add_attribute(partial, f, attribute)
|
||||||
new_object = f.object.send(attribute).build
|
new_object = f.object.send(attribute).build
|
||||||
fields = f.fields_for(attribute, new_object, :child_index => "new_#{attribute}") do |f|
|
fields = f.fields_for(attribute, new_object, :child_index => "new_#{attribute}") do |f|
|
||||||
render :partial => partial, :object => new_object, :locals => {:f => f}
|
render :partial => partial, :object => new_object, :locals => {:f => f}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_for_ob_auths_object(object_class,field = :object_auth_id)
|
def active_for_ob_auths_object(object_class,field = :object_auth_id)
|
||||||
unless active_for_action("object_auths_new_interface","setting").nil?
|
unless active_for_action("object_auths_new_interface","setting").nil?
|
||||||
ob_auth = ObjectAuth.find params[field]
|
ob_auth = ObjectAuth.find params[field]
|
||||||
ob_auth.obj_authable_type == object_class.to_s ? 'active' : nil
|
ob_auth.obj_authable_type == object_class.to_s ? 'active' : nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_for_ob_auth(ob_auth_title,field = :object_auth_id)
|
def active_for_ob_auth(ob_auth_title,field = :object_auth_id)
|
||||||
unless active_for_action("module_apps_new_interface","setting").nil?
|
unless active_for_action("module_apps_new_interface","setting").nil?
|
||||||
oa_auth = ObjectAuth.find params[field]
|
oa_auth = ObjectAuth.find params[field]
|
||||||
oa_auth.title == ob_auth_title ? 'active' : nil
|
oa_auth.title == ob_auth_title ? 'active' : nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_for_app_auth(app_title ='', opt={:controller_name => 'module_apps_new_interface',:action_name=>'setting',:field => :module_app_id})
|
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?
|
unless active_for_action(opt[:controller_name],opt[:action_name]).nil?
|
||||||
app = ModuleApp.find params[opt[:field]]
|
app = ModuleApp.find params[opt[:field]]
|
||||||
@@ -134,7 +146,7 @@ module ApplicationHelper
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_for_controllers(*controller_names)
|
def active_for_controllers(*controller_names)
|
||||||
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? 'active' : nil
|
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? 'active' : nil
|
||||||
end
|
end
|
||||||
@@ -142,11 +154,11 @@ module ApplicationHelper
|
|||||||
def visible_for_controllers(*controller_names)
|
def visible_for_controllers(*controller_names)
|
||||||
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? '' : 'hide'
|
(controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? '' : 'hide'
|
||||||
end
|
end
|
||||||
|
|
||||||
def active_for_action(controller_name, action_name)
|
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
|
((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def page_metas(page)
|
def page_metas(page)
|
||||||
tmp_meta = {}
|
tmp_meta = {}
|
||||||
metas = ''
|
metas = ''
|
||||||
@@ -175,11 +187,11 @@ module ApplicationHelper
|
|||||||
res << page_title
|
res << page_title
|
||||||
end
|
end
|
||||||
res << "</title>\n"
|
res << "</title>\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
def page_stylesheets(page, edit=nil)
|
def page_stylesheets(page, edit=nil)
|
||||||
stylesheets = ''
|
stylesheets = ''
|
||||||
unless edit
|
unless edit
|
||||||
stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='/assets/icons.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/icons.css' rel='stylesheet' type='text/css' />\n"
|
||||||
@@ -188,9 +200,9 @@ module ApplicationHelper
|
|||||||
stylesheets << "<link href='/assets/bootstrap.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/bootstrap.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='/assets/font-awesome.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/font-awesome.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='/assets/orbit-bar.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/orbit-bar.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='#{asset_path 'default_widget.css'}' rel='stylesheet' type='text/css' />\n"
|
stylesheets << "<link href='#{asset_path 'default_widget.css'}' rel='stylesheet' type='text/css' />\n"
|
||||||
stylesheets << "<link href='#{page.design.css_default.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_default
|
stylesheets << "<link href='#{page.design.css_default.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.css_default
|
||||||
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
|
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
|
||||||
stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme
|
stylesheets << "<link href='#{theme.file.url}' rel='stylesheet' type='text/css' />\n" if theme
|
||||||
@@ -224,32 +236,34 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def at_least_module_manager
|
def at_least_module_manager
|
||||||
is_manager? || is_admin?
|
is_manager? || is_admin?
|
||||||
end
|
end
|
||||||
|
|
||||||
def dislpay_view_count(object)
|
def dislpay_view_count(object)
|
||||||
"#{t(:view_count)}: #{object.view_count}"
|
"#{t(:view_count)}: #{object.view_count}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_visitors(options={})
|
# def display_visitors(options={})
|
||||||
Impression.where(options).and(:referrer.ne => nil).distinct(:session_hash).count
|
# # Impression.where(options).and(:referrer.ne => nil).distinct(:session_hash).count
|
||||||
end
|
# impressions = Impression.where(options).and(:referrer.ne => nil)
|
||||||
|
# impressions.map{|i| i[:session_hash]}.uniq.count
|
||||||
|
# end
|
||||||
|
|
||||||
def display_visitors_today
|
# def display_visitors_today
|
||||||
display_visitors(created_at: {'$gte' => Date.today.beginning_of_day, '$lte' => Date.today.end_of_day})
|
# display_visitors(created_at: {'$gte' => Date.today.beginning_of_day, '$lte' => Date.today.end_of_day})
|
||||||
end
|
# end
|
||||||
|
|
||||||
def display_visitors_this_week
|
# def display_visitors_this_week
|
||||||
display_visitors(created_at: {'$gte' => Date.today.beginning_of_week, '$lte' => Date.today.end_of_week})
|
# display_visitors(created_at: {'$gte' => Date.today.beginning_of_week, '$lte' => Date.today.end_of_week})
|
||||||
end
|
# end
|
||||||
|
|
||||||
def display_visitors_this_month
|
# def display_visitors_this_month
|
||||||
display_visitors(created_at: {'$gte' => Date.today.beginning_of_month, '$lte' => Date.today.end_of_month})
|
# display_visitors(created_at: {'$gte' => Date.today.beginning_of_month, '$lte' => Date.today.end_of_month})
|
||||||
end
|
# end
|
||||||
|
|
||||||
def display_visitors_this_year
|
# def display_visitors_this_year
|
||||||
display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year})
|
# display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year})
|
||||||
end
|
# end
|
||||||
|
|
||||||
def display_date_time(object)
|
def display_date_time(object)
|
||||||
object.strftime("%Y-%m-%d %H:%M")
|
object.strftime("%Y-%m-%d %H:%M")
|
||||||
@@ -289,7 +303,19 @@ module ApplicationHelper
|
|||||||
|
|
||||||
# NTU link
|
# NTU link
|
||||||
def get_link(site_number)
|
def get_link(site_number)
|
||||||
"http://#{request.host}:2#{site_number}00"
|
"http://#{site_number}.#{request.domain(3)}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def sortable(column, title = nil, options = {})
|
||||||
|
options[:remote] ||= true
|
||||||
|
title ||= column.titleize
|
||||||
|
css_class = column.to_s == params[:sort] ? "current #{params[:direction]}" : 'asc'
|
||||||
|
direction = column.to_s == params[:sort] && params[:direction] == 'asc' ? 'desc' : 'asc'
|
||||||
|
link_to title, params.merge({direction: direction, sort: column, sort_options: column}), {:class => "#{css_class} sortable", :remote => options[:remote]}
|
||||||
|
end
|
||||||
|
|
||||||
|
def convert_array_param(key, array)
|
||||||
|
Array(array).collect{|t| "#{key}[]=#{t}"}.join("&")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -3,6 +3,13 @@ module DefaultWidgetHelper
|
|||||||
I18n.t("#{@page_part.module_app.key}.default_widget.#{field}")
|
I18n.t("#{@page_part.module_app.key}.default_widget.#{field}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_top_hot_class(row_data)
|
||||||
|
class_attr = []
|
||||||
|
class_attr << 'data_is_hot' if( row_data.is_hot? rescue false )
|
||||||
|
class_attr << 'data_is_top' if( row_data.is_top? rescue false)
|
||||||
|
return class_attr.join(" ")
|
||||||
|
end
|
||||||
|
|
||||||
def link_to_field(row_data,field, switch, options=nil)
|
def link_to_field(row_data,field, switch, options=nil)
|
||||||
method_ary = @page_part.module_app.widget_fields_link_method
|
method_ary = @page_part.module_app.widget_fields_link_method
|
||||||
field = field.to_sym
|
field = field.to_sym
|
||||||
@@ -77,4 +84,13 @@ module DefaultWidgetHelper
|
|||||||
content_tag(:span,get_display(row_data,field_setting),:class=>field_setting[:class])
|
content_tag(:span,get_display(row_data,field_setting),:class=>field_setting[:class])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_row_category(row_data)
|
||||||
|
row_data.send("#{row_data.class.to_s.underscore}_category_id") rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_row_tags(row_data)
|
||||||
|
row_data.tagged_ids rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -8,7 +8,7 @@ module OrbitFormHelper
|
|||||||
options[:icon_date] ||= 'icons-calendar'
|
options[:icon_date] ||= 'icons-calendar'
|
||||||
options[:icon_clear] ||= 'icons-cross-3'
|
options[:icon_clear] ||= 'icons-cross-3'
|
||||||
options[:input_class] ||= 'input-large'
|
options[:input_class] ||= 'input-large'
|
||||||
options[:value] ||= options[:object][method] if options[:object] && options[:object][method]
|
options[:value] ||= options[:object].send(method) if options[:object] && options[:object][method]
|
||||||
case options[:picker_type]
|
case options[:picker_type]
|
||||||
when 'date'
|
when 'date'
|
||||||
content_tag :div, :id => options[:id], :class => options[:class] do
|
content_tag :div, :id => options[:id], :class => options[:class] do
|
||||||
@@ -22,7 +22,7 @@ module OrbitFormHelper
|
|||||||
options[:label] ||= I18n.t('datetime_picker.separated.label')
|
options[:label] ||= I18n.t('datetime_picker.separated.label')
|
||||||
content_tag :div, :id => options[:id], :class => "separated_picker #{options[:class]}" do
|
content_tag :div, :id => options[:id], :class => "separated_picker #{options[:class]}" do
|
||||||
concat label_tag options[:label] unless options[:no_label]
|
concat label_tag options[:label] unless options[:no_label]
|
||||||
concat hidden_field(object_name, method)
|
concat hidden_field(object_name, method, :value => options[:value])
|
||||||
concat separated_picker(object_name, method, options)
|
concat separated_picker(object_name, method, options)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2,16 +2,24 @@ class BackupServer
|
|||||||
@queue = :high
|
@queue = :high
|
||||||
|
|
||||||
def self.perform()
|
def self.perform()
|
||||||
#CronMail.time_check("Going to backup Orbit").deliver
|
|
||||||
dbhost = Mongoid.config.database.connection.primary.join ':'
|
dbhost = Mongoid.config.database.connection.primary.join ':'
|
||||||
dbname = Mongoid.config.database.name
|
dbname = Mongoid.config.database.name
|
||||||
archive_db_list_path = OrbitSystemPreference::ArchiveDbListPath
|
archive_db_list_path = OrbitSystemPreference::ArchiveDbListPath
|
||||||
dbdirectory = "#{Rails.root}/tmp/#{dbname}-"+Time.now.strftime("%Y-%m-%d-%H-%M")
|
dbdirectory = "#{Rails.root}/tmp/#{dbname}-"+Time.now.strftime("%Y-%m-%d-%H-%M")
|
||||||
%x[mongodump -h #{dbhost} -d #{dbname} -o #{dbdirectory} ]
|
%x[mongodump -h #{dbhost} -d #{dbname} -o #{dbdirectory} ]
|
||||||
|
|
||||||
%x[rm #{archive_db_list_path}]
|
Dir.foreach('tmp') do |item|
|
||||||
%x[ls #{Rails.root}/tmp/#{dbname}* | du -h --max-depth=1 --block-size=1M |sort -h >> #{archive_db_list_path}]
|
date_str = item.to_s.gsub("#{dbname}-",'')
|
||||||
OrbitJobLogger.info "DB backup done Path:#{dbdirectory}"
|
next if not date_str.match(/\d{4}-\d{2}-\d{2}-\d{2}-\d{2}/)
|
||||||
|
if Date.parse(date_str).to_time < Site.first.backup_keep_for_days.days.ago
|
||||||
|
OrbitLogger.info "Deleting #{date_str}"
|
||||||
|
%x[rm -rf tmp/#{item}]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
%x[rm -f #{archive_db_list_path}]
|
||||||
|
%x[cd tmp ; ls -l |grep #{dbname} | awk '{print $8}'|xargs du -h --block-size=1M --max-depth=0 |sort -h >> #{archive_db_list_path}]
|
||||||
|
OrbitLogger.info "DB backup done Path:#{dbdirectory}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1,36 +1,21 @@
|
|||||||
class DashboardCounter < Resque::Plugins::RestrictionJob
|
class DashboardCounter < Resque::Plugins::RestrictionJob
|
||||||
|
extend OrbitApp::Module::VisitorCounterEval
|
||||||
|
|
||||||
@queue = :high
|
@queue = :high
|
||||||
|
|
||||||
def self.perform(*args)
|
def self.perform(*args)
|
||||||
site = Site.first
|
site = Site.first
|
||||||
obj = new(*args)
|
obj = new(*args)
|
||||||
site.dashboard_counter[:visitors_this_week] = obj.display_visitors_this_week
|
site.visitor_counters[:total] = display_visitors
|
||||||
site.dashboard_counter[:visitors_this_month] = obj.display_visitors_this_month
|
site.visitor_counters[:today] = display_visitors_today
|
||||||
site.dashboard_counter[:visitors_this_year] = obj.display_visitors_this_year
|
site.visitor_counters[:this_week] = display_visitors_this_week
|
||||||
|
site.visitor_counters[:this_month] = display_visitors_this_month
|
||||||
|
site.visitor_counters[:this_year] = display_visitors_this_year
|
||||||
site.save
|
site.save
|
||||||
OrbitJobLogger.info "DashboardCounter done #{site.dashboard_counter.to_s}"
|
OrbitLogger.info "DashboardCounter done #{site.visitor_counters.to_s}"
|
||||||
end
|
|
||||||
|
|
||||||
|
#Notice this is mainly used at user dashbroad. however the code there is currentlly using realtime evaluation.
|
||||||
def display_visitors(options={})
|
#and the site model will need a field call dashboard_counter to complete this job.
|
||||||
impressions = Impression.where(options).and(:referrer.ne => nil)
|
|
||||||
impressions.map{|i| i[:session_hash]}.uniq.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
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
class DelayedImpressionist
|
||||||
|
def self.before_filter(*args)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
include ImpressionistController::InstanceMethods
|
||||||
|
@queue = :low
|
||||||
|
|
||||||
|
def initialize(request,controller_name,action_name,user,obj)
|
||||||
|
@controller_name = controller_name
|
||||||
|
@action_name = action_name
|
||||||
|
@user = User.find user unless user.nil?
|
||||||
|
@request = request
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.perform(*args)
|
||||||
|
arg = args[0]
|
||||||
|
@request= DelayImpressionistRequest.new
|
||||||
|
@request.restore(arg["request"])
|
||||||
|
obj = eval("#{arg["class"]}.find '#{arg['obj']['_id']}'")
|
||||||
|
# imp = new(@request,arg["controller_name"],arg["action_name"],arg["user"],obj)
|
||||||
|
new_impression = obj.impressions.build(:user_id=>arg["user"],:controller_name=>arg["controller_name"],:action_name=>arg["action_name"],:ip_address=>@request.remote_ip,:referrer=>@request.referer)
|
||||||
|
@try = 1
|
||||||
|
loop do
|
||||||
|
result = new_impression.save rescue false
|
||||||
|
break if (result || @try >= 10)
|
||||||
|
@try = @try + 1
|
||||||
|
puts "trying:#{@try}"
|
||||||
|
end
|
||||||
|
new_impression.save
|
||||||
|
obj.update_attribute(:view_count,obj.impression_count)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def user
|
||||||
|
@user
|
||||||
|
end
|
||||||
|
|
||||||
|
def action_name
|
||||||
|
@action_name
|
||||||
|
end
|
||||||
|
|
||||||
|
def controller_name
|
||||||
|
@controller_name
|
||||||
|
end
|
||||||
|
|
||||||
|
def request
|
||||||
|
@request
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
class EmailCron
|
||||||
|
@queue = :mail
|
||||||
|
|
||||||
|
def self.perform
|
||||||
|
|
||||||
|
@datas = MailCron.where(:mail_sentdate.lte => Time.now)
|
||||||
|
|
||||||
|
@datas.each do |mail_data|
|
||||||
|
|
||||||
|
@mail_j = 0
|
||||||
|
@read_mails = Array.new
|
||||||
|
|
||||||
|
@mails = mail_data.mail_to.split(",")
|
||||||
|
|
||||||
|
@mails.each do |send_mail|
|
||||||
|
|
||||||
|
@read_mails << send_mail
|
||||||
|
|
||||||
|
@mail_j += 1
|
||||||
|
|
||||||
|
if 0 == @mail_j % 30
|
||||||
|
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||||
|
@read_mails = Array.new
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if !@read_mails.join(',').blank?
|
||||||
|
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||||
|
@read_mails = Array.new
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class GetAnnouncementFromRss
|
||||||
|
@queue = :high
|
||||||
|
|
||||||
|
def self.perform()
|
||||||
|
%x(ruby "#{Rails.root}/lib/rss_ntu_job.rb")
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
class SendAskNoticeMail
|
||||||
|
@queue = :mail
|
||||||
|
|
||||||
|
def self.perform(ask_admin_id, ask_question_id)
|
||||||
|
ask_admin = AskAdmin.find(ask_admin_id)
|
||||||
|
ask_question = AskQuestion.find(ask_question_id)
|
||||||
|
AskMailer.notice(ask_admin, ask_question).deliver
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
class SendAskReplyMail
|
||||||
|
@queue = :mail
|
||||||
|
|
||||||
|
def self.perform(ask_question_id)
|
||||||
|
ask_question = AskQuestion.find(ask_question_id)
|
||||||
|
AskMailer.reply(ask_question).deliver
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -3,8 +3,8 @@ class UpdateTagCloud
|
|||||||
|
|
||||||
def self.perform()
|
def self.perform()
|
||||||
Tag.all.each do |tag|
|
Tag.all.each do |tag|
|
||||||
tag.update_attribute(:cloud_view_count, tag.impressionist_count(:created_at.gte => 14.days.ago, :created_at.lte => Time.now))
|
tag.update_attribute(:cloud_view_count, tag.get_impressionist)
|
||||||
end
|
end
|
||||||
OrbitJobLogger.info "UpdateTagCloud Done"
|
OrbitLogger.info "UpdateTagCloud Done"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
class UserActionRecoder
|
||||||
|
@queue = :low
|
||||||
|
def self.perform(user,params)
|
||||||
|
UserAction.create!(:user=>user,:params=>params,:page=>"#{params['controller']}##{params['action']}")
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
class MailCronMailer < ActionMailer::Base
|
||||||
|
default :from => "orbit_test@rulingcom.com"
|
||||||
|
|
||||||
|
def get_settings
|
||||||
|
|
||||||
|
@site = Site.first
|
||||||
|
|
||||||
|
@smtp_settings = {
|
||||||
|
:address => @site['site_settings']['address'],
|
||||||
|
:port => @site['site_settings']['port'],
|
||||||
|
:domain => @site['site_settings']['domain'],
|
||||||
|
:authentication => @site['site_settings']['authentication'],
|
||||||
|
# :user_name => @site['site_settings']['user_name'],
|
||||||
|
# :password => @site['site_settings']['password'],
|
||||||
|
:tls => (@site['site_settings']['tls'] == '0' ? false : true ) ,
|
||||||
|
:enable_starttls_auto => (@site['site_settings']['enable_starttls_auto'] == '0' ? false : true )
|
||||||
|
}
|
||||||
|
|
||||||
|
if !@site['site_settings']['user_name'].blank?
|
||||||
|
@smtp_settings[:user_name] = @site['site_settings']['user_name']
|
||||||
|
end
|
||||||
|
|
||||||
|
if !@site['site_settings']['password'].blank?
|
||||||
|
@smtp_settings[:password] = @site['site_settings']['password']
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
ActionMailer::Base.smtp_settings = @smtp_settings
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def cron_mail( data_id, group_mail )
|
||||||
|
|
||||||
|
get_settings
|
||||||
|
|
||||||
|
@data = MailCron.find(data_id)
|
||||||
|
|
||||||
|
if @data
|
||||||
|
|
||||||
|
@user = User.find(@data.create_user_id)
|
||||||
|
|
||||||
|
if !@data.mail_cron_files.blank?
|
||||||
|
@data.mail_cron_files.each_with_index do |mail_cron_file, i|
|
||||||
|
file_type = File.extname(mail_cron_file.file.to_s)
|
||||||
|
file_content = Mongo::GridFileSystem.new(Mongoid.database).open(mail_cron_file.file.url.gsub("/gridfs/", "").force_encoding("UTF-8"), 'r')
|
||||||
|
attachments["#{mail_cron_file.title}#{file_type}"] = file_content.read
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if !@data.mail_content["text"].blank?
|
||||||
|
mail( :from => @data.mail_from, :reply_to => @data.mail_reply_to, :bcc => group_mail, :subject => @data.mail_subject ) do |format|
|
||||||
|
format.html { render :text => @data.mail_content["text"] }
|
||||||
|
end
|
||||||
|
elsif !@data.mail_content["template"].blank?
|
||||||
|
mail( :from => @data.mail_from, :reply_to => @data.mail_reply_to, :bcc => group_mail, :subject => @data.mail_subject ) do |format|
|
||||||
|
format.html { render :template => @data.mail_content["template"], :collection => @data.mail_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@mail_cron_log = {
|
||||||
|
:mail_subject => @data.mail_subject,
|
||||||
|
:mail_to => group_mail,
|
||||||
|
:mail_user => @user.name,
|
||||||
|
:mailer_count => group_mail.split(",").size,
|
||||||
|
:mail_from_app => @data.mail_from_app
|
||||||
|
}
|
||||||
|
|
||||||
|
@mail_cron_log = MailCronLog.new(@mail_cron_log)
|
||||||
|
|
||||||
|
|
||||||
|
@mail_cron_log.save
|
||||||
|
|
||||||
|
@data.destroy
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -2,6 +2,8 @@ class Asset
|
|||||||
|
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
include OrbitTag::Taggable
|
||||||
|
taggable
|
||||||
|
|
||||||
mount_uploader :data, FileAssetUploader
|
mount_uploader :data, FileAssetUploader
|
||||||
|
|
||||||
@@ -16,18 +18,14 @@ class Asset
|
|||||||
|
|
||||||
belongs_to :asset_category
|
belongs_to :asset_category
|
||||||
belongs_to :assetable, polymorphic: true
|
belongs_to :assetable, polymorphic: true
|
||||||
has_and_belongs_to_many :tags, :class_name => "AssetTag"
|
# has_and_belongs_to_many :tags, :class_name => "AssetTag"
|
||||||
|
|
||||||
before_save :clean_tags
|
before_save :clean_tags
|
||||||
|
|
||||||
def sorted_tags
|
|
||||||
tags.order_by(I18n.locale, :asc)
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def clean_tags
|
def clean_tags
|
||||||
self.tag_ids.delete('')
|
self.tagged_ids.delete('')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -26,7 +26,7 @@ class Item
|
|||||||
after_save :rebuild_children_path, :if => "path_changed?"
|
after_save :rebuild_children_path, :if => "path_changed?"
|
||||||
|
|
||||||
def enabled_for_lang(lang)
|
def enabled_for_lang(lang)
|
||||||
enabled_for.include?(lang)
|
enabled_for.include?(lang) rescue false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.find_by_name(item_name)
|
def self.find_by_name(item_name)
|
||||||
@@ -64,6 +64,10 @@ class Item
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.structure_ordered_items
|
||||||
|
self.get_children(Item.root, [])
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
@@ -87,5 +91,13 @@ class Item
|
|||||||
def validates_presence_of_parent_id?
|
def validates_presence_of_parent_id?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.get_children(item, tree)
|
||||||
|
tree << item
|
||||||
|
item.children.each do |child|
|
||||||
|
self.get_children(child, tree)
|
||||||
|
end
|
||||||
|
tree
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
class MailCron
|
||||||
|
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
|
||||||
|
field :mail_from_app
|
||||||
|
field :mail_from
|
||||||
|
field :mail_to
|
||||||
|
field :mail_reply_to
|
||||||
|
field :mail_subject
|
||||||
|
field :mail_content, :type => Hash
|
||||||
|
field :mail_sentdate , :type => DateTime
|
||||||
|
|
||||||
|
field :create_user_id
|
||||||
|
field :update_user_id
|
||||||
|
|
||||||
|
has_many :mail_cron_files, :autosave => true, :dependent => :destroy
|
||||||
|
|
||||||
|
accepts_nested_attributes_for :mail_cron_files, :allow_destroy => true
|
||||||
|
|
||||||
|
after_save :save_mail_cron_files
|
||||||
|
|
||||||
|
|
||||||
|
def save_mail_cron_files
|
||||||
|
self.mail_cron_files.each do |t|
|
||||||
|
if t.should_destroy
|
||||||
|
t.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.send_mail_now(mail_cron_id)
|
||||||
|
|
||||||
|
mail_data = MailCron.find(mail_cron_id)
|
||||||
|
|
||||||
|
if !mail_data.blank?
|
||||||
|
|
||||||
|
@mail_j = 0
|
||||||
|
@read_mails = Array.new
|
||||||
|
|
||||||
|
@mails = mail_data.mail_to.split(",")
|
||||||
|
|
||||||
|
@mails.each do |send_mail|
|
||||||
|
|
||||||
|
@read_mails << send_mail
|
||||||
|
|
||||||
|
@mail_j += 1
|
||||||
|
|
||||||
|
if 0 == @mail_j % 30
|
||||||
|
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||||
|
@read_mails = Array.new
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if !@read_mails.join(',').blank?
|
||||||
|
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||||
|
@read_mails = Array.new
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
class MailCronFile
|
||||||
|
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
mount_uploader :file, AssetUploader
|
||||||
|
|
||||||
|
field :should_destroy, :type => Boolean
|
||||||
|
field :title
|
||||||
|
|
||||||
|
belongs_to :mail_cron
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
class MailCronLog
|
||||||
|
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
|
||||||
|
field :mail_subject
|
||||||
|
field :mail_to
|
||||||
|
field :mail_user
|
||||||
|
field :mailer_count
|
||||||
|
field :mail_from_app
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
@@ -8,6 +8,8 @@ class ModuleApp
|
|||||||
field :title
|
field :title
|
||||||
field :sidebar_order,type: Integer,default: 0
|
field :sidebar_order,type: Integer,default: 0
|
||||||
|
|
||||||
|
has_many :tags, as: :module_tag, dependent: :destroy
|
||||||
|
|
||||||
def refetch_setting!(reg)
|
def refetch_setting!(reg)
|
||||||
# %w{module_label category base_url version organization author intro update_info create_date}.each do |field|
|
# %w{module_label category base_url version organization author intro update_info create_date}.each do |field|
|
||||||
# self[field.to_sym] = reg.send field
|
# self[field.to_sym] = reg.send field
|
||||||
@@ -17,6 +19,7 @@ class ModuleApp
|
|||||||
self[:get_widget_style] = reg.get_widgets
|
self[:get_widget_style] = reg.get_widgets
|
||||||
self[:using_default_widget] = !reg.get_default_widget.blank?
|
self[:using_default_widget] = !reg.get_default_widget.blank?
|
||||||
self[:widgets] = reg.get_widgets
|
self[:widgets] = reg.get_widgets
|
||||||
|
self[:has_tag] = reg.get_has_tags
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -118,10 +121,6 @@ class ModuleApp
|
|||||||
|
|
||||||
has_one :app_auth,dependent: :delete
|
has_one :app_auth,dependent: :delete
|
||||||
|
|
||||||
def get_tags
|
|
||||||
get_registration.get_tags
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_categories
|
def get_categories
|
||||||
get_registration.get_categories
|
get_registration.get_categories
|
||||||
end
|
end
|
||||||
@@ -133,5 +132,31 @@ class ModuleApp
|
|||||||
def get_registration
|
def get_registration
|
||||||
OrbitApp::Module::Registration.find_by_key(key)
|
OrbitApp::Module::Registration.find_by_key(key)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.find_by_key(key)
|
||||||
|
self.where(key: key)[0] rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def sorted_tags_for_cloud
|
||||||
|
temp_tags = {}
|
||||||
|
self.tags.each{ |tag|
|
||||||
|
temp_tags.merge!({tag => tag.cloud_view_count})
|
||||||
|
}
|
||||||
|
if !temp_tags.blank?
|
||||||
|
sorted_tags = temp_tags.sort{|a,b| a[1]<=>b[1]}.reverse
|
||||||
|
sorted_tags[0][1] = :hot1
|
||||||
|
offset = (sorted_tags.size - 1) / 3
|
||||||
|
i = 1
|
||||||
|
class_i = 2
|
||||||
|
sorted_tags[1..-1].collect!{ |x|
|
||||||
|
x[1] = "hot#{class_i}"
|
||||||
|
i == offset ? i = 1 : i += 1 if class_i < 4
|
||||||
|
class_i += 1 if i == offset && class_i < 4
|
||||||
|
}
|
||||||
|
sorted_tags
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
module Mongoid
|
||||||
|
module Sortable
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
field :sort_number, type: Integer
|
||||||
|
|
||||||
|
after_initialize :set_sort_number
|
||||||
|
end
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
|
def default_sort(sorted = true)
|
||||||
|
if !sorted
|
||||||
|
asc(:sort_number)
|
||||||
|
else
|
||||||
|
asc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_sort_number
|
||||||
|
if self.new? && self.sort_number.nil?
|
||||||
|
last_record = self.class.desc(:sort_number).first
|
||||||
|
if last_record && last_record.sort_number
|
||||||
|
self.sort_number = (last_record.sort_number + 10) / 10 * 10
|
||||||
|
else
|
||||||
|
self.sort_number = 10
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -15,8 +15,13 @@ class ObjectAuth < PrototypeAuth
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_user_has_can_access_app
|
def check_user_has_can_access_app
|
||||||
sub_managing_users = auth_obj.module_app.sub_managing_users rescue []
|
if auth_obj["_type"] == "PageContext"
|
||||||
module_app = auth_obj.module_app
|
module_app = ModuleApp.where(:key=>'page_content').first
|
||||||
|
sub_managing_users = module_app.sub_managing_users rescue []
|
||||||
|
else
|
||||||
|
sub_managing_users = auth_obj.module_app.sub_managing_users rescue []
|
||||||
|
module_app = auth_obj.module_app
|
||||||
|
end
|
||||||
self.auth_users.each do |auth_user|
|
self.auth_users.each do |auth_user|
|
||||||
if !sub_managing_users.include? auth_user && !auth_user.admin?
|
if !sub_managing_users.include? auth_user && !auth_user.admin?
|
||||||
module_app.assign_sub_manager(auth_user,User.current)
|
module_app.assign_sub_manager(auth_user,User.current)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class Page < Item
|
|||||||
include Impressionist::Impressionable
|
include Impressionist::Impressionable
|
||||||
include ParserFrontEnd
|
include ParserFrontEnd
|
||||||
|
|
||||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
is_impressionable #:counter_cache => { :column_name => :view_count }
|
||||||
|
|
||||||
field :content, localize: true
|
field :content, localize: true
|
||||||
field :app_frontend_url
|
field :app_frontend_url
|
||||||
|
|||||||
@@ -51,9 +51,20 @@ class PrototypeAuth
|
|||||||
end
|
end
|
||||||
|
|
||||||
def remove_operation(item,obj)
|
def remove_operation(item,obj)
|
||||||
if (self.send item).include? obj
|
item = (item.to_s.singularize == item.to_s) ? "#{item.to_s}_id" : "#{item.to_s.singularize}_ids"
|
||||||
(self.send item).delete obj
|
if (self.send item).include? obj.id
|
||||||
|
(self.send item).delete obj.id
|
||||||
self.save!
|
self.save!
|
||||||
|
|
||||||
|
if auth_obj["_type"] == "PageContext"
|
||||||
|
module_app = ModuleApp.where(:key=>'page_content').first
|
||||||
|
else
|
||||||
|
module_app = auth_obj.module_app
|
||||||
|
end
|
||||||
|
|
||||||
|
module_app.remove_sub_manager(obj)
|
||||||
|
module_app.save
|
||||||
|
|
||||||
else
|
else
|
||||||
false #should put error message for user not existed in list
|
false #should put error message for user not existed in list
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class Site
|
|||||||
field :title_always_on, :type => Boolean, :default => false
|
field :title_always_on, :type => Boolean, :default => false
|
||||||
field :dashbroad_allow_visitor, :type => Boolean, :default => false
|
field :dashbroad_allow_visitor, :type => Boolean, :default => false
|
||||||
field :mail_settings, :type => Hash
|
field :mail_settings, :type => Hash
|
||||||
|
field :visitor_counters,:type=> Hash,:default=>{:total=>0,:today=>0,:this_week=>0,:this_month=>0,:this_year=>0}
|
||||||
|
|
||||||
field :disk_space, :type => String
|
field :disk_space, :type => String
|
||||||
field :system_package_info, :type => Hash,:default=>{}
|
field :system_package_info, :type => Hash,:default=>{}
|
||||||
@@ -28,10 +29,11 @@ class Site
|
|||||||
mount_uploader :default_image, ImageUploader
|
mount_uploader :default_image, ImageUploader
|
||||||
|
|
||||||
field :search,:type => Hash
|
field :search,:type => Hash
|
||||||
|
field :resque_namespace,:type => String, :default=>APP_CONFIG['orbit']
|
||||||
field :title, localize: true
|
field :title, localize: true
|
||||||
field :footer, localize: true
|
field :footer, localize: true
|
||||||
field :sub_menu, localize: true
|
field :sub_menu, localize: true
|
||||||
|
field :backup_keep_for_days,:type=>Integer,:default=> APP_CONFIG['backup_keep_for_days']
|
||||||
|
|
||||||
field :mobile_on, :type => Boolean, :default => false
|
field :mobile_on, :type => Boolean, :default => false
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
class SubRoleTag < ProtoTag
|
class SubRoleTag < ProtoTag
|
||||||
has_and_belongs_to_many :sub_roles
|
has_and_belongs_to_many :sub_roles
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -8,35 +8,14 @@ class Tag
|
|||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
include Impressionist::Impressionable
|
include Impressionist::Impressionable
|
||||||
|
|
||||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
is_impressionable #:counter_cache => { :column_name => :view_count }
|
||||||
|
|
||||||
field :key
|
field :name, localize: true
|
||||||
field :view_count, :type => Integer, :default => 0
|
field :view_count, :type => Integer, :default => 0
|
||||||
field :cloud_view_count, :type => Integer, :default => 0
|
field :cloud_view_count, :type => Integer, :default => 0
|
||||||
|
|
||||||
#field :cloud_amper,:type: Integer,:default=> 0
|
belongs_to :module_tag, polymorphic: true
|
||||||
|
has_many :taggings, dependent: :destroy
|
||||||
def self.sorted_for_cloud
|
|
||||||
tags = {}
|
|
||||||
self.all.each{ |tag|
|
|
||||||
tags.merge!({tag => self.get_impressionist(tag)})
|
|
||||||
}
|
|
||||||
if !tags.blank?
|
|
||||||
sorted_tags = tags.sort{|a,b| a[1]<=>b[1]}.reverse
|
|
||||||
sorted_tags[0][1] = :hot1
|
|
||||||
offset = (sorted_tags.size - 1) / 3
|
|
||||||
i = 1
|
|
||||||
class_i = 2
|
|
||||||
sorted_tags[1..-1].collect!{ |x|
|
|
||||||
x[1] = "hot#{class_i}"
|
|
||||||
i == offset ? i = 1 : i += 1 if class_i < 4
|
|
||||||
class_i += 1 if i == offset && class_i < 4
|
|
||||||
}
|
|
||||||
sorted_tags
|
|
||||||
else
|
|
||||||
[]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
class Tagging
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :to_destroy, default: false
|
||||||
|
|
||||||
|
belongs_to :tag
|
||||||
|
belongs_to :taggable, polymorphic: true
|
||||||
|
|
||||||
|
before_destroy :update_taggable_tag_ids
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def update_taggable_tag_ids
|
||||||
|
self.taggable.remove_id(self.tag.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,7 +10,7 @@ class Role < Attribute
|
|||||||
field :title, localize: true
|
field :title, localize: true
|
||||||
|
|
||||||
has_many :sub_roles, :autosave => true, :dependent => :destroy
|
has_many :sub_roles, :autosave => true, :dependent => :destroy
|
||||||
has_many :users
|
has_and_belongs_to_many :users
|
||||||
# has_many :statuses, :autosave => true, :dependent => :destroy
|
# has_many :statuses, :autosave => true, :dependent => :destroy
|
||||||
# has_many :attribute_fields, :autosave => true, :dependent => :destroy
|
# has_many :attribute_fields, :autosave => true, :dependent => :destroy
|
||||||
has_many :role_statuses, :autosave => true, :dependent => :destroy
|
has_many :role_statuses, :autosave => true, :dependent => :destroy
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class User
|
|||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :validatable #, :timeoutable
|
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable #, :timeoutable
|
||||||
|
|
||||||
mount_uploader :avatar, AvatarUploader
|
mount_uploader :avatar, AvatarUploader
|
||||||
|
|
||||||
@@ -31,6 +31,8 @@ class User
|
|||||||
# has_many :papers, :autosave => true, :dependent => :destroy
|
# has_many :papers, :autosave => true, :dependent => :destroy
|
||||||
has_and_belongs_to_many :sub_role_tags
|
has_and_belongs_to_many :sub_role_tags
|
||||||
|
|
||||||
|
has_many :user_actions, :dependent => :destroy
|
||||||
|
|
||||||
# has_and_belongs_to_many :statuses
|
# has_and_belongs_to_many :statuses
|
||||||
has_and_belongs_to_many :roles
|
has_and_belongs_to_many :roles
|
||||||
has_and_belongs_to_many :sub_roles
|
has_and_belongs_to_many :sub_roles
|
||||||
@@ -40,7 +42,6 @@ class User
|
|||||||
|
|
||||||
before_create :initialize_desktop
|
before_create :initialize_desktop
|
||||||
before_save :rebuild_status_record
|
before_save :rebuild_status_record
|
||||||
before_save :save_roles
|
|
||||||
scope :remote_account, where(:nccu_id.ne => nil)
|
scope :remote_account, where(:nccu_id.ne => nil)
|
||||||
scope :not_guest_user, all_of(:name.ne => "guest")
|
scope :not_guest_user, all_of(:name.ne => "guest")
|
||||||
|
|
||||||
@@ -87,9 +88,9 @@ class User
|
|||||||
var[:id].each do |id,val|
|
var[:id].each do |id,val|
|
||||||
# binding.pry if id == '5052c5b22b5c49ab02000004'
|
# binding.pry if id == '5052c5b22b5c49ab02000004'
|
||||||
if (val=="true")
|
if (val=="true")
|
||||||
self.roles = self.roles.reject{|t| t.id.to_s==id}
|
self.role_ids.reject!{|t| t.to_s == id}
|
||||||
elsif(val=="false")
|
elsif(val=="false")
|
||||||
self.roles << Role.find(id)
|
self.role_ids += Array(id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -104,9 +105,9 @@ class User
|
|||||||
# binding.pry if id == '5052c5b22b5c49ab02000004'
|
# binding.pry if id == '5052c5b22b5c49ab02000004'
|
||||||
|
|
||||||
if ( self.roles.include?(@roid) == false or val=="true")
|
if ( self.roles.include?(@roid) == false or val=="true")
|
||||||
self.sub_roles = self.sub_roles.reject{|t| t.id.to_s==id}
|
self.sub_role_ids.reject!{|t| t.to_s == id}
|
||||||
elsif(val=="false")
|
elsif(val=="false")
|
||||||
self.sub_roles << SubRole.find(id)
|
self.sub_role_ids += Array(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -181,7 +182,14 @@ class User
|
|||||||
def self.get_member_list_attribute_value(user_id,role_type,field_key)
|
def self.get_member_list_attribute_value(user_id,role_type,field_key)
|
||||||
@attribute = ::Attribute.where(:key => role_type).first
|
@attribute = ::Attribute.where(:key => role_type).first
|
||||||
@AttributeField = ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first
|
@AttributeField = ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first
|
||||||
return ::AttributeValue.where(attribute_field_id: @AttributeField.id, :user_id => user_id).first[I18n.locale.to_s]
|
return ::AttributeValue.where(attribute_field_id: @AttributeField.id, :user_id => user_id).first
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.get_role_member_data_by_sort(role_status_id)
|
||||||
|
a = Array.new
|
||||||
|
where(:role_status_ids=>role_status_id).desc(:_id).collect{|t| a << [ get_member_list_attribute_value(t.id,"staff","job_title")['val'].to_i, t ] }
|
||||||
|
member_data = a.sort
|
||||||
|
member_data_tmp = member_data.collect {|v| v[1] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_dept_cache
|
def create_dept_cache
|
||||||
@@ -264,10 +272,6 @@ class User
|
|||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def save_roles
|
|
||||||
# self.roles = self.sub_roles.collect{|t| t.role}.uniq
|
|
||||||
self.roles = self.roles.uniq
|
|
||||||
end
|
|
||||||
|
|
||||||
def rebuild_status_record
|
def rebuild_status_record
|
||||||
self.status_record = {}
|
self.status_record = {}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
class UserAction
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
belongs_to :user
|
||||||
|
field :params,:type => Hash
|
||||||
|
|
||||||
|
field :page
|
||||||
|
|
||||||
|
end
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
<div class="label-group">
|
<div class="label-group">
|
||||||
<div class="label-td">
|
<div class="label-td">
|
||||||
<% asset.sorted_tags.each do |tag| %>
|
<% asset.sorted_tags.each do |tag| %>
|
||||||
<span class="label label-tags"><%= tag[I18n.locale] %></span>
|
<span class="label label-tags"><%= tag.name %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<% @tags.each do |tag| %>
|
<% @tags.each do |tag| %>
|
||||||
<%= content_tag :label, :class => "checkbox inline" do -%>
|
<%= content_tag :label, :class => "checkbox inline" do -%>
|
||||||
<%= check_box_tag 'asset[tag_ids][]', tag.id, @asset.tag_ids.include?(tag.id) %>
|
<%= check_box_tag 'asset[tag_ids][]', tag.id, @asset.tag_ids.include?(tag.id) %>
|
||||||
<%= tag[I18n.locale] %>
|
<%= tag.name %>
|
||||||
<%= hidden_field_tag 'asset[tag_ids][]', '' %>
|
<%= hidden_field_tag 'asset[tag_ids][]', '' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= form_for @attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") ,:class=> "form-horizontal" do |f| %>
|
<%= form_for @attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") ,:class=> "form-horizontal" do |f| %>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member_), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="item element">
|
<!-- <div class="item element">
|
||||||
<h3><i class="icons-"></i><a href=""><%= t(:member) %></a></h3>
|
<h3><i class="icons-"></i><a href=""><%= t(:member_) %></a></h3>
|
||||||
<div class="detail w-a h-a">
|
<div class="detail w-a h-a">
|
||||||
<p class="totle"><span><%= t(:all_member) %></span>2,217</p>
|
<p class="totle"><span><%= t(:all_member) %></span>2,217</p>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
|
|||||||
@@ -8,5 +8,5 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="form-actions form-fixed pagination-right">
|
<div class="form-actions form-fixed pagination-right">
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_admin_design_path, :class => 'btn btn-primary pull-right' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:upload), upload_package_admin_designs_path, :class => 'btn btn-primary pull-right' %>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
<% content_for :side_bar do %>
|
<% content_for :side_bar do %>
|
||||||
<%= render 'admin/sites/side_bar' %>
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :side_bar_content => 'admin/sites/side_bar'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<div class="main2">
|
<div class="main2">
|
||||||
<%= form_tag '',:multipart => true,:action=>"post" do |f| %>
|
<%= form_tag '',:multipart => true,:action=>"post" do |f| %>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="filter-clear">
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icons-cycle') + t(:clear), admin_mail_crons_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn btn-small js_history" %>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<div id="filter" class="subnav">
|
||||||
|
<div class="filters">
|
||||||
|
<div id="sort_headers" class="table-label">
|
||||||
|
<%= render 'sort_headers' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "sort_header" %>
|
||||||
|
<% end %>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<tr id="<%= dom_id mail_cron_log %>" class="with_action">
|
||||||
|
<td class="span1">
|
||||||
|
<% if is_manager? %>
|
||||||
|
<%= check_box_tag 'to_delete[]', mail_cron_log.id, false, :class => "checkbox_in_list" %>
|
||||||
|
<% end -%>
|
||||||
|
</td>
|
||||||
|
<td class="span1-2">
|
||||||
|
<%= mail_cron_log.mail_subject %>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills hide">
|
||||||
|
<%if at_least_module_manager %>
|
||||||
|
<li><%= link_to t(:delete_), admin_mail_cron_log_path(mail_cron_log), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
|
||||||
|
<% end -%>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="span2">
|
||||||
|
<%= mail_cron_log.mail_to.gsub(/,/, "<br />").html_safe %>
|
||||||
|
</td>
|
||||||
|
<td class="span2">
|
||||||
|
<%= mail_cron_log.mail_user %>
|
||||||
|
</td>
|
||||||
|
<td class="span2">
|
||||||
|
<%= mail_cron_log.mail_from_app %>
|
||||||
|
</td>
|
||||||
|
<td class="span2">
|
||||||
|
<%= display_date_time(mail_cron_log.created_at) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<%= render_sort_bar(true, delete_admin_mail_cron_logs_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
|
||||||
|
['subject', 'mail_subject','span2', :subject] ,
|
||||||
|
['mail_to', 'mail_to','span2', :mail_to] ,
|
||||||
|
['mail_user', 'mail_user','span2', :mail_user] ,
|
||||||
|
['mail_from_app', 'mail_from_app','span2', :mail_from_app] ,
|
||||||
|
['sentdate', 'created_at','span2', :sentdate] ).html_safe %>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
$("#<%= dom_id @mail_cron_log %>").remove();
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<% content_for :side_bar do %>
|
||||||
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= render 'filter' %>
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="span1"></th>
|
||||||
|
<th class="span2"></th>
|
||||||
|
<th class="span2"></th>
|
||||||
|
<th class="span2"></th>
|
||||||
|
<th class="span2"></th>
|
||||||
|
<th class="span2"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tbody_mail_cron_logs" class="sort-holder">
|
||||||
|
<%= render :partial => "mail_cron_log",:collection=> @mail_cron_logs%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-actions form-fixed pagination-right">
|
||||||
|
<div id="web_link_pagination" class="paginationFixed">
|
||||||
|
<%= paginate @mail_cron_logs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
$("#delete_all").attr("action", "<%= delete_admin_mail_cron_logs_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]) %>");
|
||||||
|
$("#sort_headers").html("<%= j render 'sort_headers' %>");
|
||||||
|
$("#tbody_mail_cron_logs").html("<%= j render :partial => 'mail_cron_log', :collection => @mail_cron_logs %>");
|
||||||
|
$("#mail_cron_log_pagination").html("<%= j paginate @mail_cron_logs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="filter-clear">
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icons-cycle') + t(:clear), admin_mail_crons_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn btn-small js_history" %>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<div id="filter" class="subnav">
|
||||||
|
<div class="filters">
|
||||||
|
<div id="sort_headers" class="table-label">
|
||||||
|
<%= render 'sort_headers' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "sort_header" %>
|
||||||
|
<% end %>
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
<div id= "poststuff">
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
|
<%= f.error_messages %>
|
||||||
|
|
||||||
|
<!--Widget start-->
|
||||||
|
|
||||||
|
<div id="sub-wiget">
|
||||||
|
|
||||||
|
<div id="widget-date" class="widget-box widget-size-300">
|
||||||
|
<h3 class="widget-title"><i class="icons-calendar"></i><%= t(:date_) %></h3>
|
||||||
|
<div class="widget-content clear">
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.datetime_picker :mail_sentdate, :picker_type => 'separated', :label => t(:start) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--Wiget End-->
|
||||||
|
<!--Post Start-->
|
||||||
|
|
||||||
|
<div id="post-body">
|
||||||
|
<div id="post-body-content" class="clear">
|
||||||
|
|
||||||
|
<%= f.label :mail_subject ,t(:mail_subject)%>
|
||||||
|
<%= f.text_field :mail_subject %>
|
||||||
|
|
||||||
|
<%= f.label :mail_from ,t(:mail_from)%>
|
||||||
|
<%= f.text_field :mail_from %>
|
||||||
|
|
||||||
|
<%= f.label :mail_reply_to ,t(:mail_reply_to)%>
|
||||||
|
<%= f.text_field :mail_reply_to %>
|
||||||
|
|
||||||
|
<%= f.label :mail_to ,t(:mail_to)%>
|
||||||
|
<%= f.text_field :mail_to %>
|
||||||
|
|
||||||
|
<%= f.label :mail_content ,t(:mail_content)%>
|
||||||
|
<%= f.text_area :mail_content, :class=>"span12", :cols=>"25", :rows=>"10" %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<div id='plugin_files' class="plugin_files_block">
|
||||||
|
|
||||||
|
<table class="table table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>File</th>
|
||||||
|
<th>File Name</th>
|
||||||
|
<th class="span1"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align:center" colspan="3">
|
||||||
|
<div id='add_plugin_file' class="info_input plugin_files_block">
|
||||||
|
<%= hidden_field_tag 'plugin_file_field_count', @mail_cron.mail_cron_files.count %>
|
||||||
|
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tfoot>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<% @mail_cron.mail_cron_files.each_with_index do |mail_cron_file, i| %>
|
||||||
|
<%= f.fields_for :mail_cron_files, mail_cron_file do |f| %>
|
||||||
|
<%= render :partial => 'form_file', :object => mail_cron_file, :locals => {:f => f, :i => i} %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!--Post End-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-actions">
|
||||||
|
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||||
|
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "archive_plugin_form" %>
|
||||||
|
<script>
|
||||||
|
$('#add_plugin_file a.add').live('click', function(){
|
||||||
|
var new_id = $(this).prev().attr('value');
|
||||||
|
var old_id = new RegExp("new_add_plugin_files", "g");
|
||||||
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||||
|
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :mail_cron_files) %>").replace(old_id, new_id));
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.add_plugin_files_block a.delete').live('click', function(){
|
||||||
|
$(this).parents('.list_item').remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.action a.remove_existing_record').live('click', function(){
|
||||||
|
$(this).next('.should_destroy').attr('value', 1);
|
||||||
|
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
|
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'>
|
||||||
|
<td>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.file_field :file %>
|
||||||
|
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<%= f.text_field :title %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<span class="action">
|
||||||
|
<% if form_file.new_record? %>
|
||||||
|
<a class="delete"><i class="icon-remove"></i></a>
|
||||||
|
<% else %>
|
||||||
|
<%= f.hidden_field :id %>
|
||||||
|
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||||
|
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<tr id="<%= dom_id mail_cron %>" class="with_action">
|
||||||
|
<td class="span1">
|
||||||
|
<% if is_manager? %>
|
||||||
|
<%= check_box_tag 'to_delete[]', mail_cron.id, false, :class => "checkbox_in_list" %>
|
||||||
|
<% end -%>
|
||||||
|
</td>
|
||||||
|
<td class="span1-2">
|
||||||
|
<%= mail_cron.mail_subject %>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills hide">
|
||||||
|
<%if at_least_module_manager %>
|
||||||
|
<li><%= link_to t(:delete_), admin_mail_cron_path(mail_cron), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
|
||||||
|
<% end -%>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="span2">
|
||||||
|
<%= mail_cron.mail_to.gsub(/,/, "<br />").html_safe %>
|
||||||
|
</td>
|
||||||
|
<td class="span2">
|
||||||
|
<%= mail_cron.mail_from_app %>
|
||||||
|
</td>
|
||||||
|
<td class="span2">
|
||||||
|
<%= display_date_time(mail_cron.mail_sentdate) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<%= render_sort_bar(true, delete_admin_mail_crons_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
|
||||||
|
['subject', 'mail_subject','span2', :mail_subject] ,
|
||||||
|
['mail_to', 'mail_to','span2', :mail_to] ,
|
||||||
|
['mail_from_app', 'mail_from_app','span2', :mail_from_app] ,
|
||||||
|
['sentdate', 'mail_sentdate','span2', :mail_sentdate] ).html_safe %>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
$("#<%= dom_id @mail_cron %>").remove();
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<% content_for :side_bar do %>
|
||||||
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<h1><%= t('mail_cron.editing_mail_cron') %></h1>
|
||||||
|
|
||||||
|
<%= form_for @mail_cron, :url => admin_mail_cron_path(@mail_cron), :html => {:class => 'clear'} do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<% content_for :side_bar do %>
|
||||||
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= render 'filter' %>
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="span1"></th>
|
||||||
|
<th class="span2"></th>
|
||||||
|
<th class="span2"></th>
|
||||||
|
<th class="span2"></th>
|
||||||
|
<th class="span2"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="tbody_mail_crons" class="sort-holder">
|
||||||
|
<%= render :partial => "mail_cron",:collection=> @mail_crons%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-actions form-fixed pagination-right">
|
||||||
|
<div id="web_link_pagination" class="paginationFixed">
|
||||||
|
<%= paginate @mail_crons, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
$("#delete_all").attr("action", "<%= delete_admin_mail_crons_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]) %>");
|
||||||
|
$("#sort_headers").html("<%= j render 'sort_headers' %>");
|
||||||
|
$("#tbody_mail_crons").html("<%= j render :partial => 'mail_cron', :collection => @mail_crons %>");
|
||||||
|
$("#mail_cron_pagination").html("<%= j paginate @mail_crons, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
<% content_for :side_bar do %>
|
||||||
|
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div id="poststuff">
|
||||||
|
<h1><%= t('mail_cron.new_mail_cron') %></h1>
|
||||||
|
<%= form_for @mail_cron, :url => admin_mail_crons_path, :html => {:class => 'clear'} do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<div id="select_user_modal" class="modal hide fade">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3><%= t('list.user') %></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="tabbable tabs-left">
|
||||||
|
<div class="nano">
|
||||||
|
<div class="content">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li class="active"><a href="#all" data-toggle="tab"><%= t('list.role') %></a></li>
|
||||||
|
<% @sorted_users.each_key do |role| %>
|
||||||
|
<li class=""><a href="#r_<%= role.id %>" data-toggle="tab"><%= role.title %></a></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane fade in active" id="all">
|
||||||
|
<%= form_tag set_roles_admin_member_selects_path(field: @field), remote: true do %>
|
||||||
|
<fieldset>
|
||||||
|
<% @sorted_users.each_key do |role| %>
|
||||||
|
<label class="checkbox inline">
|
||||||
|
<%= check_box_tag 'role_ids[]', role.id , false %> <%= role.title %>
|
||||||
|
</label>
|
||||||
|
<% end %>
|
||||||
|
</fieldset>
|
||||||
|
<div class="form-actions">
|
||||||
|
<button type="button" class="btn" data-dismiss="modal"><%= t(:cancel) %></button>
|
||||||
|
<%= submit_tag t(:submit), class: "btn btn-primary" %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% @sorted_users.each do |role, users| %>
|
||||||
|
<div class="tab-pane fade" id="r_<%= role.id %>">
|
||||||
|
<%= form_tag set_users_admin_member_selects_path(field: @field), remote: true do %>
|
||||||
|
<fieldset class="clearfix">
|
||||||
|
<div class="member-filter-result nano">
|
||||||
|
<div class="content">
|
||||||
|
<ul class="checkbox-card clearfix">
|
||||||
|
<% users.each do |user| %>
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<%= image_tag (user.avatar.file ? user.avatar : "menber-pic.png"), class: "user-pic" %>
|
||||||
|
<span class="user-name"><%= user.name %></span>
|
||||||
|
</label>
|
||||||
|
<%= check_box_tag 'user_ids[]', user.id , false %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-actions condition">
|
||||||
|
<button type="button" class="btn" data-dismiss="modal"><%= t(:cancel) %></button>
|
||||||
|
<%= submit_tag t(:submit), class: "btn btn-primary" %>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$(".modal").on("hidden", function () {
|
||||||
|
$("#select_user").remove();
|
||||||
|
$('#select_user_modal').on('shown', function() {
|
||||||
|
$(this).find('.nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
|
||||||
|
$(this).find('.checkbox-card > li').cardCheck({
|
||||||
|
check: $(this).find('.checkbox-card > li input[type="checkbox"]'),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#select_user_modal').on('shown', function() {
|
||||||
|
$('#select_user_modal').off('shown')
|
||||||
|
$(this).find('.nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
|
||||||
|
$(this).find('.checkbox-card > li').cardCheck({
|
||||||
|
check: $(this).find('.checkbox-card > li input[type="checkbox"]'),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<% unless users.blank? %>
|
||||||
|
<div class="promoter-block">
|
||||||
|
<p class="promoter-title"><%= t(:promoter) %>:</p>
|
||||||
|
<ul>
|
||||||
|
<% users.each do |user| %>
|
||||||
|
<li class="promoter">
|
||||||
|
<p>
|
||||||
|
<%= link_to user.name, "mailto:#{user.email}", class: "promoter-name" %> / <span class="promoter-phone"><%= user.office_tel %></span>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||