From 3aecdd2dd57b0ed422a8958d6f4045fef231466d Mon Sep 17 00:00:00 2001 From: Panos Dalitsouris Date: Sat, 25 Feb 2023 10:08:07 +0200 Subject: [PATCH 1/6] Upgrade to rails 7 --- Gemfile | 3 +- Gemfile.lock | 245 ++++++++++++++++++++++++++++++--------------------- 2 files changed, 146 insertions(+), 102 deletions(-) diff --git a/Gemfile b/Gemfile index 53dc256..cb48412 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,6 @@ source 'https://rubygems.org' gem 'rails' -gem 'rails-api' gem 'sqlite3' gem 'minitest' -gem 'apipie-rails', '>= 0.3.0' +gem 'apipie-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 4914280..2414fdb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,114 +1,159 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.0) - actionpack (= 4.2.0) - actionview (= 4.2.0) - activejob (= 4.2.0) + actioncable (7.0.4.2) + actionpack (= 7.0.4.2) + activesupport (= 7.0.4.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (7.0.4.2) + actionpack (= 7.0.4.2) + activejob (= 7.0.4.2) + activerecord (= 7.0.4.2) + activestorage (= 7.0.4.2) + activesupport (= 7.0.4.2) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.0.4.2) + actionpack (= 7.0.4.2) + actionview (= 7.0.4.2) + activejob (= 7.0.4.2) + activesupport (= 7.0.4.2) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.0) - actionview (= 4.2.0) - activesupport (= 4.2.0) - rack (~> 1.6.0) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - actionview (4.2.0) - activesupport (= 4.2.0) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.0) + actionpack (7.0.4.2) + actionview (= 7.0.4.2) + activesupport (= 7.0.4.2) + rack (~> 2.0, >= 2.2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (7.0.4.2) + actionpack (= 7.0.4.2) + activerecord (= 7.0.4.2) + activestorage (= 7.0.4.2) + activesupport (= 7.0.4.2) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.0.4.2) + activesupport (= 7.0.4.2) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - activejob (4.2.0) - activesupport (= 4.2.0) - globalid (>= 0.3.0) - activemodel (4.2.0) - activesupport (= 4.2.0) - builder (~> 3.1) - activerecord (4.2.0) - activemodel (= 4.2.0) - activesupport (= 4.2.0) - arel (~> 6.0) - activesupport (4.2.0) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - apipie-rails (0.3.0) - json - arel (6.0.0) - builder (3.2.2) - erubis (2.7.0) - globalid (0.3.0) - activesupport (>= 4.1.0) - hike (1.2.3) - i18n (0.7.0) - json (1.8.2) - loofah (2.0.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (7.0.4.2) + activesupport (= 7.0.4.2) + globalid (>= 0.3.6) + activemodel (7.0.4.2) + activesupport (= 7.0.4.2) + activerecord (7.0.4.2) + activemodel (= 7.0.4.2) + activesupport (= 7.0.4.2) + activestorage (7.0.4.2) + actionpack (= 7.0.4.2) + activejob (= 7.0.4.2) + activerecord (= 7.0.4.2) + activesupport (= 7.0.4.2) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.4.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + apipie-rails (0.9.2) + actionpack (>= 5.0) + activesupport (>= 5.0) + builder (3.2.4) + concurrent-ruby (1.2.2) + crass (1.0.6) + date (3.3.3) + erubi (1.12.0) + globalid (1.1.0) + activesupport (>= 5.0) + i18n (1.12.0) + concurrent-ruby (~> 1.0) + loofah (2.19.1) + crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) - mime-types (2.4.3) - mini_portile (0.6.2) - minitest (5.5.0) - multi_json (1.10.1) - nokogiri (1.6.5) - mini_portile (~> 0.6.0) - rack (1.6.0) - rack-test (0.6.2) - rack (>= 1.0) - rails (4.2.0) - actionmailer (= 4.2.0) - actionpack (= 4.2.0) - actionview (= 4.2.0) - activejob (= 4.2.0) - activemodel (= 4.2.0) - activerecord (= 4.2.0) - activesupport (= 4.2.0) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.0) - sprockets-rails - rails-api (0.3.1) - actionpack (>= 3.2.11) - railties (>= 3.2.11) - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.5) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.1) - loofah (~> 2.0) - railties (4.2.0) - actionpack (= 4.2.0) - activesupport (= 4.2.0) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.4.2) - sprockets (2.12.3) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.2.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.10) - thor (0.19.1) - thread_safe (0.3.4) - tilt (1.4.1) - tzinfo (1.2.2) - thread_safe (~> 0.1) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) + method_source (1.0.0) + mini_mime (1.1.2) + mini_portile2 (2.8.1) + minitest (5.17.0) + net-imap (0.3.4) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol + nio4r (2.5.8) + nokogiri (1.14.2) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) + racc (1.6.2) + rack (2.2.6.2) + rack-test (2.0.2) + rack (>= 1.3) + rails (7.0.4.2) + actioncable (= 7.0.4.2) + actionmailbox (= 7.0.4.2) + actionmailer (= 7.0.4.2) + actionpack (= 7.0.4.2) + actiontext (= 7.0.4.2) + actionview (= 7.0.4.2) + activejob (= 7.0.4.2) + activemodel (= 7.0.4.2) + activerecord (= 7.0.4.2) + activestorage (= 7.0.4.2) + activesupport (= 7.0.4.2) + bundler (>= 1.15.0) + railties (= 7.0.4.2) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) + railties (7.0.4.2) + actionpack (= 7.0.4.2) + activesupport (= 7.0.4.2) + method_source + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) + rake (13.0.6) + sqlite3 (1.6.1) + mini_portile2 (~> 2.8.0) + thor (1.2.1) + timeout (0.3.2) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + websocket-driver (0.7.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.7) PLATFORMS ruby DEPENDENCIES - apipie-rails (>= 0.3.0) + apipie-rails minitest rails - rails-api sqlite3 + +BUNDLED WITH + 2.1.4 From 61a5fac4edd78e7be6b2a2f2f5b411495d619480 Mon Sep 17 00:00:00 2001 From: Panos Dalitsouris Date: Sat, 25 Feb 2023 10:10:46 +0200 Subject: [PATCH 2/6] Remove assets configs, they do not exist in rails 7 without Sprockets --- config/application.rb | 6 ------ config/environments/development.rb | 4 ---- config/environments/production.rb | 15 --------------- 3 files changed, 25 deletions(-) diff --git a/config/application.rb b/config/application.rb index e9b25c4..94da955 100644 --- a/config/application.rb +++ b/config/application.rb @@ -47,12 +47,6 @@ class Application < Rails::Application # like if you have constraints or database-specific column types # config.active_record.schema_format = :sql - # Enable the asset pipeline - config.assets.enabled = true - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' - config.active_support.test_order = :random end end diff --git a/config/environments/development.rb b/config/environments/development.rb index 14c2078..9cf3013 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -22,11 +22,7 @@ # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin - # Do not compress assets - config.assets.compress = false - # Expands the lines which load the assets - config.assets.debug = true config.eager_load = false end diff --git a/config/environments/production.rb b/config/environments/production.rb index a7730c6..8d76fae 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -11,18 +11,6 @@ # Disable Rails's static asset server (Apache or nginx will already do this) config.serve_static_files = false - # Compress JavaScripts and CSS - config.assets.compress = true - - # Don't fallback to assets pipeline if a precompiled asset is missed - config.assets.compile = false - - # Generate digests for assets URLs - config.assets.digest = true - - # Defaults to nil and saved in location specified by config.assets.prefix - # config.assets.manifest = YOUR_PATH - # Specifies the header that your server uses for sending files # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx @@ -45,9 +33,6 @@ # Enable serving of images, stylesheets, and JavaScripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - # config.assets.precompile += %w( search.js ) - # Disable delivery errors, bad email addresses will be ignored # config.action_mailer.raise_delivery_errors = false From 5ef0ba73cac9fc6f4acbef497d353a540edab878 Mon Sep 17 00:00:00 2001 From: Panos Dalitsouris Date: Sat, 25 Feb 2023 10:11:13 +0200 Subject: [PATCH 3/6] Replace deprecated `before_filter` with `before_action` --- app/controllers/v1/tweets_controller.rb | 2 +- app/controllers/v2/tweets_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/v1/tweets_controller.rb b/app/controllers/v1/tweets_controller.rb index 72d50f7..09bf4ff 100644 --- a/app/controllers/v1/tweets_controller.rb +++ b/app/controllers/v1/tweets_controller.rb @@ -1,6 +1,6 @@ module V1 class TweetsController < ApplicationController - before_filter :find_user + before_action :find_user api! def index diff --git a/app/controllers/v2/tweets_controller.rb b/app/controllers/v2/tweets_controller.rb index ab3c537..ff4bad1 100644 --- a/app/controllers/v2/tweets_controller.rb +++ b/app/controllers/v2/tweets_controller.rb @@ -1,6 +1,6 @@ module V2 class TweetsController < BaseController - before_filter :find_user + before_action :find_user api! def index From a3783f1f53e80ef98c1505b42e0c15e3549e885c Mon Sep 17 00:00:00 2001 From: Panos Dalitsouris Date: Fri, 3 Mar 2023 20:32:08 +0200 Subject: [PATCH 4/6] Set legacy_connection_handling to false to avoid DEPRECATION WARNING https://guides.rubyonrails.org/active_record_multiple_databases.html#migrate-to-the-new-connection-handling --- config/application.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/application.rb b/config/application.rb index 94da955..5c0d696 100644 --- a/config/application.rb +++ b/config/application.rb @@ -48,5 +48,7 @@ class Application < Rails::Application # config.active_record.schema_format = :sql config.active_support.test_order = :random + + config.active_record.legacy_connection_handling = false end end From 14fc9bdb2618e63b87f99b2cbfd4a338e924846a Mon Sep 17 00:00:00 2001 From: Panos Dalitsouris Date: Fri, 3 Mar 2023 20:31:49 +0200 Subject: [PATCH 5/6] Update tests for rails 7 --- Gemfile | 1 + Gemfile.lock | 5 +++++ app/controllers/v1/tweets_controller.rb | 2 +- app/controllers/v1/users_controller.rb | 2 +- app/controllers/v2/tweets_controller.rb | 2 +- app/controllers/v2/users_controller.rb | 2 +- test/functional/v1/tweets_controller_test.rb | 12 ++++++------ test/functional/v1/users_controller_test.rb | 8 ++++---- test/functional/v2/tweets_controller_test.rb | 12 ++++++------ test/functional/v2/users_controller_test.rb | 8 ++++---- test/integration/users_controller_test.rb | 2 +- 11 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Gemfile b/Gemfile index cb48412..bf28d22 100644 --- a/Gemfile +++ b/Gemfile @@ -4,3 +4,4 @@ gem 'rails' gem 'sqlite3' gem 'minitest' gem 'apipie-rails' +gem 'rails-controller-testing' diff --git a/Gemfile.lock b/Gemfile.lock index 2414fdb..16c7fc6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -122,6 +122,10 @@ GEM activesupport (= 7.0.4.2) bundler (>= 1.15.0) railties (= 7.0.4.2) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) @@ -153,6 +157,7 @@ DEPENDENCIES apipie-rails minitest rails + rails-controller-testing sqlite3 BUNDLED WITH diff --git a/app/controllers/v1/tweets_controller.rb b/app/controllers/v1/tweets_controller.rb index 09bf4ff..f022bff 100644 --- a/app/controllers/v1/tweets_controller.rb +++ b/app/controllers/v1/tweets_controller.rb @@ -43,7 +43,7 @@ def create def update @tweet = @user.tweets.find(params[:id]) - if @tweet.update_attributes(tweet_params) + if @tweet.update(tweet_params) head :no_content else render json: @tweet.errors, status: :unprocessable_entity diff --git a/app/controllers/v1/users_controller.rb b/app/controllers/v1/users_controller.rb index 1d42e98..d06ad48 100644 --- a/app/controllers/v1/users_controller.rb +++ b/app/controllers/v1/users_controller.rb @@ -44,7 +44,7 @@ def create def update @user = User.find(params[:id]) - if @user.update_attributes(user_params) + if @user.update(user_params) head :no_content else render json: @user.errors, status: :unprocessable_entity diff --git a/app/controllers/v2/tweets_controller.rb b/app/controllers/v2/tweets_controller.rb index ff4bad1..3853e12 100644 --- a/app/controllers/v2/tweets_controller.rb +++ b/app/controllers/v2/tweets_controller.rb @@ -43,7 +43,7 @@ def create def update @tweet = @user.tweets.find(params[:id]) - if @tweet.update_attributes(tweet_params) + if @tweet.update(tweet_params) head :no_content else render json: @tweet.errors, status: :unprocessable_entity diff --git a/app/controllers/v2/users_controller.rb b/app/controllers/v2/users_controller.rb index c23704d..7a011b6 100644 --- a/app/controllers/v2/users_controller.rb +++ b/app/controllers/v2/users_controller.rb @@ -31,7 +31,7 @@ def create def update @user = User.find(params[:id]) - if @user.update_attributes(user_params) + if @user.update(user_params) head :no_content else render json: @user.errors, status: :unprocessable_entity diff --git a/test/functional/v1/tweets_controller_test.rb b/test/functional/v1/tweets_controller_test.rb index 47eb83c..4ee7628 100644 --- a/test/functional/v1/tweets_controller_test.rb +++ b/test/functional/v1/tweets_controller_test.rb @@ -5,36 +5,36 @@ class TweetsControllerTest < ActionController::TestCase setup do @user = users(:one) @tweet = tweets(:one) - @tweet.update_attributes(user_id: @user.id) + @tweet.update(user_id: @user.id) end test "should get index" do - get :index, :user_id => @user.id + get :index, params: { user_id: @user.id } assert_response :success assert_not_nil assigns(:tweets) end test "should create tweet" do assert_difference('Tweet.count') do - post :create, user_id: @user.id, tweet: { scheduled_at: @tweet.scheduled_at, sent: @tweet.sent, text: @tweet.text, user_id: @tweet.user_id } + post :create, params: { user_id: @user.id, tweet: { scheduled_at: @tweet.scheduled_at, sent: @tweet.sent, text: @tweet.text, user_id: @tweet.user_id } } end assert_response 201 end test "should show tweet" do - get :show, user_id: @user.id, id: @tweet, user_id: @user.id + get :show, params: { user_id: @user.id, id: @tweet.id } assert_response :success end test "should update tweet" do - put :update, user_id: @user.id, id: @tweet, tweet: { scheduled_at: @tweet.scheduled_at, sent: @tweet.sent, text: @tweet.text, user_id: @tweet.user_id } + put :update, params: { user_id: @user.id, id: @tweet.id, tweet: { scheduled_at: @tweet.scheduled_at, sent: @tweet.sent, text: @tweet.text, user_id: @tweet.user_id } } assert_response 204 end test "should destroy tweet" do assert_difference('Tweet.count', -1) do - delete :destroy, user_id: @user.id, id: @tweet + delete :destroy, params: { user_id: @user.id, id: @tweet } end assert_response 204 diff --git a/test/functional/v1/users_controller_test.rb b/test/functional/v1/users_controller_test.rb index cab904e..e817c52 100644 --- a/test/functional/v1/users_controller_test.rb +++ b/test/functional/v1/users_controller_test.rb @@ -14,25 +14,25 @@ class UsersControllerTest < ActionController::TestCase test "should create user" do assert_difference('User.count') do - post :create, user: { name: @user.name } + post :create, params: { user: { name: @user.name } } end assert_response 201 end test "should show user" do - get :show, id: @user + get :show, params: { id: @user } assert_response :success end test "should update user" do - put :update, id: @user, user: { name: @user.name } + put :update, params: { id: @user, user: { name: @user.name } } assert_response 204 end test "should destroy user" do assert_difference('User.count', -1) do - delete :destroy, id: @user + delete :destroy, params: { id: @user } end assert_response 204 diff --git a/test/functional/v2/tweets_controller_test.rb b/test/functional/v2/tweets_controller_test.rb index 9948879..0b07ecc 100644 --- a/test/functional/v2/tweets_controller_test.rb +++ b/test/functional/v2/tweets_controller_test.rb @@ -5,36 +5,36 @@ class TweetsControllerTest < ActionController::TestCase setup do @user = users(:one) @tweet = tweets(:one) - @tweet.update_attributes(user_id: @user.id) + @tweet.update(user_id: @user.id) end test "should get index" do - get :index, :user_id => @user.id + get :index, params: { user_id: @user.id } assert_response :success assert_not_nil assigns(:tweets) end test "should create tweet" do assert_difference('Tweet.count') do - post :create, user_id: @user.id, tweet: { scheduled_at: @tweet.scheduled_at, sent: @tweet.sent, text: @tweet.text, user_id: @tweet.user_id } + post :create, params: { user_id: @user.id, tweet: { scheduled_at: @tweet.scheduled_at, sent: @tweet.sent, text: @tweet.text, user_id: @tweet.user_id } } end assert_response 201 end test "should show tweet" do - get :show, user_id: @user.id, id: @tweet, user_id: @user.id + get :show, params: { user_id: @user.id, id: @tweet } assert_response :success end test "should update tweet" do - put :update, user_id: @user.id, id: @tweet, tweet: { scheduled_at: @tweet.scheduled_at, sent: @tweet.sent, text: @tweet.text, user_id: @tweet.user_id } + put :update, params: { user_id: @user.id, id: @tweet, tweet: { scheduled_at: @tweet.scheduled_at, sent: @tweet.sent, text: @tweet.text, user_id: @tweet.user_id } } assert_response 204 end test "should destroy tweet" do assert_difference('Tweet.count', -1) do - delete :destroy, user_id: @user.id, id: @tweet + delete :destroy, params: { user_id: @user.id, id: @tweet.id } end assert_response 204 diff --git a/test/functional/v2/users_controller_test.rb b/test/functional/v2/users_controller_test.rb index a37c46c..fa68f47 100644 --- a/test/functional/v2/users_controller_test.rb +++ b/test/functional/v2/users_controller_test.rb @@ -14,25 +14,25 @@ class UsersControllerTest < ActionController::TestCase test "should create user" do assert_difference('User.count') do - post :create, user: { name: @user.name } + post :create, params: { user: { name: @user.name } } end assert_response 201 end test "should show user" do - get :show, id: @user + get :show, params: { id: @user.id } assert_response :success end test "should update user" do - put :update, id: @user, user: { name: @user.name } + put :update, params: { id: @user.id, user: { name: @user.name } } assert_response 204 end test "should destroy user" do assert_difference('User.count', -1) do - delete :destroy, id: @user + delete :destroy, params: { id: @user } end assert_response 204 diff --git a/test/integration/users_controller_test.rb b/test/integration/users_controller_test.rb index cac8bdb..8725e0b 100644 --- a/test/integration/users_controller_test.rb +++ b/test/integration/users_controller_test.rb @@ -7,7 +7,7 @@ class UsersControllerTest < ActionDispatch::IntegrationTest test "should create user" do assert_difference('User.count') do - post "/users", {user: { name: @user.name }}.to_json, {"CONTENT_TYPE" => "application/json"} + post "/api/v1/users", params: { user: { name: @user.name } }, headers: {"CONTENT_TYPE" => "application/json"}, as: :json end assert_response 201 From 1f8da7b6dca3796eeb732486f12140ca88038a7b Mon Sep 17 00:00:00 2001 From: Panos Dalitsouris Date: Sat, 25 Feb 2023 10:19:11 +0200 Subject: [PATCH 6/6] Run `rake apipie:static` to make views according to latest apipie version --- doc/apidoc-onepage.html | 429 +++-- doc/apidoc-plain.html | 285 ++-- doc/apidoc.html | 97 +- .../javascripts/bundled/bootstrap-collapse.js | 111 +- doc/apidoc/javascripts/bundled/bootstrap.js | 1512 +++++++++++------ doc/apidoc/javascripts/bundled/jquery.js | 5 + .../bundled/bootstrap-responsive.min.css | 21 +- .../stylesheets/bundled/bootstrap.min.css | 698 +------- doc/apidoc/tweets.html | 263 +-- doc/apidoc/tweets/create.html | 109 +- doc/apidoc/tweets/destroy.html | 28 +- doc/apidoc/tweets/index.html | 39 +- doc/apidoc/tweets/show.html | 37 +- doc/apidoc/tweets/update.html | 107 +- doc/apidoc/users.html | 368 ++-- doc/apidoc/users/create.html | 161 +- doc/apidoc/users/destroy.html | 28 +- doc/apidoc/users/index.html | 42 +- doc/apidoc/users/show.html | 34 +- doc/apidoc/users/update.html | 160 +- 20 files changed, 2478 insertions(+), 2056 deletions(-) create mode 100644 doc/apidoc/javascripts/bundled/jquery.js diff --git a/doc/apidoc-onepage.html b/doc/apidoc-onepage.html index a618c73..d19af6e 100644 --- a/doc/apidoc-onepage.html +++ b/doc/apidoc-onepage.html @@ -3,18 +3,19 @@ API documentation + -
-
+
+

Tweets

    @@ -35,7 +36,9 @@

    Users

    -
    Another API description
    +
    +

    Another API description

    +

    @@ -72,28 +75,14 @@

    -

    Examples

    -
    GET /users/980190962/tweets
    -200
    -[
    -  {
    -    "created_at": "2013-01-25T21:44:16Z",
    -    "id": 980190962,
    -    "scheduled_at": "2012-06-27T17:55:59Z",
    -    "sent": false,
    -    "text": "MyText",
    -    "updated_at": "2013-01-25T21:44:17Z",
    -    "user_id": 980190962
    -  }
    -]
    @@ -114,26 +103,14 @@

    Examples

    -

    Examples

    -
    GET /users/980190962/tweets/980190962
    -200
    -{
    -  "created_at": "2013-01-25T21:44:16Z",
    -  "id": 980190962,
    -  "scheduled_at": "2012-06-27T17:55:59Z",
    -  "sent": false,
    -  "text": "MyText",
    -  "updated_at": "2013-01-25T21:44:17Z",
    -  "user_id": 980190962
    -}
    @@ -154,34 +131,14 @@

    Examples

    -

    Examples

    -
    POST /users/980190962/tweets
    -{
    -  "tweet": {
    -    "scheduled_at": "2012-06-27 17:55:59 UTC",
    -    "sent": false,
    -    "text": "MyText",
    -    "user_id": "980190962"
    -  }
    -}
    -201
    -{
    -  "created_at": "2013-01-25T21:44:17Z",
    -  "id": 980190963,
    -  "scheduled_at": "2012-06-27T17:55:59Z",
    -  "sent": false,
    -  "text": "MyText",
    -  "updated_at": "2013-01-25T21:44:17Z",
    -  "user_id": 980190962
    -}

    Params

    @@ -203,9 +160,15 @@

    Params

    -
    - Value: Must be a Hash +

    Validations:

    +
      +
    • +

      Must be a Hash

      +
    • +
    + + @@ -218,7 +181,9 @@

    Params

    + + @@ -232,9 +197,15 @@

    Params

    -
    - Value: Must be 'true' or 'false' +

    Validations:

    +
      +
    • +

      Must be one of: true, false, 1, 0.

      +
    • +
    + + @@ -248,7 +219,9 @@

    Params

    + + @@ -262,9 +235,15 @@

    Params

    -
    - Value: Must be a number. +

    Validations:

    +
      +
    • +

      Must be a number.

      +
    • +
    + + @@ -290,25 +269,20 @@

    Params

    -

    Examples

    -
    PUT /users/980190962/tweets/980190962
    -{
    -  "tweet": {
    -    "scheduled_at": "2012-06-27 17:55:59 UTC",
    -    "sent": false,
    -    "text": "MyText",
    -    "user_id": "980190962"
    -  }
    -}
    -204

    Params

    @@ -330,9 +304,15 @@

    Params

    -
    - Value: Must be a Hash +

    Validations:

    +
      +
    • +

      Must be a Hash

      +
    • +
    + + @@ -345,7 +325,9 @@

    Params

    + + @@ -359,9 +341,15 @@

    Params

    -
    - Value: Must be 'true' or 'false' +

    Validations:

    +
      +
    • +

      Must be one of: true, false, 1, 0.

      +
    • +
    + + @@ -375,7 +363,9 @@

    Params

    + + @@ -389,9 +379,15 @@

    Params

    -
    - Value: Must be a number. +

    Validations:

    +
      +
    • +

      Must be a number.

      +
    • +
    + + @@ -417,17 +413,14 @@

    Params

    -

    Examples

    -
    DELETE /users/980190962/tweets/980190962
    -204
    @@ -465,31 +458,14 @@

    -

    Examples

    -
    GET /users
    -200
    -[
    -  {
    -    "created_at": "2013-01-25T21:44:16Z",
    -    "id": 298486374,
    -    "name": "MyString",
    -    "updated_at": "2013-01-25T21:44:16Z"
    -  },
    -  {
    -    "created_at": "2013-01-25T21:44:16Z",
    -    "id": 980190962,
    -    "name": "MyString",
    -    "updated_at": "2013-01-25T21:44:16Z"
    -  }
    -]
    @@ -510,23 +486,14 @@

    Examples

    -

    Examples

    -
    GET /users/980190962
    -200
    -{
    -  "created_at": "2013-01-25T21:44:16Z",
    -  "id": 980190962,
    -  "name": "MyString",
    -  "updated_at": "2013-01-25T21:44:16Z"
    -}
    @@ -547,28 +514,14 @@

    Examples

    -

    Examples

    -
    POST /users
    -{
    -  "user": {
    -    "name": "MyString"
    -  }
    -}
    -201
    -{
    -  "created_at": "2013-01-25T21:44:17Z",
    -  "id": 980190963,
    -  "name": "MyString",
    -  "updated_at": "2013-01-25T21:44:17Z"
    -}

    Params

    @@ -584,28 +537,112 @@

    Params

    user
    - optional + required -
    - Value: Must be a Hash +

    Validations:

    +
      +
    • +

      Must be a Hash

      +
    • +
    + + user[name]
    - optional + required +

    Name of the user

    + +

    Validations:

    +
      +
    • +

      Must be a String

      +
    • +
    + + + + + + + + + user[street]
    + + optional + , nil allowed + + + + +

    Street name

    + +

    Validations:

    +
      +
    • +

      Must be a String

      +
    • +
    + + + + + + + + user[number]
    + + optional + , nil allowed + + + + +

    Validations:

    +
      +
    • +

      Must be a Integer

      +
    • +
    + + + + + + + + + user[zip]
    + + optional + , nil allowed + + + + +

    Validations:

    +
      +
    • +

      Must be a String

      +
    • +
    + + + @@ -631,22 +668,20 @@

    Params

    -

    Examples

    -
    PUT /users/980190962
    -{
    -  "user": {
    -    "name": "MyString"
    -  }
    -}
    -204

    Params

    @@ -662,15 +697,21 @@

    Params

    user
    - optional + required -
    - Value: Must be a Hash +

    Validations:

    +
      +
    • +

      Must be a Hash

      +
    • +
    + + @@ -683,7 +724,85 @@

    Params

    +

    Name of the user

    + +

    Validations:

    +
      +
    • +

      Must be a String

      +
    • +
    + + + + + + + + + user[street]
    + + optional + , nil allowed + + + +

    Street name

    + +

    Validations:

    +
      +
    • +

      Must be a String

      +
    • +
    + + + + + + + + + user[number]
    + + optional + , nil allowed + + + + +

    Validations:

    +
      +
    • +

      Must be a Integer

      +
    • +
    + + + + + + + + + user[zip]
    + + optional + , nil allowed + + + + +

    Validations:

    +
      +
    • +

      Must be a String

      +
    • +
    + + + @@ -709,17 +828,14 @@

    Params

    -

    Examples

    -
    DELETE /users/980190962
    -204
    @@ -730,10 +846,9 @@

    Examples


    -
    -
    +
    - + diff --git a/doc/apidoc-plain.html b/doc/apidoc-plain.html index 146f87d..dffebfb 100644 --- a/doc/apidoc-plain.html +++ b/doc/apidoc-plain.html @@ -37,28 +37,14 @@

    - GET /api/v2/users/:user_id/tweets + GET /api/v1/users/:user_id/tweets
    - List tweets +

    -

    Examples

    -
    GET /users/980190962/tweets
    -200
    -[
    -  {
    -    "created_at": "2013-01-25T21:44:16Z",
    -    "id": 980190962,
    -    "scheduled_at": "2012-06-27T17:55:59Z",
    -    "sent": false,
    -    "text": "MyText",
    -    "updated_at": "2013-01-25T21:44:17Z",
    -    "user_id": 980190962
    -  }
    -]
    @@ -70,26 +56,14 @@

    - GET /api/v2/users/:user_id/tweets/:id + GET /api/v1/users/:user_id/tweets/:id
    - Show a tweet +

    -

    Examples

    -
    GET /users/980190962/tweets/980190962
    -200
    -{
    -  "created_at": "2013-01-25T21:44:16Z",
    -  "id": 980190962,
    -  "scheduled_at": "2012-06-27T17:55:59Z",
    -  "sent": false,
    -  "text": "MyText",
    -  "updated_at": "2013-01-25T21:44:17Z",
    -  "user_id": 980190962
    -}
    @@ -101,34 +75,14 @@

    - POST /api/v2/users/:user_id/tweets + POST /api/v1/users/:user_id/tweets
    - Create a tweet +

    -

    Examples

    -
    POST /users/980190962/tweets
    -{
    -  "tweet": {
    -    "scheduled_at": "2012-06-27 17:55:59 UTC",
    -    "sent": false,
    -    "text": "MyText",
    -    "user_id": "980190962"
    -  }
    -}
    -201
    -{
    -  "created_at": "2013-01-25T21:44:17Z",
    -  "id": 980190963,
    -  "scheduled_at": "2012-06-27T17:55:59Z",
    -  "sent": false,
    -  "text": "MyText",
    -  "updated_at": "2013-01-25T21:44:17Z",
    -  "user_id": 980190962
    -}

    Params

    @@ -138,7 +92,9 @@

    Params

    optional - [ Must be a Hash ] + [ +

    Must be a Hash

    + ]
    @@ -157,7 +113,9 @@

    Params

    optional - [ Must be 'true' or 'false' ] + [ +

    Must be one of: true, false, 1, 0.

    + ]
    @@ -176,7 +134,9 @@

    Params

    optional - [ Must be a number. ] + [ +

    Must be a number.

    + ]
    @@ -194,25 +154,19 @@

    - PUT /api/v2/users/:user_id/tweets/:id + PATCH /api/v1/users/:user_id/tweets/:id
    - Update a tweet + +

    +

    + PUT /api/v1/users/:user_id/tweets/:id +
    +

    -

    Examples

    -
    PUT /users/980190962/tweets/980190962
    -{
    -  "tweet": {
    -    "scheduled_at": "2012-06-27 17:55:59 UTC",
    -    "sent": false,
    -    "text": "MyText",
    -    "user_id": "980190962"
    -  }
    -}
    -204

    Params

    @@ -222,7 +176,9 @@

    Params

    optional - [ Must be a Hash ] + [ +

    Must be a Hash

    + ]
    @@ -241,7 +197,9 @@

    Params

    optional - [ Must be 'true' or 'false' ] + [ +

    Must be one of: true, false, 1, 0.

    + ]
    @@ -260,7 +218,9 @@

    Params

    optional - [ Must be a number. ] + [ +

    Must be a number.

    + ]
    @@ -278,17 +238,14 @@

    - DELETE /api/v2/users/:user_id/tweets/:id + DELETE /api/v1/users/:user_id/tweets/:id
    - Destroy a tweet +

    -

    Examples

    -
    DELETE /users/980190962/tweets/980190962
    -204
    @@ -314,31 +271,14 @@

    - GET /api/v2/users + GET /api/v1/users
    - List users +

    -

    Examples

    -
    GET /users
    -200
    -[
    -  {
    -    "created_at": "2013-01-25T21:44:16Z",
    -    "id": 298486374,
    -    "name": "MyString",
    -    "updated_at": "2013-01-25T21:44:16Z"
    -  },
    -  {
    -    "created_at": "2013-01-25T21:44:16Z",
    -    "id": 980190962,
    -    "name": "MyString",
    -    "updated_at": "2013-01-25T21:44:16Z"
    -  }
    -]
    @@ -350,23 +290,14 @@

    - GET /api/v2/users/:id + GET /api/v1/users/:id
    - Show an user +

    -

    Examples

    -
    GET /users/980190962
    -200
    -{
    -  "created_at": "2013-01-25T21:44:16Z",
    -  "id": 980190962,
    -  "name": "MyString",
    -  "updated_at": "2013-01-25T21:44:16Z"
    -}
    @@ -378,28 +309,14 @@

    - POST /api/v2/users + POST /api/v1/users
    - Create an user +

    -

    Examples

    -
    POST /users
    -{
    -  "user": {
    -    "name": "MyString"
    -  }
    -}
    -201
    -{
    -  "created_at": "2013-01-25T21:44:17Z",
    -  "id": 980190963,
    -  "name": "MyString",
    -  "updated_at": "2013-01-25T21:44:17Z"
    -}

    Params

    @@ -407,9 +324,11 @@

    Params

  • user : - optional + required - [ Must be a Hash ] + [ +

    Must be a Hash

    + ]
  • @@ -417,8 +336,51 @@

    Params

  • name : - optional + required + [ +

    Must be a String

    + ] +
    + +

    Name of the user

    + +
  • + +
  • + street : + + optional + , nil allowed + [ +

    Must be a String

    + ] +
    + +

    Street name

    + +
  • + +
  • + number : + + optional + , nil allowed + [ +

    Must be a Integer

    + ] +
    + +
  • + +
  • + zip : + + optional + , nil allowed + [ +

    Must be a String

    + ]
  • @@ -436,22 +398,19 @@

    - PUT /api/v2/users/:id + PATCH /api/v1/users/:id
    - Update an user + +

    +

    + PUT /api/v1/users/:id +
    +

    -

    Examples

    -
    PUT /users/980190962
    -{
    -  "user": {
    -    "name": "MyString"
    -  }
    -}
    -204

    Params

    @@ -459,9 +418,11 @@

    Params

  • user : - optional + required - [ Must be a Hash ] + [ +

    Must be a Hash

    + ]
  • @@ -471,6 +432,49 @@

    Params

    optional + [ +

    Must be a String

    + ] +
    + +

    Name of the user

    + + + +
  • + street : + + optional + , nil allowed + [ +

    Must be a String

    + ] +
    + +

    Street name

    + +
  • + +
  • + number : + + optional + , nil allowed + [ +

    Must be a Integer

    + ] +
    + +
  • + +
  • + zip : + + optional + , nil allowed + [ +

    Must be a String

    + ]
  • @@ -488,17 +492,14 @@

    - DELETE /api/v2/users/:id + DELETE /api/v1/users/:id
    - Destroy an user +

    -

    Examples

    -
    DELETE /users/980190962
    -204
    diff --git a/doc/apidoc.html b/doc/apidoc.html index ea14003..3b6c16b 100644 --- a/doc/apidoc.html +++ b/doc/apidoc.html @@ -3,31 +3,36 @@ API documentation + -
    -
    +
    +
    -
    -
    +
    - + diff --git a/doc/apidoc/javascripts/bundled/bootstrap-collapse.js b/doc/apidoc/javascripts/bundled/bootstrap-collapse.js index 9a36446..ae3e4c6 100644 --- a/doc/apidoc/javascripts/bundled/bootstrap-collapse.js +++ b/doc/apidoc/javascripts/bundled/bootstrap-collapse.js @@ -1,8 +1,8 @@ /* ============================================================= - * bootstrap-collapse.js v2.0.2 - * http://twitter.github.com/bootstrap/javascript.html#collapse + * bootstrap-collapse.js v2.3.2 + * http://getbootstrap.com/2.3.2/javascript.html#collapse * ============================================================= - * Copyright 2012 Twitter, Inc. + * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,16 +17,21 @@ * limitations under the License. * ============================================================ */ -!function( $ ){ - "use strict" +!function ($) { - var Collapse = function ( element, options ) { - this.$element = $(element) + "use strict"; // jshint ;_; + + + /* COLLAPSE PUBLIC CLASS DEFINITION + * ================================ */ + + var Collapse = function (element, options) { + this.$element = $(element) this.options = $.extend({}, $.fn.collapse.defaults, options) - if (this.options["parent"]) { - this.$parent = $(this.options["parent"]) + if (this.options.parent) { + this.$parent = $(this.options.parent) } this.options.toggle && this.toggle() @@ -42,31 +47,39 @@ } , show: function () { - var dimension = this.dimension() - , scroll = $.camelCase(['scroll', dimension].join('-')) - , actives = this.$parent && this.$parent.find('.in') + var dimension + , scroll + , actives , hasData + if (this.transitioning || this.$element.hasClass('in')) return + + dimension = this.dimension() + scroll = $.camelCase(['scroll', dimension].join('-')) + actives = this.$parent && this.$parent.find('> .accordion-group > .in') + if (actives && actives.length) { hasData = actives.data('collapse') + if (hasData && hasData.transitioning) return actives.collapse('hide') hasData || actives.data('collapse', null) } this.$element[dimension](0) - this.transition('addClass', 'show', 'shown') - this.$element[dimension](this.$element[0][scroll]) - + this.transition('addClass', $.Event('show'), 'shown') + $.support.transition && this.$element[dimension](this.$element[0][scroll]) } , hide: function () { - var dimension = this.dimension() + var dimension + if (this.transitioning || !this.$element.hasClass('in')) return + dimension = this.dimension() this.reset(this.$element[dimension]()) - this.transition('removeClass', 'hide', 'hidden') + this.transition('removeClass', $.Event('hide'), 'hidden') this.$element[dimension](0) } - , reset: function ( size ) { + , reset: function (size) { var dimension = this.dimension() this.$element @@ -74,41 +87,49 @@ [dimension](size || 'auto') [0].offsetWidth - this.$element[size ? 'addClass' : 'removeClass']('collapse') + this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') return this } - , transition: function ( method, startEvent, completeEvent ) { + , transition: function (method, startEvent, completeEvent) { var that = this , complete = function () { - if (startEvent == 'show') that.reset() + if (startEvent.type == 'show') that.reset() + that.transitioning = 0 that.$element.trigger(completeEvent) } - this.$element - .trigger(startEvent) - [method]('in') + this.$element.trigger(startEvent) + + if (startEvent.isDefaultPrevented()) return + + this.transitioning = 1 + + this.$element[method]('in') $.support.transition && this.$element.hasClass('collapse') ? this.$element.one($.support.transition.end, complete) : complete() - } + } , toggle: function () { this[this.$element.hasClass('in') ? 'hide' : 'show']() - } + } } - /* COLLAPSIBLE PLUGIN DEFINITION - * ============================== */ - $.fn.collapse = function ( option ) { + /* COLLAPSE PLUGIN DEFINITION + * ========================== */ + + var old = $.fn.collapse + + $.fn.collapse = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('collapse') - , options = typeof option == 'object' && option + , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option) if (!data) $this.data('collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) @@ -121,18 +142,26 @@ $.fn.collapse.Constructor = Collapse - /* COLLAPSIBLE DATA-API + /* COLLAPSE NO CONFLICT * ==================== */ - $(function () { - $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) { - var $this = $(this), href - , target = $this.attr('data-target') - || e.preventDefault() - || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 - , option = $(target).data('collapse') ? 'toggle' : $this.data() - $(target).collapse(option) - }) + $.fn.collapse.noConflict = function () { + $.fn.collapse = old + return this + } + + + /* COLLAPSE DATA-API + * ================= */ + + $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { + var $this = $(this), href + , target = $this.attr('data-target') + || e.preventDefault() + || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 + , option = $(target).data('collapse') ? 'toggle' : $this.data() + $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') + $(target).collapse(option) }) -}( window.jQuery ); \ No newline at end of file +}(window.jQuery); \ No newline at end of file diff --git a/doc/apidoc/javascripts/bundled/bootstrap.js b/doc/apidoc/javascripts/bundled/bootstrap.js index ca86867..44109f6 100644 --- a/doc/apidoc/javascripts/bundled/bootstrap.js +++ b/doc/apidoc/javascripts/bundled/bootstrap.js @@ -1,8 +1,8 @@ /* =================================================== - * bootstrap-transition.js v2.0.2 - * http://twitter.github.com/bootstrap/javascript.html#transitions + * bootstrap-transition.js v2.3.2 + * http://getbootstrap.com/2.3.2/javascript.html#transitions * =================================================== - * Copyright 2012 Twitter, Inc. + * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,42 +17,51 @@ * limitations under the License. * ========================================================== */ -!function( $ ) { - $(function () { +!function ($) { + + "use strict"; // jshint ;_; - "use strict" - /* CSS TRANSITION SUPPORT (https://gist.github.com/373874) - * ======================================================= */ + /* CSS TRANSITION SUPPORT (http://www.modernizr.com/) + * ======================================================= */ + + $(function () { $.support.transition = (function () { - var thisBody = document.body || document.documentElement - , thisStyle = thisBody.style - , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined - - return support && { - end: (function () { - var transitionEnd = "TransitionEnd" - if ( $.browser.webkit ) { - transitionEnd = "webkitTransitionEnd" - } else if ( $.browser.mozilla ) { - transitionEnd = "transitionend" - } else if ( $.browser.opera ) { - transitionEnd = "oTransitionEnd" + + var transitionEnd = (function () { + + var el = document.createElement('bootstrap') + , transEndEventNames = { + 'WebkitTransition' : 'webkitTransitionEnd' + , 'MozTransition' : 'transitionend' + , 'OTransition' : 'oTransitionEnd otransitionend' + , 'transition' : 'transitionend' + } + , name + + for (name in transEndEventNames){ + if (el.style[name] !== undefined) { + return transEndEventNames[name] } - return transitionEnd - }()) + } + + }()) + + return transitionEnd && { + end: transitionEnd } + })() }) -}( window.jQuery );/* ========================================================== - * bootstrap-alert.js v2.0.2 - * http://twitter.github.com/bootstrap/javascript.html#alerts +}(window.jQuery);/* ========================================================== + * bootstrap-alert.js v2.3.2 + * http://getbootstrap.com/2.3.2/javascript.html#alerts * ========================================================== - * Copyright 2012 Twitter, Inc. + * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,61 +77,59 @@ * ========================================================== */ -!function( $ ){ +!function ($) { + + "use strict"; // jshint ;_; - "use strict" /* ALERT CLASS DEFINITION * ====================== */ var dismiss = '[data-dismiss="alert"]' - , Alert = function ( el ) { + , Alert = function (el) { $(el).on('click', dismiss, this.close) } - Alert.prototype = { + Alert.prototype.close = function (e) { + var $this = $(this) + , selector = $this.attr('data-target') + , $parent - constructor: Alert - - , close: function ( e ) { - var $this = $(this) - , selector = $this.attr('data-target') - , $parent + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 + } - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 - } + $parent = $(selector) - $parent = $(selector) - $parent.trigger('close') + e && e.preventDefault() - e && e.preventDefault() + $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) - $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) + $parent.trigger(e = $.Event('close')) - $parent - .trigger('close') - .removeClass('in') + if (e.isDefaultPrevented()) return - function removeElement() { - $parent - .trigger('closed') - .remove() - } + $parent.removeClass('in') - $.support.transition && $parent.hasClass('fade') ? - $parent.on($.support.transition.end, removeElement) : - removeElement() + function removeElement() { + $parent + .trigger('closed') + .remove() } + $.support.transition && $parent.hasClass('fade') ? + $parent.on($.support.transition.end, removeElement) : + removeElement() } /* ALERT PLUGIN DEFINITION * ======================= */ - $.fn.alert = function ( option ) { + var old = $.fn.alert + + $.fn.alert = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('alert') @@ -134,18 +141,25 @@ $.fn.alert.Constructor = Alert + /* ALERT NO CONFLICT + * ================= */ + + $.fn.alert.noConflict = function () { + $.fn.alert = old + return this + } + + /* ALERT DATA-API * ============== */ - $(function () { - $('body').on('click.alert.data-api', dismiss, Alert.prototype.close) - }) + $(document).on('click.alert.data-api', dismiss, Alert.prototype.close) -}( window.jQuery );/* ============================================================ - * bootstrap-button.js v2.0.2 - * http://twitter.github.com/bootstrap/javascript.html#buttons +}(window.jQuery);/* ============================================================ + * bootstrap-button.js v2.3.2 + * http://getbootstrap.com/2.3.2/javascript.html#buttons * ============================================================ - * Copyright 2012 Twitter, Inc. + * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -160,58 +174,56 @@ * limitations under the License. * ============================================================ */ -!function( $ ){ - "use strict" +!function ($) { + + "use strict"; // jshint ;_; + /* BUTTON PUBLIC CLASS DEFINITION * ============================== */ - var Button = function ( element, options ) { + var Button = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.button.defaults, options) } - Button.prototype = { - - constructor: Button - - , setState: function ( state ) { - var d = 'disabled' - , $el = this.$element - , data = $el.data() - , val = $el.is('input') ? 'val' : 'html' + Button.prototype.setState = function (state) { + var d = 'disabled' + , $el = this.$element + , data = $el.data() + , val = $el.is('input') ? 'val' : 'html' - state = state + 'Text' - data.resetText || $el.data('resetText', $el[val]()) + state = state + 'Text' + data.resetText || $el.data('resetText', $el[val]()) - $el[val](data[state] || this.options[state]) + $el[val](data[state] || this.options[state]) - // push to event loop to allow forms to submit - setTimeout(function () { - state == 'loadingText' ? - $el.addClass(d).attr(d, d) : - $el.removeClass(d).removeAttr(d) - }, 0) - } + // push to event loop to allow forms to submit + setTimeout(function () { + state == 'loadingText' ? + $el.addClass(d).attr(d, d) : + $el.removeClass(d).removeAttr(d) + }, 0) + } - , toggle: function () { - var $parent = this.$element.parent('[data-toggle="buttons-radio"]') + Button.prototype.toggle = function () { + var $parent = this.$element.closest('[data-toggle="buttons-radio"]') - $parent && $parent - .find('.active') - .removeClass('active') - - this.$element.toggleClass('active') - } + $parent && $parent + .find('.active') + .removeClass('active') + this.$element.toggleClass('active') } /* BUTTON PLUGIN DEFINITION * ======================== */ - $.fn.button = function ( option ) { + var old = $.fn.button + + $.fn.button = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('button') @@ -229,22 +241,29 @@ $.fn.button.Constructor = Button + /* BUTTON NO CONFLICT + * ================== */ + + $.fn.button.noConflict = function () { + $.fn.button = old + return this + } + + /* BUTTON DATA-API * =============== */ - $(function () { - $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) { - var $btn = $(e.target) - if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') - $btn.button('toggle') - }) + $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { + var $btn = $(e.target) + if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') + $btn.button('toggle') }) -}( window.jQuery );/* ========================================================== - * bootstrap-carousel.js v2.0.2 - * http://twitter.github.com/bootstrap/javascript.html#carousel +}(window.jQuery);/* ========================================================== + * bootstrap-carousel.js v2.3.2 + * http://getbootstrap.com/2.3.2/javascript.html#carousel * ========================================================== - * Copyright 2012 Twitter, Inc. + * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -260,17 +279,18 @@ * ========================================================== */ -!function( $ ){ +!function ($) { + + "use strict"; // jshint ;_; - "use strict" /* CAROUSEL CLASS DEFINITION * ========================= */ var Carousel = function (element, options) { this.$element = $(element) - this.options = $.extend({}, $.fn.carousel.defaults, options) - this.options.slide && this.slide(this.options.slide) + this.$indicators = this.$element.find('.carousel-indicators') + this.options = options this.options.pause == 'hover' && this.$element .on('mouseenter', $.proxy(this.pause, this)) .on('mouseleave', $.proxy(this.cycle, this)) @@ -278,18 +298,26 @@ Carousel.prototype = { - cycle: function () { - this.interval = setInterval($.proxy(this.next, this), this.options.interval) + cycle: function (e) { + if (!e) this.paused = false + if (this.interval) clearInterval(this.interval); + this.options.interval + && !this.paused + && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) return this } + , getActiveIndex: function () { + this.$active = this.$element.find('.item.active') + this.$items = this.$active.parent().children() + return this.$items.index(this.$active) + } + , to: function (pos) { - var $active = this.$element.find('.active') - , children = $active.parent().children() - , activePos = children.index($active) + var activeIndex = this.getActiveIndex() , that = this - if (pos > (children.length - 1) || pos < 0) return + if (pos > (this.$items.length - 1) || pos < 0) return if (this.sliding) { return this.$element.one('slid', function () { @@ -297,14 +325,19 @@ }) } - if (activePos == pos) { + if (activeIndex == pos) { return this.pause().cycle() } - return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos])) + return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) } - , pause: function () { + , pause: function (e) { + if (!e) this.paused = true + if (this.$element.find('.next, .prev').length && $.support.transition.end) { + this.$element.trigger($.support.transition.end) + this.cycle(true) + } clearInterval(this.interval) this.interval = null return this @@ -321,12 +354,13 @@ } , slide: function (type, next) { - var $active = this.$element.find('.active') + var $active = this.$element.find('.item.active') , $next = next || $active[type]() , isCycling = this.interval , direction = type == 'next' ? 'left' : 'right' , fallback = type == 'next' ? 'first' : 'last' , that = this + , e this.sliding = true @@ -334,26 +368,41 @@ $next = $next.length ? $next : this.$element.find('.item')[fallback]() + e = $.Event('slide', { + relatedTarget: $next[0] + , direction: direction + }) + if ($next.hasClass('active')) return - if (!$.support.transition && this.$element.hasClass('slide')) { - this.$element.trigger('slide') - $active.removeClass('active') - $next.addClass('active') - this.sliding = false - this.$element.trigger('slid') - } else { + if (this.$indicators.length) { + this.$indicators.find('.active').removeClass('active') + this.$element.one('slid', function () { + var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) + $nextIndicator && $nextIndicator.addClass('active') + }) + } + + if ($.support.transition && this.$element.hasClass('slide')) { + this.$element.trigger(e) + if (e.isDefaultPrevented()) return $next.addClass(type) $next[0].offsetWidth // force reflow $active.addClass(direction) $next.addClass(direction) - this.$element.trigger('slide') this.$element.one($.support.transition.end, function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false setTimeout(function () { that.$element.trigger('slid') }, 0) }) + } else { + this.$element.trigger(e) + if (e.isDefaultPrevented()) return + $active.removeClass('active') + $next.addClass('active') + this.sliding = false + this.$element.trigger('slid') } isCycling && this.cycle() @@ -367,15 +416,18 @@ /* CAROUSEL PLUGIN DEFINITION * ========================== */ - $.fn.carousel = function ( option ) { + var old = $.fn.carousel + + $.fn.carousel = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('carousel') - , options = typeof option == 'object' && option + , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) + , action = typeof option == 'string' ? option : options.slide if (!data) $this.data('carousel', (data = new Carousel(this, options))) if (typeof option == 'number') data.to(option) - else if (typeof option == 'string' || (option = options.slide)) data[option]() - else data.cycle() + else if (action) data[action]() + else if (options.interval) data.pause().cycle() }) } @@ -387,24 +439,37 @@ $.fn.carousel.Constructor = Carousel + /* CAROUSEL NO CONFLICT + * ==================== */ + + $.fn.carousel.noConflict = function () { + $.fn.carousel = old + return this + } + /* CAROUSEL DATA-API * ================= */ - $(function () { - $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) { - var $this = $(this), href - , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 - , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data()) - $target.carousel(options) - e.preventDefault() - }) + $(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { + var $this = $(this), href + , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 + , options = $.extend({}, $target.data(), $this.data()) + , slideIndex + + $target.carousel(options) + + if (slideIndex = $this.attr('data-slide-to')) { + $target.data('carousel').pause().to(slideIndex).cycle() + } + + e.preventDefault() }) -}( window.jQuery );/* ============================================================= - * bootstrap-collapse.js v2.0.2 - * http://twitter.github.com/bootstrap/javascript.html#collapse +}(window.jQuery);/* ============================================================= + * bootstrap-collapse.js v2.3.2 + * http://getbootstrap.com/2.3.2/javascript.html#collapse * ============================================================= - * Copyright 2012 Twitter, Inc. + * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -419,16 +484,21 @@ * limitations under the License. * ============================================================ */ -!function( $ ){ - "use strict" +!function ($) { + + "use strict"; // jshint ;_; + + + /* COLLAPSE PUBLIC CLASS DEFINITION + * ================================ */ - var Collapse = function ( element, options ) { - this.$element = $(element) + var Collapse = function (element, options) { + this.$element = $(element) this.options = $.extend({}, $.fn.collapse.defaults, options) - if (this.options["parent"]) { - this.$parent = $(this.options["parent"]) + if (this.options.parent) { + this.$parent = $(this.options.parent) } this.options.toggle && this.toggle() @@ -444,31 +514,39 @@ } , show: function () { - var dimension = this.dimension() - , scroll = $.camelCase(['scroll', dimension].join('-')) - , actives = this.$parent && this.$parent.find('.in') + var dimension + , scroll + , actives , hasData + if (this.transitioning || this.$element.hasClass('in')) return + + dimension = this.dimension() + scroll = $.camelCase(['scroll', dimension].join('-')) + actives = this.$parent && this.$parent.find('> .accordion-group > .in') + if (actives && actives.length) { hasData = actives.data('collapse') + if (hasData && hasData.transitioning) return actives.collapse('hide') hasData || actives.data('collapse', null) } this.$element[dimension](0) - this.transition('addClass', 'show', 'shown') - this.$element[dimension](this.$element[0][scroll]) - + this.transition('addClass', $.Event('show'), 'shown') + $.support.transition && this.$element[dimension](this.$element[0][scroll]) } , hide: function () { - var dimension = this.dimension() + var dimension + if (this.transitioning || !this.$element.hasClass('in')) return + dimension = this.dimension() this.reset(this.$element[dimension]()) - this.transition('removeClass', 'hide', 'hidden') + this.transition('removeClass', $.Event('hide'), 'hidden') this.$element[dimension](0) } - , reset: function ( size ) { + , reset: function (size) { var dimension = this.dimension() this.$element @@ -476,41 +554,49 @@ [dimension](size || 'auto') [0].offsetWidth - this.$element[size ? 'addClass' : 'removeClass']('collapse') + this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') return this } - , transition: function ( method, startEvent, completeEvent ) { + , transition: function (method, startEvent, completeEvent) { var that = this , complete = function () { - if (startEvent == 'show') that.reset() + if (startEvent.type == 'show') that.reset() + that.transitioning = 0 that.$element.trigger(completeEvent) } - this.$element - .trigger(startEvent) - [method]('in') + this.$element.trigger(startEvent) + + if (startEvent.isDefaultPrevented()) return + + this.transitioning = 1 + + this.$element[method]('in') $.support.transition && this.$element.hasClass('collapse') ? this.$element.one($.support.transition.end, complete) : complete() - } + } , toggle: function () { this[this.$element.hasClass('in') ? 'hide' : 'show']() - } + } } - /* COLLAPSIBLE PLUGIN DEFINITION - * ============================== */ - $.fn.collapse = function ( option ) { + /* COLLAPSE PLUGIN DEFINITION + * ========================== */ + + var old = $.fn.collapse + + $.fn.collapse = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('collapse') - , options = typeof option == 'object' && option + , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option) if (!data) $this.data('collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) @@ -523,25 +609,33 @@ $.fn.collapse.Constructor = Collapse - /* COLLAPSIBLE DATA-API + /* COLLAPSE NO CONFLICT * ==================== */ - $(function () { - $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) { - var $this = $(this), href - , target = $this.attr('data-target') - || e.preventDefault() - || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 - , option = $(target).data('collapse') ? 'toggle' : $this.data() - $(target).collapse(option) - }) + $.fn.collapse.noConflict = function () { + $.fn.collapse = old + return this + } + + + /* COLLAPSE DATA-API + * ================= */ + + $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { + var $this = $(this), href + , target = $this.attr('data-target') + || e.preventDefault() + || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 + , option = $(target).data('collapse') ? 'toggle' : $this.data() + $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') + $(target).collapse(option) }) -}( window.jQuery );/* ============================================================ - * bootstrap-dropdown.js v2.0.2 - * http://twitter.github.com/bootstrap/javascript.html#dropdowns +}(window.jQuery);/* ============================================================ + * bootstrap-dropdown.js v2.3.2 + * http://getbootstrap.com/2.3.2/javascript.html#dropdowns * ============================================================ - * Copyright 2012 Twitter, Inc. + * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -557,15 +651,16 @@ * ============================================================ */ -!function( $ ){ +!function ($) { + + "use strict"; // jshint ;_; - "use strict" /* DROPDOWN CLASS DEFINITION * ========================= */ - var toggle = '[data-toggle="dropdown"]' - , Dropdown = function ( element ) { + var toggle = '[data-toggle=dropdown]' + , Dropdown = function (element) { var $el = $(element).on('click.dropdown.data-api', this.toggle) $('html').on('click.dropdown.data-api', function () { $el.parent().removeClass('open') @@ -576,39 +671,105 @@ constructor: Dropdown - , toggle: function ( e ) { + , toggle: function (e) { var $this = $(this) - , selector = $this.attr('data-target') , $parent , isActive - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 - } + if ($this.is('.disabled, :disabled')) return - $parent = $(selector) - $parent.length || ($parent = $this.parent()) + $parent = getParent($this) isActive = $parent.hasClass('open') clearMenus() - !isActive && $parent.toggleClass('open') + + if (!isActive) { + if ('ontouchstart' in document.documentElement) { + // if mobile we we use a backdrop because click events don't delegate + $('