initial
9
.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
.bundle
|
||||
db/*.sqlite3
|
||||
log/*.log
|
||||
tmp/
|
||||
.sass-cache/
|
||||
.DS_Store
|
||||
private_medias/
|
||||
public/public_medias
|
||||
public/assets
|
4
Capfile
Normal file
@ -0,0 +1,4 @@
|
||||
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
||||
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
||||
|
||||
load 'config/deploy' # remove this line to skip loading any of the default tasks
|
41
Gemfile
Normal file
@ -0,0 +1,41 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'rails', '4.2'
|
||||
gem 'bcrypt', '~> 3.1.7'
|
||||
|
||||
gem 'sqlite3'
|
||||
gem 'sass-rails', '~> 4.0.3'
|
||||
gem 'uglifier', '>= 1.3.0'
|
||||
gem 'coffee-rails', '~> 4.0.0'
|
||||
|
||||
gem 'jquery-rails'
|
||||
gem 'turbolinks'
|
||||
gem 'jbuilder', '~> 2.0'
|
||||
|
||||
gem 'sdoc', '~> 0.4.0', group: :doc
|
||||
|
||||
gem 'spring', group: :development
|
||||
|
||||
gem 'haml-rails'
|
||||
|
||||
|
||||
gem 'unicorn'
|
||||
|
||||
gem "capistrano", '2.15.5', group: :development
|
||||
gem "rvm-capistrano",'1.4.1', group: :development
|
||||
gem 'net-ssh', '~>2.7.0'
|
||||
|
||||
gem "therubyracer"
|
||||
|
||||
|
||||
gem 'carrierwave'
|
||||
gem 'rmagick', :require => 'RMagick'
|
||||
gem 'acts_as_tree'
|
||||
gem 'formtastic', "2.3.0"
|
||||
|
||||
gem "twitter-bootstrap-rails"
|
||||
gem 'formtastic-bootstrap'
|
||||
|
||||
gem 'kaminari-bootstrap'
|
||||
gem 'acts_as_commentable'
|
||||
gem "mysql2"
|
231
Gemfile.lock
Normal file
@ -0,0 +1,231 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (4.2.0)
|
||||
actionpack (= 4.2.0)
|
||||
actionview (= 4.2.0)
|
||||
activejob (= 4.2.0)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (4.2.0)
|
||||
actionview (= 4.2.0)
|
||||
activesupport (= 4.2.0)
|
||||
rack (~> 1.6.0)
|
||||
rack-test (~> 0.6.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
||||
actionview (4.2.0)
|
||||
activesupport (= 4.2.0)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
||||
activejob (4.2.0)
|
||||
activesupport (= 4.2.0)
|
||||
globalid (>= 0.3.0)
|
||||
activemodel (4.2.0)
|
||||
activesupport (= 4.2.0)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.2.0)
|
||||
activemodel (= 4.2.0)
|
||||
activesupport (= 4.2.0)
|
||||
arel (~> 6.0)
|
||||
activesupport (4.2.0)
|
||||
i18n (~> 0.7)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
acts_as_commentable (4.0.2)
|
||||
acts_as_tree (2.1.0)
|
||||
activerecord (>= 3.0.0)
|
||||
arel (6.0.0)
|
||||
bcrypt (3.1.10)
|
||||
builder (3.2.2)
|
||||
capistrano (2.15.5)
|
||||
highline
|
||||
net-scp (>= 1.0.0)
|
||||
net-sftp (>= 2.0.0)
|
||||
net-ssh (>= 2.0.14)
|
||||
net-ssh-gateway (>= 1.1.0)
|
||||
carrierwave (0.10.0)
|
||||
activemodel (>= 3.2.0)
|
||||
activesupport (>= 3.2.0)
|
||||
json (>= 1.7)
|
||||
mime-types (>= 1.16)
|
||||
coffee-rails (4.0.1)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
coffee-script (2.3.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.9.0)
|
||||
erubis (2.7.0)
|
||||
execjs (2.3.0)
|
||||
formtastic (2.3.0)
|
||||
actionpack (>= 3.0)
|
||||
formtastic-bootstrap (3.0.0)
|
||||
formtastic (>= 2.2)
|
||||
globalid (0.3.2)
|
||||
activesupport (>= 4.1.0)
|
||||
haml (4.0.6)
|
||||
tilt
|
||||
haml-rails (0.8.2)
|
||||
actionpack (>= 4.0.1)
|
||||
activesupport (>= 4.0.1)
|
||||
haml (>= 3.1, < 5.0)
|
||||
html2haml (>= 1.0.1)
|
||||
railties (>= 4.0.1)
|
||||
highline (1.6.21)
|
||||
hike (1.2.3)
|
||||
html2haml (2.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
haml (~> 4.0.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
ruby_parser (~> 3.5)
|
||||
i18n (0.7.0)
|
||||
jbuilder (2.2.6)
|
||||
activesupport (>= 3.0.0, < 5)
|
||||
multi_json (~> 1.2)
|
||||
jquery-rails (4.0.3)
|
||||
rails-dom-testing (~> 1.0)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (1.8.2)
|
||||
kaminari (0.16.3)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
kaminari-bootstrap (3.0.1)
|
||||
kaminari (>= 0.13.0)
|
||||
rails
|
||||
kgio (2.9.3)
|
||||
libv8 (3.16.14.7)
|
||||
loofah (2.0.1)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.6.3)
|
||||
mime-types (>= 1.16, < 3)
|
||||
mime-types (2.4.3)
|
||||
mini_portile (0.6.2)
|
||||
minitest (5.5.1)
|
||||
multi_json (1.10.1)
|
||||
mysql2 (0.3.17)
|
||||
net-scp (1.2.1)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-sftp (2.1.2)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh (2.7.0)
|
||||
net-ssh-gateway (1.2.0)
|
||||
net-ssh (>= 2.6.5)
|
||||
nokogiri (1.6.6.2)
|
||||
mini_portile (~> 0.6.0)
|
||||
rack (1.6.0)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (4.2.0)
|
||||
actionmailer (= 4.2.0)
|
||||
actionpack (= 4.2.0)
|
||||
actionview (= 4.2.0)
|
||||
activejob (= 4.2.0)
|
||||
activemodel (= 4.2.0)
|
||||
activerecord (= 4.2.0)
|
||||
activesupport (= 4.2.0)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.2.0)
|
||||
sprockets-rails
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.5)
|
||||
activesupport (>= 4.2.0.beta, < 5.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.0.1)
|
||||
loofah (~> 2.0)
|
||||
railties (4.2.0)
|
||||
actionpack (= 4.2.0)
|
||||
activesupport (= 4.2.0)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
raindrops (0.13.0)
|
||||
rake (10.4.2)
|
||||
rdoc (4.2.0)
|
||||
json (~> 1.4)
|
||||
ref (1.0.5)
|
||||
rmagick (2.13.4)
|
||||
ruby_parser (3.6.4)
|
||||
sexp_processor (~> 4.1)
|
||||
rvm-capistrano (1.4.1)
|
||||
capistrano (>= 2.0.0)
|
||||
sass (3.2.19)
|
||||
sass-rails (4.0.5)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
sass (~> 3.2.2)
|
||||
sprockets (~> 2.8, < 3.0)
|
||||
sprockets-rails (~> 2.0)
|
||||
sdoc (0.4.1)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
rdoc (~> 4.0)
|
||||
sexp_processor (4.4.5)
|
||||
spring (1.3.1)
|
||||
sprockets (2.12.3)
|
||||
hike (~> 1.2)
|
||||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
sprockets-rails (2.2.4)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sqlite3 (1.3.10)
|
||||
therubyracer (0.12.1)
|
||||
libv8 (~> 3.16.14.0)
|
||||
ref
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.4)
|
||||
tilt (1.4.1)
|
||||
turbolinks (2.5.3)
|
||||
coffee-rails
|
||||
twitter-bootstrap-rails (3.2.0)
|
||||
actionpack (~> 4.1)
|
||||
execjs (~> 2.2)
|
||||
rails (~> 4.1)
|
||||
railties (~> 4.1)
|
||||
tzinfo (1.2.2)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (2.7.0)
|
||||
execjs (>= 0.3.0)
|
||||
json (>= 1.8.0)
|
||||
unicorn (4.8.3)
|
||||
kgio (~> 2.6)
|
||||
rack
|
||||
raindrops (~> 0.7)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
acts_as_commentable
|
||||
acts_as_tree
|
||||
bcrypt (~> 3.1.7)
|
||||
capistrano (= 2.15.5)
|
||||
carrierwave
|
||||
coffee-rails (~> 4.0.0)
|
||||
formtastic (= 2.3.0)
|
||||
formtastic-bootstrap
|
||||
haml-rails
|
||||
jbuilder (~> 2.0)
|
||||
jquery-rails
|
||||
kaminari-bootstrap
|
||||
mysql2
|
||||
net-ssh (~> 2.7.0)
|
||||
rails (= 4.2)
|
||||
rmagick
|
||||
rvm-capistrano (= 1.4.1)
|
||||
sass-rails (~> 4.0.3)
|
||||
sdoc (~> 0.4.0)
|
||||
spring
|
||||
sqlite3
|
||||
therubyracer
|
||||
turbolinks
|
||||
twitter-bootstrap-rails
|
||||
uglifier (>= 1.3.0)
|
||||
unicorn
|
201
Gemfile.lock.old
Normal file
@ -0,0 +1,201 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (4.1.4)
|
||||
actionpack (= 4.1.4)
|
||||
actionview (= 4.1.4)
|
||||
mail (~> 2.5.4)
|
||||
actionpack (4.1.4)
|
||||
actionview (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
rack (~> 1.5.2)
|
||||
rack-test (~> 0.6.2)
|
||||
actionview (4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
activemodel (4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.1.4)
|
||||
activemodel (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
arel (~> 5.0.0)
|
||||
activesupport (4.1.4)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo (~> 1.1)
|
||||
acts_as_commentable (4.0.2)
|
||||
acts_as_tree (2.1.0)
|
||||
activerecord (>= 3.0.0)
|
||||
arel (5.0.1.20140414130214)
|
||||
bcrypt (3.1.7)
|
||||
builder (3.2.2)
|
||||
capistrano (2.15.5)
|
||||
highline
|
||||
net-scp (>= 1.0.0)
|
||||
net-sftp (>= 2.0.0)
|
||||
net-ssh (>= 2.0.14)
|
||||
net-ssh-gateway (>= 1.1.0)
|
||||
carrierwave (0.10.0)
|
||||
activemodel (>= 3.2.0)
|
||||
activesupport (>= 3.2.0)
|
||||
json (>= 1.7)
|
||||
mime-types (>= 1.16)
|
||||
coffee-rails (4.0.1)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
coffee-script (2.3.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.8.0)
|
||||
erubis (2.7.0)
|
||||
execjs (2.2.1)
|
||||
formtastic (2.3.0)
|
||||
actionpack (>= 3.0)
|
||||
formtastic-bootstrap (3.0.0)
|
||||
formtastic (>= 2.2)
|
||||
haml (4.0.5)
|
||||
tilt
|
||||
haml-rails (0.5.3)
|
||||
actionpack (>= 4.0.1)
|
||||
activesupport (>= 4.0.1)
|
||||
haml (>= 3.1, < 5.0)
|
||||
railties (>= 4.0.1)
|
||||
highline (1.6.21)
|
||||
hike (1.2.3)
|
||||
i18n (0.6.11)
|
||||
jbuilder (2.1.3)
|
||||
activesupport (>= 3.0.0, < 5)
|
||||
multi_json (~> 1.2)
|
||||
jquery-rails (3.1.2)
|
||||
railties (>= 3.0, < 5.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (1.8.1)
|
||||
kaminari (0.16.1)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
kaminari-bootstrap (3.0.1)
|
||||
kaminari (>= 0.13.0)
|
||||
rails
|
||||
kgio (2.9.2)
|
||||
libv8 (3.16.14.7)
|
||||
mail (2.5.4)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.25.1)
|
||||
minitest (5.4.2)
|
||||
multi_json (1.10.1)
|
||||
mysql2 (0.3.16)
|
||||
net-scp (1.2.1)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-sftp (2.1.2)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh (2.7.0)
|
||||
net-ssh-gateway (1.2.0)
|
||||
net-ssh (>= 2.6.5)
|
||||
polyglot (0.3.5)
|
||||
rack (1.5.2)
|
||||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
rails (4.1.4)
|
||||
actionmailer (= 4.1.4)
|
||||
actionpack (= 4.1.4)
|
||||
actionview (= 4.1.4)
|
||||
activemodel (= 4.1.4)
|
||||
activerecord (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.1.4)
|
||||
sprockets-rails (~> 2.0)
|
||||
railties (4.1.4)
|
||||
actionpack (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
raindrops (0.13.0)
|
||||
rake (10.3.2)
|
||||
rdoc (4.1.2)
|
||||
json (~> 1.4)
|
||||
ref (1.0.5)
|
||||
rmagick (2.13.3)
|
||||
rvm-capistrano (1.4.1)
|
||||
capistrano (>= 2.0.0)
|
||||
sass (3.2.19)
|
||||
sass-rails (4.0.3)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
sass (~> 3.2.0)
|
||||
sprockets (~> 2.8, <= 2.11.0)
|
||||
sprockets-rails (~> 2.0)
|
||||
sdoc (0.4.1)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
rdoc (~> 4.0)
|
||||
spring (1.1.3)
|
||||
sprockets (2.11.0)
|
||||
hike (~> 1.2)
|
||||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
sprockets-rails (2.1.4)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (~> 2.8)
|
||||
sqlite3 (1.3.9)
|
||||
therubyracer (0.12.1)
|
||||
libv8 (~> 3.16.14.0)
|
||||
ref
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.4)
|
||||
tilt (1.4.1)
|
||||
treetop (1.4.15)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
turbolinks (2.4.0)
|
||||
coffee-rails
|
||||
twitter-bootstrap-rails (3.2.0)
|
||||
actionpack (~> 4.1)
|
||||
execjs (~> 2.2)
|
||||
rails (~> 4.1)
|
||||
railties (~> 4.1)
|
||||
tzinfo (1.2.2)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (2.5.3)
|
||||
execjs (>= 0.3.0)
|
||||
json (>= 1.8.0)
|
||||
unicorn (4.8.3)
|
||||
kgio (~> 2.6)
|
||||
rack
|
||||
raindrops (~> 0.7)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
acts_as_commentable
|
||||
acts_as_tree
|
||||
bcrypt (~> 3.1.7)
|
||||
capistrano (= 2.15.5)
|
||||
carrierwave
|
||||
coffee-rails (~> 4.0.0)
|
||||
formtastic (= 2.3.0)
|
||||
formtastic-bootstrap
|
||||
haml-rails
|
||||
jbuilder (~> 2.0)
|
||||
jquery-rails
|
||||
kaminari-bootstrap
|
||||
mysql2
|
||||
net-ssh (~> 2.7.0)
|
||||
rails (= 4.1.4)
|
||||
rmagick
|
||||
rvm-capistrano (= 1.4.1)
|
||||
sass-rails (~> 4.0.3)
|
||||
sdoc (~> 0.4.0)
|
||||
spring
|
||||
sqlite3
|
||||
therubyracer
|
||||
turbolinks
|
||||
twitter-bootstrap-rails
|
||||
uglifier (>= 1.3.0)
|
||||
unicorn
|
28
README.rdoc
Normal file
@ -0,0 +1,28 @@
|
||||
== README
|
||||
|
||||
This README would normally document whatever steps are necessary to get the
|
||||
application up and running.
|
||||
|
||||
Things you may want to cover:
|
||||
|
||||
* Ruby version
|
||||
|
||||
* System dependencies
|
||||
|
||||
* Configuration
|
||||
|
||||
* Database creation
|
||||
|
||||
* Database initialization
|
||||
|
||||
* How to run the test suite
|
||||
|
||||
* Services (job queues, cache servers, search engines, etc.)
|
||||
|
||||
* Deployment instructions
|
||||
|
||||
* ...
|
||||
|
||||
|
||||
Please feel free to use a different markup language if you do not plan to run
|
||||
<tt>rake doc:app</tt>.
|
6
Rakefile
Normal file
@ -0,0 +1,6 @@
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
|
||||
Rails.application.load_tasks
|
0
app/assets/images/.keep
Normal file
BIN
app/assets/images/admin/content_type/type_BlockContent.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/assets/images/admin/content_type/type_BreakContent.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
app/assets/images/admin/content_type/type_DownloadContent.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
app/assets/images/admin/content_type/type_DynamicContent.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/assets/images/admin/content_type/type_EventContent.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/assets/images/admin/content_type/type_GalleryContent.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/assets/images/admin/content_type/type_HtmlContent.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/assets/images/admin/content_type/type_ImageContent.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/assets/images/admin/content_type/type_ImgLinkContent.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/assets/images/admin/content_type/type_LinkContent.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
app/assets/images/admin/content_type/type_MapContent.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/assets/images/admin/content_type/type_TableContent.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/assets/images/admin/content_type/type_TextContent.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
app/assets/images/admin/content_type/type_TitleContent.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/assets/images/file_types/1358029801_css.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
app/assets/images/file_types/1358029807_docx.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/assets/images/file_types/1358029820_psd.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
app/assets/images/file_types/1358029824_jpg.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/assets/images/file_types/1358029827_generic.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
app/assets/images/file_types/1358029830_doc.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/assets/images/file_types/1358029834_aac.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
app/assets/images/file_types/1358029839_wmv.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
app/assets/images/file_types/1358029845_raw.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/assets/images/file_types/1358029848_tar.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/assets/images/file_types/1358029854_tiff.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/assets/images/file_types/1358029858_rtf.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/assets/images/file_types/1358029860_rtf.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/assets/images/file_types/1358029868_js.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
app/assets/images/file_types/1358029872_gif.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/assets/images/file_types/1358029874_aiff.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
app/assets/images/file_types/1358029878_gzip.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/assets/images/file_types/1358029881_ma.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
app/assets/images/file_types/1358029885_mp.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/assets/images/file_types/1358029888_php.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
app/assets/images/file_types/1358029892_mpeg.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
app/assets/images/file_types/1358029894_mov.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/assets/images/file_types/1358029899_html.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
app/assets/images/file_types/1358029903_avi.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
app/assets/images/file_types/1358029912_wav.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
app/assets/images/file_types/1358029916_generic.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
app/assets/images/file_types/_blank.png
Executable file
After Width: | Height: | Size: 558 B |
BIN
app/assets/images/file_types/_page.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/assets/images/file_types/aac.png
Executable file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/assets/images/file_types/ai.png
Normal file
After Width: | Height: | Size: 9.6 KiB |
BIN
app/assets/images/file_types/bmp.png
Normal file
After Width: | Height: | Size: 453 KiB |
BIN
app/assets/images/file_types/eps.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
app/assets/images/file_types/gif.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
app/assets/images/file_types/icns.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
app/assets/images/file_types/ico.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
app/assets/images/file_types/jpeg.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
app/assets/images/file_types/jpg.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
app/assets/images/file_types/key.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
app/assets/images/file_types/kth.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
app/assets/images/file_types/m4v.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/assets/images/file_types/md.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
app/assets/images/file_types/mpg.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
app/assets/images/file_types/nmbtemplate.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
app/assets/images/file_types/numbers.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/assets/images/file_types/odf.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/assets/images/file_types/ods.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/assets/images/file_types/odt.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/assets/images/file_types/otp.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/assets/images/file_types/ots.png
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/assets/images/file_types/ott.png
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/assets/images/file_types/pages.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
app/assets/images/file_types/pdf.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/assets/images/file_types/php.png
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/assets/images/file_types/png.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
app/assets/images/file_types/psd.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/assets/images/file_types/sql.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
app/assets/images/file_types/tar.gz.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/assets/images/file_types/tar.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/assets/images/file_types/template.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
app/assets/images/file_types/tiff.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
app/assets/images/file_types/txt.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
app/assets/images/file_types/zip.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/assets/images/fond.jpg
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
app/assets/images/images/bx_loader.gif
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
app/assets/images/images/controls.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
app/assets/images/nb.png
Normal file
After Width: | Height: | Size: 898 B |
BIN
app/assets/images/vendor/select2-spinner.gif
vendored
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
app/assets/images/vendor/select2.png
vendored
Executable file
After Width: | Height: | Size: 613 B |
BIN
app/assets/images/vendor/select2x2.png
vendored
Executable file
After Width: | Height: | Size: 845 B |
400
app/assets/javascripts/admin.coffee
Normal file
@ -0,0 +1,400 @@
|
||||
|
||||
#= require jquery
|
||||
#= require jquery_ujs
|
||||
# require turbolinks
|
||||
|
||||
#= require event_form
|
||||
#= require bootstrap
|
||||
|
||||
#= require vendor/jquery-sortable
|
||||
#= require vendor/jquery.event.drag.js
|
||||
#= require vendor/bootstrap-slider
|
||||
#= require vendor/jquery.ui.widget
|
||||
#= require vendor/tmpl.min
|
||||
#= require vendor/jquery.iframe-transport
|
||||
#= require vendor/jquery.fileupload
|
||||
#= require vendor/jquery.fileupload-ui
|
||||
#= require vendor/jquery.fileupload-process
|
||||
#= require vendor/select2.min
|
||||
|
||||
|
||||
#= require manager
|
||||
#= require image_files
|
||||
#= require pane_hover
|
||||
|
||||
|
||||
#= require redactor
|
||||
#= require redactor_plugins/fontsize
|
||||
#= require redactor_plugins/fontfamily
|
||||
#= require redactor_plugins/fontcolor
|
||||
|
||||
#= require nested_fields
|
||||
|
||||
portlet_to_move = false
|
||||
content_type_to_move =false
|
||||
@open_collapse3 = ->
|
||||
$("#collapse3 .panel").show()
|
||||
$("#collapse3").show()
|
||||
|
||||
@reset_edit_pane = ->
|
||||
$("#element_form").html()
|
||||
$("#collapse3").hide()
|
||||
|
||||
@unselect_portlet = ->
|
||||
$(".portlet.active").removeClass("active")
|
||||
reset_edit_pane()
|
||||
|
||||
@cancel_move_portlet = ->
|
||||
$(".move_message").show()
|
||||
$(".cancel_message").hide()
|
||||
|
||||
$(".move").removeClass("move")
|
||||
$(".portlet_placeholder").remove()
|
||||
portlet_to_move = false
|
||||
|
||||
$(document).ready ->
|
||||
|
||||
$(document).on 'click', 'input.datepicker', ->
|
||||
$(this).datetimepicker(
|
||||
language: 'fr'
|
||||
pickTime: false
|
||||
).focus();
|
||||
|
||||
$(document).on 'click', 'input.datetimepicker', ->
|
||||
$(this).datetimepicker(
|
||||
use24hours: true
|
||||
format: 'DD/MM/YYYY hh:mm'
|
||||
minuteStepping:15
|
||||
language: 'fr'
|
||||
).focus();
|
||||
|
||||
|
||||
$(document).on 'click', 'input.timepicker', ->
|
||||
$(this).datetimepicker(
|
||||
use24hours: true
|
||||
format: 'DD/MM/YYYY hh:mm'
|
||||
minuteStepping:15
|
||||
pickDate: false
|
||||
language: 'fr'
|
||||
).focus();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).on "click", ".portlet", (event) ->
|
||||
if !$(this).hasClass("active") and portlet_to_move == false
|
||||
|
||||
$(".portlet.active").removeClass("active")
|
||||
$(this).addClass("active")
|
||||
|
||||
|
||||
$.ajax({url : $(this).data("edit-link"), type: "GET"});
|
||||
$("#collapse3 .trash").attr("href", $(this).data("show-link"));
|
||||
|
||||
event.stopPropagation();
|
||||
|
||||
$(document).on "click", ".block_portlets", (event) ->
|
||||
portlet_to_move = false
|
||||
content_type_to_move = false
|
||||
$("#element_form").html("")
|
||||
|
||||
$(".portlet.active").removeClass("active")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).on "click", "#content_types .content_type", ->
|
||||
cancel_move_portlet()
|
||||
unselect_portlet()
|
||||
reset_edit_pane()
|
||||
|
||||
|
||||
type = $(this).data("type")
|
||||
content_type_to_move = type
|
||||
init_portlets_place_holder()
|
||||
$(this).addClass("move")
|
||||
false
|
||||
|
||||
|
||||
|
||||
$(document).on "click", ".portlet_handle", ->
|
||||
if portlet_to_move == false
|
||||
|
||||
$(".move_message").hide()
|
||||
$(".cancel_message").show()
|
||||
|
||||
|
||||
id = $(this).data("portlet-id")
|
||||
portlet_to_move = $("#portlet_"+id)
|
||||
init_portlets_place_holder()
|
||||
portlet_to_move.addClass("move")
|
||||
false
|
||||
else
|
||||
cancel_move_portlet()
|
||||
|
||||
false
|
||||
|
||||
$(document).on "click", ".portlet_placeholder", ->
|
||||
if portlet_to_move != false
|
||||
$(this).after portlet_to_move
|
||||
$(".move").removeClass("move")
|
||||
$(".portlet_placeholder").remove()
|
||||
update_block_portlet_order(portlet_to_move.closest(".block_portlets").data("block_id"))
|
||||
cancel_move_portlet()
|
||||
else
|
||||
|
||||
block_id = $(this).closest(".block_portlets").data("block_id")
|
||||
|
||||
|
||||
$(this).replaceWith('<div id="new_portlet_form_inline" class="portlet"><div id="new_portlet_content_form"></div></div>');
|
||||
|
||||
$.ajax({
|
||||
url:"/portlet/portlets/new.js",
|
||||
type: "GET",
|
||||
data: {
|
||||
block_id : block_id,
|
||||
position : $(this).attr("data_position"),
|
||||
content_type : content_type_to_move
|
||||
}
|
||||
|
||||
})
|
||||
content_type_to_move = false
|
||||
$(".portlet_placeholder").remove()
|
||||
|
||||
|
||||
|
||||
|
||||
@init_portlets_place_holder = ->
|
||||
placeholder = '<div class="portlet_placeholder"><i class="fa fa-angle-right place"></i></div>'
|
||||
$(".block_portlets").each ->
|
||||
$(this).find(".portlet_placeholder").remove()
|
||||
$(this).prepend(placeholder)
|
||||
$(this).find(".portlet").each ->
|
||||
$(this).after(placeholder)
|
||||
|
||||
|
||||
|
||||
|
||||
@flash_delay = ->
|
||||
$("#flashs").find(".alert").each ->
|
||||
|
||||
if !$(this).hasClass("delay")
|
||||
$(this).addClass("delay")
|
||||
$(this).delay(3000).fadeOut();
|
||||
|
||||
|
||||
|
||||
@init_menu_items_list = ->
|
||||
|
||||
if $(".prevv_folder").length > 0
|
||||
|
||||
$(".prevv_folder").sortable({
|
||||
group:"menu_items",
|
||||
containerSelector :".receptable",
|
||||
itemSelector:".menu_item_row",
|
||||
handle: ".handle",
|
||||
nested:false,
|
||||
placeholder:"<div class='placeholder'></div>",
|
||||
|
||||
|
||||
})
|
||||
oldContainer = ""
|
||||
$("#sortable_menu_item").sortable({
|
||||
group:"menu_items",
|
||||
containerSelector :".receptable",
|
||||
itemSelector:".menu_item_row",
|
||||
handle: ".handle",
|
||||
nested:true,
|
||||
placeholder:"<div class='placeholder'></div>",
|
||||
afterMove: (placeholder, container) ->
|
||||
if oldContainer != container and container.el.hasClass("prevv_folder")
|
||||
if oldContainer
|
||||
oldContainer.el.removeClass("active")
|
||||
container.el.addClass("active")
|
||||
oldContainer = container
|
||||
onDrop: (item, Container, _super) ->
|
||||
|
||||
|
||||
if Container
|
||||
|
||||
parent_id = Container.el.data("parent-id")
|
||||
menu_id = Container.el.data("menu-id")
|
||||
id = item.data("menu-item-id")
|
||||
$.ajax({
|
||||
url:"/admin/menu_items/"+id+".js",
|
||||
type: "PUT",
|
||||
data: {
|
||||
reorder : true,
|
||||
menu_item : {
|
||||
parent_id : parent_id,
|
||||
menu_id : menu_id
|
||||
}
|
||||
},
|
||||
success : ->
|
||||
|
||||
|
||||
_super(item)
|
||||
item.remove()
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
|
||||
|
||||
|
||||
|
||||
_super(item)
|
||||
|
||||
sortable_data = {parent_id :$("#sortable_menu_item").data("parent-id"), menu_id :$("#sortable_menu_item").data("menu-id") , menu_items_ids : []}
|
||||
|
||||
$("#sortable_menu_item").find(".menu_item_row").each ->
|
||||
sortable_data.menu_items_ids.push $(this).data("menu-item-id")
|
||||
|
||||
|
||||
$.ajax({url : "/admin/menu_items/reorder", data : sortable_data, type: "POST"});
|
||||
|
||||
})
|
||||
|
||||
|
||||
@update_block_portlet_order = (block_portlet_id) ->
|
||||
return_order = []
|
||||
|
||||
block_portlet = $("#block_portlet_"+block_portlet_id)
|
||||
|
||||
block_data = {block_id : block_portlet.data('block_id'), block_portlet_ids : []}
|
||||
|
||||
block_portlet.children('.portlet').each ->
|
||||
if $(this).data('portlet_id')
|
||||
block_data.block_portlet_ids.push($(this).data('portlet_id'))
|
||||
|
||||
|
||||
|
||||
return_order.push(block_data);
|
||||
|
||||
|
||||
|
||||
$.ajax({url : "/portlet/portlets/reorder", data : {blocks:return_order}, type: "POST"})
|
||||
|
||||
|
||||
jQuery ->
|
||||
|
||||
$(".inline-contenteditable").keypress (e) ->
|
||||
if e.which == 13
|
||||
false
|
||||
else
|
||||
$(this).html($(this).text())
|
||||
return true
|
||||
|
||||
|
||||
$(document).on 'click', ".portlet_title_content .inline-contenteditable", () ->
|
||||
|
||||
$.ajax
|
||||
url : "/portlet/title_contents/"+$(this).data("title-id")+"/edit.js",
|
||||
type: "GET",
|
||||
|
||||
$(document).on 'blur keyup paste', ".portlet_title_content .inline-contenteditable", () ->
|
||||
$(this).html($(this).text())
|
||||
$.ajax
|
||||
url : "/portlet/title_contents/"+$(this).data("title-id"),
|
||||
type: "PUT",
|
||||
data :
|
||||
title_content :
|
||||
content : $(this).html()
|
||||
|
||||
|
||||
|
||||
|
||||
$(".sortable").sortable({
|
||||
|
||||
containerSelector :".block",
|
||||
itemSelector:".portlet",
|
||||
handle: ".handle",
|
||||
nested:true,
|
||||
placeholder:"<div class='placeholder'></div>"
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
flash_delay();
|
||||
|
||||
|
||||
item_catched = ""
|
||||
|
||||
|
||||
adjustment = ""
|
||||
|
||||
$("#menu_item_inspector_container").sortable({
|
||||
|
||||
|
||||
itemSelector:"#menu_item_informations",
|
||||
pullPlaceholder :false,
|
||||
placeholder : "",
|
||||
handle: ".inspector_handle",
|
||||
onDragStart: ($item, container, _super) ->
|
||||
$item.css({
|
||||
height: $item.height(),
|
||||
width: $item.width()
|
||||
})
|
||||
|
||||
$("body").addClass("dragging")
|
||||
|
||||
offset = $item.offset()
|
||||
pointer = container.rootGroup.pointer
|
||||
adjustment = {
|
||||
left: pointer.left - offset.left,
|
||||
top: pointer.top - offset.top
|
||||
}
|
||||
|
||||
onCancel : ($item, container, _super) ->
|
||||
$item.css(position)
|
||||
$item.removeClass("dragged")
|
||||
$("body").removeClass("dragging")
|
||||
|
||||
onDrag: ($item, position, _super) ->
|
||||
|
||||
$item.css({
|
||||
left: position.left - adjustment.left,
|
||||
top: position.top - adjustment.top - $(window).scrollTop()
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).on "scroll", () ->
|
||||
|
||||
if( $(this).scrollTop() <= 52 )
|
||||
top = 52 - $(this).scrollTop()
|
||||
else
|
||||
top = 0
|
||||
|
||||
$("#toolbar-text, #menu_item_informations").css
|
||||
top : top
|
||||
|
||||
$(document).on "click", "#menu_item_informations .save", ->
|
||||
$(this).closest(".panel").find("form").submit()
|
||||
return false
|
||||
|
||||
$(document).on "click", "#menu_item_informations h4", ->
|
||||
$(this).next(".panel").toggle()
|
||||
return false
|
||||
|
||||
|
||||
|
13
app/assets/javascripts/bootstrap.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
//= require bootstrap/affix
|
||||
//= require bootstrap/alert
|
||||
//= require bootstrap/button
|
||||
//= require bootstrap/carousel
|
||||
|
||||
//= require bootstrap/dropdown
|
||||
//= require bootstrap/tab
|
||||
//= require bootstrap/transition
|
||||
//= require bootstrap/scrollspy
|
||||
//= require bootstrap/modal
|
||||
//= require bootstrap/tooltip
|
||||
//= require bootstrap/popover
|
||||
//= require bootstrap/datetimepicker
|
137
app/assets/javascripts/bootstrap/affix.js
Normal file
@ -0,0 +1,137 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: affix.js v3.1.1
|
||||
* http://getbootstrap.com/javascript/#affix
|
||||
* ========================================================================
|
||||
* Copyright 2011-2014 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) {
|
||||
'use strict';
|
||||
|
||||
// AFFIX CLASS DEFINITION
|
||||
// ======================
|
||||
|
||||
var Affix = function (element, options) {
|
||||
this.options = $.extend({}, Affix.DEFAULTS, options)
|
||||
this.$window = $(window)
|
||||
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
|
||||
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
|
||||
|
||||
this.$element = $(element)
|
||||
this.affixed =
|
||||
this.unpin =
|
||||
this.pinnedOffset = null
|
||||
|
||||
this.checkPosition()
|
||||
}
|
||||
|
||||
Affix.RESET = 'affix affix-top affix-bottom'
|
||||
|
||||
Affix.DEFAULTS = {
|
||||
offset: 0
|
||||
}
|
||||
|
||||
Affix.prototype.getPinnedOffset = function () {
|
||||
if (this.pinnedOffset) return this.pinnedOffset
|
||||
this.$element.removeClass(Affix.RESET).addClass('affix')
|
||||
var scrollTop = this.$window.scrollTop()
|
||||
var position = this.$element.offset()
|
||||
return (this.pinnedOffset = position.top - scrollTop)
|
||||
}
|
||||
|
||||
Affix.prototype.checkPositionWithEventLoop = function () {
|
||||
setTimeout($.proxy(this.checkPosition, this), 1)
|
||||
}
|
||||
|
||||
Affix.prototype.checkPosition = function () {
|
||||
if (!this.$element.is(':visible')) return
|
||||
|
||||
var scrollHeight = $(document).height()
|
||||
var scrollTop = this.$window.scrollTop()
|
||||
var position = this.$element.offset()
|
||||
var offset = this.options.offset
|
||||
var offsetTop = offset.top
|
||||
var offsetBottom = offset.bottom
|
||||
|
||||
if (this.affixed == 'top') position.top += scrollTop
|
||||
|
||||
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
||||
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
|
||||
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
|
||||
|
||||
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
|
||||
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
|
||||
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
|
||||
|
||||
if (this.affixed === affix) return
|
||||
if (this.unpin) this.$element.css('top', '')
|
||||
|
||||
var affixType = 'affix' + (affix ? '-' + affix : '')
|
||||
var e = $.Event(affixType + '.bs.affix')
|
||||
|
||||
this.$element.trigger(e)
|
||||
|
||||
if (e.isDefaultPrevented()) return
|
||||
|
||||
this.affixed = affix
|
||||
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
|
||||
|
||||
this.$element
|
||||
.removeClass(Affix.RESET)
|
||||
.addClass(affixType)
|
||||
.trigger($.Event(affixType.replace('affix', 'affixed')))
|
||||
|
||||
if (affix == 'bottom') {
|
||||
this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// AFFIX PLUGIN DEFINITION
|
||||
// =======================
|
||||
|
||||
var old = $.fn.affix
|
||||
|
||||
$.fn.affix = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.affix')
|
||||
var options = typeof option == 'object' && option
|
||||
|
||||
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.affix.Constructor = Affix
|
||||
|
||||
|
||||
// AFFIX NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.affix.noConflict = function () {
|
||||
$.fn.affix = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// AFFIX DATA-API
|
||||
// ==============
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('[data-spy="affix"]').each(function () {
|
||||
var $spy = $(this)
|
||||
var data = $spy.data()
|
||||
|
||||
data.offset = data.offset || {}
|
||||
|
||||
if (data.offsetBottom) data.offset.bottom = data.offsetBottom
|
||||
if (data.offsetTop) data.offset.top = data.offsetTop
|
||||
|
||||
$spy.affix(data)
|
||||
})
|
||||
})
|
||||
|
||||
}(jQuery);
|
88
app/assets/javascripts/bootstrap/alert.js
Normal file
@ -0,0 +1,88 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: alert.js v3.1.1
|
||||
* http://getbootstrap.com/javascript/#alerts
|
||||
* ========================================================================
|
||||
* Copyright 2011-2014 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) {
|
||||
'use strict';
|
||||
|
||||
// ALERT CLASS DEFINITION
|
||||
// ======================
|
||||
|
||||
var dismiss = '[data-dismiss="alert"]'
|
||||
var Alert = function (el) {
|
||||
$(el).on('click', dismiss, this.close)
|
||||
}
|
||||
|
||||
Alert.prototype.close = function (e) {
|
||||
var $this = $(this)
|
||||
var selector = $this.attr('data-target')
|
||||
|
||||
if (!selector) {
|
||||
selector = $this.attr('href')
|
||||
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
|
||||
}
|
||||
|
||||
var $parent = $(selector)
|
||||
|
||||
if (e) e.preventDefault()
|
||||
|
||||
if (!$parent.length) {
|
||||
$parent = $this.hasClass('alert') ? $this : $this.parent()
|
||||
}
|
||||
|
||||
$parent.trigger(e = $.Event('close.bs.alert'))
|
||||
|
||||
if (e.isDefaultPrevented()) return
|
||||
|
||||
$parent.removeClass('in')
|
||||
|
||||
function removeElement() {
|
||||
$parent.trigger('closed.bs.alert').remove()
|
||||
}
|
||||
|
||||
$.support.transition && $parent.hasClass('fade') ?
|
||||
$parent
|
||||
.one($.support.transition.end, removeElement)
|
||||
.emulateTransitionEnd(150) :
|
||||
removeElement()
|
||||
}
|
||||
|
||||
|
||||
// ALERT PLUGIN DEFINITION
|
||||
// =======================
|
||||
|
||||
var old = $.fn.alert
|
||||
|
||||
$.fn.alert = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.alert')
|
||||
|
||||
if (!data) $this.data('bs.alert', (data = new Alert(this)))
|
||||
if (typeof option == 'string') data[option].call($this)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.alert.Constructor = Alert
|
||||
|
||||
|
||||
// ALERT NO CONFLICT
|
||||
// =================
|
||||
|
||||
$.fn.alert.noConflict = function () {
|
||||
$.fn.alert = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// ALERT DATA-API
|
||||
// ==============
|
||||
|
||||
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
|
||||
|
||||
}(jQuery);
|
107
app/assets/javascripts/bootstrap/button.js
Normal file
@ -0,0 +1,107 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: button.js v3.1.1
|
||||
* http://getbootstrap.com/javascript/#buttons
|
||||
* ========================================================================
|
||||
* Copyright 2011-2014 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) {
|
||||
'use strict';
|
||||
|
||||
// BUTTON PUBLIC CLASS DEFINITION
|
||||
// ==============================
|
||||
|
||||
var Button = function (element, options) {
|
||||
this.$element = $(element)
|
||||
this.options = $.extend({}, Button.DEFAULTS, options)
|
||||
this.isLoading = false
|
||||
}
|
||||
|
||||
Button.DEFAULTS = {
|
||||
loadingText: 'loading...'
|
||||
}
|
||||
|
||||
Button.prototype.setState = function (state) {
|
||||
var d = 'disabled'
|
||||
var $el = this.$element
|
||||
var val = $el.is('input') ? 'val' : 'html'
|
||||
var data = $el.data()
|
||||
|
||||
state = state + 'Text'
|
||||
|
||||
if (!data.resetText) $el.data('resetText', $el[val]())
|
||||
|
||||
$el[val](data[state] || this.options[state])
|
||||
|
||||
// push to event loop to allow forms to submit
|
||||
setTimeout($.proxy(function () {
|
||||
if (state == 'loadingText') {
|
||||
this.isLoading = true
|
||||
$el.addClass(d).attr(d, d)
|
||||
} else if (this.isLoading) {
|
||||
this.isLoading = false
|
||||
$el.removeClass(d).removeAttr(d)
|
||||
}
|
||||
}, this), 0)
|
||||
}
|
||||
|
||||
Button.prototype.toggle = function () {
|
||||
var changed = true
|
||||
var $parent = this.$element.closest('[data-toggle="buttons"]')
|
||||
|
||||
if ($parent.length) {
|
||||
var $input = this.$element.find('input')
|
||||
if ($input.prop('type') == 'radio') {
|
||||
if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
|
||||
else $parent.find('.active').removeClass('active')
|
||||
}
|
||||
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
|
||||
}
|
||||
|
||||
if (changed) this.$element.toggleClass('active')
|
||||
}
|
||||
|
||||
|
||||
// BUTTON PLUGIN DEFINITION
|
||||
// ========================
|
||||
|
||||
var old = $.fn.button
|
||||
|
||||
$.fn.button = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.button')
|
||||
var options = typeof option == 'object' && option
|
||||
|
||||
if (!data) $this.data('bs.button', (data = new Button(this, options)))
|
||||
|
||||
if (option == 'toggle') data.toggle()
|
||||
else if (option) data.setState(option)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.button.Constructor = Button
|
||||
|
||||
|
||||
// BUTTON NO CONFLICT
|
||||
// ==================
|
||||
|
||||
$.fn.button.noConflict = function () {
|
||||
$.fn.button = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// BUTTON DATA-API
|
||||
// ===============
|
||||
|
||||
$(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
|
||||
var $btn = $(e.target)
|
||||
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
||||
$btn.button('toggle')
|
||||
e.preventDefault()
|
||||
})
|
||||
|
||||
}(jQuery);
|
205
app/assets/javascripts/bootstrap/carousel.js
Normal file
@ -0,0 +1,205 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: carousel.js v3.1.1
|
||||
* http://getbootstrap.com/javascript/#carousel
|
||||
* ========================================================================
|
||||
* Copyright 2011-2014 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) {
|
||||
'use strict';
|
||||
|
||||
// CAROUSEL CLASS DEFINITION
|
||||
// =========================
|
||||
|
||||
var Carousel = function (element, options) {
|
||||
this.$element = $(element)
|
||||
this.$indicators = this.$element.find('.carousel-indicators')
|
||||
this.options = options
|
||||
this.paused =
|
||||
this.sliding =
|
||||
this.interval =
|
||||
this.$active =
|
||||
this.$items = null
|
||||
|
||||
this.options.pause == 'hover' && this.$element
|
||||
.on('mouseenter', $.proxy(this.pause, this))
|
||||
.on('mouseleave', $.proxy(this.cycle, this))
|
||||
}
|
||||
|
||||
Carousel.DEFAULTS = {
|
||||
interval: 5000,
|
||||
pause: 'hover',
|
||||
wrap: true
|
||||
}
|
||||
|
||||
Carousel.prototype.cycle = function (e) {
|
||||
e || (this.paused = false)
|
||||
|
||||
this.interval && clearInterval(this.interval)
|
||||
|
||||
this.options.interval
|
||||
&& !this.paused
|
||||
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
Carousel.prototype.getActiveIndex = function () {
|
||||
this.$active = this.$element.find('.item.active')
|
||||
this.$items = this.$active.parent().children()
|
||||
|
||||
return this.$items.index(this.$active)
|
||||
}
|
||||
|
||||
Carousel.prototype.to = function (pos) {
|
||||
var that = this
|
||||
var activeIndex = this.getActiveIndex()
|
||||
|
||||
if (pos > (this.$items.length - 1) || pos < 0) return
|
||||
|
||||
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) })
|
||||
if (activeIndex == pos) return this.pause().cycle()
|
||||
|
||||
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
|
||||
}
|
||||
|
||||
Carousel.prototype.pause = function (e) {
|
||||
e || (this.paused = true)
|
||||
|
||||
if (this.$element.find('.next, .prev').length && $.support.transition) {
|
||||
this.$element.trigger($.support.transition.end)
|
||||
this.cycle(true)
|
||||
}
|
||||
|
||||
this.interval = clearInterval(this.interval)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
Carousel.prototype.next = function () {
|
||||
if (this.sliding) return
|
||||
return this.slide('next')
|
||||
}
|
||||
|
||||
Carousel.prototype.prev = function () {
|
||||
if (this.sliding) return
|
||||
return this.slide('prev')
|
||||
}
|
||||
|
||||
Carousel.prototype.slide = function (type, next) {
|
||||
var $active = this.$element.find('.item.active')
|
||||
var $next = next || $active[type]()
|
||||
var isCycling = this.interval
|
||||
var direction = type == 'next' ? 'left' : 'right'
|
||||
var fallback = type == 'next' ? 'first' : 'last'
|
||||
var that = this
|
||||
|
||||
if (!$next.length) {
|
||||
if (!this.options.wrap) return
|
||||
$next = this.$element.find('.item')[fallback]()
|
||||
}
|
||||
|
||||
if ($next.hasClass('active')) return this.sliding = false
|
||||
|
||||
var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
|
||||
this.$element.trigger(e)
|
||||
if (e.isDefaultPrevented()) return
|
||||
|
||||
this.sliding = true
|
||||
|
||||
isCycling && this.pause()
|
||||
|
||||
if (this.$indicators.length) {
|
||||
this.$indicators.find('.active').removeClass('active')
|
||||
this.$element.one('slid.bs.carousel', function () {
|
||||
var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
|
||||
$nextIndicator && $nextIndicator.addClass('active')
|
||||
})
|
||||
}
|
||||
|
||||
if ($.support.transition && this.$element.hasClass('slide')) {
|
||||
$next.addClass(type)
|
||||
$next[0].offsetWidth // force reflow
|
||||
$active.addClass(direction)
|
||||
$next.addClass(direction)
|
||||
$active
|
||||
.one($.support.transition.end, function () {
|
||||
$next.removeClass([type, direction].join(' ')).addClass('active')
|
||||
$active.removeClass(['active', direction].join(' '))
|
||||
that.sliding = false
|
||||
setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0)
|
||||
})
|
||||
.emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
|
||||
} else {
|
||||
$active.removeClass('active')
|
||||
$next.addClass('active')
|
||||
this.sliding = false
|
||||
this.$element.trigger('slid.bs.carousel')
|
||||
}
|
||||
|
||||
isCycling && this.cycle()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// CAROUSEL PLUGIN DEFINITION
|
||||
// ==========================
|
||||
|
||||
var old = $.fn.carousel
|
||||
|
||||
$.fn.carousel = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.carousel')
|
||||
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
var action = typeof option == 'string' ? option : options.slide
|
||||
|
||||
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
|
||||
if (typeof option == 'number') data.to(option)
|
||||
else if (action) data[action]()
|
||||
else if (options.interval) data.pause().cycle()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.carousel.Constructor = Carousel
|
||||
|
||||
|
||||
// CAROUSEL NO CONFLICT
|
||||
// ====================
|
||||
|
||||
$.fn.carousel.noConflict = function () {
|
||||
$.fn.carousel = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// CAROUSEL DATA-API
|
||||
// =================
|
||||
|
||||
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
||||
var $this = $(this), href
|
||||
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
||||
var options = $.extend({}, $target.data(), $this.data())
|
||||
var slideIndex = $this.attr('data-slide-to')
|
||||
if (slideIndex) options.interval = false
|
||||
|
||||
$target.carousel(options)
|
||||
|
||||
if (slideIndex = $this.attr('data-slide-to')) {
|
||||
$target.data('bs.carousel').to(slideIndex)
|
||||
}
|
||||
|
||||
e.preventDefault()
|
||||
})
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('[data-ride="carousel"]').each(function () {
|
||||
var $carousel = $(this)
|
||||
$carousel.carousel($carousel.data())
|
||||
})
|
||||
})
|
||||
|
||||
}(jQuery);
|
170
app/assets/javascripts/bootstrap/collapse.js
Normal file
@ -0,0 +1,170 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: collapse.js v3.1.1
|
||||
* http://getbootstrap.com/javascript/#collapse
|
||||
* ========================================================================
|
||||
* Copyright 2011-2014 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) {
|
||||
'use strict';
|
||||
|
||||
// COLLAPSE PUBLIC CLASS DEFINITION
|
||||
// ================================
|
||||
|
||||
var Collapse = function (element, options) {
|
||||
this.$element = $(element)
|
||||
this.options = $.extend({}, Collapse.DEFAULTS, options)
|
||||
this.transitioning = null
|
||||
|
||||
if (this.options.parent) this.$parent = $(this.options.parent)
|
||||
if (this.options.toggle) this.toggle()
|
||||
}
|
||||
|
||||
Collapse.DEFAULTS = {
|
||||
toggle: true
|
||||
}
|
||||
|
||||
Collapse.prototype.dimension = function () {
|
||||
var hasWidth = this.$element.hasClass('width')
|
||||
return hasWidth ? 'width' : 'height'
|
||||
}
|
||||
|
||||
Collapse.prototype.show = function () {
|
||||
if (this.transitioning || this.$element.hasClass('in')) return
|
||||
|
||||
var startEvent = $.Event('show.bs.collapse')
|
||||
this.$element.trigger(startEvent)
|
||||
if (startEvent.isDefaultPrevented()) return
|
||||
|
||||
var actives = this.$parent && this.$parent.find('> .panel > .in')
|
||||
|
||||
if (actives && actives.length) {
|
||||
var hasData = actives.data('bs.collapse')
|
||||
if (hasData && hasData.transitioning) return
|
||||
actives.collapse('hide')
|
||||
hasData || actives.data('bs.collapse', null)
|
||||
}
|
||||
|
||||
var dimension = this.dimension()
|
||||
|
||||
this.$element
|
||||
.removeClass('collapse')
|
||||
.addClass('collapsing')
|
||||
[dimension](0)
|
||||
|
||||
this.transitioning = 1
|
||||
|
||||
var complete = function () {
|
||||
this.$element
|
||||
.removeClass('collapsing')
|
||||
.addClass('collapse in')
|
||||
[dimension]('auto')
|
||||
this.transitioning = 0
|
||||
this.$element.trigger('shown.bs.collapse')
|
||||
}
|
||||
|
||||
if (!$.support.transition) return complete.call(this)
|
||||
|
||||
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
|
||||
|
||||
this.$element
|
||||
.one($.support.transition.end, $.proxy(complete, this))
|
||||
.emulateTransitionEnd(350)
|
||||
[dimension](this.$element[0][scrollSize])
|
||||
}
|
||||
|
||||
Collapse.prototype.hide = function () {
|
||||
if (this.transitioning || !this.$element.hasClass('in')) return
|
||||
|
||||
var startEvent = $.Event('hide.bs.collapse')
|
||||
this.$element.trigger(startEvent)
|
||||
if (startEvent.isDefaultPrevented()) return
|
||||
|
||||
var dimension = this.dimension()
|
||||
|
||||
this.$element
|
||||
[dimension](this.$element[dimension]())
|
||||
[0].offsetHeight
|
||||
|
||||
this.$element
|
||||
.addClass('collapsing')
|
||||
.removeClass('collapse')
|
||||
.removeClass('in')
|
||||
|
||||
this.transitioning = 1
|
||||
|
||||
var complete = function () {
|
||||
this.transitioning = 0
|
||||
this.$element
|
||||
.trigger('hidden.bs.collapse')
|
||||
.removeClass('collapsing')
|
||||
.addClass('collapse')
|
||||
}
|
||||
|
||||
if (!$.support.transition) return complete.call(this)
|
||||
|
||||
this.$element
|
||||
[dimension](0)
|
||||
.one($.support.transition.end, $.proxy(complete, this))
|
||||
.emulateTransitionEnd(350)
|
||||
}
|
||||
|
||||
Collapse.prototype.toggle = function () {
|
||||
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
||||
}
|
||||
|
||||
|
||||
// COLLAPSE PLUGIN DEFINITION
|
||||
// ==========================
|
||||
|
||||
var old = $.fn.collapse
|
||||
|
||||
$.fn.collapse = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.collapse')
|
||||
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
||||
|
||||
if (!data && options.toggle && option == 'show') option = !option
|
||||
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.collapse.Constructor = Collapse
|
||||
|
||||
|
||||
// COLLAPSE NO CONFLICT
|
||||
// ====================
|
||||
|
||||
$.fn.collapse.noConflict = function () {
|
||||
$.fn.collapse = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// COLLAPSE DATA-API
|
||||
// =================
|
||||
|
||||
$(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
||||
var $this = $(this), href
|
||||
var target = $this.attr('data-target')
|
||||
|| e.preventDefault()
|
||||
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
||||
var $target = $(target)
|
||||
var data = $target.data('bs.collapse')
|
||||
var option = data ? 'toggle' : $this.data()
|
||||
var parent = $this.attr('data-parent')
|
||||
var $parent = parent && $(parent)
|
||||
|
||||
if (!data || !data.transitioning) {
|
||||
if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
|
||||
$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
|
||||
}
|
||||
|
||||
$target.collapse(option)
|
||||
})
|
||||
|
||||
}(jQuery);
|
3652
app/assets/javascripts/bootstrap/datetimepicker.js
Executable file
147
app/assets/javascripts/bootstrap/dropdown.js
Normal file
@ -0,0 +1,147 @@
|
||||
/* ========================================================================
|
||||
* Bootstrap: dropdown.js v3.1.1
|
||||
* http://getbootstrap.com/javascript/#dropdowns
|
||||
* ========================================================================
|
||||
* Copyright 2011-2014 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* ======================================================================== */
|
||||
|
||||
|
||||
+function ($) {
|
||||
'use strict';
|
||||
|
||||
// DROPDOWN CLASS DEFINITION
|
||||
// =========================
|
||||
|
||||
var backdrop = '.dropdown-backdrop'
|
||||
var toggle = '[data-toggle=dropdown]'
|
||||
var Dropdown = function (element) {
|
||||
$(element).on('click.bs.dropdown', this.toggle)
|
||||
}
|
||||
|
||||
Dropdown.prototype.toggle = function (e) {
|
||||
var $this = $(this)
|
||||
|
||||
if ($this.is('.disabled, :disabled')) return
|
||||
|
||||
var $parent = getParent($this)
|
||||
var isActive = $parent.hasClass('open')
|
||||
|
||||
clearMenus()
|
||||
|
||||
if (!isActive) {
|
||||
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
|
||||
// if mobile we use a backdrop because click events don't delegate
|
||||
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
|
||||
}
|
||||
|
||||
var relatedTarget = { relatedTarget: this }
|
||||
$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
|
||||
|
||||
if (e.isDefaultPrevented()) return
|
||||
|
||||
$parent
|
||||
.toggleClass('open')
|
||||
.trigger('shown.bs.dropdown', relatedTarget)
|
||||
|
||||
$this.focus()
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
Dropdown.prototype.keydown = function (e) {
|
||||
if (!/(38|40|27)/.test(e.keyCode)) return
|
||||
|
||||
var $this = $(this)
|
||||
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
if ($this.is('.disabled, :disabled')) return
|
||||
|
||||
var $parent = getParent($this)
|
||||
var isActive = $parent.hasClass('open')
|
||||
|
||||
if (!isActive || (isActive && e.keyCode == 27)) {
|
||||
if (e.which == 27) $parent.find(toggle).focus()
|
||||
return $this.click()
|
||||
}
|
||||
|
||||
var desc = ' li:not(.divider):visible a'
|
||||
var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc)
|
||||
|
||||
if (!$items.length) return
|
||||
|
||||
var index = $items.index($items.filter(':focus'))
|
||||
|
||||
if (e.keyCode == 38 && index > 0) index-- // up
|
||||
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
|
||||
if (!~index) index = 0
|
||||
|
||||
$items.eq(index).focus()
|
||||
}
|
||||
|
||||
function clearMenus(e) {
|
||||
$(backdrop).remove()
|
||||
$(toggle).each(function () {
|
||||
var $parent = getParent($(this))
|
||||
var relatedTarget = { relatedTarget: this }
|
||||
if (!$parent.hasClass('open')) return
|
||||
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
|
||||
if (e.isDefaultPrevented()) return
|
||||
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
|
||||
})
|
||||
}
|
||||
|
||||
function getParent($this) {
|
||||
var selector = $this.attr('data-target')
|
||||
|
||||
if (!selector) {
|
||||
selector = $this.attr('href')
|
||||
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
||||
}
|
||||
|
||||
var $parent = selector && $(selector)
|
||||
|
||||
return $parent && $parent.length ? $parent : $this.parent()
|
||||
}
|
||||
|
||||
|
||||
// DROPDOWN PLUGIN DEFINITION
|
||||
// ==========================
|
||||
|
||||
var old = $.fn.dropdown
|
||||
|
||||
$.fn.dropdown = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
var data = $this.data('bs.dropdown')
|
||||
|
||||
if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
|
||||
if (typeof option == 'string') data[option].call($this)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.dropdown.Constructor = Dropdown
|
||||
|
||||
|
||||
// DROPDOWN NO CONFLICT
|
||||
// ====================
|
||||
|
||||
$.fn.dropdown.noConflict = function () {
|
||||
$.fn.dropdown = old
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
// APPLY TO STANDARD DROPDOWN ELEMENTS
|
||||
// ===================================
|
||||
|
||||
$(document)
|
||||
.on('click.bs.dropdown.data-api', clearMenus)
|
||||
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
|
||||
.on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown)
|
||||
|
||||
}(jQuery);
|