bootstrap_form_builder 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +39 -0
  3. data/Rakefile +38 -0
  4. data/lib/bootstrap_form_builder.rb +6 -0
  5. data/lib/bootstrap_form_builder/form_builder.rb +60 -0
  6. data/lib/bootstrap_form_builder/helpers.rb +13 -0
  7. data/lib/bootstrap_form_builder/version.rb +3 -0
  8. data/lib/tasks/bootstrap_form_builder_tasks.rake +4 -0
  9. data/test/bootstrap_form_builder/form_builder_test.rb +129 -0
  10. data/test/bootstrap_form_builder/helpers_test.rb +18 -0
  11. data/test/dummy/README.rdoc +261 -0
  12. data/test/dummy/Rakefile +7 -0
  13. data/test/dummy/app/assets/javascripts/application.js +15 -0
  14. data/test/dummy/app/assets/javascripts/books.js +2 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/test/dummy/app/assets/stylesheets/books.css +4 -0
  17. data/test/dummy/app/controllers/application_controller.rb +3 -0
  18. data/test/dummy/app/controllers/books_controller.rb +40 -0
  19. data/test/dummy/app/helpers/application_helper.rb +2 -0
  20. data/test/dummy/app/helpers/books_helper.rb +2 -0
  21. data/test/dummy/app/models/author.rb +3 -0
  22. data/test/dummy/app/models/book.rb +4 -0
  23. data/test/dummy/app/views/books/_form.html.erb +7 -0
  24. data/test/dummy/app/views/books/edit.html.erb +2 -0
  25. data/test/dummy/app/views/books/index.html.erb +2 -0
  26. data/test/dummy/app/views/books/new.html.erb +2 -0
  27. data/test/dummy/app/views/books/show.html.erb +2 -0
  28. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  29. data/test/dummy/config.ru +4 -0
  30. data/test/dummy/config/application.rb +56 -0
  31. data/test/dummy/config/boot.rb +10 -0
  32. data/test/dummy/config/database.yml +25 -0
  33. data/test/dummy/config/environment.rb +5 -0
  34. data/test/dummy/config/environments/development.rb +37 -0
  35. data/test/dummy/config/environments/production.rb +67 -0
  36. data/test/dummy/config/environments/test.rb +37 -0
  37. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  38. data/test/dummy/config/initializers/inflections.rb +15 -0
  39. data/test/dummy/config/initializers/mime_types.rb +5 -0
  40. data/test/dummy/config/initializers/secret_token.rb +7 -0
  41. data/test/dummy/config/initializers/session_store.rb +8 -0
  42. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  43. data/test/dummy/config/locales/en.yml +5 -0
  44. data/test/dummy/config/routes.rb +60 -0
  45. data/test/dummy/db/development.sqlite3 +0 -0
  46. data/test/dummy/db/migrate/20120104000542_create_authors.rb +9 -0
  47. data/test/dummy/db/migrate/20120104000544_create_books.rb +11 -0
  48. data/test/dummy/db/schema.rb +31 -0
  49. data/test/dummy/db/test.sqlite3 +0 -0
  50. data/test/dummy/log/development.log +17 -0
  51. data/test/dummy/log/test.log +55 -0
  52. data/test/dummy/public/404.html +26 -0
  53. data/test/dummy/public/422.html +26 -0
  54. data/test/dummy/public/500.html +25 -0
  55. data/test/dummy/public/favicon.ico +0 -0
  56. data/test/dummy/script/rails +6 -0
  57. data/test/dummy/test/fixtures/authors.yml +7 -0
  58. data/test/dummy/test/fixtures/books.yml +9 -0
  59. data/test/dummy/test/integration/book_requests_test.rb +17 -0
  60. data/test/dummy/test/test_helper.rb +6 -0
  61. data/test/dummy/test/unit/author_test.rb +7 -0
  62. data/test/dummy/test/unit/book_test.rb +7 -0
  63. data/test/dummy/test/unit/helpers/books_helper_test.rb +4 -0
  64. data/test/dummy/tmp/cache/assets/C98/B70/sprockets%2F64db420a3a172209bf0b734312a4888a +0 -0
  65. data/test/dummy/tmp/cache/assets/CB0/730/sprockets%2F655cb37a6521d047af8484f0185602ff +0 -0
  66. data/test/dummy/tmp/cache/assets/CCA/F50/sprockets%2F6b31a25791c10a22585e5f302df431cd +0 -0
  67. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  68. data/test/dummy/tmp/cache/assets/CE3/AE0/sprockets%2Ffe65891a24f0c47f015e45717e7b8b21 +0 -0
  69. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  70. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  71. data/test/dummy/tmp/cache/assets/D54/910/sprockets%2F787b6a4c2386b5edf98f90508b85cc3d +0 -0
  72. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  73. data/test/dummy/tmp/cache/assets/D68/930/sprockets%2F5a15e52e84502f9fceb7ea04020f65fc +0 -0
  74. data/test/dummy/tmp/cache/assets/D8C/140/sprockets%2F2afdbb3902a1be5d2f045cfc837903a3 +0 -0
  75. data/test/dummy/tmp/cache/assets/DA2/BB0/sprockets%2Fe7ddf5e91f014c5324e1a397beef71f2 +0 -0
  76. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  77. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  78. data/test/test_helper.rb +11 -0
  79. metadata +233 -0
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '88ae39ddb9840576a182c90c27f86f30a3e7e049e569010c90b5c8a2e4e0842875c398ca942d4c1337c3434ad8b1dec2ba4936a099a265f51c998232dcaa8a40'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,60 @@
1
+ Dummy::Application.routes.draw do
2
+ resources :books
3
+
4
+ # The priority is based upon order of creation:
5
+ # first created -> highest priority.
6
+
7
+ # Sample of regular route:
8
+ # match 'products/:id' => 'catalog#view'
9
+ # Keep in mind you can assign values other than :controller and :action
10
+
11
+ # Sample of named route:
12
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
13
+ # This route can be invoked with purchase_url(:id => product.id)
14
+
15
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
16
+ # resources :products
17
+
18
+ # Sample resource route with options:
19
+ # resources :products do
20
+ # member do
21
+ # get 'short'
22
+ # post 'toggle'
23
+ # end
24
+ #
25
+ # collection do
26
+ # get 'sold'
27
+ # end
28
+ # end
29
+
30
+ # Sample resource route with sub-resources:
31
+ # resources :products do
32
+ # resources :comments, :sales
33
+ # resource :seller
34
+ # end
35
+
36
+ # Sample resource route with more complex sub-resources
37
+ # resources :products do
38
+ # resources :comments
39
+ # resources :sales do
40
+ # get 'recent', :on => :collection
41
+ # end
42
+ # end
43
+
44
+ # Sample resource route within a namespace:
45
+ # namespace :admin do
46
+ # # Directs /admin/products/* to Admin::ProductsController
47
+ # # (app/controllers/admin/products_controller.rb)
48
+ # resources :products
49
+ # end
50
+
51
+ # You can have the root of your site routed with "root"
52
+ # just remember to delete public/index.html.
53
+ # root :to => 'welcome#index'
54
+
55
+ # See how all your routes lay out with "rake routes"
56
+
57
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
58
+ # Note: This route will make all actions in every controller accessible via GET requests.
59
+ # match ':controller(/:action(/:id))(.:format)'
60
+ end
Binary file
@@ -0,0 +1,9 @@
1
+ class CreateAuthors < ActiveRecord::Migration
2
+ def change
3
+ create_table :authors do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class CreateBooks < ActiveRecord::Migration
2
+ def change
3
+ create_table :books do |t|
4
+ t.belongs_to :author
5
+ t.text :title
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :books, :author_id
10
+ end
11
+ end
@@ -0,0 +1,31 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20120104000544) do
15
+
16
+ create_table "authors", :force => true do |t|
17
+ t.string "name"
18
+ t.datetime "created_at", :null => false
19
+ t.datetime "updated_at", :null => false
20
+ end
21
+
22
+ create_table "books", :force => true do |t|
23
+ t.integer "author_id"
24
+ t.text "title"
25
+ t.datetime "created_at", :null => false
26
+ t.datetime "updated_at", :null => false
27
+ end
28
+
29
+ add_index "books", ["author_id"], :name => "index_books_on_author_id"
30
+
31
+ end
Binary file
@@ -0,0 +1,17 @@
1
+  (0.3ms) begin transaction
2
+
3
+
4
+ Started GET "/books/new" for 127.0.0.1 at 2012-01-12 16:01:52 -0800
5
+ Processing by BooksController#new as HTML
6
+ Completed 500 Internal Server Error in 1ms
7
+
8
+ ActiveRecord::StatementInvalid (Could not find table 'books'):
9
+ app/controllers/books_controller.rb:11:in `new'
10
+ app/controllers/books_controller.rb:11:in `new'
11
+ test/integration/book_requests_test.rb:5:in `block in <class:BookRequestsTest>'
12
+
13
+
14
+ Rendered /Users/jparker/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/actionpack-3.2.0.rc1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.7ms)
15
+ Rendered /Users/jparker/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/actionpack-3.2.0.rc1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.7ms)
16
+ Rendered /Users/jparker/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/actionpack-3.2.0.rc1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (8.1ms)
17
+  (0.1ms) rollback transaction
@@ -0,0 +1,55 @@
1
+  (0.1ms) begin transaction
2
+
3
+
4
+ Started GET "/books/new" for 127.0.0.1 at 2012-01-13 11:41:15 -0800
5
+ Processing by BooksController#new as HTML
6
+ Rendered books/_form.html.erb (10.4ms)
7
+ Rendered books/new.html.erb within layouts/application (15.8ms)
8
+ Completed 200 OK in 48ms (Views: 27.3ms | ActiveRecord: 0.2ms)
9
+  (0.1ms) rollback transaction
10
+  (0.0ms) begin transaction
11
+  (0.0ms) rollback transaction
12
+  (0.0ms) begin transaction
13
+  (0.0ms) rollback transaction
14
+  (0.0ms) begin transaction
15
+  (0.0ms) rollback transaction
16
+  (0.0ms) begin transaction
17
+  (0.0ms) rollback transaction
18
+  (0.0ms) begin transaction
19
+  (0.0ms) rollback transaction
20
+  (0.0ms) begin transaction
21
+  (0.0ms) rollback transaction
22
+  (0.0ms) begin transaction
23
+  (0.0ms) rollback transaction
24
+  (0.0ms) begin transaction
25
+  (0.0ms) rollback transaction
26
+  (0.0ms) begin transaction
27
+  (0.0ms) rollback transaction
28
+  (0.0ms) begin transaction
29
+  (0.0ms) rollback transaction
30
+  (0.0ms) begin transaction
31
+  (0.0ms) rollback transaction
32
+  (0.0ms) begin transaction
33
+  (0.0ms) rollback transaction
34
+  (0.0ms) begin transaction
35
+  (0.0ms) rollback transaction
36
+  (0.0ms) begin transaction
37
+  (0.0ms) rollback transaction
38
+  (0.0ms) begin transaction
39
+  (0.0ms) rollback transaction
40
+  (0.0ms) begin transaction
41
+  (0.0ms) rollback transaction
42
+  (0.0ms) begin transaction
43
+  (0.0ms) rollback transaction
44
+  (0.0ms) begin transaction
45
+  (0.0ms) rollback transaction
46
+  (0.0ms) begin transaction
47
+  (0.0ms) rollback transaction
48
+  (0.0ms) begin transaction
49
+  (0.0ms) rollback transaction
50
+  (0.0ms) begin transaction
51
+  (0.0ms) rollback transaction
52
+  (0.0ms) begin transaction
53
+  (0.0ms) rollback transaction
54
+  (0.0ms) begin transaction
55
+  (0.0ms) rollback transaction
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ name: MyString
5
+
6
+ two:
7
+ name: MyString
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ author:
5
+ title: MyText
6
+
7
+ two:
8
+ author:
9
+ title: MyText
@@ -0,0 +1,17 @@
1
+ require 'test_helper'
2
+
3
+ class BookRequestsTest < ActionDispatch::IntegrationTest
4
+ test 'GET /books/new renders the form' do
5
+ get '/books/new'
6
+ assert_select 'form[action=?]', books_path do
7
+ assert_select 'div.clearfix#book_title_input' do
8
+ assert_select 'label[for=book_title]', 'Title'
9
+ assert_select 'input[type=text]#book_title'
10
+ end
11
+ assert_select 'div.clearfix#author_name_input' do
12
+ assert_select 'label[for=book_author_attributes_name]', 'Author'
13
+ assert_select 'input[type=text]#book_author_attributes_name'
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,6 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class AuthorTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class BookTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class BooksHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,11 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+ require 'mocha'
7
+
8
+ Rails.backtrace_cleaner.remove_silencers!
9
+
10
+ # Load support files
11
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }