diff --git a/.gitignore b/.gitignore
index 7230c44..ae8fd2b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,11 @@
-log/*.log
-tmp/*
-tmp/**/*
-doc/api
-doc/app
-db/*.sqlite3
-.sass-cache/
-public/stylesheets/*.css
-.rspec/
-*.swp
-*~
-.DS_Store
-public/images/system
-public/system
-public/.htaccess
-public/assets
-*.bak
-Thumbs.db
-.bundle
-bin/
+/.bundle
+/log/*.log
+/tmp
config/vhost.conf
+config/database.yml
+public/assets
+public/system
+.sass-cache
+tags
+coverage
+config/initializers/secret_token.rb
diff --git a/.ruby-version b/.ruby-version
new file mode 100644
index 0000000..cb50681
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+2.0.0-p247
diff --git a/.travis.yml b/.travis.yml
index 6ea2f60..2aaba94 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,16 @@
-before_script: "RAILS_ENV=development bundle exec rake db:migrate db:test:prepare"
-script: "bundle exec rake spec"
+before_script:
+ - sudo apt-get install python-pip
+ - sudo pip install pygments
+ - sudo -u postgres createuser cms -dSR
+ - RAILS_ENV=development bundle exec rake db:create:all config:generate
+ - 'sh -e /etc/init.d/xvfb start'
+ - bundle exec rake db:migrate db:test:prepare
+script:
+ - 'DISPLAY=:99.0 bundle exec rake spec'
rvm:
- - 1.8.7
- - 1.9.2
- - ree
+ - 2.0.0
+ - 1.9.3
notifications:
recipients:
- enrique@cloverinteractive.com
- - alejandro@cloverinteractive.com
- adan@cloverinteractive.com
- - alexperto@cloveritneractive.com
diff --git a/Gemfile b/Gemfile
index 6b62319..9438000 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,67 +1,54 @@
source 'http://rubygems.org'
-gem 'rails', '3.2.8'
+gem 'rails', '3.2.14'
+gem 'pg'
-gem 'will_paginate'
+gem 'bootstrap-will_paginate'
gem 'haml-rails'
gem 'devise'
-gem 'paperclip'
-gem 'acts-as-taggable-on'
+gem 'devise_invitable'
gem 'tabs_on_rails'
gem 'jquery-rails'
gem 'simple_form'
-gem 'single_test'
gem 'capistrano'
gem 'mime-types', :require => 'mime/types'
gem 'symbolize'
gem 'friendly_id', '~> 4.0.1'
+gem 'redcarpet', '2.2.2'
+gem 'pygments.rb', '0.4.2'
+gem 'mail_form'
group :development do
+ gem 'better_errors'
+ gem 'binding_of_caller'
+ gem 'debugger'
gem 'quiet_assets'
gem 'bullet'
gem 'pry-rails'
+ gem 'rails_best_practices'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
+ gem 'therubyracer', platforms: :ruby
gem 'compass-rails'
+ gem 'bootstrap-sass'
+ gem 'bootstrap_pagedown'
gem 'fancybox-rails'
+ gem 'turbo-sprockets-rails3'
end
group :development, :test do
- gem "rspec-rails", "~> 2.6"
+ gem 'rspec-rails'
+ gem 'single_test'
+ gem 'launchy'
end
group :test do
gem 'database_cleaner'
gem 'factory_girl_rails'
gem 'capybara-webkit'
- gem 'mocha', :require => false
-end
-
-platforms :ruby do
- group :test, :development do
- gem 'sqlite3'
- end
-
- group :production do
- gem 'mysql2'
- end
-end
-
-platforms :jruby do
- gem 'activerecord-jdbc-adapter'
- gem 'jruby-openssl'
- gem 'trinidad'
- gem 'ffi-ncurses'
-
- group :test, :development do
- gem 'jdbc-sqlite3'
- end
-
- group :production do
- gem 'jdbc-mysql', :require => false
- end
+ gem 'simplecov'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 6534b1d..df6d422 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,39 +1,49 @@
GEM
remote: http://rubygems.org/
specs:
- actionmailer (3.2.8)
- actionpack (= 3.2.8)
- mail (~> 2.4.4)
- actionpack (3.2.8)
- activemodel (= 3.2.8)
- activesupport (= 3.2.8)
+ actionmailer (3.2.14)
+ actionpack (= 3.2.14)
+ mail (~> 2.5.4)
+ actionpack (3.2.14)
+ activemodel (= 3.2.14)
+ activesupport (= 3.2.14)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
- rack (~> 1.4.0)
+ rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
- sprockets (~> 2.1.3)
- activemodel (3.2.8)
- activesupport (= 3.2.8)
+ sprockets (~> 2.2.1)
+ activemodel (3.2.14)
+ activesupport (= 3.2.14)
builder (~> 3.0.0)
- activerecord (3.2.8)
- activemodel (= 3.2.8)
- activesupport (= 3.2.8)
+ activerecord (3.2.14)
+ activemodel (= 3.2.14)
+ activesupport (= 3.2.14)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.2.8)
- activemodel (= 3.2.8)
- activesupport (= 3.2.8)
- activesupport (3.2.8)
- i18n (~> 0.6)
+ activeresource (3.2.14)
+ activemodel (= 3.2.14)
+ activesupport (= 3.2.14)
+ activesupport (3.2.14)
+ i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
- acts-as-taggable-on (2.3.3)
- rails (~> 3.0)
addressable (2.3.2)
arel (3.0.2)
- bcrypt-ruby (3.0.1)
- builder (3.0.3)
+ awesome_print (1.1.0)
+ bcrypt-ruby (3.1.1)
+ better_errors (0.3.2)
+ coderay (>= 1.0.0)
+ erubis (>= 2.7.0)
+ binding_of_caller (0.7.1)
+ debug_inspector (>= 0.0.1)
+ bootstrap-sass (2.3.2.2)
+ sass (~> 3.2)
+ bootstrap-will_paginate (0.0.9)
+ will_paginate
+ bootstrap_pagedown (1.1.0)
+ rails (>= 3.2)
+ builder (3.0.4)
bullet (4.1.5)
uniform_notifier (~> 1.0.0)
capistrano (2.11.2)
@@ -55,7 +65,8 @@ GEM
childprocess (0.3.5)
ffi (~> 1.0, >= 1.0.6)
chunky_png (1.2.5)
- cocaine (0.2.1)
+ code_analyzer (0.4.2)
+ sexp_processor
coderay (1.0.7)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@@ -63,7 +74,9 @@ GEM
coffee-script (2.2.0)
coffee-script-source
execjs
- coffee-script-source (1.2.0)
+ coffee-script-source (1.6.3)
+ colored (1.2)
+ columnize (0.3.6)
compass (0.12.1)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
@@ -71,24 +84,35 @@ GEM
compass-rails (1.0.1)
compass (~> 0.12.0)
database_cleaner (0.7.2)
- devise (2.1.2)
+ debug_inspector (0.0.2)
+ debugger (1.6.1)
+ columnize (>= 0.3.1)
+ debugger-linecache (~> 1.2.0)
+ debugger-ruby_core_source (~> 1.2.3)
+ debugger-linecache (1.2.0)
+ debugger-ruby_core_source (1.2.3)
+ devise (3.0.0)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
- railties (~> 3.1)
- warden (~> 1.2.1)
- diff-lcs (1.1.3)
+ railties (>= 3.2.6, < 5)
+ warden (~> 1.2.3)
+ devise_invitable (1.1.8)
+ actionmailer (~> 3.0)
+ devise (>= 2.1.2)
+ railties (~> 3.0)
+ diff-lcs (1.2.4)
erubis (2.7.0)
- execjs (1.3.0)
+ execjs (1.4.0)
multi_json (~> 1.0)
- factory_girl (2.6.4)
- activesupport (>= 2.3.9)
- factory_girl_rails (1.7.0)
- factory_girl (~> 2.6.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)
fancybox-rails (0.1.4)
railties (>= 3.1.0)
ffi (1.1.5)
- friendly_id (4.0.8)
+ friendly_id (4.0.9)
fssm (0.2.8.1)
haml (3.1.7)
haml-rails (0.3.5)
@@ -97,26 +121,26 @@ GEM
haml (~> 3.1)
railties (>= 3.1, < 4.1)
highline (1.6.11)
- hike (1.2.1)
- i18n (0.6.1)
+ hike (1.2.3)
+ i18n (0.6.5)
journey (1.0.4)
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
- json (1.7.5)
+ json (1.8.0)
+ launchy (2.3.0)
+ addressable (~> 2.3)
+ libv8 (3.11.8.17)
libwebsocket (0.1.5)
addressable
- mail (2.4.4)
- i18n (>= 0.4.0)
+ mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- metaclass (0.0.1)
+ mail_form (1.4.1)
+ actionmailer (~> 3.0)
method_source (0.8)
- mime-types (1.19)
- mocha (0.10.5)
- metaclass (~> 0.0.1)
- multi_json (1.3.6)
- mysql2 (0.3.11)
+ mime-types (1.25)
+ multi_json (1.8.1)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
@@ -126,61 +150,72 @@ GEM
net-ssh (>= 1.99.1)
nokogiri (1.5.5)
orm_adapter (0.4.0)
- paperclip (2.7.0)
- activerecord (>= 2.3.0)
- activesupport (>= 2.3.2)
- cocaine (>= 0.0.2)
- mime-types
+ pg (0.14.1)
polyglot (0.3.3)
+ posix-spawn (0.3.6)
pry (0.9.10)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.3.1)
pry-rails (0.1.6)
pry
+ pygments.rb (0.4.2)
+ posix-spawn (~> 0.3.6)
+ yajl-ruby (~> 1.1.0)
quiet_assets (1.0.1)
railties (~> 3.1)
- rack (1.4.1)
+ rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
- rack-ssl (1.3.2)
+ rack-ssl (1.3.3)
rack
- rack-test (0.6.1)
+ rack-test (0.6.2)
rack (>= 1.0)
- rails (3.2.8)
- actionmailer (= 3.2.8)
- actionpack (= 3.2.8)
- activerecord (= 3.2.8)
- activeresource (= 3.2.8)
- activesupport (= 3.2.8)
+ rails (3.2.14)
+ actionmailer (= 3.2.14)
+ actionpack (= 3.2.14)
+ activerecord (= 3.2.14)
+ activeresource (= 3.2.14)
+ activesupport (= 3.2.14)
bundler (~> 1.0)
- railties (= 3.2.8)
- railties (3.2.8)
- actionpack (= 3.2.8)
- activesupport (= 3.2.8)
+ railties (= 3.2.14)
+ rails_best_practices (1.14.3)
+ activesupport
+ awesome_print
+ code_analyzer (>= 0.4.2)
+ colored
+ erubis
+ i18n
+ require_all
+ ruby-progressbar
+ railties (3.2.14)
+ actionpack (= 3.2.14)
+ activesupport (= 3.2.14)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
- rake (0.9.2.2)
- rdoc (3.12)
+ rake (10.1.0)
+ rdoc (3.12.2)
json (~> 1.4)
- rspec (2.9.0)
- rspec-core (~> 2.9.0)
- rspec-expectations (~> 2.9.0)
- rspec-mocks (~> 2.9.0)
- rspec-core (2.9.0)
- rspec-expectations (2.9.0)
- diff-lcs (~> 1.1.3)
- rspec-mocks (2.9.0)
- rspec-rails (2.9.0)
+ redcarpet (2.2.2)
+ ref (1.0.4)
+ require_all (1.3.1)
+ rspec-core (2.14.4)
+ rspec-expectations (2.14.0)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-mocks (2.14.2)
+ rspec-rails (2.14.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
- rspec (~> 2.9.0)
+ rspec-core (~> 2.14.0)
+ rspec-expectations (~> 2.14.0)
+ rspec-mocks (~> 2.14.0)
+ ruby-progressbar (1.2.0)
rubyzip (0.9.9)
- sass (3.1.15)
- sass-rails (3.2.5)
+ sass (3.2.10)
+ sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
@@ -189,70 +224,86 @@ GEM
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
+ sexp_processor (4.3.0)
simple_form (2.0.2)
actionpack (~> 3.0)
activemodel (~> 3.0)
+ simplecov (0.7.1)
+ multi_json (~> 1.0)
+ simplecov-html (~> 0.7.1)
+ simplecov-html (0.7.1)
single_test (0.4.4)
slop (3.3.2)
- sprockets (2.1.3)
+ sprockets (2.2.2)
hike (~> 1.2)
+ multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sqlite3 (1.3.5)
symbolize (4.2.0)
tabs_on_rails (2.1.1)
- thor (0.16.0)
- tilt (1.3.3)
- treetop (1.4.10)
+ therubyracer (0.11.4)
+ libv8 (~> 3.11.8.12)
+ ref
+ thor (0.18.1)
+ tilt (1.4.1)
+ treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
- tzinfo (0.3.33)
- uglifier (1.2.3)
+ turbo-sprockets-rails3 (0.3.10)
+ railties (> 3.2.8, < 4.0.0)
+ sprockets (>= 2.0.0)
+ tzinfo (0.3.37)
+ uglifier (2.1.2)
execjs (>= 0.3.0)
- multi_json (>= 1.0.2)
+ multi_json (~> 1.0, >= 1.0.2)
uniform_notifier (1.0.2)
- warden (1.2.1)
+ warden (1.2.3)
rack (>= 1.0)
- will_paginate (3.0.3)
+ will_paginate (3.0.4)
xpath (0.1.4)
nokogiri (~> 1.3)
+ yajl-ruby (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
- activerecord-jdbc-adapter
- acts-as-taggable-on
+ better_errors
+ binding_of_caller
+ bootstrap-sass
+ bootstrap-will_paginate
+ bootstrap_pagedown
bullet
capistrano
capybara-webkit
coffee-rails (~> 3.2.1)
compass-rails
database_cleaner
+ debugger
devise
+ devise_invitable
factory_girl_rails
fancybox-rails
- ffi-ncurses
friendly_id (~> 4.0.1)
haml-rails
- jdbc-mysql
- jdbc-sqlite3
jquery-rails
- jruby-openssl
+ launchy
+ mail_form
mime-types
- mocha
- mysql2
- paperclip
+ pg
pry-rails
+ pygments.rb (= 0.4.2)
quiet_assets
- rails (= 3.2.8)
- rspec-rails (~> 2.6)
+ rails (= 3.2.14)
+ rails_best_practices
+ redcarpet (= 2.2.2)
+ rspec-rails
sass-rails (~> 3.2.3)
simple_form
+ simplecov
single_test
- sqlite3
symbolize
tabs_on_rails
- trinidad
+ therubyracer
+ turbo-sprockets-rails3
uglifier (>= 1.0.3)
- will_paginate
diff --git a/README.md b/README.md
index 5570ee7..31a1060 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# Clover CMS [](http://travis-ci.org/cloverinteractive/clovercms)
+# Clover CMS [](https://travis-ci.org/cloverinteractive/cms)
-__A dead simple content management system for Rails 3.2.8__
+__A dead simple content management system for Rails 3.2.14__
CloveCMS provides the simpler barebones for creating a website, in v1.1 we embraced an even simpler approach by making it a single user app
that means v1.1 does not support ACL nor multiple users, these features are present on v1.0, if you need ACL and multiple users checkout v1.0,
@@ -29,18 +29,8 @@ To install and run in development:
We currently test with:
-* ruby 1.9.2
-* ruby 1.8.7
-* ree
-
-### JRuby
-
-We take JRuby into consideration, and our Gemfile works nice with its platforms, but since we can only version one instance, we don't build against it. However you can use `clovercms` with JRuby by doing the following:
-
-0. `rm -f Gemfile.lock`
-1. `jruby -S bundle install`
-
-## Contribute
+* ruby 2.0.0
+* ruby 1.9.3
Feel free to submit a pull request and don't forget to add your name to the list below.
diff --git a/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png b/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png
deleted file mode 100755
index 5b5dab2..0000000
Binary files a/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png b/app/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png
deleted file mode 100755
index ac8b229..0000000
Binary files a/app/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png b/app/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png
deleted file mode 100755
index ad3d634..0000000
Binary files a/app/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png b/app/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png
deleted file mode 100755
index 42ccba2..0000000
Binary files a/app/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png b/app/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png
deleted file mode 100755
index 5a46b47..0000000
Binary files a/app/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png b/app/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png
deleted file mode 100755
index 86c2baa..0000000
Binary files a/app/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png b/app/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png
deleted file mode 100755
index 4443fdc..0000000
Binary files a/app/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png b/app/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png
deleted file mode 100755
index 7c9fa6c..0000000
Binary files a/app/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-icons_222222_256x240.png b/app/assets/images/jquery-ui/ui-icons_222222_256x240.png
deleted file mode 100755
index b273ff1..0000000
Binary files a/app/assets/images/jquery-ui/ui-icons_222222_256x240.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png b/app/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png
deleted file mode 100755
index 09d1cdc..0000000
Binary files a/app/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-icons_454545_256x240.png b/app/assets/images/jquery-ui/ui-icons_454545_256x240.png
deleted file mode 100755
index 59bd45b..0000000
Binary files a/app/assets/images/jquery-ui/ui-icons_454545_256x240.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-icons_888888_256x240.png b/app/assets/images/jquery-ui/ui-icons_888888_256x240.png
deleted file mode 100755
index 6d02426..0000000
Binary files a/app/assets/images/jquery-ui/ui-icons_888888_256x240.png and /dev/null differ
diff --git a/app/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png b/app/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png
deleted file mode 100755
index 2ab019b..0000000
Binary files a/app/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png and /dev/null differ
diff --git a/app/assets/images/uploadify/cancel.png b/app/assets/images/uploadify/cancel.png
deleted file mode 100755
index 35682b0..0000000
Binary files a/app/assets/images/uploadify/cancel.png and /dev/null differ
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index e3b3f96..2c5d33d 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -2,9 +2,9 @@
//
//= require jquery
//= require jquery_ujs
-//= require jquery-ui
//= require fancybox
//= require jquery.easing
//= require loopedslider
-//= require wymeditor
+//= require bootstrap
+//= require bootstrap_pagedown
//= require_tree .
diff --git a/app/assets/javascripts/global.js b/app/assets/javascripts/global.js
index eb4083f..72e49b5 100644
--- a/app/assets/javascripts/global.js
+++ b/app/assets/javascripts/global.js
@@ -1,177 +1,13 @@
$(function() {
$.fn.loopedSlider.defaults.addPagination = true;
$('#slider').loopedSlider({ autoStart: 5000, containerClick: false });
-});
-
-
-// Add images to editor
-function add_images()
-{
- $("#images_list img").each(function(){
- $(this).click(function(){
- image_operations({ element: this, title: 'Add image', text: 'Would you like to add this image to the page?' })
- });
- });
-}
-
-function remove_uploaded()
-{
- $("p.fields").each(function() {
- if ( $(this).children("input:first").val() != "" )
- $(this).remove();
- });
-}
-
-// Add documents to editor
-
-function add_documents()
-{
-$("#documents a").each(function(){
- $(this).click(function(){
- document_operations({ element: this, title: 'Add document', text: 'Would you like to add this document to the page?' } );
- return false;
- });
- });
-}
-
-// Keywords box functions
-
-function existing_keywords()
-{
- $('#keywords option').each(function(){
- $(this).dblclick(function(){
- delete_confirmation_dialog({
- element: this,
- title: 'Delete tag from tag list',
- text: 'Are you sure you want to delete ' + this.value + ' from your tag list?',
- onsuccess: 'keyword_list'
- });
- });
- });
-}
-
-function add_keywords()
-{
- $('#keyword_button').click(function(){
- $('#keyword_input').html(function() {
- if (this.value != '') {
- $.each(this.value.split(/\s?,\s?/), function(index, value) {
- $('#keywords').append('');
- $("#keywords").children(":last").dblclick (function() {
- delete_confirmation_dialog({
- element: this,
- title: 'Delete tag from tag list',
- text: 'Are you sure you want to delete ' + value + ' from your tag list?',
- onsuccess: 'keyword_list'
- });
- });
- });
- keyword_list();
- this.value = '';
- }
- });
- });
-}
-
-function keyword_list()
-{
- var keywords = "";
- $("#keywords option").each(function(){
- if ( keywords == "")
- keywords = this.value;
- else
- keywords = keywords + ", " + this.value;
- });
- $("#final_keywords_list").val(keywords);
-}
-
-// Dialog box functions
-
-function delete_confirmation_dialog( params ) {
- element = '
';
- element += params.text + '
';
-
- $("#main").append(element);
-
- $(function() {
- // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
- $("#dialog").dialog("destroy");
- $("#dialog-confirm").dialog({
- resizable: false,
- modal: true,
- dialogClass: 'alert',
- buttons: {
- 'Delete': function() {
- $(this).dialog('close');
- $(params.element).remove();
- eval(params.onsuccess + '()');
- $(this).remove();
- },
- Cancel: function() {
- $(this).dialog('close');
- $(this).remove();
- }
- }
- });
- });
-}
-
-function image_operations( params ) {
- element = '';
- element += params.text + '
';
- $("#main").append(element);
-
- $(function() {
- $("#dialog-pictures").dialog({
- resizable: false,
- modal: true,
- dialogClass: 'info',
- buttons: {
- 'Add picture to page': function() {
- $(this).dialog('close');
- var img = document.createElement("img");
- var p = document.createElement(p)
- p.innerHTML = ' ';
- img.src = params.element.src.replace(/small/, 'medium' );
- $("body", $("iframe").contents()).append(img, p);
- $("a[href=#tabs-1]").click();
- $(this).remove();
- },
- Cancel: function() {
- $(this).dialog('close');
- $(this).remove();
- }
- }
- });
- });
-}
-
-// nested models
-$(function() {
- $('form a.add_child').click(function() {
- var association = $(this).attr('data-association');
- var template = $('#' + association + '_fields_template').html();
- var regexp = new RegExp('new_' + association, 'g');
- var new_id = new Date().getTime();
- $(this).parent().before(template.replace(regexp, new_id));
- return false;
- });
+ if ( $("#wmd-input").length > 0 ) {
+ var converter = Markdown.getSanitizingConverter();
+ var editor = new Markdown.Editor( converter );
- $('form a.remove_child').live('click', function() {
- var hidden_field = $(this).prev('input[type=hidden]')[0];
- if(hidden_field) {
- hidden_field.value = '1';
- }
- $(this).parents('.fields').hide();
- return false;
- });
+ Markdown.Extra.init( converter );
+ editor.run();
+ }
});
-// button methods
-function submit_button()
-{
- $('.submit').button( { icons: { primary: 'ui-icon-circle-check' } } ).click(function() {
- $('.form').submit();
- });
-}
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index f0f22ee..0053bda 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -4,6 +4,5 @@
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require fancybox
- *= require uploadify
*= require main
*/
diff --git a/app/assets/stylesheets/dashboard.scss b/app/assets/stylesheets/dashboard.scss
index 15eefd2..e65b04f 100644
--- a/app/assets/stylesheets/dashboard.scss
+++ b/app/assets/stylesheets/dashboard.scss
@@ -1,5 +1,7 @@
@import "compass/reset";
@import "compass/css3/border-radius";
+@import "bootstrap";
+@import "bootstrap_pagedown";
html {
height: 100%;
diff --git a/app/assets/stylesheets/jquery-ui.css b/app/assets/stylesheets/jquery-ui.css
deleted file mode 100755
index 77d0ad2..0000000
--- a/app/assets/stylesheets/jquery-ui.css
+++ /dev/null
@@ -1,565 +0,0 @@
-/*!
- * jQuery UI CSS Framework 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Theming/API
- */
-
-/* Layout helpers
-----------------------------------*/
-.ui-helper-hidden { display: none; }
-.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
-.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
-.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
-.ui-helper-clearfix:after { clear: both; }
-.ui-helper-clearfix { zoom: 1; }
-.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
-
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-disabled { cursor: default !important; }
-
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Overlays */
-.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
-
-
-/*!
- * jQuery UI CSS Framework 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Theming/API
- *
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
- */
-
-
-/* Component containers
-----------------------------------*/
-.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
-.ui-widget .ui-widget { font-size: 1em; }
-.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
-.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(/assets/jquery-ui/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
-.ui-widget-content a { color: #222222; }
-.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(/assets/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
-.ui-widget-header a { color: #222222; }
-
-/* Interaction states
-----------------------------------*/
-.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(/assets/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
-.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
-.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(/assets/jquery-ui/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
-.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
-.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(/assets/jquery-ui/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
-.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
-.ui-widget :active { outline: none; }
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(/assets/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
-.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
-.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(/assets/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
-.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
-.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
-.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
-.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
-.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { width: 16px; height: 16px; background-image: url(/assets/jquery-ui/ui-icons_222222_256x240.png); }
-.ui-widget-content .ui-icon {background-image: url(/assets/jquery-ui/ui-icons_222222_256x240.png); }
-.ui-widget-header .ui-icon {background-image: url(/assets/jquery-ui/ui-icons_222222_256x240.png); }
-.ui-state-default .ui-icon { background-image: url(/assets/jquery-ui/ui-icons_888888_256x240.png); }
-.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(/assets/jquery-ui/ui-icons_454545_256x240.png); }
-.ui-state-active .ui-icon {background-image: url(/assets/jquery-ui/ui-icons_454545_256x240.png); }
-.ui-state-highlight .ui-icon {background-image: url(/assets/jquery-ui/ui-icons_2e83ff_256x240.png); }
-.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(/assets/jquery-ui/ui-icons_cd0a0a_256x240.png); }
-
-/* positioning */
-.ui-icon-carat-1-n { background-position: 0 0; }
-.ui-icon-carat-1-ne { background-position: -16px 0; }
-.ui-icon-carat-1-e { background-position: -32px 0; }
-.ui-icon-carat-1-se { background-position: -48px 0; }
-.ui-icon-carat-1-s { background-position: -64px 0; }
-.ui-icon-carat-1-sw { background-position: -80px 0; }
-.ui-icon-carat-1-w { background-position: -96px 0; }
-.ui-icon-carat-1-nw { background-position: -112px 0; }
-.ui-icon-carat-2-n-s { background-position: -128px 0; }
-.ui-icon-carat-2-e-w { background-position: -144px 0; }
-.ui-icon-triangle-1-n { background-position: 0 -16px; }
-.ui-icon-triangle-1-ne { background-position: -16px -16px; }
-.ui-icon-triangle-1-e { background-position: -32px -16px; }
-.ui-icon-triangle-1-se { background-position: -48px -16px; }
-.ui-icon-triangle-1-s { background-position: -64px -16px; }
-.ui-icon-triangle-1-sw { background-position: -80px -16px; }
-.ui-icon-triangle-1-w { background-position: -96px -16px; }
-.ui-icon-triangle-1-nw { background-position: -112px -16px; }
-.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
-.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
-.ui-icon-arrow-1-n { background-position: 0 -32px; }
-.ui-icon-arrow-1-ne { background-position: -16px -32px; }
-.ui-icon-arrow-1-e { background-position: -32px -32px; }
-.ui-icon-arrow-1-se { background-position: -48px -32px; }
-.ui-icon-arrow-1-s { background-position: -64px -32px; }
-.ui-icon-arrow-1-sw { background-position: -80px -32px; }
-.ui-icon-arrow-1-w { background-position: -96px -32px; }
-.ui-icon-arrow-1-nw { background-position: -112px -32px; }
-.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
-.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
-.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
-.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
-.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
-.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
-.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
-.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
-.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
-.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
-.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
-.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
-.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
-.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
-.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
-.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
-.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
-.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
-.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
-.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
-.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
-.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
-.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
-.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
-.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
-.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
-.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
-.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
-.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
-.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
-.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
-.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
-.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
-.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
-.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
-.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
-.ui-icon-arrow-4 { background-position: 0 -80px; }
-.ui-icon-arrow-4-diag { background-position: -16px -80px; }
-.ui-icon-extlink { background-position: -32px -80px; }
-.ui-icon-newwin { background-position: -48px -80px; }
-.ui-icon-refresh { background-position: -64px -80px; }
-.ui-icon-shuffle { background-position: -80px -80px; }
-.ui-icon-transfer-e-w { background-position: -96px -80px; }
-.ui-icon-transferthick-e-w { background-position: -112px -80px; }
-.ui-icon-folder-collapsed { background-position: 0 -96px; }
-.ui-icon-folder-open { background-position: -16px -96px; }
-.ui-icon-document { background-position: -32px -96px; }
-.ui-icon-document-b { background-position: -48px -96px; }
-.ui-icon-note { background-position: -64px -96px; }
-.ui-icon-mail-closed { background-position: -80px -96px; }
-.ui-icon-mail-open { background-position: -96px -96px; }
-.ui-icon-suitcase { background-position: -112px -96px; }
-.ui-icon-comment { background-position: -128px -96px; }
-.ui-icon-person { background-position: -144px -96px; }
-.ui-icon-print { background-position: -160px -96px; }
-.ui-icon-trash { background-position: -176px -96px; }
-.ui-icon-locked { background-position: -192px -96px; }
-.ui-icon-unlocked { background-position: -208px -96px; }
-.ui-icon-bookmark { background-position: -224px -96px; }
-.ui-icon-tag { background-position: -240px -96px; }
-.ui-icon-home { background-position: 0 -112px; }
-.ui-icon-flag { background-position: -16px -112px; }
-.ui-icon-calendar { background-position: -32px -112px; }
-.ui-icon-cart { background-position: -48px -112px; }
-.ui-icon-pencil { background-position: -64px -112px; }
-.ui-icon-clock { background-position: -80px -112px; }
-.ui-icon-disk { background-position: -96px -112px; }
-.ui-icon-calculator { background-position: -112px -112px; }
-.ui-icon-zoomin { background-position: -128px -112px; }
-.ui-icon-zoomout { background-position: -144px -112px; }
-.ui-icon-search { background-position: -160px -112px; }
-.ui-icon-wrench { background-position: -176px -112px; }
-.ui-icon-gear { background-position: -192px -112px; }
-.ui-icon-heart { background-position: -208px -112px; }
-.ui-icon-star { background-position: -224px -112px; }
-.ui-icon-link { background-position: -240px -112px; }
-.ui-icon-cancel { background-position: 0 -128px; }
-.ui-icon-plus { background-position: -16px -128px; }
-.ui-icon-plusthick { background-position: -32px -128px; }
-.ui-icon-minus { background-position: -48px -128px; }
-.ui-icon-minusthick { background-position: -64px -128px; }
-.ui-icon-close { background-position: -80px -128px; }
-.ui-icon-closethick { background-position: -96px -128px; }
-.ui-icon-key { background-position: -112px -128px; }
-.ui-icon-lightbulb { background-position: -128px -128px; }
-.ui-icon-scissors { background-position: -144px -128px; }
-.ui-icon-clipboard { background-position: -160px -128px; }
-.ui-icon-copy { background-position: -176px -128px; }
-.ui-icon-contact { background-position: -192px -128px; }
-.ui-icon-image { background-position: -208px -128px; }
-.ui-icon-video { background-position: -224px -128px; }
-.ui-icon-script { background-position: -240px -128px; }
-.ui-icon-alert { background-position: 0 -144px; }
-.ui-icon-info { background-position: -16px -144px; }
-.ui-icon-notice { background-position: -32px -144px; }
-.ui-icon-help { background-position: -48px -144px; }
-.ui-icon-check { background-position: -64px -144px; }
-.ui-icon-bullet { background-position: -80px -144px; }
-.ui-icon-radio-off { background-position: -96px -144px; }
-.ui-icon-radio-on { background-position: -112px -144px; }
-.ui-icon-pin-w { background-position: -128px -144px; }
-.ui-icon-pin-s { background-position: -144px -144px; }
-.ui-icon-play { background-position: 0 -160px; }
-.ui-icon-pause { background-position: -16px -160px; }
-.ui-icon-seek-next { background-position: -32px -160px; }
-.ui-icon-seek-prev { background-position: -48px -160px; }
-.ui-icon-seek-end { background-position: -64px -160px; }
-.ui-icon-seek-start { background-position: -80px -160px; }
-/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
-.ui-icon-seek-first { background-position: -80px -160px; }
-.ui-icon-stop { background-position: -96px -160px; }
-.ui-icon-eject { background-position: -112px -160px; }
-.ui-icon-volume-off { background-position: -128px -160px; }
-.ui-icon-volume-on { background-position: -144px -160px; }
-.ui-icon-power { background-position: 0 -176px; }
-.ui-icon-signal-diag { background-position: -16px -176px; }
-.ui-icon-signal { background-position: -32px -176px; }
-.ui-icon-battery-0 { background-position: -48px -176px; }
-.ui-icon-battery-1 { background-position: -64px -176px; }
-.ui-icon-battery-2 { background-position: -80px -176px; }
-.ui-icon-battery-3 { background-position: -96px -176px; }
-.ui-icon-circle-plus { background-position: 0 -192px; }
-.ui-icon-circle-minus { background-position: -16px -192px; }
-.ui-icon-circle-close { background-position: -32px -192px; }
-.ui-icon-circle-triangle-e { background-position: -48px -192px; }
-.ui-icon-circle-triangle-s { background-position: -64px -192px; }
-.ui-icon-circle-triangle-w { background-position: -80px -192px; }
-.ui-icon-circle-triangle-n { background-position: -96px -192px; }
-.ui-icon-circle-arrow-e { background-position: -112px -192px; }
-.ui-icon-circle-arrow-s { background-position: -128px -192px; }
-.ui-icon-circle-arrow-w { background-position: -144px -192px; }
-.ui-icon-circle-arrow-n { background-position: -160px -192px; }
-.ui-icon-circle-zoomin { background-position: -176px -192px; }
-.ui-icon-circle-zoomout { background-position: -192px -192px; }
-.ui-icon-circle-check { background-position: -208px -192px; }
-.ui-icon-circlesmall-plus { background-position: 0 -208px; }
-.ui-icon-circlesmall-minus { background-position: -16px -208px; }
-.ui-icon-circlesmall-close { background-position: -32px -208px; }
-.ui-icon-squaresmall-plus { background-position: -48px -208px; }
-.ui-icon-squaresmall-minus { background-position: -64px -208px; }
-.ui-icon-squaresmall-close { background-position: -80px -208px; }
-.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
-.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
-.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
-.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
-.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
-.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Corner radius */
-.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
-.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
-.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
-.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
-
-/* Overlays */
-.ui-widget-overlay { background: #aaaaaa url(/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
-.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*!
- * jQuery UI Resizable 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Resizable#theming
- */
-.ui-resizable { position: relative;}
-.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
-.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
-.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
-.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
-.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
-.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
-.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
-.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
-.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
-.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*!
- * jQuery UI Selectable 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Selectable#theming
- */
-.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
-/*!
- * jQuery UI Accordion 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Accordion#theming
- */
-/* IE/Win - Fix animation bug - #4615 */
-.ui-accordion { width: 100%; }
-.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
-.ui-accordion .ui-accordion-li-fix { display: inline; }
-.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
-.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
-.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
-.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
-.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
-.ui-accordion .ui-accordion-content-active { display: block; }
-/*!
- * jQuery UI Autocomplete 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Autocomplete#theming
- */
-.ui-autocomplete { position: absolute; cursor: default; }
-
-/* workarounds */
-* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
-
-/*
- * jQuery UI Menu @VERSION
- *
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Menu#theming
- */
-.ui-menu {
- list-style:none;
- padding: 2px;
- margin: 0;
- display:block;
- float: left;
-}
-.ui-menu .ui-menu {
- margin-top: -3px;
-}
-.ui-menu .ui-menu-item {
- margin:0;
- padding: 0;
- zoom: 1;
- float: left;
- clear: left;
- width: 100%;
-}
-.ui-menu .ui-menu-item a {
- text-decoration:none;
- display:block;
- padding:.2em .4em;
- line-height:1.5;
- zoom:1;
-}
-.ui-menu .ui-menu-item a.ui-state-hover,
-.ui-menu .ui-menu-item a.ui-state-active {
- font-weight: normal;
- margin: -1px;
-}
-/*!
- * jQuery UI Button 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Button#theming
- */
-.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
-.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
-button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
-.ui-button-icons-only { width: 3.4em; }
-button.ui-button-icons-only { width: 3.7em; }
-
-/*button text element */
-.ui-button .ui-button-text { display: block; line-height: 1.4; }
-.ui-button-text-only .ui-button-text { padding: .4em 1em; }
-.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
-.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
-.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
-.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
-/* no icon support for input elements, provide padding by default */
-input.ui-button { padding: .4em 1em; }
-
-/*button icon element(s) */
-.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
-.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
-.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
-.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
-.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
-
-/*button sets*/
-.ui-buttonset { margin-right: 7px; }
-.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
-
-/* workarounds */
-button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
-/*!
- * jQuery UI Dialog 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Dialog#theming
- */
-.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
-.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
-.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
-.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
-.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
-.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
-.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
-.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
-.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
-.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
-.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
-.ui-draggable .ui-dialog-titlebar { cursor: move; }
-/*!
- * jQuery UI Slider 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Slider#theming
- */
-.ui-slider { position: relative; text-align: left; }
-.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
-.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
-
-.ui-slider-horizontal { height: .8em; }
-.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
-.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
-.ui-slider-horizontal .ui-slider-range-min { left: 0; }
-.ui-slider-horizontal .ui-slider-range-max { right: 0; }
-
-.ui-slider-vertical { width: .8em; height: 100px; }
-.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
-.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
-.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
-.ui-slider-vertical .ui-slider-range-max { top: 0; }/*!
- * jQuery UI Tabs 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Tabs#theming
- */
-.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
-.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
-.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
-.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
-.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
-.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
-.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
-.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
-.ui-tabs .ui-tabs-hide { display: none !important; }
-/*!
- * jQuery UI Datepicker 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Datepicker#theming
- */
-.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
-.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
-.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
-.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
-.ui-datepicker .ui-datepicker-prev { left:2px; }
-.ui-datepicker .ui-datepicker-next { right:2px; }
-.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
-.ui-datepicker .ui-datepicker-next-hover { right:1px; }
-.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
-.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
-.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
-.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
-.ui-datepicker select.ui-datepicker-month,
-.ui-datepicker select.ui-datepicker-year { width: 49%;}
-.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
-.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
-.ui-datepicker td { border: 0; padding: 1px; }
-.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
-.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
-.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
-.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
-
-/* with multiple calendars */
-.ui-datepicker.ui-datepicker-multi { width:auto; }
-.ui-datepicker-multi .ui-datepicker-group { float:left; }
-.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
-.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
-.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
-.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
-.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
-.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
-
-/* RTL support */
-.ui-datepicker-rtl { direction: rtl; }
-.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-
-/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
-.ui-datepicker-cover {
- display: none; /*sorry for IE5*/
- display/**/: block; /*sorry for IE5*/
- position: absolute; /*must have*/
- z-index: -1; /*must have*/
- filter: mask(); /*must have*/
- top: -4px; /*must have*/
- left: -4px; /*must have*/
- width: 200px; /*must have*/
- height: 200px; /*must have*/
-}/*!
- * jQuery UI Progressbar 1.8.19
- *
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Progressbar#theming
- */
-.ui-progressbar { height:2em; text-align: left; overflow: hidden; }
-.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
diff --git a/app/assets/stylesheets/uploadify.css b/app/assets/stylesheets/uploadify.css
deleted file mode 100644
index 405f59c..0000000
--- a/app/assets/stylesheets/uploadify.css
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Uploadify v2.1.4
-Release Date: November 8, 2010
-
-Copyright (c) 2010 Ronnie Garcia, Travis Nickels
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-.uploadifyQueueItem {
- background-color: #F5F5F5;
- border: 2px solid #E5E5E5;
- font: 11px Verdana, Geneva, sans-serif;
- margin-top: 5px;
- padding: 10px;
- width: 350px;
-}
-.uploadifyError {
- background-color: #FDE5DD !important;
- border: 2px solid #FBCBBC !important;
-}
-.uploadifyQueueItem .cancel {
- float: right;
-}
-.uploadifyQueue .completed {
- background-color: #E5E5E5;
-}
-.uploadifyProgress {
- background-color: #E5E5E5;
- margin-top: 10px;
- width: 100%;
-}
-.uploadifyProgressBar {
- background-color: #0099FF;
- height: 3px;
- width: 1px;
-}
\ No newline at end of file
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 6d00948..23d4348 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -2,9 +2,9 @@ class ApplicationController < ActionController::Base
before_filter :set_locale, :authenticate_user!
layout :guess_layout
- rescue_from ActiveRecord::RecordNotFound, :with => :page_not_found
- rescue_from Clover::PageNotFoundError, :with => :page_not_found
- rescue_from Clover::UnauthorizedAccessError, :with => :unauthorized_access
+ rescue_from ActiveRecord::RecordNotFound, with: :page_not_found
+ rescue_from Clover::PageNotFoundError, with: :page_not_found
+ rescue_from Clover::UnauthorizedAccessError, with: :unauthorized_access
protect_from_forgery
@@ -21,40 +21,32 @@ def set_locale
end
def devise_layout
- if controller_name == 'registrations'
- set_tab :edit_user
- return 'dashboard'
- end
-
- 'sessions'
+ return 'sessions' unless controller_name === 'registrations'
+ set_tab :edit_user
+ return 'dashboard'
end
def website_layout
- return "themes/#{ site[:theme] }/theme" if site[:theme].present?
- 'themes/default/theme'
+ return "themes/#{ site[:theme] || 'default' }/theme"
end
def dashboard_controller?
- params[:controller] =~ /^dashboard\/[a-z_]+$/
+ controller_path =~ /^dashboard\/[a-z_]+$/
end
def guess_layout
- if dashboard_controller?
- 'dashboard'
- elsif devise_controller?
- devise_layout
- else
- website_layout
- end
+ return devise_layout if devise_controller?
+ return 'dashboard' if dashboard_controller?
+
+ website_layout
end
protected
def unauthorized_access
- flash[:info] = t 'messages.unauthorized_access'
- redirect_to new_user_session_path
+ redirect_to new_user_session_path, flash: { info: t('messages.unauthorized_access') }
end
def page_not_found
- render 'public/404.html', :formats => [ :html ], :status => :not_found, :layout => false
+ render 'public/404', formats: [ :html ], status: :not_found, layout: false
end
end
diff --git a/app/controllers/contact_forms_controller.rb b/app/controllers/contact_forms_controller.rb
index d7b79a1..69a6a13 100644
--- a/app/controllers/contact_forms_controller.rb
+++ b/app/controllers/contact_forms_controller.rb
@@ -2,12 +2,12 @@ class ContactFormsController < ApplicationController
def create
@contact_form = ContactForm.new params[:contact_form]
- if @contact_form.valid?
+ if @contact_form.deliver
flash[:success] = t 'messages.email_sent'
- redirect_to root_path
else
flash[:error] = t 'messages.failed_miserably'
- redirect_to request.env["HTTP_REFERER"]
end
+
+ redirect_to :back
end
end
diff --git a/app/controllers/dashboard/assets_controller.rb b/app/controllers/dashboard/assets_controller.rb
deleted file mode 100644
index 3b0c65e..0000000
--- a/app/controllers/dashboard/assets_controller.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-class Dashboard::AssetsController < ApplicationController
- before_filter :fix_content_type
-
- def create
- @asset = Asset.new :attachable_type => params[:attachable_type], :attachable_id => params[:attachable_id]
- @asset.asset = params[:Filedata]
-
- if @asset.save!
- success = { :status => 'success', :thumbnail => @asset.asset.url(:small) }.to_json
- render :json => success
- else
- render :json => { :status => 'error' }.to_json
- end
- end
-
- def destroy
- end
-
- private
- def fix_content_type
- params[:Filedata].content_type = MIME::Types.type_for(params[:Filedata].original_filename).to_s
- end
-end
diff --git a/app/controllers/dashboard/pages_controller.rb b/app/controllers/dashboard/pages_controller.rb
index 8e788d6..fa83b63 100644
--- a/app/controllers/dashboard/pages_controller.rb
+++ b/app/controllers/dashboard/pages_controller.rb
@@ -1,52 +1,42 @@
class Dashboard::PagesController < ApplicationController
- before_filter :set_page, :only => [ :edit, :update, :destroy ]
+ before_filter :find_page, only: [ :edit, :update, :destroy ]
- set_tab :list_pages, :only => :index
- set_tab :new_page, :only => :new
+ set_tab :list_pages, only: :index
+ set_tab :new_page, only: :new
- # GET /pages
def index
- @pages = Page.page params[:page]
+ @pages = Page.includes( :section ).page params[:page]
end
- # GET /pages/new
def new
@page = Page.new
end
- # POST /pages
def create
- @page = Page.new params[:page].except('keywords')
- @page.keyword_list = params[:page][:keywords] if params[:page][:keywords].present?
+ @page = Page.new params[:page]
if @page.save
- flash[:success] = t 'messages.created_successfully'
- redirect_to dashboard_pages_path
+ redirect_to dashboard_pages_path, flash: { success: t('messages.created_successfully') }
else
render :new
end
end
- # PUT /pages/1
def update
- @page.keyword_list = params[:page][:keywords] if params[:page][:keywords].present?
-
- if @page.update_attributes params[:page].except('keywords')
- flash[:success] = t 'messages.updated_successfully'
- redirect_to dashboard_pages_path
+ if @page.update_attributes params[:page]
+ redirect_to edit_dashboard_page_path( @page ), flash: { success: t('messages.updated_successfully') }
else
render :edit
end
end
- # DELETE /pages/1
def destroy
@page.destroy
redirect_to dashboard_pages_path
end
private
- def set_page
- @page ||= Page.find params[:id]
+ def find_page
+ @page = Page.find params[:id]
end
end
diff --git a/app/controllers/dashboard/sections_controller.rb b/app/controllers/dashboard/sections_controller.rb
index 3de13f9..506d4f9 100644
--- a/app/controllers/dashboard/sections_controller.rb
+++ b/app/controllers/dashboard/sections_controller.rb
@@ -1,12 +1,12 @@
class Dashboard::SectionsController < ApplicationController
- before_filter :set_section, :only => [ :edit, :update, :destroy ]
+ before_filter :find_section, only: [ :edit, :update, :destroy ]
- set_tab :list_sections, :only => :index
- set_tab :new_section, :only => :new
+ set_tab :list_sections, only: :index
+ set_tab :new_section, only: :new
# GET /sections
def index
- @sections = Section.page params[:page]
+ @sections = Section.includes( :main_section ).page params[:page]
end
# GET /sections/1
@@ -24,8 +24,7 @@ def create
@section = Section.new params[:section]
if @section.save
- flash[:success] = t 'messages.created_successfully'
- redirect_to dashboard_sections_path
+ redirect_to dashboard_sections_path, flash: { success: t('messages.created_successfully') }
else
render :new
end
@@ -34,8 +33,7 @@ def create
# PUT /sections/1
def update
if @section.update_attributes params[:section]
- flash[:success] = t 'messages.updated_successfully'
- redirect_to dashboard_sections_path
+ redirect_to dashboard_sections_path, flash: { success: t('messages.updated_successfully') }
else
render :edit
end
@@ -48,7 +46,7 @@ def destroy
end
private
- def set_section
- @section ||= Section.find params[:id]
+ def find_section
+ @section = Section.find params[:id]
end
end
diff --git a/app/controllers/dashboard/settings_controller.rb b/app/controllers/dashboard/settings_controller.rb
index 99ff9a3..9bc9020 100644
--- a/app/controllers/dashboard/settings_controller.rb
+++ b/app/controllers/dashboard/settings_controller.rb
@@ -1,8 +1,8 @@
class Dashboard::SettingsController < ApplicationController
- before_filter :set_setting, :only => [ :edit, :update, :destroy ]
+ before_filter :find_setting, only: [ :edit, :update, :destroy ]
- set_tab :list_settings, :only => :index
- set_tab :new_setting, :only => :new
+ set_tab :list_settings, only: :index
+ set_tab :new_setting, only: :new
def index
@settings = Setting.page params[:page]
@@ -12,52 +12,35 @@ def new
@setting = Setting.new
end
- def edit
- @themes = get_themes if @setting.name == 'theme'
- end
-
def create
@setting = Setting.new params[:setting]
if @setting.save
- flash[:success] = t 'messages.created_successfully'
- redirect_to dashboard_settings_path
+ redirect_to dashboard_settings_path, flash: { success: t('messages.created_successfully') }
else
render :new
end
end
def update
- params[:setting] = params[:setting].except(:name) if !@setting.destroyable?
-
if @setting.update_attributes params[:setting]
- flash[:success] = t 'messages.updated_successfully'
- redirect_to dashboard_settings_path
+ redirect_to dashboard_settings_path, flash: { success: t('messages.updated_successfully') }
else
render :edit
end
end
def destroy
- if @setting.delete
- flash[:success] = t 'messages.deleted_successfully'
- redirect_to dashboard_settings_path
+ if @setting.destroyable? and @setting.destroy
+ redirect_to dashboard_settings_path, flash: { success: t('messages.deleted_successfully') }
else
- flash[:error] = t 'messages.failed_miserably'
- redirect_to dashboard_settings_path
+ redirect_to dashboard_settings_path, flash: { error: t('messages.failed_miserably') }
end
end
private
- def get_themes
- themes_path = File.join Rails.root, 'app', 'views', 'layouts', 'themes'
-
- Dir.new(themes_path).select do |dir|
- dir =~ /^[a-z0-9_-]+$/i && File.directory?( File.join themes_path, dir )
- end
- end
-
- def set_setting
- @setting ||= Setting.find params[:id]
+ def find_setting
+ @setting = Setting.find params[:id]
+ @themes = $themes
end
end
diff --git a/app/controllers/dashboard/users_controller.rb b/app/controllers/dashboard/users_controller.rb
index 654ab03..4196a39 100644
--- a/app/controllers/dashboard/users_controller.rb
+++ b/app/controllers/dashboard/users_controller.rb
@@ -1,5 +1,5 @@
class Dashboard::UsersController < ApplicationController
- set_tab :list_users, :only => :index
+ set_tab :list_users, only: :index
def index
@users = User.order('username').page params[:page]
@@ -8,9 +8,7 @@ def index
def destroy
@user = User.find params[:id]
- if @user.delete
- flash[:success] = t('messages.deleted_successfully')
- redirect_to :action => :index
- end
+ @user.destroy
+ redirect_to dashboard_users_path
end
end
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index bb48ba9..7a4a722 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -1,33 +1,25 @@
class PagesController < ApplicationController
- skip_before_filter :authenticate_user!
+ skip_before_filter :authenticate_user!
# GET /:section/:page
# GET /:section/:subsection/:page
def show
- @page = subsection.pages.published.find( params[:page] ) if subsection
- @page ||= section.pages.published.find( params[:page] ) if section
-
- raise Clover::PageNotFoundError if @page.blank?
-
- if @page.has_contact?
- @contact_form = render_to_string :partial => 'contact_forms/contact_form', :object => ContactForm.new
- end
+ @section, @subsection, @page = *Section.with_children( params )
+ raise_if_page_not_found!
end
#GET /
def home
@page = Page.published.home_page
@section = @page.section
+
+ raise_if_page_not_found!
+
render :show
end
private
- def subsection
- @subsection ||= Section.where( :slug => params[:subsection] ).first
- end
-
- def section
- @section = @subsection.try :main_section
- @section ||= Section.find params[:section]
+ def raise_if_page_not_found!
+ raise Clover::PageNotFoundError unless @page.present?
end
end
diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb
index 7953108..f19b492 100644
--- a/app/controllers/users/registrations_controller.rb
+++ b/app/controllers/users/registrations_controller.rb
@@ -1,10 +1,10 @@
module Users
class RegistrationsController < Devise::RegistrationsController
- before_filter :deactivate_action, :only => [ :create, :new ]
+ before_filter :deactivate_action, only: [ :create, :new ]
private
def deactivate_action
- render 'public/404', :formats => :html, :status => :not_found, :layout => false
+ render 'public/404', formats: :html, status: :not_found, layout: false
end
end
end
diff --git a/app/exceptions/clover.rb b/app/exceptions/clover.rb
index c9fb8d2..b45e9ee 100644
--- a/app/exceptions/clover.rb
+++ b/app/exceptions/clover.rb
@@ -1,3 +1,5 @@
+require 'active_record/errors'
+
module Clover
class UnauthorizedAccessError < SecurityError; end
class PageNotFoundError < ActiveRecord::RecordNotFound; end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index cf5ea62..de6be79 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,40 +1,2 @@
module ApplicationHelper
- def main_sections_collection section_name
- Section.where("name != '#{section_name}'").map { |section| [ section.name, section.id ] }
- end
-
- def all_sections_collection
- Section.all.map { |section| [ section.name, section.id ] }
- end
-
- def article_kinds
- types = 'dashboard.articles.types'
- [ %W(#{t("#{types}.post")} post), %W(#{t("#{types}.review")} review), %W(#{t("#{types}.news")} news) ]
- end
-
- def meta(name, content)
- %()
- end
-
- def new_child_fields_template(form_builder, association, options={})
- options[:object] ||= form_builder.object.class.reflect_on_association(association).klass.new
- options[:partial] ||= association.to_s.singularize
- options[:form_builder_local] ||= :f
-
- content_for :resource_templates do
- content_tag(:div, :id => "#{options[:partial]}_fields_template", :style => "display: none") do
- form_builder.fields_for(association, options[:object], :child_index => "new_#{association}") do |f|
- render :partial => options[:partial], :locals => { options[:form_builder_local] => f }
- end
- end
- end
- end
-
- def add_child_fields_link(name, association)
- link_to name, "#", :class => 'add_child', :"data-association" => association
- end
-
- def remove_child_fields_link(name, form_builder)
- form_builder.hidden_field(:_destroy) + link_to(name, "#", :class => "remove_child")
- end
end
diff --git a/app/helpers/markdown_helper.rb b/app/helpers/markdown_helper.rb
new file mode 100644
index 0000000..c37fb93
--- /dev/null
+++ b/app/helpers/markdown_helper.rb
@@ -0,0 +1,6 @@
+module MarkdownHelper
+ def markdown text
+ renderer = PygmentsRenderer.new $render_options
+ Redcarpet::Markdown.new( renderer, $markdown_extensions ).render( text ).html_safe
+ end
+end
diff --git a/app/middleware/flash_session_cookie_middleware.rb b/app/middleware/flash_session_cookie_middleware.rb
deleted file mode 100644
index 9716c30..0000000
--- a/app/middleware/flash_session_cookie_middleware.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'rack/utils'
-
-class FlashSessionCookieMiddleware
- def initialize(app, session_key = '_session_id')
- @app = app
- @session_key = session_key
- end
-
- def call(env)
- if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
- req = Rack::Request.new(env)
- env['HTTP_COOKIE'] = [ @session_key, req.params[@session_key] ].join('=').freeze unless req.params[@session_key].nil?
- env['HTTP_ACCEPT'] = "#{req.params['_http_accept']}".freeze unless req.params['_http_accept'].nil?
- end
-
- @app.call(env)
- end
-end
diff --git a/app/models/asset.rb b/app/models/asset.rb
deleted file mode 100644
index d8ccc0a..0000000
--- a/app/models/asset.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class Asset < ActiveRecord::Base
- belongs_to :attachable, :polymorphic => true
-
- has_attached_file :asset, :styles => {
- :squared => "120x80#",
- :small => "120x80>",
- :medium => "180x120>",
- :big => "300x225>"
- }
-
- validates_attachment_presence :asset
- validates_attachment_content_type :asset, :content_type => [ 'image/jpeg', 'image/png', 'image/gif' ]
- validates_attachment_size :asset, :less_than => 20.megabytes
-end
diff --git a/app/models/contact_form.rb b/app/models/contact_form.rb
index de3ca5a..4b24065 100644
--- a/app/models/contact_form.rb
+++ b/app/models/contact_form.rb
@@ -1,17 +1,13 @@
-class ContactForm
- include ActiveModel::Validations
-
- validates_presence_of :recipient, :subject, :body
- validates_format_of :recipient, :with => /\b[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}\b/i
- validates_length_of :body, :minimum => 10
-
- attr_accessor :recipient, :subject, :body
-
- def initialize(attributes = {})
- @recipient = attributes[:recipient]
- @body = attributes[:body]
- @subject = attributes[:subject]
-
- yield(self) if block_given?
+class ContactForm < MailForm::Base
+ attribute :name, validate: true
+ attribute :email, validate: /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
+ attribute :subject
+ attribute :message
+
+ def headers
+ {
+ subject: subject,
+ from: %("#{ name }" <#{ email }>)
+ }
end
end
diff --git a/app/models/page.rb b/app/models/page.rb
index d3fccec..1cdb6bc 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -1,32 +1,31 @@
class Page < ActiveRecord::Base
extend FriendlyId
- acts_as_taggable_on :keywords
-
- has_many :assets, :as => :attachable
belongs_to :section
before_save :check_home_page
- validates :name, :content, :section, :presence => true
- validates :name, :uniqueness => true
+ validates :name, :content, :section, presence: true
+ validates :name, uniqueness: true
- friendly_id :name, :use => :slugged
+ friendly_id :name, use: :slugged
attr_accessible :name, :content, :section, :home_page, :published, :section_id, :has_contact
- scope :published, where(:published => true)
+ scope :published, -> { where published: true }
+
+ delegate :name, to: :section, prefix: true
def self.home_page
- where( :home_page => true ).first
+ where( home_page: true ).first
end
private
def check_home_page
- if home_page?
- Page.where("home_page = ?", true).each do |page|
- page.update_attributes( :home_page => false ) if page != self
- end
+ return unless home_page?
+
+ Page.where( home_page: true ).find_each do |page|
+ page.update_attributes!( home_page: false ) unless page === self
end
end
end
diff --git a/app/models/section.rb b/app/models/section.rb
index 02fa036..49881ef 100644
--- a/app/models/section.rb
+++ b/app/models/section.rb
@@ -1,13 +1,49 @@
class Section < ActiveRecord::Base
extend FriendlyId
- has_many :pages
- has_many :subsections, :class_name => "Section", :foreign_key => :main_section_id
- belongs_to :main_section, :class_name => "Section", :foreign_key => :main_section_id
+ has_many :pages, dependent: :destroy
- validates :name, :presence => true, :uniqueness => true
+ has_many :subsections, class_name: "Section", foreign_key: :main_section_id, dependent: :destroy
+ belongs_to :main_section, class_name: "Section", foreign_key: :main_section_id
- friendly_id :name, :use => :slugged
+ validates :name, presence: true, uniqueness: true
+
+ friendly_id :name, use: :slugged
attr_accessible :name, :main_section_id
+
+ delegate :name, to: :main_section, prefix: true, allow_nil: true
+
+ def section_collection
+ return scoped_collection unless new_record?
+
+ Section.section_collection
+ end
+
+ def self.section_collection
+ Section.select( 'name, id' ).all.map { |section| [ section.name, section.id ] }
+ end
+
+ def self.with_children( params )
+ section = includes( :pages ).find_by_slug params[:section]
+ subsection = fetch_subsection( section, params[:subsection] ) if section and params[:subsection]
+ page = fetch_page ( subsection || section ), params[:page]
+
+ [ section, subsection, page ]
+ end
+
+ def self.fetch_subsection( section, slug )
+ section.subsections.find_by_slug slug
+ end
+
+ def self.fetch_page( section, slug )
+ return if section.nil?
+ section.pages.published.find_by_slug slug
+ end
+
+ private
+ def scoped_collection
+ Section.select( 'name, id' ).where( "id != ?", id ).where( main_section_id: nil ).
+ map { |section| [ section.name, section.id ] }
+ end
end
diff --git a/app/models/setting.rb b/app/models/setting.rb
index 4ab1973..370b91c 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -1,27 +1,19 @@
class Setting < ActiveRecord::Base
- validates_presence_of :name, :value
- validates_uniqueness_of :name
+ validates :name, :value, presence: true
+ validates :name, uniqueness: true
- validates_format_of :name, :with => /^[a-z0-9_]+$/
- attr_accessible :name, :value, :description
+ validates_format_of :name, with: /\A[a-z0-9_]+\z/i
attr_accessible :name, :value, :description, :destroyable
- def delete
- return super if destroyable?
- false
- end
-
- def delete!
- return super if destroyable?
- false
+ def name=(value)
+ self[:name] = value if destroyable?
end
def self.get_site_settings
- site = {}
- Setting.select('name, value').each do |setting|
+ Setting.select('name, value').inject( {} ) do |site, setting|
site[setting.name.to_sym] = setting.value
+ site
end
- site
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index ed34d28..7fe01c0 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,14 +1,16 @@
class User < ActiveRecord::Base
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable, :lockable, :registerable
- validates_format_of :username, :with => /^([a-z0-9\-_.]{2,31})$/i
+ validates :username, presence: true, uniqueness: true
+ validates :username, format: { with: /\A[\w\.\-@]+\z/ }
+ validates :username, length: { minimum: 4, maximum: 10 }
attr_accessor :login
- attr_accessible :email, :password, :password_confirmation, :remember_me, :avatar, :username, :login
+ attr_accessible :email, :password, :password_confirmation, :remember_me, :username, :login
protected
def self.find_for_database_authentication(conditions)
login = conditions.delete :login
- where(conditions).where([ "username = :value OR email = :value", { :value => login } ]).first
+ where(conditions).where([ "username = :value OR email = :value", { value: login } ]).first
end
end
diff --git a/app/views/contact_forms/_contact_form.html.haml b/app/views/contact_forms/_contact_form.html.haml
index ebd71af..263108f 100644
--- a/app/views/contact_forms/_contact_form.html.haml
+++ b/app/views/contact_forms/_contact_form.html.haml
@@ -1,12 +1,8 @@
%fieldset
- = form_for contact_form, :as => :contact_form, :url => contact_form_path do |contact|
- = contact.label :recipient
- = contact.text_field :recipient
-
- = contact.label :subject
- = contact.text_field :subject
-
- = contact.label :body
- = contact.text_area :body
+ = simple_form_for ContactForm.new, as: :contact_form, url: contact_form_path do |contact|
+ = contact.input :name
+ = contact.input :email
+ = contact.input :subject
+ = contact.input :message, as: :text
= contact.submit :submit
diff --git a/app/views/contact_forms/new.html.haml b/app/views/contact_forms/new.html.haml
deleted file mode 100644
index 8d66559..0000000
--- a/app/views/contact_forms/new.html.haml
+++ /dev/null
@@ -1,12 +0,0 @@
-%fieldset
- = form_for @contact_form, :validate => true do |contact|
- = contact.label :recipient
- = contact.text_field :recipient
-
- = contact.label :subject
- = contact.text_field :subject
-
- = contact.label :body
- = contact.text_area :body
-
- = contact.submit :submit
diff --git a/app/views/dashboard/pages/_form.html.haml b/app/views/dashboard/pages/_form.html.haml
new file mode 100644
index 0000000..88a5b1f
--- /dev/null
+++ b/app/views/dashboard/pages/_form.html.haml
@@ -0,0 +1,18 @@
+= simple_form_for [ :dashboard, page ] do |f|
+ #page_content
+ = f.input :name, placeholder: t('common.descriptions.url.item_name', item: Page.model_name.human.downcase )
+
+ = f.pagedown_editor :content
+
+ = f.label :section do
+ = t 'activerecord.attributes.page.section'
+ %small= t 'dashboard.page.descriptions.section'
+
+ = f.select :section_id, Section.section_collection
+
+ .buttonset
+ = f.input :home_page, input_html: { class: :home_page }
+ = f.input :has_contact, input_html: { class: :contact_form }
+ = f.input :published, input_html: { class: :published }
+
+ = f.submit t( 'common.forms.submit' )
diff --git a/app/views/dashboard/pages/_page.html.haml b/app/views/dashboard/pages/_page.html.haml
index ab6bcbd..0400377 100644
--- a/app/views/dashboard/pages/_page.html.haml
+++ b/app/views/dashboard/pages/_page.html.haml
@@ -1,8 +1,8 @@
-%tr{ :class => cycle(:odd, :even) }
+%tr{ class: cycle(:odd, :even) }
%td= link_to page.name, edit_dashboard_page_path( page )
- %td= page.section.name
- %td= l page.created_at, :format => :short
- %td= l page.updated_at, :format => :short
+ %td= page.section_name
+ %td= l page.created_at, format: :short
+ %td= l page.updated_at, format: :short
%td
- = link_to t('links.edit'), edit_dashboard_page_path( page ), :class => 'icon edit'
- = link_to t('links.destroy'), dashboard_page_path( page ), :confirm => t('common.messages.are_you_sure'), :method => :delete, :class => 'icon delete'
\ No newline at end of file
+ = link_to t('links.edit'), edit_dashboard_page_path( page ), class: 'icon edit'
+ = link_to t('links.destroy'), dashboard_page_path( page ), class: 'icon delete', confirm: t('common.messages.are_you_sure'), data: { method: :delete }
diff --git a/app/views/dashboard/pages/_page_editor.html.haml b/app/views/dashboard/pages/_page_editor.html.haml
deleted file mode 100644
index 3719650..0000000
--- a/app/views/dashboard/pages/_page_editor.html.haml
+++ /dev/null
@@ -1,36 +0,0 @@
-= form_for [:dashboard, page_editor ], :validate => true do |f|
- #page_content
- = f.hidden_field :keywords, :id => :final_keywords_list
- %label{ :for => :page_name }
- = t 'common.fields.name'
- %small= t 'common.descriptions.url.item_name', :item => t('activerecord.models.page').downcase
- = f.text_field :name
- = f.text_area :content, :class => 'wymeditor'
-
- %label{ :for => :page_section_id }
- = t 'activerecord.attributes.page.section'
- %small= t 'dashboard.page.descriptions.section'
- = f.select :section_id, all_sections_collection
-
- .buttonset
- = f.label :home_page
- = f.check_box :home_page, :class => :home_page
- = f.label :has_contact
- = f.check_box :has_contact, :class => :contact_form
- = f.label :published
- = f.check_box :published, :class => :published
-
- %button.wymupdate= t 'common.forms.submit'
-
-:javascript
- $(document).ready(function() {
- $('#tabs').tabs();
- $('.wymupdate').button({ icons: { primary: "ui-icon-circle-check" } });
- $('.buttonset').buttonset();
- $('.home_page').button({ icons: { primary: "ui-icon-home" } });
- $('.contact_form').button({ icons: { primary: "ui-icon-mail-closed" } });
- $('.published').button({ icons: { primary: "ui-icon-check" } });
- $('#keyword_button').button({ icons: { primary: "ui-icon-circle-plus" } });
- add_keywords();
- existing_keywords();
- });
diff --git a/app/views/dashboard/pages/edit.haml b/app/views/dashboard/pages/edit.haml
index 97e61d6..e7640b3 100644
--- a/app/views/dashboard/pages/edit.haml
+++ b/app/views/dashboard/pages/edit.haml
@@ -1,23 +1 @@
-#tabs
- %ul
- %li= link_to t('links.item_details', :item => t('activerecord.models.page')), '#tabs-1'
- %li= link_to t('links.item_keywords', :item => t('activerecord.models.page')), '#tabs-2'
- %li= link_to t('links.item_assets', :item => t('activerecord.models.page')), '#tabs-3'
- #tabs-1
- = render :partial => 'page_editor', :object => @page
- #tabs-2
- = render 'shared/keywords', :resource_keywords => @page.keywords.map(&:name)
- .spacer
- #tabs-3
- .splitcontentleft
- #images_list
- - @page.assets.each do |asset|
- = image_tag asset.asset.url(:small)
- %file#uploadify{ :name => 'asset' }
- .splitcontentright
- = render 'shared/uploadify', :object => @page
- .spacer
-:javascript
- $(function() {
- add_images();
- })
+= render 'form', page: @page
diff --git a/app/views/dashboard/pages/index.haml b/app/views/dashboard/pages/index.haml
index dffe86c..9130674 100644
--- a/app/views/dashboard/pages/index.haml
+++ b/app/views/dashboard/pages/index.haml
@@ -1,16 +1,18 @@
-%h2= t 'common.headers.item_list', :item => t('activerecord.models.page').pluralize
+%h2= t 'common.headers.item_list', item: Page.model_name.human( count: 0 )
+
%p.info
%span.bold= t('messages.information') + ':'
= t 'dashboard.page.instructions.index'
-%table.tabular{ :cellpadding => 0, :cellspacing => 0}
+%table.tabular{ cellpadding: 0, cellspacing: 0 }
%thead
%tr
%th= t 'common.fields.name'
- %th= t 'activerecord.models.section'
+ %th= Section.model_name.human
%th= t 'common.fields.created_at'
%th= t 'common.fields.updated_at'
%th= t 'common.messages.options'
%tbody
- = render :partial => 'page', :collection => @pages
+ = render @pages
+
= will_paginate @pages
diff --git a/app/views/dashboard/pages/new.haml b/app/views/dashboard/pages/new.haml
index a614893..e7640b3 100644
--- a/app/views/dashboard/pages/new.haml
+++ b/app/views/dashboard/pages/new.haml
@@ -1,9 +1 @@
-#tabs
- %ul
- %li= link_to t('links.item_details', :item => t('activerecord.models.page')), '#tabs-1'
- %li= link_to t('links.item_keywords', :item => t('activerecord.models.page')), '#tabs-2'
- #tabs-1
- = render :partial => 'page_editor', :object => @page
- #tabs-2
- = render :partial => 'shared/keywords', :locals => { :resource_keywords => @page.keywords.map(&:name) }
- .clear
+= render 'form', page: @page
diff --git a/app/views/dashboard/sections/_form.html.haml b/app/views/dashboard/sections/_form.html.haml
new file mode 100644
index 0000000..5c69c06
--- /dev/null
+++ b/app/views/dashboard/sections/_form.html.haml
@@ -0,0 +1,19 @@
+= form_for [ :dashboard, section ] do |f|
+ .columns
+ .half
+ %label{ for: :section_name }
+ = Section.model_name.human
+ %small= t 'dashboard.sections.descriptions.name'
+ = f.text_field :name
+
+ %label{ for: :main_section_id }
+ = t 'activerecord.attributes.section.main_section'
+ %small= t 'dashboard.sections.descriptions.main_section'
+ = f.select :main_section_id, section.section_collection, include_blank: true
+
+ %button#submit= t 'common.forms.submit'
+
+ .half
+ #tips_content.box
+ %h3= t 'common.headers.did_you_know'
+ %p= t 'dashboard.sections.index.tip'
diff --git a/app/views/dashboard/sections/_page_section.html.haml b/app/views/dashboard/sections/_page_section.html.haml
deleted file mode 100644
index 47bfd25..0000000
--- a/app/views/dashboard/sections/_page_section.html.haml
+++ /dev/null
@@ -1,25 +0,0 @@
-= form_for [ :dashboard, page_section ], :validate => true do |f|
- .columns
- .half
- %label{ :for => :section_name }
- = t 'activerecord.models.section'
- %small= t 'dashboard.sections.descriptions.name'
- = f.text_field :name
-
- %label{ :for => :main_section_id }
- = t 'activerecord.attributes.section.main_section'
- %small= t 'dashboard.sections.descriptions.main_section'
- = f.select :main_section_id, main_sections_collection(page_section.name), :include_blank => true
-
- %button#submit= t 'common.forms.submit'
-
- .half
- #tips_content.box
- %h3= t 'common.headers.did_you_know'
- %p= t 'dashboard.sections.index.tip'
-
-:javascript
- $(document).ready(function() {
- $('#submit').button({ icons: { primary: 'ui-icon-circle-check' } });
- $('#sections_menu_link').addClass('active');
- });
diff --git a/app/views/dashboard/sections/_section.html.haml b/app/views/dashboard/sections/_section.html.haml
index 0ac5067..f193350 100644
--- a/app/views/dashboard/sections/_section.html.haml
+++ b/app/views/dashboard/sections/_section.html.haml
@@ -1,9 +1,9 @@
-%tr{ :class => cycle(:odd, :even) }
+%tr{ class: cycle(:odd, :even) }
%td= section.name
- %td= section.main_section.name if section.main_section.present?
- %td= l section.created_at, :format => :short
- %td= l section.updated_at, :format => :short
+ %td= section.main_section_name
+ %td= l section.created_at, format: :short
+ %td= l section.updated_at, format: :short
%td
- = link_to t('links.edit'), edit_dashboard_section_path(section), :class => 'icon edit'
- = link_to t('links.destroy'), dashboard_section_path(section), :confirm => t('common.messages.are_you_sure'), :method => :delete, :class => 'icon delete'
+ = link_to t('links.edit'), edit_dashboard_section_path( section.id ), class: 'icon edit'
+ = link_to t('links.destroy'), dashboard_section_path( section.id ), class: 'icon delete', confirm: t('common.messages.are_you_sure'), data: { method: :delete }
diff --git a/app/views/dashboard/sections/edit.haml b/app/views/dashboard/sections/edit.haml
index 767d9a9..4885ab2 100644
--- a/app/views/dashboard/sections/edit.haml
+++ b/app/views/dashboard/sections/edit.haml
@@ -1,2 +1,2 @@
-%h2= t 'links.edit_item', :item => t('activerecord.models.section')
-= render :partial => 'page_section', :object => @section
+%h2= t 'links.edit_item', item: Section.model_name.human
+= render 'form', section: @section
diff --git a/app/views/dashboard/sections/index.haml b/app/views/dashboard/sections/index.haml
index bc270d6..0df8abd 100644
--- a/app/views/dashboard/sections/index.haml
+++ b/app/views/dashboard/sections/index.haml
@@ -1,9 +1,9 @@
-%h2= t 'common.headers.item_list', :item => t('activerecord.models.section')
+%h2= t 'common.headers.item_list', item: Section.model_name.human( count: 0 )
%p.info
%span.bold= t('messages.information') + ':'
= t '.information'
-%table.tabular{ :cellpading => 0, :cellspacing => 0 }
+%table.tabular{ cellpading: 0, cellspacing: 0 }
%thead
%tr
%th= t 'activerecord.attributes.section.name'
@@ -11,5 +11,7 @@
%th= t 'common.fields.created_at'
%th= t 'common.fields.updated_at'
%th= t 'common.messages.options'
- %tbody= render :partial => 'section', :collection => @sections
+ %tbody
+ = render @sections
+
= will_paginate @sections
diff --git a/app/views/dashboard/sections/new.haml b/app/views/dashboard/sections/new.haml
index 415e0d5..45ad999 100644
--- a/app/views/dashboard/sections/new.haml
+++ b/app/views/dashboard/sections/new.haml
@@ -1,2 +1,2 @@
-%h2= t 'links.new_item', :item => t("activerecord.models.section")
-= render :partial => 'page_section', :object => @section
+%h2= t 'links.new_item', item: Section.model_name.human
+= render 'form', section: @section
diff --git a/app/views/dashboard/settings/_setting_editor.html.haml b/app/views/dashboard/settings/_form.html.haml
similarity index 70%
rename from app/views/dashboard/settings/_setting_editor.html.haml
rename to app/views/dashboard/settings/_form.html.haml
index dc2661d..ea74a9f 100644
--- a/app/views/dashboard/settings/_setting_editor.html.haml
+++ b/app/views/dashboard/settings/_form.html.haml
@@ -1,4 +1,4 @@
-= form_for [ :dashboard, setting_editor ], :validate => true do |f|
+= form_for [ :dashboard, setting ] do |f|
.columns
.half
= f.label :name
@@ -19,8 +19,3 @@
#tips_content.box
%h3= t 'common.headers.did_you_know'
%p= t 'dashboard.settings.forms.tip'
-
-:javascript
- $(function() {
- $("#submit").button({ icons: { primary: 'ui-icon-circle-check' } });
- });
diff --git a/app/views/dashboard/settings/_setting.html.haml b/app/views/dashboard/settings/_setting.html.haml
index 01b6687..873467a 100644
--- a/app/views/dashboard/settings/_setting.html.haml
+++ b/app/views/dashboard/settings/_setting.html.haml
@@ -1,8 +1,8 @@
-%tr{ :class => cycle(:odd, :even) }
+%tr{ class: cycle(:odd, :even) }
%td= setting.name
%td= setting.description
- %td= l setting.created_at, :format => :short
- %td= l setting.updated_at, :format => :short
+ %td= l setting.created_at, format: :short
+ %td= l setting.updated_at, format: :short
%td
- = link_to t('links.edit'), edit_dashboard_setting_path(setting), :class => 'icon edit'
- = link_to t('links.destroy'), dashboard_setting_path(setting), :confirm => t('common.messages.are_you_sure'), :method => :delete, :class => 'icon delete' if setting.destroyable?
+ = link_to t('links.edit'), edit_dashboard_setting_path(setting), class: 'icon edit'
+ = link_to t('links.destroy'), dashboard_setting_path(setting), confirm: t('common.messages.are_you_sure'), method: :delete, class: 'icon delete' if setting.destroyable?
diff --git a/app/views/dashboard/settings/edit.html.haml b/app/views/dashboard/settings/edit.html.haml
index 5511557..377625f 100644
--- a/app/views/dashboard/settings/edit.html.haml
+++ b/app/views/dashboard/settings/edit.html.haml
@@ -1,2 +1,2 @@
-%h2= t 'links.edit_item', :item => t('activerecord.models.setting')
-= render :partial => 'setting_editor', :object => @setting, :locals => { :themes => @themes }
+%h2= t 'links.edit_item', item: Setting.model_name.human
+= render 'form', setting: @setting, themes: @themes
diff --git a/app/views/dashboard/settings/index.html.haml b/app/views/dashboard/settings/index.html.haml
index 569c852..4779c9c 100644
--- a/app/views/dashboard/settings/index.html.haml
+++ b/app/views/dashboard/settings/index.html.haml
@@ -1,10 +1,10 @@
-%h2= t 'common.headers.item_list', :item => t('activerecord.models.setting')
+%h2= t 'common.headers.item_list', item: Setting.model_name.human
%p.info
%span.bold= t('messages.information') + ':'
= t '.instructions'
-%table.tabular{ :cellpadding => 0, :cellspacing => 0 }
+%table.tabular{ cellpadding: 0, cellspacing: 0 }
%thead
%tr
%th= t 'common.fields.name'
@@ -13,5 +13,6 @@
%th= t 'common.fields.updated_at'
%th= t 'common.messages.options'
%tbody
- = render :partial => 'setting', :collection => @settings
+ = render @settings
+
= will_paginate @settings
diff --git a/app/views/dashboard/settings/new.html.haml b/app/views/dashboard/settings/new.html.haml
index 6c05d18..a5a1f62 100644
--- a/app/views/dashboard/settings/new.html.haml
+++ b/app/views/dashboard/settings/new.html.haml
@@ -1,2 +1,2 @@
-%h2= t 'links.new_item', :item => t('activerecord.models.setting')
-= render :partial => 'setting_editor', :object => @setting, :locals => { :themes => @themes }
+%h2= t 'links.new_item', item: Setting.model_name.human
+= render 'form', setting: @setting, themes: @themes
diff --git a/app/views/dashboard/users/_user.html.haml b/app/views/dashboard/users/_user.html.haml
index 68f32c8..3df0bd6 100644
--- a/app/views/dashboard/users/_user.html.haml
+++ b/app/views/dashboard/users/_user.html.haml
@@ -1,7 +1,7 @@
-%tr{ :class => cycle(:odd, :even) }
+%tr{ class: cycle(:odd, :even) }
%td= user.username
%td= user.email
- %td= l(user.confirmed_at, :format => :short) if user.confirmed_at
- %td= l(user.last_sign_in_at, :format => :short) if user.last_sign_in_at
+ %td= l( user.confirmed_at, format: :short ) if user.confirmed_at
+ %td= l( user.last_sign_in_at, format: :short ) if user.last_sign_in_at
%td
- = link_to t('links.destroy'), dashboard_user_path(user), :method => :delete, :confirm => t('common.messages.are_you_sure'), :class => 'icon user_delete'
+ = link_to t('links.destroy'), dashboard_user_path(user), class: 'icon delete', confirm: t('common.messages.are_you_sure'), data: { method: :delete }
diff --git a/app/views/dashboard/users/index.html.haml b/app/views/dashboard/users/index.html.haml
index 12baf29..ea2ec3e 100644
--- a/app/views/dashboard/users/index.html.haml
+++ b/app/views/dashboard/users/index.html.haml
@@ -1,4 +1,4 @@
-%h2= t 'common.headers.item_list', :item => t('activerecord.models.user')
+%h2= t 'common.headers.item_list', item: User.model_name.human
%p.info
%span.bold= t('messages.information') + ':'
= t '.tip'
@@ -12,5 +12,6 @@
%th= t 'activerecord.attributes.user.last_sign_in_at'
%th= t 'common.messages.options'
%tbody
- = render :partial => 'user', :collection => @users
+ = render @users
+
= will_paginate @users
diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml
index 87f8fef..fd7ca69 100644
--- a/app/views/devise/confirmations/new.html.haml
+++ b/app/views/devise/confirmations/new.html.haml
@@ -1,5 +1,5 @@
#login_form
- = form_for resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post } do |f|
+ = form_for resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post } do |f|
%fieldset
= devise_error_messages!
@@ -9,4 +9,4 @@
= f.submit t('devise.forms.resend_confirmation')
.more_options
- = render :partial => "devise/shared/links"
+ = render partial: "devise/shared/links"
diff --git a/app/views/devise/mailer/confirmation_instructions.html.haml b/app/views/devise/mailer/confirmation_instructions.html.haml
index 7840b9c..1b6bdb8 100644
--- a/app/views/devise/mailer/confirmation_instructions.html.haml
+++ b/app/views/devise/mailer/confirmation_instructions.html.haml
@@ -1,4 +1,4 @@
%p
Welcome #{@resource.email}!
%p You can confirm your account through the link below:
-%p= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
+%p= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @resource.confirmation_token)
diff --git a/app/views/devise/mailer/reset_password_instructions.html.haml b/app/views/devise/mailer/reset_password_instructions.html.haml
index 4fc4743..1b8157b 100644
--- a/app/views/devise/mailer/reset_password_instructions.html.haml
+++ b/app/views/devise/mailer/reset_password_instructions.html.haml
@@ -1,6 +1,6 @@
%p
Hello #{@resource.email}!
%p Someone has requested a link to change your password, and you can do this through the link below.
-%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)
+%p= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @resource.reset_password_token)
%p If you didn't request this, please ignore this email.
%p Your password won't change until you access the link above and create a new one.
diff --git a/app/views/devise/mailer/unlock_instructions.html.haml b/app/views/devise/mailer/unlock_instructions.html.haml
index 34b0e9e..543e209 100644
--- a/app/views/devise/mailer/unlock_instructions.html.haml
+++ b/app/views/devise/mailer/unlock_instructions.html.haml
@@ -2,4 +2,4 @@
Hello #{@resource.email}!
%p Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
%p Click the link below to unlock your account:
-%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token)
+%p= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @resource.unlock_token)
diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml
index 3b4e3e7..5cbdf8d 100644
--- a/app/views/devise/passwords/edit.html.haml
+++ b/app/views/devise/passwords/edit.html.haml
@@ -1,5 +1,5 @@
#login_form
- = form_for resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put } do |f|
+ = form_for resource, as: resource_name, url: password_path(resource_name), html: { method: :put } do |f|
%fieldset
= devise_error_messages!
= f.hidden_field :reset_password_token
@@ -13,4 +13,4 @@
= f.submit t('devise.forms.change_password')
.more_options
- = render :partial => "devise/shared/links"
+ = render partial: "devise/shared/links"
diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml
index 4f2a9ae..2f2ea5e 100644
--- a/app/views/devise/passwords/new.html.haml
+++ b/app/views/devise/passwords/new.html.haml
@@ -1,5 +1,5 @@
#login_form
- = form_for resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post } do |f|
+ = form_for resource, as: resource_name, url: password_path(resource_name), html: { method: :post } do |f|
%fieldset
= devise_error_messages!
@@ -8,4 +8,4 @@
= f.submit t('devise.forms.reset_password')
.more_options
- = render :partial => "devise/shared/links"
+ = render partial: "devise/shared/links"
diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml
index cc28dce..72e3d71 100644
--- a/app/views/devise/registrations/edit.html.haml
+++ b/app/views/devise/registrations/edit.html.haml
@@ -1,5 +1,5 @@
-%h2= t 'links.edit_item', :item => t('activerecord.models.user')
-= form_for resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put } do |f|
+%h2= t 'links.edit_item', item: User.model_name.human
+= form_for resource, as: resource_name, url: registration_path(resource_name), html: { method: :put } do |f|
.columns
.half
= devise_error_messages!
@@ -26,6 +26,6 @@
%h3= t 'common.headers.cancel_account'
%p
= t('common.messages.unhappy')
- = link_to t('common.headers.cancel_account'), registration_path(resource_name), :confirm => t('common.messages.are_you_sure'), :method => :delete
+ = link_to t('common.headers.cancel_account'), registration_path(resource_name), confirm: t('common.messages.are_you_sure'), method: :delete
- content_for :sub_nav do
- = render :partial => 'layouts/dashboard/nav/users'
+ = render partial: 'layouts/dashboard/nav/users'
diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml
index e8194f7..9bf0c97 100644
--- a/app/views/devise/registrations/new.html.haml
+++ b/app/views/devise/registrations/new.html.haml
@@ -1,21 +1,21 @@
#login_form
- = form_for resource, :as => resource_name, :url => registration_path(resource_name) do |f|
+ = form_for resource, as: resource_name, url: registration_path(resource_name) do |f|
%fieldset
= devise_error_messages!
= f.label :email
- = f.text_field :email, :class => :"input_text shadowed"
+ = f.text_field :email, class: :"input_text shadowed"
= f.label :username
- = f.text_field :username, :class => :"input_text shadowed"
+ = f.text_field :username, class: :"input_text shadowed"
= f.label :password
- = f.password_field :password, :class => :"input_password shadowed"
+ = f.password_field :password, class: :"input_password shadowed"
= f.label :password_confirmation
- = f.password_field :password_confirmation, :class => :"input_password shadowed"
+ = f.password_field :password_confirmation, class: :"input_password shadowed"
= f.submit t('devise.forms.sign_up')
.more_options
- = render :partial => "devise/shared/links"
+ = render partial: "devise/shared/links"
diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml
index bf24239..7589c11 100644
--- a/app/views/devise/sessions/new.html.haml
+++ b/app/views/devise/sessions/new.html.haml
@@ -1,5 +1,5 @@
#login_form
- = form_for resource, :as => resource_name, :url => session_path(resource_name) do |f|
+ = form_for resource, as: resource_name, url: session_path(resource_name) do |f|
%fieldset
= f.label :login
= f.text_field :login
@@ -13,4 +13,4 @@
= f.submit t('devise.forms.sign_in')
.more_options
- = render :partial => "devise/shared/links"
+ = render partial: "devise/shared/links"
diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml
index 22b1033..b00f754 100644
--- a/app/views/devise/unlocks/new.html.haml
+++ b/app/views/devise/unlocks/new.html.haml
@@ -1,5 +1,5 @@
#login_form
- = form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f|
+ = form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f|
%fieldset
= devise_error_messages!
@@ -8,4 +8,4 @@
= f.submit "Resend unlock instructions"
.more_options
- = render :partial => "devise/shared/links"
+ = render partial: "devise/shared/links"
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 0192798..9b62715 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -14,7 +14,7 @@
#nav_wrap= yield :nav_wrap
#content_wrap
#content
- = render :partial => 'layouts/application/flashes'
+ = render partial: 'layouts/application/flashes'
- if content_for? :module
.module
%h2.title= yield :module_title
diff --git a/app/views/layouts/application/_flashes.html.haml b/app/views/layouts/application/_flashes.html.haml
index cb6a72f..a260f26 100644
--- a/app/views/layouts/application/_flashes.html.haml
+++ b/app/views/layouts/application/_flashes.html.haml
@@ -1,4 +1,4 @@
#flash
- flash.each do |(status, message)|
- css_class = (status == :alert) ? 'error' : status.to_s
- = content_tag :div, flash[status], :class => css_class
+ = content_tag :div, flash[status], class: css_class
diff --git a/app/views/layouts/dashboard.html.haml b/app/views/layouts/dashboard.html.haml
index 445c6b9..f491cdd 100644
--- a/app/views/layouts/dashboard.html.haml
+++ b/app/views/layouts/dashboard.html.haml
@@ -1,13 +1,14 @@
- selected_tab = ( controller_name == 'registrations' ) ? 'users' : controller_name
-= render 'layouts/dashboard/head', :selected_tab => selected_tab
+= render 'layouts/dashboard/head', selected_tab: selected_tab
= render 'layouts/dashboard/navigation'
= render 'layouts/dashboard/top'
+
!!!
%html
%head
%title= content_for?(:title) ? yield(:title) : 'Dashboard'
= javascript_include_tag :application
- = stylesheet_link_tag 'dashboard'
+ = stylesheet_link_tag 'main', 'dashboard'
= yield :head
= csrf_meta_tag
%body
@@ -16,9 +17,9 @@
#nav_wrap= yield :nav_wrap
#content_wrap
#content
- = render :partial => 'layouts/dashboard/flashes'
+ = render partial: 'layouts/dashboard/flashes'
.module
- %h2.title= content_for?(:module_title) ? yield(:module_title) : t( "activerecord.models.#{ selected_tab.singularize }" )
+ %h2.title= content_for?(:module_title) ? yield(:module_title) : selected_tab.singularize.classify.constantize.model_name.human
.module_body= yield
#footer_wrap
#footer= content_for?(:footer) ? yield(:footer) : 'CloverInteractive'
diff --git a/app/views/layouts/dashboard/_flashes.html.haml b/app/views/layouts/dashboard/_flashes.html.haml
index fc8c769..40e2617 100644
--- a/app/views/layouts/dashboard/_flashes.html.haml
+++ b/app/views/layouts/dashboard/_flashes.html.haml
@@ -4,4 +4,4 @@
- when 'alert' then 'error'
- when 'notice' then 'success'
- else status.to_s
- = content_tag :div, flash[status], :class => css_class
+ = content_tag :div, flash[status], class: css_class
diff --git a/app/views/layouts/dashboard/_navigation.html.haml b/app/views/layouts/dashboard/_navigation.html.haml
index 3d0c2bd..cf01c05 100644
--- a/app/views/layouts/dashboard/_navigation.html.haml
+++ b/app/views/layouts/dashboard/_navigation.html.haml
@@ -1,19 +1,8 @@
-- content_for :head do
- = stylesheet_link_tag 'jquery-ui'
- = javascript_include_tag 'wymeditor/jquery.wymeditor.min', 'uploadify/uploadify.min', 'uploadify/swfobject'
- :javascript
- $(function() {
- $("textarea.wymeditor").wymeditor({
- logoHtml: '',
- skin: 'compact'
- });
- });
-
- content_for :nav_wrap do
%ul#nav
- %li#sections_menu_link= link_to t('activerecord.models.section'), dashboard_sections_path
- %li#pages_menu_link= link_to t('activerecord.models.page'), dashboard_pages_path
- %li#settings_menu_link= link_to t('activerecord.models.setting'), dashboard_settings_path
- %li#users_menu_link= link_to t('activerecord.models.user'), dashboard_users_path
+ %li#sections_menu_link= link_to Section.model_name.human(count: 0), dashboard_sections_path
+ %li#pages_menu_link= link_to Page.model_name.human(count: 0), dashboard_pages_path
+ %li#settings_menu_link= link_to Setting.model_name.human(count: 0), dashboard_settings_path
+ %li#users_menu_link= link_to User.model_name.human(count: 0), dashboard_users_path
= yield :nav
= content_for?( :sub_nav ) ? yield( :sub_nav ) : render( "layouts/dashboard/nav/#{controller_name}" )
diff --git a/app/views/layouts/dashboard/_top.html.haml b/app/views/layouts/dashboard/_top.html.haml
index 05c49dd..8f42cbc 100644
--- a/app/views/layouts/dashboard/_top.html.haml
+++ b/app/views/layouts/dashboard/_top.html.haml
@@ -1,5 +1,5 @@
= content_for :top do
- = link_to '', root_path, :id => "logo"
+ = link_to '', root_path, id: "logo"
#account_info
- if defined?( current_user ) and defined?( edit_user_registration_path ) and defined?( destroy_user_registration_path )
= t 'common.messages.hi'
diff --git a/app/views/layouts/dashboard/nav/_pages.html.haml b/app/views/layouts/dashboard/nav/_pages.html.haml
index 333ee97..c7a3a19 100644
--- a/app/views/layouts/dashboard/nav/_pages.html.haml
+++ b/app/views/layouts/dashboard/nav/_pages.html.haml
@@ -1,3 +1,3 @@
-= tabs_tag :open_tabs => { :id => "sub_menu", :class => "sub_nav" } do |tab|
- = tab.list_pages t('links.item_list', :item => t('activerecord.models.page')), dashboard_pages_path
- = tab.new_page t('links.new_item', :item => t('activerecord.models.page')), new_dashboard_page_path
+= tabs_tag open_tabs: { id: "sub_menu", class: "sub_nav" } do |tab|
+ = tab.list_pages t('links.item_list', item: Page.model_name.human(count: 0)), dashboard_pages_path
+ = tab.new_page t('links.new_item', item: Page.model_name.human), new_dashboard_page_path
diff --git a/app/views/layouts/dashboard/nav/_sections.html.haml b/app/views/layouts/dashboard/nav/_sections.html.haml
index 9556f55..3133996 100644
--- a/app/views/layouts/dashboard/nav/_sections.html.haml
+++ b/app/views/layouts/dashboard/nav/_sections.html.haml
@@ -1,3 +1,3 @@
-= tabs_tag :open_tabs => { :id => "sub_menu", :class => "sub_nav" } do |tab|
- = tab.list_sections t('links.item_list', :item => t('activerecord.models.section')), dashboard_sections_path
- = tab.new_section t('links.new_item', :item => t('activerecord.models.section')), new_dashboard_section_path
+= tabs_tag open_tabs: { id: "sub_menu", class: "sub_nav" } do |tab|
+ = tab.list_sections t('links.item_list', item: Section.model_name.human( count: 0 )), dashboard_sections_path
+ = tab.new_section t('links.new_item', item: Section.model_name.human), new_dashboard_section_path
diff --git a/app/views/layouts/dashboard/nav/_settings.html.haml b/app/views/layouts/dashboard/nav/_settings.html.haml
index dfad712..a42c227 100644
--- a/app/views/layouts/dashboard/nav/_settings.html.haml
+++ b/app/views/layouts/dashboard/nav/_settings.html.haml
@@ -1,3 +1,3 @@
-= tabs_tag :open_tabs => { :id => "sub_menu", :class => "sub_nav" } do |tab|
- = tab.list_settings t('links.item_list', :item => t('activerecord.models.setting')), dashboard_settings_path
- = tab.new_setting t('links.new_item', :item => t('activerecord.models.setting')), new_dashboard_setting_path
+= tabs_tag open_tabs: { id: "sub_menu", class: "sub_nav" } do |tab|
+ = tab.list_settings t('links.item_list', item: Setting.model_name.human( count: 0 )), dashboard_settings_path
+ = tab.new_setting t('links.new_item', item: Setting.model_name.human), new_dashboard_setting_path
diff --git a/app/views/layouts/dashboard/nav/_users.html.haml b/app/views/layouts/dashboard/nav/_users.html.haml
index d9d8cf0..ec0c815 100644
--- a/app/views/layouts/dashboard/nav/_users.html.haml
+++ b/app/views/layouts/dashboard/nav/_users.html.haml
@@ -1,2 +1,3 @@
-= tabs_tag :open_tabs => { :id => "sub_menu", :class => "sub_nav" } do |tab|
- = tab.list_users t('links.item_list', :item => t('activerecord.models.user')), dashboard_users_path
+= tabs_tag open_tabs: { id: "sub_menu", class: "sub_nav" } do |tab|
+ = tab.list_users t('links.item_list', item: User.model_name.human(count: 0)), dashboard_users_path
+ = tab.edit_user t('links.item_edit', item: User.model_name.human), edit_user_registration_path
diff --git a/app/views/layouts/sessions.html.haml b/app/views/layouts/sessions.html.haml
index fa7264e..aab7487 100644
--- a/app/views/layouts/sessions.html.haml
+++ b/app/views/layouts/sessions.html.haml
@@ -2,10 +2,10 @@
= t "devise.#{ controller_name }.#{ action_name }.title"
- content_for :head do
- = stylesheet_link_tag 'sessions'
+ = stylesheet_link_tag :sessions
- content_for :top do
- %a{:href =>"/"}
+ = link_to root_path do
%h1#logo CloverInteractive
-= render :file => 'layouts/application'
+= render file: 'layouts/application'
diff --git a/app/views/layouts/themes/clover/_banner.html.haml b/app/views/layouts/themes/clover/_banner.html.haml
index b3d531b..dfe759c 100644
--- a/app/views/layouts/themes/clover/_banner.html.haml
+++ b/app/views/layouts/themes/clover/_banner.html.haml
@@ -7,9 +7,9 @@
%h1 Impulsamos tu empresa a través de las ventajas que Internet te ofrece: reducir costos, potenciar tus productos y aumentar tu economía.
%h3 Consigue aqui desde un consejo hasta una solución de telefonia
#slider
- #slider_left= link_to image_tag("themes/clover/scroll_left.gif", :alt => "Scroll left"), "#", :class => "previous"
- = render :partial => 'layouts/themes/clover/slides'
- #slider_right= link_to image_tag("themes/clover/scroll_right.gif", :alt => "Scroll right"), "#", :class => "next"
+ #slider_left= link_to image_tag("themes/clover/scroll_left.gif", alt: "Scroll left"), "#", class: "previous"
+ = render partial: 'layouts/themes/clover/slides'
+ #slider_right= link_to image_tag("themes/clover/scroll_right.gif", alt: "Scroll right"), "#", class: "next"
- elsif page.present?
%h1= section.name.titleize
%h2= page.name.titleize
diff --git a/app/views/layouts/themes/clover/_bottom.html.haml b/app/views/layouts/themes/clover/_bottom.html.haml
index 697e8e9..1cc06d0 100644
--- a/app/views/layouts/themes/clover/_bottom.html.haml
+++ b/app/views/layouts/themes/clover/_bottom.html.haml
@@ -28,11 +28,11 @@
#newsletter_box.b360
%h2 Subscribete al newsletter
- / - form_for EmailList.new, :url => "/email_lists/add_to_list", :html => { :id => "newsletter", :class => "forms_footer" } do |f|
- / %label= f.text_field :email, :value => "Email", :class => "input_text"
+ / - form_for EmailList.new, url: "/email_lists/add_to_list", html: { id: "newsletter", class: "forms_footer" } do |f|
+ / %label= f.text_field :email, value: "Email", class: "input_text"
/ %label.right
- / %a.button1{ :href => "javascript:void(null);" }
- / %span{ :onclick => "$('#newsletter')[0].submit();" } Subscribir
+ / %a.button1{ href: "javascript:void(null);" }
+ / %span{ onclick: "$('#newsletter')[0].submit();" } Subscribir
#footer2
diff --git a/app/views/layouts/themes/clover/_slides.html.haml b/app/views/layouts/themes/clover/_slides.html.haml
index 3d32dc1..d0aeed0 100644
--- a/app/views/layouts/themes/clover/_slides.html.haml
+++ b/app/views/layouts/themes/clover/_slides.html.haml
@@ -3,19 +3,19 @@
.first_slide
= image_tag "themes/clover/content/preview.jpg"
.preview_intro
- = link_to image_tag("themes/clover/view_project_btn.jpg"), "http://www.artificialonline.com", :target => "_blank", :class => "view_project"
+ = link_to image_tag("themes/clover/view_project_btn.jpg"), "http://www.artificialonline.com", target: "_blank", class: "view_project"
%p Clover Interactive hospedaje web!
%p Hospedaje y administración de sistemas
.second_slide
= image_tag "themes/clover/content/preview2.jpg"
.preview_intro
- = link_to image_tag("themes/clover/view_project_btn.jpg"), "http://www.aloboutique.com", :target => "_blank", :class => "view_project"
+ = link_to image_tag("themes/clover/view_project_btn.jpg"), "http://www.aloboutique.com", target: "_blank", class: "view_project"
%p Clover Interactive desarrollo web!
%p XHTML + CSS + Ruby, PHP + MySQL
.third_slide
= image_tag "themes/clover/content/preview3.jpg"
.preview_intro
- = link_to image_tag("themes/clover/view_project_btn.jpg"), "http://www.tjruby.org", :target => "_blank", :class => "view_project"
+ = link_to image_tag("themes/clover/view_project_btn.jpg"), "http://www.tjruby.org", target: "_blank", class: "view_project"
%p Clover Interactive activo!
%p Comprometidos con la comunidad.
diff --git a/app/views/layouts/themes/clover/theme.html.haml b/app/views/layouts/themes/clover/theme.html.haml
index c69ef44..fdfef1f 100644
--- a/app/views/layouts/themes/clover/theme.html.haml
+++ b/app/views/layouts/themes/clover/theme.html.haml
@@ -6,18 +6,18 @@
= stylesheet_link_tag :application, :clover
= yield :head
= csrf_meta_tag
- %body{ :class => ( @page.present? && @page.home_page ? '' : 'section' ) }
+ %body{ class: ( @page.present? && @page.home_page ? '' : 'section' ) }
#wrapper
- = render :partial => 'layouts/themes/clover/top'
- = render :partial => 'layouts/themes/clover/banner', :object => @page
+ = render partial: 'layouts/themes/clover/top'
+ = render partial: 'layouts/themes/clover/banner', object: @page
#mid
- if @page.present? && @page.home_page?
#content= yield
- = render :partial =>'layouts/themes/clover/sidebar', :object => @page, :locals => { :section => @section }
+ = render partial:'layouts/themes/clover/sidebar', object: @page, locals: { section: @section }
- elsif @page.present?
#imid
- = render :partial => 'layouts/themes/clover/sidebar', :object => @page, :locals => { :section => @section }
+ = render partial: 'layouts/themes/clover/sidebar', object: @page, locals: { section: @section }
#content= yield
- = render :partial => 'layouts/themes/clover/bottom'
+ = render partial: 'layouts/themes/clover/bottom'
diff --git a/app/views/layouts/themes/default/theme.html.haml b/app/views/layouts/themes/default/theme.html.haml
index 839035e..0b1e1cc 100644
--- a/app/views/layouts/themes/default/theme.html.haml
+++ b/app/views/layouts/themes/default/theme.html.haml
@@ -1,4 +1,4 @@
-!!!5
+!!!
%html
%head
%title= (content_for? :title) ? yield(:title) : 'CloverCMS - TJRuby theme'
@@ -6,7 +6,7 @@
%body
#wrapper
#page_top
- = render :partial => 'layouts/themes/default/top'
+ = render partial: 'layouts/themes/default/top'
#main
#content= yield
#sidebar= yield :sidebar
diff --git a/app/views/layouts/themes/simple_blog/_sidebar.html.haml b/app/views/layouts/themes/simple_blog/_sidebar.html.haml
index 89a97ec..33da965 100644
--- a/app/views/layouts/themes/simple_blog/_sidebar.html.haml
+++ b/app/views/layouts/themes/simple_blog/_sidebar.html.haml
@@ -6,9 +6,9 @@
%ul
- section.pages.published.each do |page|
- if section.main_section
- %li= link_to page.name.titleize, subsection_page_path(section.url_name, section.main_section.url_name, page.url_name)
+ %li= link_to page.name.titleize, subsection_page_path( section section.main_section, page )
- else
- %li= link_to page.name.titleize, section_page_path(section.url_name, page.url_name)
+ %li= link_to page.name.titleize, section_page_path( section, page )
%h2 Follow us on
%ul.icons
diff --git a/app/views/layouts/themes/simple_blog/theme.html.haml b/app/views/layouts/themes/simple_blog/theme.html.haml
index 04109d5..787e82b 100644
--- a/app/views/layouts/themes/simple_blog/theme.html.haml
+++ b/app/views/layouts/themes/simple_blog/theme.html.haml
@@ -1,17 +1,17 @@
-!!!5
+!!!
%html
%head
- %meta{ :charset => 'utf-8' }
- = yield :meta
+ %meta{ charset: 'utf-8' }
%title= content_for?(:title) ? yield(:title) : 'Simple Blog'
= stylesheet_link_tag 'application', 'simple_blog'
+
%body
- = render :partial => 'layouts/themes/simple_blog/nav'
+ = render partial: 'layouts/themes/simple_blog/nav'
#wrapper
- = render :partial => 'layouts/application/flashes'
+ = render partial: 'layouts/application/flashes'
#content_wrapper
#content= yield
- #sidebar= render :partial => 'layouts/themes/simple_blog/sidebar', :locals => { :section => @section }
+ #sidebar= render partial: 'layouts/themes/simple_blog/sidebar', locals: { section: @section }
.clear
- #footer= render :partial => 'layouts/themes/simple_blog/footer', :locals => { :section => @section }
+ #footer= render partial: 'layouts/themes/simple_blog/footer', locals: { section: @section }
diff --git a/app/views/pages/show.haml b/app/views/pages/show.haml
index ee8904f..5d63f08 100644
--- a/app/views/pages/show.haml
+++ b/app/views/pages/show.haml
@@ -1,11 +1,10 @@
%h1= @page.name.titleize
-!= @page.content
+= markdown @page.content
-!= @contact_form if @contact_form.present?
+= render 'contact_forms/contact_form' if @page.has_contact?
= content_for :title do
- = "#{site[:site_name]} - #{@page.name.titleize}"
+ = "#{site[:site_name]} - #{ @page.name.titleize }"
+
= content_for :footer do
!= "#{site[:footer]}"
-= content_for :meta do
- != meta "keywords", @page.keywords.join(',') if @page.keywords.present?
diff --git a/app/views/shared/_keywords.html.haml b/app/views/shared/_keywords.html.haml
deleted file mode 100644
index 63832ae..0000000
--- a/app/views/shared/_keywords.html.haml
+++ /dev/null
@@ -1,15 +0,0 @@
-.columns
- .half
- %label
- = t 'common.fields.keywords'
- %small= t 'common.descriptions.keywords'
- %input#keyword_input{ :type => :text, :style => 'width: 250px; display: inline' }
- %button#keyword_button= t 'common.forms.add'
- %select{ :size => 5, :style => 'width: 350px; border: 1px solid gray;', :id => 'keywords' }
- - resource_keywords.each do |keyword|
- %option=keyword
- .half
- #tips_container.box
- %h3= t 'common.headers.did_you_know'
- %p= t 'common.tips.keywords.first'
- %p= t 'common.tips.keywords.second'
diff --git a/app/views/shared/_login_box.html.haml b/app/views/shared/_login_box.html.haml
index a1a904e..ecfe482 100644
--- a/app/views/shared/_login_box.html.haml
+++ b/app/views/shared/_login_box.html.haml
@@ -1,12 +1,12 @@
%h1#logo= 'Clover Interactive'
#login-form-container
- = form_tag new_user_session_path, :id => 'login-form', :class => 'forms' do
+ = form_tag new_user_session_path, id: 'login-form', class: 'forms' do
#form-body
%fieldset
= label_tag 'Email'
- = text_field_tag 'user[email]', nil, :class => :input_text
+ = text_field_tag 'user[email]', nil, class: :input_text
= label_tag 'Password'
- = password_field_tag 'user[password]', nil, :class => :input_text
+ = password_field_tag 'user[password]', nil, class: :input_text
%p
- %input.input_button{ :type => :submit, :value => :login }
+ %input.input_button{ type: :submit, value: :login }
%button.input_button Register
\ No newline at end of file
diff --git a/app/views/shared/_uploadify.html.haml b/app/views/shared/_uploadify.html.haml
deleted file mode 100644
index f18c082..0000000
--- a/app/views/shared/_uploadify.html.haml
+++ /dev/null
@@ -1,34 +0,0 @@
-- session_key = Rails.application.config.session_options[:key]
-:javascript
- $(function () {
- var uploadify_script_data = {};
- var csrf_token = $('meta[name=csrf-token]').attr('content');
- var csrf_param = $('meta[name=csrf-param]').attr('content');
-
- uploadify_script_data[csrf_param] = encodeURI(encodeURIComponent(csrf_token));
- uploadify_script_data['#{session_key}'] = '#{cookies[session_key]}';
- uploadify_script_data.attachable_type = '#{object.class}'
- uploadify_script_data.attachable_id = '#{object.id}'
-
- $('#uploadify').uploadify({
- script : '/dashboard/assets/',
- scriptData : uploadify_script_data,
- uploader : '/swf/uploadify/uploadify.swf',
- cancelImg : '/assets/uploadify/cancel.png',
- fileExt : '*.png;*.jpg;*.gif',
- auto : true,
- onComplete : function(a, b, c, response) {
- response = $.parseJSON(response);
- if (response.status == "success") {
- var img = document.createElement('img');
- img.src = response.thumbnail;
- $("#images_list").append(img);
- $(img).click(function(){
- image_operations({ element: this, title: '#{t 'links.add_item', :item => t('common.fields.image')}', text: '#{t 'common.headers.add_image', :item => t('common.fields.image')}' })
- });
- }
- },
- fileDesc : '#{t('common.forms.file_description')}',
- sizeLimit : #{19.megabytes}
- });
- });
diff --git a/bin/autospec b/bin/autospec
new file mode 100755
index 0000000..64dcb9c
--- /dev/null
+++ b/bin/autospec
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'autospec' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('rspec-core', 'autospec')
diff --git a/bin/cap b/bin/cap
new file mode 100755
index 0000000..30352d4
--- /dev/null
+++ b/bin/cap
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'cap' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('capistrano', 'cap')
diff --git a/bin/capify b/bin/capify
new file mode 100755
index 0000000..0f486e8
--- /dev/null
+++ b/bin/capify
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'capify' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('capistrano', 'capify')
diff --git a/bin/coderay b/bin/coderay
new file mode 100755
index 0000000..5be1c00
--- /dev/null
+++ b/bin/coderay
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'coderay' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('coderay', 'coderay')
diff --git a/bin/compass b/bin/compass
new file mode 100755
index 0000000..e1ac749
--- /dev/null
+++ b/bin/compass
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'compass' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('compass', 'compass')
diff --git a/bin/erubis b/bin/erubis
new file mode 100755
index 0000000..2c7348b
--- /dev/null
+++ b/bin/erubis
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'erubis' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('erubis', 'erubis')
diff --git a/bin/haml b/bin/haml
new file mode 100755
index 0000000..3c6d074
--- /dev/null
+++ b/bin/haml
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'haml' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('haml', 'haml')
diff --git a/bin/html2haml b/bin/html2haml
new file mode 100755
index 0000000..a52215a
--- /dev/null
+++ b/bin/html2haml
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'html2haml' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('haml', 'html2haml')
diff --git a/bin/htmldiff b/bin/htmldiff
new file mode 100755
index 0000000..c70e238
--- /dev/null
+++ b/bin/htmldiff
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'htmldiff' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('diff-lcs', 'htmldiff')
diff --git a/bin/launchy b/bin/launchy
new file mode 100755
index 0000000..92b254a
--- /dev/null
+++ b/bin/launchy
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'launchy' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('launchy', 'launchy')
diff --git a/bin/ldiff b/bin/ldiff
new file mode 100755
index 0000000..8e3524a
--- /dev/null
+++ b/bin/ldiff
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'ldiff' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('diff-lcs', 'ldiff')
diff --git a/bin/nokogiri b/bin/nokogiri
new file mode 100755
index 0000000..d55f84b
--- /dev/null
+++ b/bin/nokogiri
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'nokogiri' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('nokogiri', 'nokogiri')
diff --git a/bin/posix-spawn-benchmark b/bin/posix-spawn-benchmark
new file mode 100755
index 0000000..9e73bb8
--- /dev/null
+++ b/bin/posix-spawn-benchmark
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'posix-spawn-benchmark' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('posix-spawn', 'posix-spawn-benchmark')
diff --git a/bin/pry b/bin/pry
new file mode 100755
index 0000000..54678a3
--- /dev/null
+++ b/bin/pry
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'pry' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('pry', 'pry')
diff --git a/bin/rackup b/bin/rackup
new file mode 100755
index 0000000..8cc9953
--- /dev/null
+++ b/bin/rackup
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'rackup' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('rack', 'rackup')
diff --git a/bin/rails b/bin/rails
new file mode 100755
index 0000000..657440d
--- /dev/null
+++ b/bin/rails
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'rails' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('railties', 'rails')
diff --git a/bin/rails_best_practices b/bin/rails_best_practices
new file mode 100755
index 0000000..30c973c
--- /dev/null
+++ b/bin/rails_best_practices
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'rails_best_practices' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('rails_best_practices', 'rails_best_practices')
diff --git a/bin/rake b/bin/rake
new file mode 100755
index 0000000..26c7a2d
--- /dev/null
+++ b/bin/rake
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'rake' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('rake', 'rake')
diff --git a/bin/rdebug b/bin/rdebug
new file mode 100755
index 0000000..c0c33af
--- /dev/null
+++ b/bin/rdebug
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'rdebug' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('debugger', 'rdebug')
diff --git a/bin/rdoc b/bin/rdoc
new file mode 100755
index 0000000..f57260f
--- /dev/null
+++ b/bin/rdoc
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'rdoc' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('rdoc', 'rdoc')
diff --git a/bin/redcarpet b/bin/redcarpet
new file mode 100755
index 0000000..37d58a8
--- /dev/null
+++ b/bin/redcarpet
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'redcarpet' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('redcarpet', 'redcarpet')
diff --git a/bin/ri b/bin/ri
new file mode 100755
index 0000000..90f2517
--- /dev/null
+++ b/bin/ri
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'ri' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('rdoc', 'ri')
diff --git a/bin/rspec b/bin/rspec
new file mode 100755
index 0000000..0c86b5c
--- /dev/null
+++ b/bin/rspec
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'rspec' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('rspec-core', 'rspec')
diff --git a/bin/sass b/bin/sass
new file mode 100755
index 0000000..d65bb10
--- /dev/null
+++ b/bin/sass
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'sass' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('sass', 'sass')
diff --git a/bin/sass-convert b/bin/sass-convert
new file mode 100755
index 0000000..ddde743
--- /dev/null
+++ b/bin/sass-convert
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'sass-convert' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('sass', 'sass-convert')
diff --git a/bin/scss b/bin/scss
new file mode 100755
index 0000000..9f5e435
--- /dev/null
+++ b/bin/scss
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'scss' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('sass', 'scss')
diff --git a/bin/sprockets b/bin/sprockets
new file mode 100755
index 0000000..09a1ad1
--- /dev/null
+++ b/bin/sprockets
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'sprockets' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('sprockets', 'sprockets')
diff --git a/bin/thor b/bin/thor
new file mode 100755
index 0000000..8421e00
--- /dev/null
+++ b/bin/thor
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'thor' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('thor', 'thor')
diff --git a/bin/tilt b/bin/tilt
new file mode 100755
index 0000000..09fe73e
--- /dev/null
+++ b/bin/tilt
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'tilt' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('tilt', 'tilt')
diff --git a/bin/tt b/bin/tt
new file mode 100755
index 0000000..6e3920b
--- /dev/null
+++ b/bin/tt
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by Bundler.
+#
+# The application 'tt' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'pathname'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require 'rubygems'
+require 'bundler/setup'
+
+load Gem.bin_path('treetop', 'tt')
diff --git a/config/_database.yml.erb b/config/_database.yml.erb
new file mode 100644
index 0000000..3725b2a
--- /dev/null
+++ b/config/_database.yml.erb
@@ -0,0 +1,15 @@
+defaults: &defaults
+ adapter: postgresql
+ encoding: utf8
+ pool: 5
+ host: localhost
+ username: cms
+ min_messages: warning
+
+test:
+ <<: *defaults
+ database: cms_test
+
+<%= Rails.env %>:
+ <<: *defaults
+ database: cms_<%= Rails.env %>
diff --git a/config/_secret_token.rb.erb b/config/_secret_token.rb.erb
new file mode 100644
index 0000000..da0392d
--- /dev/null
+++ b/config/_secret_token.rb.erb
@@ -0,0 +1 @@
+Clover::Application.config.secret_token = '<%= @secret_token %>'
diff --git a/config/_vhost.conf.erb b/config/_vhost.conf.erb
new file mode 100644
index 0000000..f6ebcaa
--- /dev/null
+++ b/config/_vhost.conf.erb
@@ -0,0 +1,47 @@
+<%
+if _bare_host = @host.match( /^(?:www)\.(.*)/ )
+ _bare_host = _bare_host[1]
+end
+
+def ip_from_hostname hostname
+ require 'socket'
+ Socket.gethostbyname( hostname )[3].unpack( 'C4' ).join '.'
+end
+
+if _bare_host.present?
+%>
+server {
+ listen 80;
+ server_name <%= _bare_host %>;
+ rewrite ^(.*) http://<%= @host %>$1 permanent;
+}
+
+<% end %>
+server {
+ listen 80;
+ server_name <%= @host %>;
+
+ root <%= @public %>;
+ passenger_enabled on;
+
+ access_log <%= @log %>/nginx.access.log;
+ error_log <%= @log %>/nginx.error.log warn;
+
+ sendfile on;
+ location ~ ^/assets/ {
+ gzip_static on;
+ gzip_disable "MSIE [1-60]\.";
+ expires max;
+ add_header Cache-Control public;
+ add_header ETag "";
+ }
+
+ error_page 401 403 404 /404.html;
+ error_page 500 502 503 504 /50x.html;
+
+ location = /50x.html {
+ root html;
+ }
+}
+
+# vim: set ft=nginx:
diff --git a/config/application.rb b/config/application.rb
index 4a634fb..a681569 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -10,7 +10,7 @@
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
- Bundler.require(*Rails.groups(:assets => %w(development test)))
+ Bundler.require(*Rails.groups(assets: %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
@@ -23,7 +23,7 @@ class Application < Rails::Application
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
- config.autoload_paths += %W(#{config.root}/app/middleware #{config.root}/extras)
+ config.autoload_paths += %W( #{config.root}/lib/extensions )
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
@@ -44,16 +44,31 @@ class Application < Rails::Application
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
- config.filter_parameters += [:password]
+ config.filter_parameters += [:password, :password_confirmation]
# Enable the asset pipeline
config.assets.enabled = true
- config.assets.precompile += %w( clover.css tjruby.css dashboard.css simple_blog.css sessions.css jquery-ui.css )
- config.assets.precompile += %w( wymeditor/jquery.wymeditor.min.js uploadify/uploadify.min.js uploadify/swfobject.js )
+ config.assets.precompile += %w( clover.css tjruby.css dashboard.css simple_blog.css sessions.css )
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
+
+ $markdown_extensions = {
+ autolink: true,
+ no_intra_emphasis: true,
+ fenced_code_blocks: true,
+ space_after_headers: true,
+ superscript: true,
+ }
+
+ $render_options = {
+ filter_html: true,
+ hard_wrap: true,
+ with_toc_data: true,
+ }
+
+ $themes = Dir[ Rails.root.join('app', 'views', 'layouts', 'themes', '**' ) ].map { |dir| File.basename dir }
end
end
diff --git a/config/capistrano_templates.rb b/config/capistrano_templates.rb
deleted file mode 100644
index 9765ec9..0000000
--- a/config/capistrano_templates.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-unless Capistrano::Configuration.respond_to?(:instance)
- abort "This extension requires Capistrano 2"
-end
-
-Capistrano::Configuration.instance.load do
- namespace :deploy do
- namespace :db do
-
- desc <<-DESC
- Creates the database.yml configuration file in shared path.
-
- By default, this task uses a template unless a template \
- called database.yml.erb is found either is :template_dir \
- or /config/deploy folders. The default template matches \
- the template for config/database.yml file shipped with Rails.
-
- When this recipe is loaded, db:setup is automatically configured \
- to be invoked after deploy:setup. You can skip this task setting \
- the variable :skip_db_setup to true. This is especially useful \
- if you are using this recipe in combination with \
- capistrano-ext/multistaging to avoid multiple db:setup calls \
- when running deploy:setup for all stages one by one.
- DESC
- task :setup, :except => { :no_release => true } do
-
- default_template = <<-EOF
- base: &base
- adapter: sqlite3
- timeout: 5000
- development:
- database: #{shared_path}/db/development.sqlite3
- <<: *base
- test:
- database: #{shared_path}/db/test.sqlite3
- <<: *base
- production:
- database: #{shared_path}/db/production.sqlite3
- <<: *base
- EOF
-
- database = fetch(:template_dir, "config/deploy") + '/database.yml.erb'
- htaccess = fetch(:template_dir, "config/deploy") + '/htaccess.erb'
-
- database_template = File.file?(database) ? File.read(database) : default_template
- database_config = ERB.new(database_template)
-
- if File.file?(htaccess)
- htaccess_template = File.read(htaccess)
- apache_config = ERB.new(htaccess_template)
- end
-
- run "mkdir -p #{shared_path}/db"
- run "mkdir -p #{shared_path}/config"
- run "mkdir -p #{shared_path}/vendor"
- run "mkdir -p #{shared_path}/public"
-
- put database_config.result(binding), "#{shared_path}/config/database.yml"
- put apache_config.result(binding), "#{shared_path}/public/.htaccess" if !apache_config.nil?
- end
-
- desc <<-DESC
- [internal] Updates the symlink for database.yml file to the just deployed release.
- DESC
- task :symlink, :except => { :no_release => true } do
- run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
- end
-
- end
-
- after "deploy:setup", "deploy:db:setup" unless fetch(:skip_db_setup, false)
- after "deploy:finalize_update", "deploy:db:symlink"
- end
-end
-
diff --git a/config/cucumber.yml b/config/cucumber.yml
deleted file mode 100644
index 19b288d..0000000
--- a/config/cucumber.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-<%
-rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
-rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
-std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
-%>
-default: <%= std_opts %> features
-wip: --tags @wip:3 --wip features
-rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
diff --git a/config/database.yml b/config/database.yml
index 7551340..352ff7d 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -1,25 +1,15 @@
-# SQLite version 3.x
-# gem install sqlite3-ruby (not necessary on OS X Leopard)
-development:
- adapter: sqlite3
- database: db/development.sqlite3
+defaults: &defaults
+ adapter: postgresql
+ encoding: utf8
pool: 5
- timeout: 5000
+ host: localhost
+ username: cms
+ min_messages: warning
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
-test: &test
- adapter: sqlite3
- database: db/test.sqlite3
- pool: 5
- timeout: 5000
+test:
+ <<: *defaults
+ database: cms_test
-production:
- adapter: sqlite3
- database: db/production.sqlite3
- pool: 5
- timeout: 5000
-
-cucumber:
- <<: *test
\ No newline at end of file
+development:
+ <<: *defaults
+ database: cms_development
diff --git a/config/deploy.rb b/config/deploy.rb
index 153f0ad..2f75da7 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -14,7 +14,7 @@
role :web, "#{subdomain}.#{domain}"
role :app, "#{subdomain}.#{domain}"
-role :db, "#{subdomain}.#{domain}", :primary => true
+role :db, "#{subdomain}.#{domain}", primary: true
set :deploy_to, "/home/#{user}/rails_apps/#{subdomain}.#{domain}/#{application}"
@@ -23,7 +23,7 @@
namespace :deploy do
task :start do ; end
task :stop do ; end
- task :restart, :roles => :app, :except => { :no_release => true } do
+ task :restart, roles: :app, except: { no_release: true } do
run "touch #{File.join(current_path,'tmp','restart.txt')}"
end
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 416785b..897419e 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -18,7 +18,7 @@
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
- config.action_mailer.default_url_options = { :host => 'localhost:3000' }
+ config.action_mailer.default_url_options = { host: 'localhost:3000' }
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 12f6679..53ff2c2 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -40,5 +40,5 @@
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
- config.action_mailer.default_url_options = { :host => 'localhost:3000' }
+ config.action_mailer.default_url_options = { host: 'localhost:3000' }
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 5b27ebc..633b523 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -36,7 +36,7 @@
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
- config.action_mailer.default_url_options = { :host => 'localhost:3000' }
+ config.action_mailer.default_url_options = { host: 'localhost:3000' }
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
config.assets.allow_debugging = true
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 6812fbc..d6bcc60 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -69,7 +69,7 @@
# :http_auth and :token_auth by adding those symbols to the array below.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
- # passing :skip => :sessions to `devise_for` in your config/routes.rb
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth]
# ==> Configuration for :database_authenticatable
@@ -99,8 +99,8 @@
# The key to be used to check existing users when sending an invitation
# and the regexp used to test it when validate_on_invite is not set.
- # config.invite_key = {:email => /A[^@]+@[^@]+z/}
- # config.invite_key = {:email => /A[^@]+@[^@]+z/, :username => nil}
+ # config.invite_key = {email: /A[^@]+@[^@]+z/}
+ # config.invite_key = {email: /A[^@]+@[^@]+z/, username: nil}
# Flag that force a record to be valid before being actually invited
# Default: false
@@ -131,7 +131,7 @@
# config.extend_remember_period = false
# Options to be passed to the created cookie. For instance, you can set
- # :secure => true in order to force SSL only cookies.
+ # secure: true in order to force SSL only cookies.
# config.rememberable_options = {}
# ==> Configuration for :validatable
@@ -227,7 +227,7 @@
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
- # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
@@ -235,7 +235,7 @@
#
# config.warden do |manager|
# manager.intercept_401 = false
- # manager.default_strategies(:scope => :user).unshift :some_external_strategy
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
# ==> Mountable engine configurations
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb
deleted file mode 100644
index 2b560d3..0000000
--- a/config/initializers/secret_token.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# Your secret key for verifying the integrity of signed cookies.
-# If you change this key, all old signed cookies will become invalid!
-# Make sure the secret is at least 30 characters and all random,
-# no regular words or you'll be exposed to dictionary attacks.
-Clover::Application.config.secret_token = 'eea93344927bd7860495a5c87132622ca87a41909fb0dddd3774b7f0d438386d1af9be3af199177c5987383fcbf31713c543bd659df8aeb54b7aa31aeed138b1'
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 6dba04c..63abbb7 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,14 +1,8 @@
# Be sure to restart your server when you modify this file.
-Clover::Application.config.session_store :cookie_store, :key => '_clover_session'
+Clover::Application.config.session_store :cookie_store, key: '_clover_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Clover::Application.config.session_store :active_record_store
-
-Rails.application.config.middleware.insert_before(
- ActionDispatch::Session::CookieStore,
- FlashSessionCookieMiddleware,
- Rails.application.config.session_options[:key]
-)
diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb
new file mode 100644
index 0000000..59c7d25
--- /dev/null
+++ b/config/initializers/simple_form.rb
@@ -0,0 +1,138 @@
+# Use this setup block to configure all options available in SimpleForm.
+SimpleForm.setup do |config|
+ # Wrappers are used by the form builder to generate a
+ # complete input. You can remove any component from the
+ # wrapper, change the order or even add your own to the
+ # stack. The options given below are used to wrap the
+ # whole input.
+ config.wrappers :default, :class => :input,
+ :hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
+ ## Extensions enabled by default
+ # Any of these extensions can be disabled for a
+ # given input by passing: `f.input EXTENSION_NAME => false`.
+ # You can make any of these extensions optional by
+ # renaming `b.use` to `b.optional`.
+
+ # Determines whether to use HTML5 (:email, :url, ...)
+ # and required attributes
+ b.use :html5
+
+ # Calculates placeholders automatically from I18n
+ # You can also pass a string as f.input :placeholder => "Placeholder"
+ b.use :placeholder
+
+ ## Optional extensions
+ # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
+ # to the input. If so, they will retrieve the values from the model
+ # if any exists. If you want to enable the lookup for any of those
+ # extensions by default, you can change `b.optional` to `b.use`.
+
+ # Calculates maxlength from length validations for string inputs
+ b.optional :maxlength
+
+ # Calculates pattern from format validations for string inputs
+ b.optional :pattern
+
+ # Calculates min and max from length validations for numeric inputs
+ b.optional :min_max
+
+ # Calculates readonly automatically from readonly attributes
+ b.optional :readonly
+
+ ## Inputs
+ b.use :label_input
+ b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
+ b.use :error, :wrap_with => { :tag => :span, :class => :error }
+ end
+
+ # The default wrapper to be used by the FormBuilder.
+ config.default_wrapper = :default
+
+ # Define the way to render check boxes / radio buttons with labels.
+ # Defaults to :nested for bootstrap config.
+ # :inline => input + label
+ # :nested => label > input
+ config.boolean_style = :nested
+
+ # Default class for buttons
+ config.button_class = 'btn'
+
+ # Method used to tidy up errors. Specify any Rails Array method.
+ # :first lists the first message for each field.
+ # Use :to_sentence to list all errors for each field.
+ # config.error_method = :first
+
+ # Default tag used for error notification helper.
+ config.error_notification_tag = :div
+
+ # CSS class to add for error notification helper.
+ config.error_notification_class = 'alert alert-error'
+
+ # ID to add for error notification helper.
+ # config.error_notification_id = nil
+
+ # Series of attempts to detect a default label method for collection.
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
+
+ # Series of attempts to detect a default value method for collection.
+ # config.collection_value_methods = [ :id, :to_s ]
+
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
+ # config.collection_wrapper_tag = nil
+
+ # You can define the class to use on all collection wrappers. Defaulting to none.
+ # config.collection_wrapper_class = nil
+
+ # You can wrap each item in a collection of radio/check boxes with a tag,
+ # defaulting to :span. Please note that when using :boolean_style = :nested,
+ # SimpleForm will force this option to be a label.
+ # config.item_wrapper_tag = :span
+
+ # You can define a class to use in all item wrappers. Defaulting to none.
+ # config.item_wrapper_class = nil
+
+ # How the label text should be generated altogether with the required text.
+ # config.label_text = lambda { |label, required| "#{required} #{label}" }
+
+ # You can define the class to use on all labels. Default is nil.
+ config.label_class = 'control-label'
+
+ # You can define the class to use on all forms. Default is simple_form.
+ # config.form_class = :simple_form
+
+ # You can define which elements should obtain additional classes
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
+
+ # Whether attributes are required by default (or not). Default is true.
+ # config.required_by_default = true
+
+ # Tell browsers whether to use default HTML5 validations (novalidate option).
+ # Default is enabled.
+ config.browser_validations = false
+
+ # Collection of methods to detect if a file type was given.
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
+
+ # Custom mappings for input types. This should be a hash containing a regexp
+ # to match as key, and the input type that will be used when the field name
+ # matches the regexp as value.
+ # config.input_mappings = { /count/ => :integer }
+
+ # Default priority for time_zone inputs.
+ # config.time_zone_priority = nil
+
+ # Default priority for country inputs.
+ # config.country_priority = nil
+
+ # Default size for text inputs.
+ # config.default_input_size = 50
+
+ # When false, do not use translations for labels.
+ # config.translate_labels = true
+
+ # Automatically discover new inputs in Rails' autoload path.
+ # config.inputs_discovery = true
+
+ # Cache SimpleForm inputs discovery
+ # config.cache_discovery = !Rails.env.development?
+end
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb
index da4fb07..999df20 100644
--- a/config/initializers/wrap_parameters.rb
+++ b/config/initializers/wrap_parameters.rb
@@ -5,7 +5,7 @@
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
- wrap_parameters :format => [:json]
+ wrap_parameters format: [:json]
end
# Disable root element in JSON by default.
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 96f6a58..4433436 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -77,6 +77,7 @@ en:
item_details: '%{item} details'
item_keywords: '%{item} keywords'
item_assets: '%{item} Assets'
+ item_edit: '%{item} Edit'
add_item: 'Add %{item}'
logout: 'logout'
diff --git a/config/locales/es.yml b/config/locales/es.yml
index dccb078..95ad464 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -77,6 +77,7 @@ es:
item_details: 'Detalles de %{item}'
item_keywords: 'Palabras clave de %{item}'
item_assets: 'Recursos de %{item}'
+ item_edit: 'Editar %{item}'
add_item: 'Agregar %{item}'
logout: 'salir'
@@ -120,12 +121,18 @@ es:
activerecord:
models:
- section: 'Sección'
- page: 'Pagina'
- article: 'Articulo'
- user: 'Usuario'
- role: 'Rol'
- setting: 'Configuración'
+ section:
+ one: 'Sección'
+ other: 'Secciones'
+ page:
+ one: 'Página'
+ other: 'Páginas'
+ user:
+ one: 'Usuario'
+ other: 'Usuarios'
+ setting:
+ one: 'Configuración'
+ other: 'Configuraciones'
attributes:
section:
name: 'Nombre'
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
new file mode 100644
index 0000000..0df11fe
--- /dev/null
+++ b/config/locales/simple_form.en.yml
@@ -0,0 +1,26 @@
+en:
+ simple_form:
+ "yes": 'Yes'
+ "no": 'No'
+ required:
+ text: 'required'
+ mark: '*'
+ # You can uncomment the line below if you need to overwrite the whole required html.
+ # When using html, text and mark won't be used.
+ # html: '*'
+ error_notification:
+ default_message: "Please review the problems below:"
+ # Labels and hints examples
+ # labels:
+ # defaults:
+ # password: 'Password'
+ # user:
+ # new:
+ # email: 'E-mail to sign in.'
+ # edit:
+ # email: 'E-mail.'
+ # hints:
+ # defaults:
+ # username: 'User name to sign in.'
+ # password: 'No special characters, please.'
+
diff --git a/config/routes.rb b/config/routes.rb
index 20f16ae..9b48195 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,21 +1,21 @@
Clover::Application.routes.draw do
- devise_for :users, :controllers => { :registrations => 'users/registrations' }
+ devise_for :users, controllers: { registrations: 'users/registrations' }
- resource :contact_form, :only => [ :create ]
+ resource :contact_form, only: [ :create ]
- match "/dashboard", :to => "dashboard/sections#index", :as => :dashboard, :via => :get
- match "/dashboard/profile", :to => redirect("/users/edit"), :as => :user_root, :via => :get
+ match "/dashboard", to: "dashboard/sections#index", as: :dashboard, via: :get
+ match "/dashboard/profile", to: redirect("/users/edit"), as: :user_root, via: :get
namespace :dashboard do
- resources :users, :only => [ :index, :destroy ]
- resources :assets, :only => [ :create, :destroy ]
- resources :settings, :except => :show
- resources :sections, :except => :show
- resources :pages, :except => :show
+ resources :users, only: [ :index, :destroy ]
+ resources :assets, only: [ :create, :destroy ]
+ resources :settings, except: :show
+ resources :sections, except: :show
+ resources :pages, except: :show
end
- match ":section/:page", :to => "pages#show", :as => :section_page, :via => :get, :format => :html
- match ":section/:subsection/:page", :to => "pages#show", :as => :subsection_page, :via => :get, :format => :html
+ match ":section/:page", to: "pages#show", as: :section_page, via: :get, format: :html
+ match ":section/:subsection/:page", to: "pages#show", as: :subsection_page, via: :get, format: :html
- root :to => "pages#home", :via => :get
+ root to: "pages#home", via: :get
end
diff --git a/db/migrate/20100805055902_create_sections.rb b/db/migrate/20100805055902_create_sections.rb
index c7d6f21..cfeb141 100644
--- a/db/migrate/20100805055902_create_sections.rb
+++ b/db/migrate/20100805055902_create_sections.rb
@@ -3,7 +3,7 @@ def self.up
create_table :sections do |t|
t.string :name
t.integer :main_section_id
- t.string :url_name, :unique => true
+ t.string :url_name, unique: true
t.timestamps
end
diff --git a/db/migrate/20100806061522_create_pages.rb b/db/migrate/20100806061522_create_pages.rb
index baf21f7..f63268d 100644
--- a/db/migrate/20100806061522_create_pages.rb
+++ b/db/migrate/20100806061522_create_pages.rb
@@ -5,9 +5,9 @@ def self.up
t.string :url_name
t.text :content
t.integer :section_id
- t.boolean :published, :default => false
- t.boolean :home_page, :default => false
- t.boolean :has_contact, :default => false
+ t.boolean :published, default: false
+ t.boolean :home_page, default: false
+ t.boolean :has_contact, default: false
t.timestamps
end
diff --git a/db/migrate/20100814005921_devise_create_users.rb b/db/migrate/20100814005921_devise_create_users.rb
index 5e5d3eb..8b0f52e 100644
--- a/db/migrate/20100814005921_devise_create_users.rb
+++ b/db/migrate/20100814005921_devise_create_users.rb
@@ -2,9 +2,9 @@ class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
## Database authenticatable
- t.string :email, :null => false, :default => ""
- t.string :username, :null => false, :default => ''
- t.string :encrypted_password, :null => false, :default => ""
+ t.string :email, null: false, default: ""
+ t.string :username, null: false, default: ''
+ t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_password_token
@@ -14,7 +14,7 @@ def self.up
t.datetime :remember_created_at
## Trackable
- t.integer :sign_in_count, :default => 0
+ t.integer :sign_in_count, default: 0
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
@@ -30,7 +30,7 @@ def self.up
t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
- t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
+ t.integer :failed_attempts, default: 0 # Only if lock strategy is :failed_attempts
t.string :unlock_token # Only if unlock strategy is :email or :both
t.datetime :locked_at
@@ -43,11 +43,11 @@ def self.up
t.timestamps
end
- add_index :users, :email, :unique => true
- add_index :users, :username, :unique => true
- add_index :users, :reset_password_token, :unique => true
- add_index :users, :confirmation_token, :unique => true
- add_index :users, :unlock_token, :unique => true
+ add_index :users, :email, unique: true
+ add_index :users, :username, unique: true
+ add_index :users, :reset_password_token, unique: true
+ add_index :users, :confirmation_token, unique: true
+ add_index :users, :unlock_token, unique: true
end
def self.down
diff --git a/db/migrate/20101012145155_acts_as_taggable_on_migration.rb b/db/migrate/20101012145155_acts_as_taggable_on_migration.rb
deleted file mode 100644
index e47c4a1..0000000
--- a/db/migrate/20101012145155_acts_as_taggable_on_migration.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-class ActsAsTaggableOnMigration < ActiveRecord::Migration
- def self.up
- create_table :tags do |t|
- t.string :name
- end
-
- create_table :taggings do |t|
- t.references :tag
-
- # You should make sure that the column created is
- # long enough to store the required class names.
- t.references :taggable, :polymorphic => true
- t.references :tagger, :polymorphic => true
-
- t.string :context
-
- t.datetime :created_at
- end
-
- add_index :taggings, :tag_id
- add_index :taggings, [:taggable_id, :taggable_type, :context]
- add_index :taggings, [:tagger_id, :tagger_type]
- end
-
- def self.down
- drop_table :taggings
- drop_table :tags
- end
-end
diff --git a/db/migrate/20101110064447_create_assets.rb b/db/migrate/20101110064447_create_assets.rb
deleted file mode 100644
index f97d785..0000000
--- a/db/migrate/20101110064447_create_assets.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-class CreateAssets < ActiveRecord::Migration
- def self.up
- create_table :assets do |t|
- t.string :description
- t.string :asset_file_name
- t.string :asset_content_type
- t.integer :asset_file_size
- t.integer :attachable_id
- t.string :attachable_type
- end
-
- add_index :assets, :asset_content_type
- add_index :assets, [ :attachable_id, :attachable_type ]
- end
-
- def self.down
- remove_index :assets, [ :attachable_id, :attachable_type ]
- remove_index :assets, :asset_content_type
-
- drop_table :assets
- end
-end
diff --git a/db/migrate/20110209072651_create_settings.rb b/db/migrate/20110209072651_create_settings.rb
index 583b527..f41b6b8 100644
--- a/db/migrate/20110209072651_create_settings.rb
+++ b/db/migrate/20110209072651_create_settings.rb
@@ -1,10 +1,10 @@
class CreateSettings < ActiveRecord::Migration
def self.up
create_table :settings do |t|
- t.string :name, :null => false
- t.text :value, :null => false
+ t.string :name, null: false
+ t.text :value, null: false
t.string :description
- t.boolean :destroyable, :default => true
+ t.boolean :destroyable, default: true
t.timestamps
end
diff --git a/db/migrate/20120918221141_add_slug_to_pages.rb b/db/migrate/20120918221141_add_slug_to_pages.rb
index 18bc4f8..35d70f9 100644
--- a/db/migrate/20120918221141_add_slug_to_pages.rb
+++ b/db/migrate/20120918221141_add_slug_to_pages.rb
@@ -1,6 +1,6 @@
class AddSlugToPages < ActiveRecord::Migration
def change
add_column :pages, :slug, :string
- add_index :pages, :slug, :unique => true
+ add_index :pages, :slug, unique: true
end
end
diff --git a/db/migrate/20120918223422_add_slug_to_sections.rb b/db/migrate/20120918223422_add_slug_to_sections.rb
index 46407c6..733fc07 100644
--- a/db/migrate/20120918223422_add_slug_to_sections.rb
+++ b/db/migrate/20120918223422_add_slug_to_sections.rb
@@ -1,6 +1,6 @@
class AddSlugToSections < ActiveRecord::Migration
def change
add_column :sections, :slug, :string
- add_index :sections, :slug, :unique => true
+ add_index :sections, :slug, unique: true
end
end
diff --git a/db/schema.rb b/db/schema.rb
index db70c88..da3c21e 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -13,18 +13,6 @@
ActiveRecord::Schema.define(:version => 20120918223422) do
- create_table "assets", :force => true do |t|
- t.string "description"
- t.string "asset_file_name"
- t.string "asset_content_type"
- t.integer "asset_file_size"
- t.integer "attachable_id"
- t.string "attachable_type"
- end
-
- add_index "assets", ["asset_content_type"], :name => "index_assets_on_asset_content_type"
- add_index "assets", ["attachable_id", "attachable_type"], :name => "index_assets_on_attachable_id_and_attachable_type"
-
create_table "pages", :force => true do |t|
t.string "name"
t.text "content"
@@ -60,24 +48,6 @@
t.datetime "updated_at", :null => false
end
- create_table "taggings", :force => true do |t|
- t.integer "tag_id"
- t.integer "taggable_id"
- t.string "taggable_type"
- t.integer "tagger_id"
- t.string "tagger_type"
- t.string "context"
- t.datetime "created_at"
- end
-
- add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
- add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
- add_index "taggings", ["tagger_id", "tagger_type"], :name => "index_taggings_on_tagger_id_and_tagger_type"
-
- create_table "tags", :force => true do |t|
- t.string "name"
- end
-
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "username", :default => "", :null => false
diff --git a/db/seeds.rb b/db/seeds.rb
index 060d2b2..e6d4317 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -1,30 +1,30 @@
# We crate our default section and page to avoid CMS errors
-section = Section.create!( :name => 'main' )
-page = section.pages.build( :name => 'main page', :content => 'this is my main page', :home_page => true, :published => true ).save!
+section = Section.create!( name: 'main' )
+page = section.pages.build( name: 'main page', content: 'this is my main page', home_page: true, published: true ).save!
# We create and activate a default user
-user = User.create! :username => 'admin', :password => 'administrator', :email => "admin@example.com"
+user = User.create! username: 'admin', password: 'administrator', email: "admin@example.com"
user.save!
# We create the default non-destroyable site settings
default_settings = [
{
- :name => 'theme',
- :value => 'default',
- :description => 'This is the theme of your site.'
+ name: 'theme',
+ value: 'default',
+ description: 'This is the theme of your site.'
},
{
- :name => 'site_name',
- :value => 'CloverInteractive',
- :description => 'This is your site name.'
+ name: 'site_name',
+ value: 'CloverInteractive',
+ description: 'This is your site name.'
},
{
- :name => 'footer',
- :value => 'This site is powered by CloverInteractive',
- :description => "This is your site's footer."
+ name: 'footer',
+ value: 'This site is powered by CloverInteractive',
+ description: "This is your site's footer."
}
]
diff --git a/lib/extensions/pygments_renderer.rb b/lib/extensions/pygments_renderer.rb
new file mode 100644
index 0000000..683432b
--- /dev/null
+++ b/lib/extensions/pygments_renderer.rb
@@ -0,0 +1,9 @@
+class PygmentsRenderer < Redcarpet::Render::HTML
+ def block_code( code, language )
+ sha = Digest::SHA1.hexdigest( code )
+
+ Rails.cache.fetch [ 'code', language, sha ].join( '-' ) do
+ Pygments.highlight( code, lexer: language, options: { encoding: 'utf-8' } )
+ end
+ end
+end
diff --git a/lib/tasks/config.rake b/lib/tasks/config.rake
new file mode 100644
index 0000000..8658fdf
--- /dev/null
+++ b/lib/tasks/config.rake
@@ -0,0 +1,56 @@
+namespace :config do
+ desc "Generate application environment files"
+ task :generate => [ :vhost, :database, :secret_token ]
+
+ desc "Generate nginx vhost"
+ task :vhost do
+ erb_parse :vhost
+ end
+
+
+ desc "Generate database.yml"
+ task :database do
+ erb_parse :database, extension: '.yml'
+ end
+
+ desc "Generate secret_token.rb"
+ task :secret_token do
+ erb_parse :secret_token, extension: '.rb', output_dir: Rails.root.join( 'config', 'initializers' ).to_s
+ end
+
+ def erb_parse name, opts={}
+ require 'erb'
+ require 'securerandom'
+
+ ext = opts[:extension] || '.conf'
+
+ host = {
+ 'development' => 'www.cms.dev',
+ 'production' => 'www.cloverinteractive.com',
+ 'staging' => 'staging.cloverinteractive.com'
+ }[ Rails.env ]
+
+ config_dir = Rails.root.join( 'config' ).to_s
+ output_dir = opts[:output_dir] || config_dir
+
+ erb_env = Proc.new do
+ @host = host
+ @root = Rails.root
+
+ @subdomain = host.split( '.' ).first
+ @public = "#{ @root.join 'public' }"
+ @log = "#{ @root.join 'log' }"
+ @dev_on = Rails.env.production? ? 'off' : 'on'
+
+ @secret_token = SecureRandom.hex 64
+
+ binding
+ end.call
+
+ response = ERB.new File.read( File.join( config_dir, "_#{ name }#{ ext }.erb" ) )
+
+ File.open File.join( output_dir, "#{ name }#{ ext }" ), 'w' do |f|
+ f.print response.result( erb_env )
+ end
+ end
+end
diff --git a/lib/templates/haml/scaffold/_form.html.haml b/lib/templates/haml/scaffold/_form.html.haml
new file mode 100644
index 0000000..ac3aa7b
--- /dev/null
+++ b/lib/templates/haml/scaffold/_form.html.haml
@@ -0,0 +1,10 @@
+= simple_form_for(@<%= singular_table_name %>) do |f|
+ = f.error_notification
+
+ .form-inputs
+ <%- attributes.each do |attribute| -%>
+ = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
+ <%- end -%>
+
+ .form-actions
+ = f.button :submit
diff --git a/public/swf/uploadify/uploadify.swf b/public/swf/uploadify/uploadify.swf
deleted file mode 100755
index 592badd..0000000
Binary files a/public/swf/uploadify/uploadify.swf and /dev/null differ
diff --git a/spec/controllers/dashboard/pages_controller_spec.rb b/spec/controllers/dashboard/pages_controller_spec.rb
index 4385819..84d8d92 100644
--- a/spec/controllers/dashboard/pages_controller_spec.rb
+++ b/spec/controllers/dashboard/pages_controller_spec.rb
@@ -1,16 +1,14 @@
require 'spec_helper'
describe Dashboard::PagesController do
- before :each do
- @user = Factory.create :user
- @section = Factory.create :section
- @page = Factory.create :page, :section => @section
- end
+ let( :user ) { create :user }
+ let( :section ) { create :section }
+ let( :page ) { create :page, section: section }
+
+ before { page.should be_persisted }
describe "when user is logged in" do
- before :each do
- login_as @user
- end
+ before { sign_in user }
describe "GET index" do
before :each do
@@ -18,7 +16,7 @@
end
it "should assign @pages" do
- assigns( :pages ).should == [ @page ]
+ assigns( :pages ).should include( page )
end
it "should be successful" do
@@ -50,7 +48,7 @@
describe "GET edit" do
before :each do
- get :edit, :id => @page
+ get :edit, id: page
end
it "should assign @page" do
@@ -67,10 +65,9 @@
end
describe "POST create" do
- before :each do
- @page_attr = Factory.attributes_for :page, :name => 'new page', :section_id => @section.id
- post :create, :page => @page_attr
- end
+ let( :page_attr ) { attributes_for :page, name: 'new page', section_id: section.id }
+
+ before { post :create, page: page_attr }
it "should redirect to index" do
response.should redirect_to( dashboard_pages_path )
@@ -78,26 +75,26 @@
it "should create page" do
assigns( :page ).should be_kind_of( Page )
- Page.count.should == 2
+ Page.count.should eql( 2 )
end
it "should render new if anything goes wrong" do
- post :create, :page => @page_attr.merge( :name => @page.name )
+ post :create, page: page_attr.merge( name: page.name )
response.should render_template( :new )
end
end
describe "PUT update" do
before :each do
- put :update, :id => @page, :page => { :name => 'batman' }
+ put :update, id: page, page: { name: 'batman' }
end
it "should redirect to index" do
- response.should redirect_to( dashboard_pages_path )
+ response.should redirect_to( edit_dashboard_page_path( page.reload ) )
end
it "should update @page" do
- assigns( :page ).should == @page.reload
+ assigns( :page ).should eql( page.reload )
end
it "should assign @page" do
@@ -107,11 +104,11 @@
describe "DELETE destroy" do
before :each do
- delete :destroy, :id => @page
+ delete :destroy, id: page
end
it "should destroy page" do
- Page.count.should == 0
+ Page.count.should eql( 0 )
end
it "should redirect to index" do
@@ -125,23 +122,23 @@
it "should redirect to login when using GET" do
actions = %w/index new edit/
actions.each do |action|
- get action, :id => @page
+ get action, id: page
response.should redirect_to( new_user_session_path )
end
end
it "should redirect to login when using POST" do
- post :create, :page => Factory.attributes_for( :page )
+ post :create, page: attributes_for( :page )
response.should redirect_to( new_user_session_path )
end
it "should redirect to login when using PUT" do
- put :update, :id => @page, :page => { :name => '' }
+ put :update, id: page, page: { name: '' }
response.should redirect_to( new_user_session_path )
end
it "should redirect to login when using DELETE" do
- delete :destroy, :id => @page
+ delete :destroy, id: page
response.should redirect_to( new_user_session_path )
end
end
diff --git a/spec/controllers/dashboard/sections_controller_spec.rb b/spec/controllers/dashboard/sections_controller_spec.rb
index 819d2f0..2d7a317 100644
--- a/spec/controllers/dashboard/sections_controller_spec.rb
+++ b/spec/controllers/dashboard/sections_controller_spec.rb
@@ -1,14 +1,13 @@
require 'spec_helper'
describe Dashboard::SectionsController do
- before :each do
- @user = Factory.create :user
- @section = Factory.create :section
- end
+ let( :user ) { create :user }
+ let( :section ) { create :section }
describe "when user is logged in" do
before :each do
- login_as @user
+ section.should be_persisted
+ sign_in user
end
describe "GET index" do
@@ -21,7 +20,7 @@
end
it "should assign @sections" do
- assigns( :sections ).should == [ @section ]
+ assigns( :sections ).should include( section )
end
it "should render index" do
@@ -49,7 +48,7 @@
describe "GET edit" do
before :each do
- get :edit, :id => @section
+ get :edit, id: section
end
it "should be successfu" do
@@ -67,11 +66,7 @@
describe "POST create" do
before :each do
- post :create, :section => Factory.attributes_for( :section )
- end
-
- it "should create new section" do
- Section.count.should == 2
+ expect { post :create, section: attributes_for( :section ) }.to change { Section.count }.by 1
end
it "should assign @section" do
@@ -83,41 +78,42 @@
end
it "should render new should something go wrong" do
- post :create, Factory.attributes_for( :section, :name => '' )
+ post :create, attributes_for( :section, name: '' )
response.should render_template( :new )
end
end
describe "PUT update" do
- before :each do
- put :update, :id => @section, :section => { :name => 'batman' }
- end
+ before { section.should be_persisted }
- it "should assign @section" do
- assigns( :section ).should be_kind_of( Section )
- end
+ context :update_successful do
+ before { put :update, id: section, section: { name: 'batman' } }
- it "should update @section" do
- assigns( :section ).should == @section
- end
+ it "should assign @section" do
+ assigns( :section ).should be_kind_of( Section )
+ end
- it "should redirect to index" do
- response.should redirect_to( dashboard_sections_path )
+ it "should update @section" do
+ assigns( :section ).should eql( section )
+ end
+
+ it "should redirect to index" do
+ response.should redirect_to( dashboard_sections_path )
+ end
end
- it "should render edit should something go wrong" do
- put :update, :id => @section, :section => { :name => '' }
- response.should render_template( :edit )
+
+ context :update_fails do
+ it "should render edit should something go wrong" do
+ put :update, id: section, section: { name: '' }
+ response.should render_template( :edit )
+ end
end
end
describe "DELETE destroy" do
before :each do
- delete :destroy, :id => @section
- end
-
- it "should destroy section" do
- Section.count.should == 0
+ expect { delete :destroy, id: section }.to change { Section.count }.by -1
end
it "should redirect to index" do
@@ -131,23 +127,23 @@
it "should redirect to login when using GET" do
actions = %w/index new edit/
actions.each do |action|
- get action, :id => @section
+ get action, id: section
response.should redirect_to( new_user_session_path )
end
end
it "should redirect to login when using POST" do
- post :create, :setting => Factory.attributes_for( :section )
+ post :create, setting: attributes_for( :section )
response.should redirect_to( new_user_session_path )
end
it "should redirect to login when using PUT" do
- put :update, :id => @section, :section => { :name => 'batman' }
+ put :update, id: section, section: { name: 'batman' }
response.should redirect_to( new_user_session_path )
end
it "should redirect to login when using DELETE" do
- delete :destroy, :id => @section
+ delete :destroy, id: section
response.should redirect_to( new_user_session_path )
end
end
diff --git a/spec/controllers/dashboard/settings_controller_spec.rb b/spec/controllers/dashboard/settings_controller_spec.rb
index 62bf879..7094c7f 100644
--- a/spec/controllers/dashboard/settings_controller_spec.rb
+++ b/spec/controllers/dashboard/settings_controller_spec.rb
@@ -1,15 +1,11 @@
require 'spec_helper'
describe Dashboard::SettingsController do
- before :each do
- @user = Factory.create :user
- @setting = Factory.create :setting, :name => 'test_setting', :value => 'true'
- end
+ let( :user ) { create :user }
+ let( :setting ) { create :setting, name: 'test_setting', value: 'true' }
describe "when user is logged in" do
- before :each do
- login_as @user
- end
+ before { sign_in user }
describe "GET index" do
before :each do
@@ -21,7 +17,7 @@
end
it "should assign @settings" do
- assigns( :settings ).should == [ @setting ]
+ assigns( :settings ).should include( setting )
end
it "should render index" do
@@ -49,7 +45,7 @@
describe "GET edit" do
before :each do
- get :edit, :id => @setting
+ get :edit, id: setting
end
it "should be successful" do
@@ -67,11 +63,7 @@
describe "POST create" do
before :each do
- post :create, :setting => Factory.attributes_for( :setting )
- end
-
- it "should create setting" do
- Setting.count.should == 2
+ expect { post :create, setting: attributes_for( :setting ) }.to change { Setting.count }.by 1
end
it "should assign @setting" do
@@ -83,18 +75,18 @@
end
it "should render new should anything go wrong" do
- post :create, :setting => Factory.attributes_for( :setting, :name => '' )
+ post :create, setting: attributes_for( :setting, name: nil )
response.should render_template( :new )
end
end
describe "PUT update" do
before :each do
- put :update, :id => @setting, :setting => { :name => 'batman' }
+ put :update, id: setting, setting: { name: 'batman' }
end
it "should update setting" do
- assigns( :setting ).should == @setting.reload
+ assigns( :setting ).should eql( setting.reload )
end
it "should assign @setting" do
@@ -106,18 +98,16 @@
end
it "should render edit should anything go wrong" do
- put :update, :id => @setting, :setting => { :name => '' }
+ put :update, id: setting, setting: { name: nil }
response.should render_template( :edit )
end
end
describe "DELETE destroy" do
- before :each do
- delete :destroy, :id => @setting
- end
+ before { delete :destroy, id: setting }
it "should destroy setting" do
- Setting.count.should == 0
+ Setting.count.should eql( 0 )
end
it "should redirect to index" do
@@ -125,13 +115,10 @@
end
it "should not destroy if setting is not destroyable" do
- setting = Factory.create :setting
setting.destroyable = false
setting.save!
- delete :destroy, :id => setting
- Setting.count.should == 1
- Setting.first.should == setting
+ expect { delete :destroy, id: setting }.to_not change { Setting.count }
end
end
end
@@ -141,23 +128,23 @@
it "should redirect to login when using GET" do
actions = %w/index new edit/
actions.each do |action|
- get action, :id => @setting
+ get action, id: setting
response.should redirect_to( new_user_session_path )
end
end
it "should redirect to login when using POST" do
- post :create, :setting => Factory.attributes_for( :setting )
+ post :create, setting: attributes_for( :setting )
response.should redirect_to( new_user_session_path )
end
it "should redirect to login when using PUT" do
- put :update, :id => @setting, :setting => { :name => 'batman' }
+ put :update, id: setting, setting: { name: 'batman' }
response.should redirect_to( new_user_session_path )
end
it "should redirect to login when using DELETE" do
- delete :destroy, :id => @setting
+ delete :destroy, id: setting
response.should redirect_to( new_user_session_path )
end
end
diff --git a/spec/controllers/dashboard/users_controller_spec.rb b/spec/controllers/dashboard/users_controller_spec.rb
index 022448d..61fed5d 100644
--- a/spec/controllers/dashboard/users_controller_spec.rb
+++ b/spec/controllers/dashboard/users_controller_spec.rb
@@ -1,14 +1,10 @@
require 'spec_helper'
describe Dashboard::UsersController do
- before :each do
- @user = Factory.create :user
- end
+ let( :user ) { create :user }
describe "when user is logged in" do
- before :each do
- login_as @user
- end
+ before { sign_in user }
describe "GET index" do
before :each do
@@ -20,7 +16,7 @@
end
it "should assign @users" do
- assigns( :users ).should == [ @user ]
+ assigns( :users ).should include( user )
end
it "should render index" do
@@ -30,11 +26,7 @@
describe "DELETE destroy" do
before :each do
- delete :destroy, :id => @user
- end
-
- it "should delete user" do
- User.count.should == 0
+ expect { delete :destroy, id: user }.to change { User.count }.by -1
end
it "should redirect to index" do
@@ -51,7 +43,7 @@
end
it "should redirect to login when using DELETE" do
- delete :destroy, :id => @user
+ delete :destroy, id: user
response.should redirect_to( new_user_session_path )
end
end
diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb
index e870843..56a02b8 100644
--- a/spec/controllers/pages_controller_spec.rb
+++ b/spec/controllers/pages_controller_spec.rb
@@ -1,22 +1,26 @@
require 'spec_helper'
describe PagesController do
- before :each do
- @page = Factory.create :page, :home_page => true
- get :show, :page => @page.slug, :section => @page.section.slug
- end
+ let( :page ) { create :page, home_page: true }
- it "response should be sucessful" do
- response.should be_success
- end
+ context 'render page' do
+ before( :each ) do
+ page.should be_persisted
+ get :show, page: page.slug, section: page.section.slug
+ end
- it "should render show" do
- response.should render_template( :show )
- end
+ it "response should be sucessful" do
+ response.should be_success
+ end
+
+ it "should render show" do
+ response.should render_template( :show )
+ end
- it "should render show for homepage" do
- get :home
- response.should be_success
- response.should render_template( :show )
+ it "should render show for homepage" do
+ get :home
+ response.should be_success
+ response.should render_template( :show )
+ end
end
end
diff --git a/spec/factories.rb b/spec/factories.rb
index 43e3050..50b57b5 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -9,7 +9,7 @@
factory :user do
username 'user'
- email { Factory.next :email }
+ email { generate :email }
password 'password'
password_confirmation 'password'
end
@@ -22,7 +22,7 @@
end
factory :section do
- name { Factory.next :name }
+ name { generate :name }
end
factory :setting do
diff --git a/spec/models/page_spec.rb b/spec/models/page_spec.rb
index 3b7930c..9a0964d 100644
--- a/spec/models/page_spec.rb
+++ b/spec/models/page_spec.rb
@@ -1,38 +1,29 @@
require 'spec_helper'
describe Page do
- before :each do
- @page = Factory.create :page
- end
+ let( :page ) { create :page }
describe "name" do
it "must be present" do
- @page.name = nil
- @page.should be_invalid
+ page.name = nil
+ page.should be_invalid
end
it "must be unique" do
- page = Factory.build :page
- page.should be_invalid
+ new_page = build :page, name: page.name
+ new_page.should be_invalid
end
end
describe "slug" do
it "must be autogenerated" do
- @page.slug.should be_present
+ page.save!
+ page.slug.should be_present
end
end
it "should belong to one section" do
- page = Page.new :name => 'test_name', :content => 'Test content'
+ page = build :page, name: 'test_name', content: 'Test content', section: nil
page.should be_invalid
-
- @page.section.should be_present
- end
-
- it "should accept keywords" do
- @page.keyword_list = 'this, are, some, keywords'
- @page.should be_valid
- @page.save.should == true
end
end
diff --git a/spec/models/section_spec.rb b/spec/models/section_spec.rb
index 82fa3de..8889668 100644
--- a/spec/models/section_spec.rb
+++ b/spec/models/section_spec.rb
@@ -1,26 +1,117 @@
require 'spec_helper'
describe Section do
- before :each do
- @section = Factory :section, :name => "test"
- end
+ let( :section ) { create :section, name: 'test' }
+ let( :subsection ) { create :section, main_section: section }
+
describe "name" do
it "should be present" do
- new_section = Section.new
+ new_section = build :section, name: nil
new_section.should be_invalid
end
it "should be unique" do
- section = Factory.build :section, :name => "test"
- section.should be_invalid
+ section.should be_persisted
- section.name = 'new_name'
- section.should be_valid
+ new_section = build :section, name: section.name
+ new_section.should be_invalid
end
end
it "should have an slug after created" do
- @section.slug.should be_present
+ section.slug.should be_present
+ end
+
+ describe :section_collection do
+ before { section.should be_persisted }
+
+ context :new_record do
+ it 'should show fetch all sections' do
+ new_section = build :section
+ new_section.section_collection.should include( [ section.name, section.id ] )
+ new_section.section_collection.should eql( Section.section_collection )
+ end
+ end
+
+ context :exting_record do
+ it 'should not fetch self' do
+ section.section_collection.should_not include( [ section.name, section.id ] )
+ section.section_collection.should eql( [] )
+ end
+ end
+ end
+
+ describe :with_children do
+ context :section_page do
+ let( :section_page ) { create :page, section: section }
+
+ before( :each ) do
+ section.should be_persisted
+ section_page.should be_persisted
+ end
+
+ it 'should fetch section and page' do
+ new_section, new_subsection, page = *Section.with_children( section: section.slug, page: section_page.slug )
+
+ new_section.should be_present
+ new_section.should be_kind_of( Section )
+
+ new_subsection.should be_blank
+
+ page.should be_present
+ page.should be_kind_of( Page )
+ end
+
+ it 'should only fetch section if page name is wrong' do
+ new_section, new_subsection, page = *Section.with_children( section: section.slug, page: "#{ section_page.slug }-wrong" )
+
+ new_section.should be_present
+ new_subsection.should be_blank
+ page.should be_blank
+ end
+
+ it 'should not fetch anything if section name is wrong' do
+ new_section, new_subsection, page = *Section.with_children( section: "#{ section.slug }-wrong", page: section_page.slug )
+
+ new_section.should be_blank
+ new_subsection.should be_blank
+ page.should be_blank
+ end
+ end
+
+ context :subsection_page do
+ let( :section_page ) { create :page, section: subsection }
+
+ before( :each ) do
+ section.should be_persisted
+ subsection.should be_persisted
+ section_page.should be_persisted
+ end
+
+ it 'it should fetch section, subsection and page' do
+ new_section, new_subsection, page = *Section.with_children( section: section.slug, subsection: subsection.slug, page: section_page.slug )
+
+ new_section.should be_present
+ new_subsection.should be_present
+ page.should be_present
+ end
+
+ it 'should not fetch anything if section name is wrong' do
+ new_section, new_subsection, page = *Section.with_children( section: "#{ section.slug }-wrong", subsection: subsection.slug, page: section_page.slug )
+
+ new_section.should be_blank
+ new_subsection.should be_blank
+ page.should be_blank
+ end
+
+ it 'should not fetch page if subsection name is wrong' do
+ new_section, new_subsection, page = *Section.with_children( section: section.slug, subsection: "#{ subsection.slug }-wrong", page: section_page.slug )
+
+ new_section.should be_present
+ new_subsection.should be_blank
+ page.should be_blank
+ end
+ end
end
end
diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb
index e275d8b..3ad87ce 100644
--- a/spec/models/setting_spec.rb
+++ b/spec/models/setting_spec.rb
@@ -1,35 +1,31 @@
require 'spec_helper'
describe Setting do
- before :each do
- @theme = Factory.create :setting, :name => 'theme', :value => 'clover', :destroyable => false
- end
+ let( :theme ) { create :setting, name: 'theme', value: 'clover', destroyable: false }
describe "name" do
it "must be present" do
- setting = Factory.build :setting, :name => ''
+ setting = build :setting, name: nil
setting.should be_invalid
end
it "must be unique" do
- setting = Factory.build :setting, :name => 'theme'
+ theme.should be_persisted
+
+ setting = build :setting, name: 'theme'
setting.should be_invalid
end
it "shold be properly formatted" do
- setting = Factory.build :setting, :name => 'badly formatted name '
+ setting = build :setting, name: 'badly formatted name '
setting.should be_invalid
end
end
describe "value" do
it "must be present" do
- setting = Factory.build :setting, :value => ''
+ setting = build :setting, value: ''
setting.should be_invalid
end
end
-
- it "should not delete non destroyable settings" do
- @theme.delete.should be_false
- end
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 8454e71..b79ab09 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1,33 +1,34 @@
require 'spec_helper'
describe User do
- before :each do
- @user = Factory.create :user
- end
+ let( :user ) { create :user }
describe "email" do
it "must be unique" do
- user = Factory.build :user, :email => @user.email
- user.should be_invalid
+ user.should be_persisted
+
+ new_user = build :user, email: user.email
+ new_user.should be_invalid
end
it "must have proper format" do
- user = Factory.build :user
+ new_user = build :user
+
%w/invalid_email in@va@lid invalit@..@/.each do |invalid_email|
- user.email = invalid_email
- user.should be_invalid
+ new_user.email = invalid_email
+ new_user.should be_invalid
end
end
end
describe "username" do
it "must be present" do
- user = Factory.build :user, :username => ''
+ user = build :user, username: nil
user.should be_invalid
end
it "must be properly formatted" do
- user = Factory.build :user, :username => ''
+ user = build :user, username: nil
%w/&*)@user tes!@@k ASc))/.each do |invalid_username|
user.username = invalid_username
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 0d1b441..81760ce 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,14 +1,39 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
-ENV["RAILS_ENV"] ||= 'test'
+ENV["RAILS_ENV"] = 'test'
+
+require 'simplecov'
+SimpleCov.start 'rails'
+
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
-require 'mocha'
+require 'rspec/autorun'
+require 'capybara/rspec'
+
+Capybara.javascript_driver = :webkit
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
- config.mock_with :mocha
config.use_transactional_fixtures = true
+
+ config.before( :suite ) do
+ DatabaseCleaner.strategy = :truncation
+ DatabaseCleaner.clean_with :truncation
+ end
+
+ config.before( :each ) do
+ DatabaseCleaner.start
+ end
+
+ config.after( :each ) do
+ DatabaseCleaner.clean
+ end
+
+ config.infer_base_class_for_anonymous_controllers = false
+ config.order = "random"
+
+ config.include FactoryGirl::Syntax::Methods
+ config.include Devise::TestHelpers, type: :controller
end
diff --git a/spec/support/controller_spec_helper.rb b/spec/support/controller_spec_helper.rb
deleted file mode 100644
index dbaf678..0000000
--- a/spec/support/controller_spec_helper.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-module ControllerSpecHelpers
- def login_as( user )
- @controller.class.any_instance.stubs( :current_user ).returns user
- @controller.class.any_instance.stubs( :authenticate_user! ).returns true
- end
-end
-
-RSpec.configure do |config|
- config.include ControllerSpecHelpers, :type => :controller
-end
diff --git a/spec/support/devise.rb b/spec/support/devise.rb
deleted file mode 100644
index 3552bea..0000000
--- a/spec/support/devise.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-RSpec.configure do |config|
- config.include Devise::TestHelpers, :type => :controller
-end
diff --git a/vendor/assets/javascripts/uploadify/swfobject.js b/vendor/assets/javascripts/uploadify/swfobject.js
deleted file mode 100755
index 8eafe9d..0000000
--- a/vendor/assets/javascripts/uploadify/swfobject.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/* SWFObject v2.2
- is released under the MIT License
-*/
-var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab');swfobject.embedSWF(f.uploader,f.id+"Uploader",f.width,f.height,"9.0.24",f.expressInstall,g,{quality:"high",wmode:f.wmode,allowScriptAccess:f.scriptAccess},{},function(i){if(typeof(f.onSWFReady)=="function"&&i.success){f.onSWFReady()}});if(f.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('')}else{a("#"+f.queueID).addClass("uploadifyQueue")}}if(typeof(f.onOpen)=="function"){a(this).bind("uploadifyOpen",f.onOpen)}a(this).bind("uploadifySelect",{action:f.onSelect,queueID:f.queueID},function(k,i,j){if(k.data.action(k,i,j)!==false){var l=Math.round(j.size/1024*100)*0.01;var m="KB";if(l>1000){l=Math.round(l*0.001*100)*0.01;m="MB"}var n=l.toString().split(".");if(n.length>1){l=n[0]+"."+n[1].substr(0,2)}else{l=n[0]}if(j.name.length>20){fileName=j.name.substr(0,20)+"..."}else{fileName=j.name}queue="#"+a(this).attr("id")+"Queue";if(k.data.queueID){queue="#"+k.data.queueID}a(queue).append('')}});a(this).bind("uploadifySelectOnce",{action:f.onSelectOnce},function(i,j){i.data.action(i,j);if(f.auto){if(f.checkScript){a(this).uploadifyUpload(null,false)}else{a(this).uploadifyUpload(null,true)}}});a(this).bind("uploadifyQueueFull",{action:f.onQueueFull},function(i,j){if(i.data.action(i,j)!==false){alert("The queue is full. The max size is "+j+".")}});a(this).bind("uploadifyCheckExist",{action:f.onCheck},function(n,m,l,k,p){var j=new Object();j=l;j.folder=(k.substr(0,1)=="/")?k:e+k;if(p){for(var i in l){var o=i}}a.post(m,j,function(s){for(var q in s){if(n.data.action(n,s,q)!==false){var r=confirm("Do you want to replace the file "+s[q]+"?");if(!r){document.getElementById(a(n.target).attr("id")+"Uploader").cancelFileUpload(q,true,true)}}}if(p){document.getElementById(a(n.target).attr("id")+"Uploader").startFileUpload(o,true)}else{document.getElementById(a(n.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:f.onCancel},function(n,j,m,o,i,l){if(n.data.action(n,j,m,o,l)!==false){if(i){var k=(l==true)?0:250;a("#"+a(this).attr("id")+j).fadeOut(k,function(){a(this).remove()})}}});a(this).bind("uploadifyClearQueue",{action:f.onClearQueue},function(k,j){var i=(f.queueID)?f.queueID:a(this).attr("id")+"Queue";if(j){a("#"+i).find(".uploadifyQueueItem").remove()}if(k.data.action(k,j)!==false){a("#"+i).find(".uploadifyQueueItem").each(function(){var l=a(".uploadifyQueueItem").index(this);a(this).delay(l*100).fadeOut(250,function(){a(this).remove()})})}});var c=[];a(this).bind("uploadifyError",{action:f.onError},function(m,i,l,k){if(m.data.action(m,i,l,k)!==false){var j=new Array(i,l,k);c.push(j);a("#"+a(this).attr("id")+i).find(".percentage").text(" - "+k.type+" Error");a("#"+a(this).attr("id")+i).find(".uploadifyProgress").hide();a("#"+a(this).attr("id")+i).addClass("uploadifyError")}});if(typeof(f.onUpload)=="function"){a(this).bind("uploadifyUpload",f.onUpload)}a(this).bind("uploadifyProgress",{action:f.onProgress,toDisplay:f.displayData},function(k,i,j,l){if(k.data.action(k,i,j,l)!==false){a("#"+a(this).attr("id")+i+"ProgressBar").animate({width:l.percentage+"%"},250,function(){if(l.percentage==100){a(this).closest(".uploadifyProgress").fadeOut(250,function(){a(this).remove()})}});if(k.data.toDisplay=="percentage"){displayData=" - "+l.percentage+"%"}if(k.data.toDisplay=="speed"){displayData=" - "+l.speed+"KB/s"}if(k.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+i).find(".percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:f.onComplete},function(l,i,k,j,m){if(l.data.action(l,i,k,unescape(j),m)!==false){a("#"+a(this).attr("id")+i).find(".percentage").text(" - Completed");if(f.removeCompleted){a("#"+a(l.target).attr("id")+i).fadeOut(250,function(){a(this).remove()})}a("#"+a(l.target).attr("id")+i).addClass("completed")}});if(typeof(f.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:f.onAllComplete},function(i,j){if(i.data.action(i,j)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(a(this).data("settings").scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+i[k]}j=escape(l.substr(1))}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d
-
-
-
-WYMeditor iframe
-
-
-
-
-
diff --git a/vendor/assets/javascripts/wymeditor/jquery.wymeditor.min.js b/vendor/assets/javascripts/wymeditor/jquery.wymeditor.min.js
deleted file mode 100644
index 1748335..0000000
--- a/vendor/assets/javascripts/wymeditor/jquery.wymeditor.min.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*jslint evil: true, indent: 4 *//**
- WYMeditor
- =========
-
- version 1.0.0a2
-
- WYMeditor : what you see is What You Mean web-based editor
-
- Main JS file with core classes and functions.
-
- Copyright
- ---------
-
- Copyright (c) 2005 - 2010 Jean-Francois Hovinne, http://www.wymeditor.org/
- Dual licensed under the MIT (MIT-license.txt)
- and GPL (GPL-license.txt) licenses.
-
- Website
- -------
-
- For further information visit:
- http://www.wymeditor.org/
-
-
- Authors
- -------
-
- See AUTHORS file
-*/// Global WYMeditor namespace.
-typeof WYMeditor=="undefined"&&(WYMeditor={}),function(){if(!window.console||!window.console.firebug){var a=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"],b=function(){},c;WYMeditor.console={};for(c=0;c"+""+WYMeditor.TOOLS+"
"+""+""+WYMeditor.CONTAINERS+WYMeditor.CLASSES+"
"+""+WYMeditor.HTML+WYMeditor.IFRAME+WYMeditor.STATUS+"
"+""+WYMeditor.LOGO+"
"+"",logoHtml:String()+'WYMeditor',iframeHtml:String()+''+'"+"
",editorStyles:[],toolsHtml:String()+'",toolsItemHtml:String()+''+''+WYMeditor.TOOL_TITLE+""+"",toolsItems:[{name:"Bold",title:"Strong",css:"wym_tools_strong"},{name:"Italic",title:"Emphasis",css:"wym_tools_emphasis"},{name:"Superscript",title:"Superscript",css:"wym_tools_superscript"},{name:"Subscript",title:"Subscript",css:"wym_tools_subscript"},{name:"InsertOrderedList",title:"Ordered_List",css:"wym_tools_ordered_list"},{name:"InsertUnorderedList",title:"Unordered_List",css:"wym_tools_unordered_list"},{name:"Indent",title:"Indent",css:"wym_tools_indent"},{name:"Outdent",title:"Outdent",css:"wym_tools_outdent"},{name:"Undo",title:"Undo",css:"wym_tools_undo"},{name:"Redo",title:"Redo",css:"wym_tools_redo"},{name:"CreateLink",title:"Link",css:"wym_tools_link"},{name:"Unlink",title:"Unlink",css:"wym_tools_unlink"},{name:"InsertImage",title:"Image",css:"wym_tools_image"},{name:"InsertTable",title:"Table",css:"wym_tools_table"},{name:"Paste",title:"Paste_From_Word",css:"wym_tools_paste"},{name:"ToggleHtml",title:"HTML",css:"wym_tools_html"},{name:"Preview",title:"Preview",css:"wym_tools_preview"}],containersHtml:String()+''+"
{Containers}
"+"
"+WYMeditor.CONTAINERS_ITEMS+"
"+"
",containersItemHtml:String()+''+''+WYMeditor.CONTAINER_TITLE+""+"",containersItems:[{name:"P",title:"Paragraph",css:"wym_containers_p"},{name:"H1",title:"Heading_1",css:"wym_containers_h1"},{name:"H2",title:"Heading_2",css:"wym_containers_h2"},{name:"H3",title:"Heading_3",css:"wym_containers_h3"},{name:"H4",title:"Heading_4",css:"wym_containers_h4"},{name:"H5",title:"Heading_5",css:"wym_containers_h5"},{name:"H6",title:"Heading_6",css:"wym_containers_h6"},{name:"PRE",title:"Preformatted",css:"wym_containers_pre"},{name:"BLOCKQUOTE",title:"Blockquote",css:"wym_containers_blockquote"},{name:"TH",title:"Table_Header",css:"wym_containers_th"}],classesHtml:String()+''+"
{Classes}
"+"
"+WYMeditor.CLASSES_ITEMS+"
"+"
",classesItemHtml:String()+''+''+WYMeditor.CLASS_TITLE+""+"",classesItems:[],statusHtml:String()+''+"
{Status}
"+"",htmlHtml:String()+''+"
{Source_Code}
"+''+"",boxSelector:".wym_box",toolsSelector:".wym_tools",toolsListSelector:" ul",containersSelector:".wym_containers",classesSelector:".wym_classes",htmlSelector:".wym_html",iframeSelector:".wym_iframe iframe",iframeBodySelector:".wym_iframe",statusSelector:".wym_status",toolSelector:".wym_tools a",containerSelector:".wym_containers a",classSelector:".wym_classes a",htmlValSelector:".wym_html_val",hrefSelector:".wym_href",srcSelector:".wym_src",titleSelector:".wym_title",relSelector:".wym_rel",altSelector:".wym_alt",textSelector:".wym_text",rowsSelector:".wym_rows",colsSelector:".wym_cols",captionSelector:".wym_caption",summarySelector:".wym_summary",submitSelector:"form",cancelSelector:".wym_cancel",previewSelector:"",dialogTypeSelector:".wym_dialog_type",dialogLinkSelector:".wym_dialog_link",dialogImageSelector:".wym_dialog_image",dialogTableSelector:".wym_dialog_table",dialogPasteSelector:".wym_dialog_paste",dialogPreviewSelector:".wym_dialog_preview",updateSelector:".wymupdate",updateEvent:"click",dialogFeatures:"menubar=no,titlebar=no,toolbar=no,resizable=no,width=560,height=300,top=0,left=0",dialogFeaturesPreview:"menubar=no,titlebar=no,toolbar=no,resizable=no,scrollbars=yes,width=560,height=300,top=0,left=0",dialogHtml:String()+''+''+""+''+""+WYMeditor.DIALOG_TITLE+""+''+''+""+WYMeditor.DIALOG_BODY+"",dialogLinkHtml:String()+''+""+"",dialogImageHtml:String()+''+""+"",dialogTableHtml:String()+''+""+"",dialogPasteHtml:String()+''+""+"",dialogPreviewHtml:String()+'',dialogStyles:[],stringDelimiterLeft:"{",stringDelimiterRight:"}",preInit:null,preBind:null,postInit:null,preInitDialog:null,postInitDialog:null},a),this.each(function(){var b=new WYMeditor.editor(jQuery(this),a)})},jQuery.extend({wymeditors:function(a){return WYMeditor.INSTANCES[a]}}),WYMeditor.computeWymPath=function(){var a=jQuery(jQuery.grep(jQuery("script"),function(a){return a.src?a.src.match(/jquery\.wymeditor(\.pack|\.min|\.packed)?\.js(\?.*)?$/)||a.src.match(/\/core\.js(\?.*)?$/):null}));return a.length>0?a.attr("src"):(WYMeditor.console.warn("Error determining wymPath. No base WYMeditor file located."),WYMeditor.console.warn("Assuming wymPath to be the current URL"),WYMeditor.console.warn("Please pass a correct wymPath option"),"")},WYMeditor.computeBasePath=function(a){var b=a.lastIndexOf("/");return a.substr(0,b+1)},WYMeditor.computeJqueryPath=function(){return jQuery(jQuery.grep(jQuery("script"),function(a){return a.src&&a.src.match(/jquery(-(.*)){0,1}(\.pack|\.min|\.packed)?\.js(\?.*)?$/)})).attr("src")},WYMeditor.INIT_DIALOG=function(index){var wym=window.opener.WYMeditor.INSTANCES[index],doc=window.document,selected=wym.selected(),dialogType=jQuery(wym._options.dialogTypeSelector).val(),sStamp=wym.uniqueStamp(),styles,aCss,tableOnClick;dialogType===WYMeditor.DIALOG_LINK&&(selected&&selected.tagName&&selected.tagName.toLowerCase!==WYMeditor.A&&(selected=jQuery(selected).parentsOrSelf(WYMeditor.A)),!selected&&wym._selected_image&&(selected=jQuery(wym._selected_image).parentsOrSelf(WYMeditor.A))),jQuery.isFunction(wym._options.preInitDialog)&&wym._options.preInitDialog(wym,window),styles=doc.styleSheets[0],aCss=eval(wym._options.dialogStyles),wym.addCssRules(doc,aCss),selected&&(jQuery(wym._options.hrefSelector).val(jQuery(selected).attr(WYMeditor.HREF)),jQuery(wym._options.srcSelector).val(jQuery(selected).attr(WYMeditor.SRC)),jQuery(wym._options.titleSelector).val(jQuery(selected).attr(WYMeditor.TITLE)),jQuery(wym._options.relSelector).val(jQuery(selected).attr(WYMeditor.REL)),jQuery(wym._options.altSelector).val(jQuery(selected).attr(WYMeditor.ALT))),wym._selected_image&&(jQuery(wym._options.dialogImageSelector+" "+wym._options.srcSelector).val(jQuery(wym._selected_image).attr(WYMeditor.SRC)),jQuery(wym._options.dialogImageSelector+" "+wym._options.titleSelector).val(jQuery(wym._selected_image).attr(WYMeditor.TITLE)),jQuery(wym._options.dialogImageSelector+" "+wym._options.altSelector).val(jQuery(wym._selected_image).attr(WYMeditor.ALT))),jQuery(wym._options.dialogLinkSelector+" "+wym._options.submitSelector).submit(function(){var a=jQuery(wym._options.hrefSelector).val(),b;a.length>0&&(selected[0]&&selected[0].tagName.toLowerCase()===WYMeditor.A?b=selected:(wym._exec(WYMeditor.CREATE_LINK,sStamp),b=jQuery("a[href="+sStamp+"]",wym._doc.body)),b.attr(WYMeditor.HREF,a),b.attr(WYMeditor.TITLE,jQuery(wym._options.titleSelector).val()),b.attr(WYMeditor.REL,jQuery(wym._options.relSelector).val())),window.close()}),jQuery(wym._options.dialogImageSelector+" "+wym._options.submitSelector).submit(function(){var a=jQuery(wym._options.srcSelector).val(),b;a.length>0&&(wym._exec(WYMeditor.INSERT_IMAGE,sStamp),b=jQuery("img[src$="+sStamp+"]",wym._doc.body),b.attr(WYMeditor.SRC,a),b.attr(WYMeditor.TITLE,jQuery(wym._options.titleSelector).val()),b.attr(WYMeditor.ALT,jQuery(wym._options.altSelector).val())),window.close()}),tableOnClick=WYMeditor.MAKE_TABLE_ONCLICK(wym),jQuery(wym._options.dialogTableSelector+" "+wym._options.submitSelector).submit(tableOnClick),jQuery(wym._options.dialogPasteSelector+" "+wym._options.submitSelector).submit(function(){var a=jQuery(wym._options.textSelector).val();wym.paste(a),window.close()}),jQuery(wym._options.dialogPreviewSelector+" "+wym._options.previewSelector).html(wym.xhtml()),jQuery(wym._options.cancelSelector).mousedown(function(){window.close()}),jQuery.isFunction(wym._options.postInitDialog)&&wym._options.postInitDialog(wym,window)},WYMeditor.MAKE_TABLE_ONCLICK=function(a){var b=function(){var b=jQuery(a._options.rowsSelector).val(),c=jQuery(a._options.colsSelector).val(),d=jQuery(a._options.captionSelector).val(),e=jQuery(a._options.summarySelector).val(),f=a.insertTable(b,c,d,e);window.close()};return b},jQuery.fn.isPhantomNode=function(){return this[0].nodeType===3?!/[^\t\n\r ]/.test(this[0].data):!1},WYMeditor.isPhantomNode=function(a){return a.nodeType===3?!/[^\t\n\r ]/.test(a.data):!1},WYMeditor.isPhantomString=function(a){return!/[^\t\n\r ]/.test(a)},jQuery.fn.parentsOrSelf=function(a){var b=this;return b[0].nodeType===3&&(b=b.parents().slice(0,1)),b.filter(a).size()===1?b:b.parents(a).slice(0,1)},WYMeditor.Helper={replaceAll:function(a,b,c){var d=new RegExp(b,"g");return a.replace(d,c)},insertAt:function(a,b,c){return a.substr(0,c)+b+a.substring(c)},trim:function(a){return a.replace(/^(\s*)|(\s*)$/gm,"")},contains:function(a,b){var c;for(c=0;c["+a.childNodes.length+"]":a.nodeName:"[No node]"}function j(a){this._next=this.root=a}function k(a,b){this.node=a,this.offset=b}function l(a){this.code=this[a],this.codeName=a,this.message="DOMException: "+this.codeName}var m=a.util;m.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||b.fail("document missing a Node creation method"),m.isHostMethod(document,"getElementsByTagName")||b.fail("document missing getElementsByTagName method");var n=document.createElement("div");m.areHostMethods(n,["insertBefore","appendChild","cloneNode"])||b.fail("Incomplete Element implementation"),n=document.createTextNode("test"),m.areHostMethods(n,["splitText","deleteData","insertData","appendData","cloneNode"])||b.fail("Incomplete Text Node implementation");var o=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1};j.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next,b;if(this._current)if(b=a.firstChild)this._next=b;else{for(b=null;a!==this.root&&!(b=a.nextSibling);)a=a.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root=null}},k.prototype={equals:function(a){return this.node===a.node&this.offset==a.offset},inspect:function(){return"[DomPosition("+i(this.node)+":"+this.offset+")]"}},l.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11},l.prototype.toString=function(){return this.message},a.dom={arrayContains:o,getNodeIndex:c,getCommonAncestor:d,isAncestorOf:function(a,b,c){for(b=c?b:b.parentNode;b;){if(b===a)return!0;b=b.parentNode}return!1},getClosestAncestorIn:e,isCharacterDataNode:f,insertAfter:g,splitDataNode:function(a,b){var c;return a.nodeType==3?c=a.splitText(b):(c=a.cloneNode(),c.deleteData(0,b),a.deleteData(0,a.length-b),g(c,a)),c},getDocument:h,getWindow:function(a){a=h(a);if(typeof a.defaultView!="undefined")return a.defaultView;if(typeof a.parentWindow!="undefined")return a.parentWindow;throw Error("Cannot get a window object for node")},getIframeWindow:function(a){if(typeof a.contentWindow!="undefined")return a.contentWindow;if(typeof a.contentDocument!="undefined")return a.contentDocument.defaultView;throw Error("getIframeWindow: No Window object found for iframe element")},getIframeDocument:function(a){if(typeof a.contentDocument!="undefined")return a.contentDocument;if(typeof a.contentWindow!="undefined")return a.contentWindow.document;throw Error("getIframeWindow: No Document object found for iframe element")},getBody:function(a){return m.isHostObject(a,"body")?a.body:a.getElementsByTagName("body")[0]},comparePoints:function(a,b,f,g){var h;if(a==f)return b===g?0:b=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]),d}function i(a){for(var b,d,e=c(a.range).createDocumentFragment();d=a.next();){b=a.isPartiallySelectedSubtree(),d=d.cloneNode(!b),b&&(b=a.getSubtreeIterator(),d.appendChild(i(b)),b.detach(!0));if(d.nodeType==10)throw new J("HIERARCHY_REQUEST_ERR");e.appendChild(d)}return e}function j(a,b,c){var d,e;for(c=c||{stop:!1};d=a.next();)if(a.isPartiallySelectedSubtree()){if(b(d)===!1){c.stop=!0;return}d=a.getSubtreeIterator(),j(d,b,c),d.detach(!0);if(c.stop)return}else for(d=H.createIterator(d);e=d.next();)if(b(e)===!1){c.stop=!0;return}}function k(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),k(b),b.detach(!0)):a.remove()}function l(a){for(var b,d=c(a.range).createDocumentFragment(),e;b=a.next();){a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),e=a.getSubtreeIterator(),b.appendChild(l(e)),e.detach(!0)):a.remove();if(b.nodeType==10)throw new J("HIERARCHY_REQUEST_ERR");d.appendChild(b)}return d}function m(a,b,c){var d=!!b&&!!b.length,e,f=!!c;d&&(e=RegExp("^("+b.join("|")+")$"));var g=[];return j(new o(a,!1),function(a){(!d||e.test(a.nodeType))&&(!f||c(a))&&g.push(a)}),g}function n(a){return"["+(typeof a.getName=="undefined"?"Range":a.getName())+"("+H.inspectNode(a.startContainer)+":"+a.startOffset+", "+H.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function o(a,b){this.range=a,this.clonePartiallySelectedTextNodes=b;if(!a.collapsed){this.sc=a.startContainer,this.so=a.startOffset,this.ec=a.endContainer,this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&H.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc===c&&!H.isCharacterDataNode(this.sc)?this.sc.childNodes[this.so]:H.getClosestAncestorIn(this.sc,c,!0),this._last=this.ec===c&&!H.isCharacterDataNode(this.ec)?this.ec.childNodes[this.eo-1]:H.getClosestAncestorIn(this.ec,c,!0))}}function p(a){this.code=this[a],this.codeName=a,this.message="RangeException: "+this.codeName}function q(a,b,c){this.nodes=m(a,b,c),this._next=this.nodes[0],this._position=0}function r(a){return function(b,c){for(var d,e=c?b:b.parentNode;e;){d=e.nodeType;if(H.arrayContains(a,d))return e;e=e.parentNode}return null}}function s(a){for(var b;b=a.parentNode;)a=b;return a}function t(a,b){if(Q(a,b))throw new p("INVALID_NODE_TYPE_ERR")}function u(a){if(!a.startContainer)throw new J("INVALID_STATE_ERR")}function v(a,b){if(!H.arrayContains(b,a.nodeType))throw new p("INVALID_NODE_TYPE_ERR")}function w(a,b){if(b<0||b>(H.isCharacterDataNode(a)?a.length:a.childNodes.length))throw new J("INDEX_SIZE_ERR")}function x(a,b){if(O(a,!0)!==O(b,!0))throw new J("WRONG_DOCUMENT_ERR")}function y(a){if(P(a,!0))throw new J("NO_MODIFICATION_ALLOWED_ERR")}function z(a,b){if(!a)throw new J(b)}function A(a){if(!O(a.startContainer,!0)||!O(a.endContainer,!0)||!(a.startOffset<=(H.isCharacterDataNode(a.startContainer)?a.startContainer.length:a.startContainer.childNodes.length))||!(a.endOffset<=(H.isCharacterDataNode(a.endContainer)?a.endContainer.length:a.endContainer.childNodes.length)))throw Error("Range error: Range is no longer valid after DOM mutation ("+a.inspect()+")")}function B(a){a.START_TO_START=S,a.START_TO_END=T,a.END_TO_END=U,a.END_TO_START=V,a.NODE_BEFORE=W,a.NODE_AFTER=X,a.NODE_BEFORE_AND_AFTER=Y,a.NODE_INSIDE=Z}function C(a){B(a),B(a.prototype)}function D(a,d,r){function B(a,b){return function(c){u(this),v(c,K),v(s(c),L),c=(a?e:f)(c),(b?D:E)(this,c.node,c.offset)}}function D(a,b,c){var e=a.endContainer,f=a.endOffset;if(b!==a.startContainer||c!==this.startOffset){if(s(b)!=s(e)||H.comparePoints(b,c,e,f)==1)e=b,f=c;d(a,b,c,e,f)}}function E(a,b,c){var e=a.startContainer,f=a.startOffset;if(b!==a.endContainer||c!==this.endOffset){if(s(b)!=s(e)||H.comparePoints(b,c,e,f)==-1)e=b,f=c;d(a,e,f,b,c)}}function F(a,b,c){(b!==a.startContainer||c!==this.startOffset||b!==a.endContainer||c!==this.endOffset)&&d(a,b,c,b,c)}function I(a){return function(){u(this),A(this);var b=this.startContainer,c=this.startOffset,e=this.commonAncestorContainer,g=new o(this,!0);return b!==e&&(b=H.getClosestAncestorIn(b,e,!0),c=f(b),b=c.node,c=c.offset),j(g,y),g.reset(),e=a(g),g.detach(),d(this,b,c,b,c),e}}a.prototype={attachListener:function(a,b){this._listeners[a].push(b)},setStart:function(a,b){u(this),t(a,!0),w(a,b),D(this,a,b)},setEnd:function(a,b){u(this),t(a,!0),w(a,b),E(this,a,b)},setStartBefore:B(!0,!0),setStartAfter:B(!1,!0),setEndBefore:B(!0,!1),setEndAfter:B(!1,!1),collapse:function(a){u(this),A(this),a?d(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){u(this),t(a,!0),d(this,a,0,a,g(a))},selectNode:function(a){u(this),t(a,!1),v(a,K);var b=e(a);a=f(a),d(this,b.node,b.offset,a.node,a.offset)},compareBoundaryPoints:function(a,b){u(this),A(this),x(this.startContainer,b.startContainer);var c=a==V||a==S?"start":"end",d=a==T||a==S?"start":"end";return H.comparePoints(this[c+"Container"],this[c+"Offset"],b[d+"Container"],b[d+"Offset"])},insertNode:function(a){u(this),A(this),v(a,M),y(this.startContainer);if(H.isAncestorOf(a,this.startContainer,!0))throw new J("HIERARCHY_REQUEST_ERR");this.setStartBefore(h(a,this.startContainer,this.startOffset))},cloneContents:function(){u(this),A(this);var a,b;return this.collapsed?c(this).createDocumentFragment():this.startContainer===this.endContainer&&H.isCharacterDataNode(this.startContainer)?(a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset,this.endOffset),b=c(this).createDocumentFragment(),b.appendChild(a),b):(b=new o(this,!0),a=i(b),b.detach(),a)},extractContents:I(l),deleteContents:I(k),canSurroundContents:function(){u(this),A(this),y(this.startContainer),y(this.endContainer);var a=new o(this,!0),c=a._first&&b(a._first,this)||a._last&&b(a._last,this);return a.detach(),!c},surroundContents:function(a){v(a,N);if(!this.canSurroundContents())throw new p("BAD_BOUNDARYPOINTS_ERR");var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);h(a,this.startContainer,this.startOffset),a.appendChild(b),this.selectNode(a)},cloneRange:function(){u(this),A(this);for(var a=new G(c(this)),b=R.length,d;b--;)d=R[b],a[d]=this[d];return a},detach:function(){r(this)},toString:function(){u(this),A(this);var a=this.startContainer;if(a===this.endContainer&&H.isCharacterDataNode(a))return a.nodeType==3||a.nodeType==4?a.data.slice(this.startOffset,this.endOffset):"";var b=[];return a=new o(this,!0),j(a,function(a){(a.nodeType==3||a.nodeType==4)&&
-b.push(a.data)}),a.detach(),b.join("")},compareNode:function(a){u(this),A(this);var b=a.parentNode,c=H.getNodeIndex(a);if(!b)throw new J("NOT_FOUND_ERR");return a=this.comparePoint(b,c),b=this.comparePoint(b,c+1),a<0?b>0?Y:W:b>0?X:Z},comparePoint:function(a,b){return u(this),A(this),z(a,"HIERARCHY_REQUEST_ERR"),x(a,this.startContainer),H.comparePoints(a,b,this.startContainer,this.startOffset)<0?-1:H.comparePoints(a,b,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:function(a){u(this);var b=c(this),d=b.createElement("div");d.innerHTML=a;for(a=b.createDocumentFragment();b=d.firstChild;)a.appendChild(b);return a},intersectsNode:function(a,b){u(this),A(this),z(a,"NOT_FOUND_ERR");if(H.getDocument(a)!==c(this))return!1;var d=a.parentNode,e=H.getNodeIndex(a);z(d,"NOT_FOUND_ERR");var f=H.comparePoints(d,e,this.endContainer,this.endOffset);return d=H.comparePoints(d,e+1,this.startContainer,this.startOffset),b?f<=0&&d>=0:f<0&&d>0},isPointInRange:function(a,b){return u(this),A(this),z(a,"HIERARCHY_REQUEST_ERR"),x(a,this.startContainer),H.comparePoints(a,b,this.startContainer,this.startOffset)>=0&&H.comparePoints(a,b,this.endContainer,this.endOffset)<=0},intersectsRange:function(a){u(this),A(this);if(c(a)!=c(this))throw new J("WRONG_DOCUMENT_ERR");return H.comparePoints(this.startContainer,this.startOffset,a.endContainer,a.endOffset)<0&&H.comparePoints(this.endContainer,this.endOffset,a.startContainer,a.startOffset)>0},intersection:function(a){if(this.intersectsRange(a)){var b=H.comparePoints(this.startContainer,this.startOffset,a.startContainer,a.startOffset),c=H.comparePoints(this.endContainer,this.endOffset,a.endContainer,a.endOffset),d=this.cloneRange();return b==-1&&d.setStart(a.startContainer,a.startOffset),c==1&&d.setEnd(a.endContainer,a.endOffset),d}return null},containsNode:function(a,b){return b?this.intersectsNode(a,!1):this.compareNode(a)==Z},containsNodeContents:function(a){return this.comparePoint(a,0)>=0&&this.comparePoint(a,g(a))<=0},splitBoundaries:function(){A(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,e=this.endOffset,f=a===c;H.isCharacterDataNode(c)&&e>0&&e0&&b=H.getNodeIndex(a)&&e++,b=0),d(this,a,b,c,e)},normalizeBoundaries:function(){A(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,e=this.endOffset,f=function(a){var b=a.nextSibling;b&&b.nodeType==a.nodeType&&(c=a,e=a.length,a.appendData(b.data),b.parentNode.removeChild(b))},g=function(d){var f=d.previousSibling;if(f&&f.nodeType==d.nodeType){a=d;var g=d.length;b=f.length,d.insertData(0,f.data),f.parentNode.removeChild(f),a==c?(e+=b,c=a):c==d.parentNode&&(f=H.getNodeIndex(d),e==f?(c=d,e=g):e>f&&e--)}},h=!0;H.isCharacterDataNode(c)?c.length==e&&f(c):(e>0&&(h=c.childNodes[e-1])&&H.isCharacterDataNode(h)&&f(h),h=!this.collapsed),h?H.isCharacterDataNode(a)?b==0&&g(a):b0&&b.previousSibling);j=b.nextSibling;if(i==-1&&j&&e.isCharacterDataNode(j)){g.setEndPoint(c?"EndToStart":"EndToEnd",a);if(/[\r\n]/.test(j.data)){h=g.duplicate(),c=h.text.replace(/\r\n/g,"\r").length;for(c=h.moveStart("character",c);h.compareEndPoints("StartToEnd",h)==-1;)c++,h.moveStart("character",1)}else c=g.text.length;h=new f(j,c)}else j=(d||!c)&&b.previousSibling,h=(c=(d||c)&&b.nextSibling)&&e.isCharacterDataNode(c)?new f(c,0):j&&e.isCharacterDataNode(j)?new f(j,j.length):new f(h,e.getNodeIndex(b));return b.parentNode.removeChild(b),h}function c(a,b){var c,d,f=a.offset,g=e.getDocument(a.node),h=g.body.createTextRange(),i=e.isCharacterDataNode(a.node);return i?(c=a.node,d=c.parentNode):(c=a.node.childNodes,c=f12