jquery_dynamic_fields 0.0.3 → 0.0.4

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 (103) hide show
  1. data/.rspec +1 -0
  2. data/app/helpers/jquery_dynamic_fields/field_helper.rb +1 -1
  3. data/bin/autospec +16 -0
  4. data/bin/erubis +16 -0
  5. data/bin/guard +16 -0
  6. data/bin/htmldiff +16 -0
  7. data/bin/launchy +16 -0
  8. data/bin/ldiff +16 -0
  9. data/bin/nokogiri +16 -0
  10. data/bin/rackup +16 -0
  11. data/bin/rails +16 -0
  12. data/bin/rake +16 -0
  13. data/bin/rake2thor +16 -0
  14. data/bin/ri +16 -0
  15. data/bin/rspec +16 -0
  16. data/bin/thor +16 -0
  17. data/bin/tilt +16 -0
  18. data/bin/tt +16 -0
  19. data/jquery_dynamic_fields.gemspec +8 -0
  20. data/lib/jquery_dynamic_fields/version.rb +1 -1
  21. data/spec/dummy/.gitignore +15 -0
  22. data/spec/dummy/Gemfile +46 -0
  23. data/spec/dummy/README.rdoc +261 -0
  24. data/spec/dummy/Rakefile +7 -0
  25. data/spec/dummy/app/assets/images/rails.png +0 -0
  26. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  27. data/spec/dummy/app/assets/javascripts/tasklists.js.coffee +3 -0
  28. data/spec/dummy/app/assets/javascripts/tasks.js.coffee +3 -0
  29. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  30. data/spec/dummy/app/assets/stylesheets/scaffolds.css.scss +56 -0
  31. data/spec/dummy/app/assets/stylesheets/tasklists.css.scss +3 -0
  32. data/spec/dummy/app/assets/stylesheets/tasks.css.scss +3 -0
  33. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  34. data/spec/dummy/app/controllers/tasklists_controller.rb +83 -0
  35. data/spec/dummy/app/controllers/tasks_controller.rb +83 -0
  36. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  37. data/spec/dummy/app/helpers/tasklists_helper.rb +2 -0
  38. data/spec/dummy/app/helpers/tasks_helper.rb +2 -0
  39. data/spec/dummy/app/mailers/.gitkeep +0 -0
  40. data/spec/dummy/app/models/.gitkeep +0 -0
  41. data/spec/dummy/app/models/task.rb +4 -0
  42. data/spec/dummy/app/models/tasklist.rb +5 -0
  43. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  44. data/spec/dummy/app/views/tasklists/_form.html.erb +30 -0
  45. data/spec/dummy/app/views/tasklists/_task_fields.html.erb +7 -0
  46. data/spec/dummy/app/views/tasklists/edit.html.erb +6 -0
  47. data/spec/dummy/app/views/tasklists/index.html.erb +21 -0
  48. data/spec/dummy/app/views/tasklists/new.html.erb +5 -0
  49. data/spec/dummy/app/views/tasklists/show.html.erb +5 -0
  50. data/spec/dummy/bin/autospec +16 -0
  51. data/spec/dummy/bin/erubis +16 -0
  52. data/spec/dummy/bin/guard +16 -0
  53. data/spec/dummy/bin/htmldiff +16 -0
  54. data/spec/dummy/bin/ldiff +16 -0
  55. data/spec/dummy/bin/nokogiri +16 -0
  56. data/spec/dummy/bin/rackup +16 -0
  57. data/spec/dummy/bin/rails +16 -0
  58. data/spec/dummy/bin/rake +16 -0
  59. data/spec/dummy/bin/rake2thor +16 -0
  60. data/spec/dummy/bin/ri +16 -0
  61. data/spec/dummy/bin/rspec +16 -0
  62. data/spec/dummy/bin/sass +16 -0
  63. data/spec/dummy/bin/sass-convert +16 -0
  64. data/spec/dummy/bin/scss +16 -0
  65. data/spec/dummy/bin/thor +16 -0
  66. data/spec/dummy/bin/tilt +16 -0
  67. data/spec/dummy/bin/tt +16 -0
  68. data/spec/dummy/config.ru +4 -0
  69. data/spec/dummy/config/application.rb +68 -0
  70. data/spec/dummy/config/boot.rb +6 -0
  71. data/spec/dummy/config/database.yml +25 -0
  72. data/spec/dummy/config/environment.rb +5 -0
  73. data/spec/dummy/config/environments/development.rb +37 -0
  74. data/spec/dummy/config/environments/production.rb +67 -0
  75. data/spec/dummy/config/environments/test.rb +37 -0
  76. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  77. data/spec/dummy/config/initializers/inflections.rb +15 -0
  78. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  79. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  80. data/spec/dummy/config/initializers/session_store.rb +8 -0
  81. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  82. data/spec/dummy/config/locales/en.yml +5 -0
  83. data/spec/dummy/config/routes.rb +59 -0
  84. data/spec/dummy/db/migrate/20120618180254_create_tasklists.rb +9 -0
  85. data/spec/dummy/db/migrate/20120618180402_create_tasks.rb +10 -0
  86. data/spec/dummy/db/schema.rb +29 -0
  87. data/spec/dummy/db/seeds.rb +7 -0
  88. data/spec/dummy/lib/assets/.gitkeep +0 -0
  89. data/spec/dummy/lib/tasks/.gitkeep +0 -0
  90. data/spec/dummy/log/.gitkeep +0 -0
  91. data/spec/dummy/public/404.html +26 -0
  92. data/spec/dummy/public/422.html +26 -0
  93. data/spec/dummy/public/500.html +25 -0
  94. data/spec/dummy/public/favicon.ico +0 -0
  95. data/spec/dummy/public/index.html +241 -0
  96. data/spec/dummy/public/robots.txt +5 -0
  97. data/spec/dummy/script/rails +6 -0
  98. data/spec/dummy/vendor/assets/javascripts/.gitkeep +0 -0
  99. data/spec/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
  100. data/spec/dummy/vendor/plugins/.gitkeep +0 -0
  101. data/spec/requests/jquery_dynamic_fields_spec.rb +22 -0
  102. data/spec/spec_helper.rb +44 -0
  103. metadata +313 -4
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ Dummy::Application.load_tasks
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require jquery_dynamic_fields
16
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,56 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px; }
7
+
8
+ p, ol, ul, td {
9
+ font-family: verdana, arial, helvetica, sans-serif;
10
+ font-size: 13px;
11
+ line-height: 18px; }
12
+
13
+ pre {
14
+ background-color: #eee;
15
+ padding: 10px;
16
+ font-size: 11px; }
17
+
18
+ a {
19
+ color: #000;
20
+ &:visited {
21
+ color: #666; }
22
+ &:hover {
23
+ color: #fff;
24
+ background-color: #000; } }
25
+
26
+ div {
27
+ &.field, &.actions {
28
+ margin-bottom: 10px; } }
29
+
30
+ #notice {
31
+ color: green; }
32
+
33
+ .field_with_errors {
34
+ padding: 2px;
35
+ background-color: red;
36
+ display: table; }
37
+
38
+ #error_explanation {
39
+ width: 450px;
40
+ border: 2px solid red;
41
+ padding: 7px;
42
+ padding-bottom: 0;
43
+ margin-bottom: 20px;
44
+ background-color: #f0f0f0;
45
+ h2 {
46
+ text-align: left;
47
+ font-weight: bold;
48
+ padding: 5px 5px 5px 15px;
49
+ font-size: 12px;
50
+ margin: -7px;
51
+ margin-bottom: 0px;
52
+ background-color: #c00;
53
+ color: #fff; }
54
+ ul li {
55
+ font-size: 12px;
56
+ list-style: square; } }
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Tasklists controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Tasks controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,83 @@
1
+ class TasklistsController < ApplicationController
2
+ # GET /tasklists
3
+ # GET /tasklists.json
4
+ def index
5
+ @tasklists = Tasklist.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @tasklists }
10
+ end
11
+ end
12
+
13
+ # GET /tasklists/1
14
+ # GET /tasklists/1.json
15
+ def show
16
+ @tasklist = Tasklist.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @tasklist }
21
+ end
22
+ end
23
+
24
+ # GET /tasklists/new
25
+ # GET /tasklists/new.json
26
+ def new
27
+ @tasklist = Tasklist.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render json: @tasklist }
32
+ end
33
+ end
34
+
35
+ # GET /tasklists/1/edit
36
+ def edit
37
+ @tasklist = Tasklist.find(params[:id])
38
+ end
39
+
40
+ # POST /tasklists
41
+ # POST /tasklists.json
42
+ def create
43
+ @tasklist = Tasklist.new(params[:tasklist])
44
+
45
+ respond_to do |format|
46
+ if @tasklist.save
47
+ format.html { redirect_to @tasklist, notice: 'Tasklist was successfully created.' }
48
+ format.json { render json: @tasklist, status: :created, location: @tasklist }
49
+ else
50
+ format.html { render action: "new" }
51
+ format.json { render json: @tasklist.errors, status: :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /tasklists/1
57
+ # PUT /tasklists/1.json
58
+ def update
59
+ @tasklist = Tasklist.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @tasklist.update_attributes(params[:tasklist])
63
+ format.html { redirect_to @tasklist, notice: 'Tasklist was successfully updated.' }
64
+ format.json { head :no_content }
65
+ else
66
+ format.html { render action: "edit" }
67
+ format.json { render json: @tasklist.errors, status: :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /tasklists/1
73
+ # DELETE /tasklists/1.json
74
+ def destroy
75
+ @tasklist = Tasklist.find(params[:id])
76
+ @tasklist.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to tasklists_url }
80
+ format.json { head :no_content }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,83 @@
1
+ class TasksController < ApplicationController
2
+ # GET /tasks
3
+ # GET /tasks.json
4
+ def index
5
+ @tasks = Task.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @tasks }
10
+ end
11
+ end
12
+
13
+ # GET /tasks/1
14
+ # GET /tasks/1.json
15
+ def show
16
+ @task = Task.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @task }
21
+ end
22
+ end
23
+
24
+ # GET /tasks/new
25
+ # GET /tasks/new.json
26
+ def new
27
+ @task = Task.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render json: @task }
32
+ end
33
+ end
34
+
35
+ # GET /tasks/1/edit
36
+ def edit
37
+ @task = Task.find(params[:id])
38
+ end
39
+
40
+ # POST /tasks
41
+ # POST /tasks.json
42
+ def create
43
+ @task = Task.new(params[:task])
44
+
45
+ respond_to do |format|
46
+ if @task.save
47
+ format.html { redirect_to @task, notice: 'Task was successfully created.' }
48
+ format.json { render json: @task, status: :created, location: @task }
49
+ else
50
+ format.html { render action: "new" }
51
+ format.json { render json: @task.errors, status: :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /tasks/1
57
+ # PUT /tasks/1.json
58
+ def update
59
+ @task = Task.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @task.update_attributes(params[:task])
63
+ format.html { redirect_to @task, notice: 'Task was successfully updated.' }
64
+ format.json { head :no_content }
65
+ else
66
+ format.html { render action: "edit" }
67
+ format.json { render json: @task.errors, status: :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /tasks/1
73
+ # DELETE /tasks/1.json
74
+ def destroy
75
+ @task = Task.find(params[:id])
76
+ @task.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to tasks_url }
80
+ format.json { head :no_content }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module TasklistsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module TasksHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ class Task < ActiveRecord::Base
2
+ attr_accessible :label, :tasklist_id
3
+ belongs_to :tasklist
4
+ end
@@ -0,0 +1,5 @@
1
+ class Tasklist < ActiveRecord::Base
2
+ attr_accessible :title, :tasks_attributes
3
+ has_many :tasks
4
+ accepts_nested_attributes_for :tasks
5
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,30 @@
1
+ <%= form_for(@tasklist) do |f| %>
2
+ <% if @tasklist.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@tasklist.errors.count, "error") %> prohibited this tasklist from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @tasklist.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :title -%>
16
+ <%= f.text_field :title -%>
17
+ </div>
18
+
19
+ <%= f.fields_for :tasks, @tasklist.tasks do |ff| -%>
20
+ <%= render "task_fields", f: ff -%>
21
+ <% end -%>
22
+
23
+ <div class="field">
24
+ <%= link_to_add_fields "add a task", f, :tasks -%>
25
+ </div>
26
+
27
+ <div class="actions">
28
+ <%= f.submit %>
29
+ </div>
30
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <div class="task">
2
+ <fieldset>
3
+ <%= f.label :label -%>
4
+ <%= f.text_field :label -%>
5
+ <%= link_to_remove_field f -%>
6
+ </fieldset>
7
+ </div>
@@ -0,0 +1,6 @@
1
+ <h1>Editing tasklist</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @tasklist %> |
6
+ <%= link_to 'Back', tasklists_path %>
@@ -0,0 +1,21 @@
1
+ <h1>Listing tasklists</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th></th>
6
+ <th></th>
7
+ <th></th>
8
+ </tr>
9
+
10
+ <% @tasklists.each do |tasklist| %>
11
+ <tr>
12
+ <td><%= link_to 'Show', tasklist %></td>
13
+ <td><%= link_to 'Edit', edit_tasklist_path(tasklist) %></td>
14
+ <td><%= link_to 'Destroy', tasklist, method: :delete, data: { confirm: 'Are you sure?' } %></td>
15
+ </tr>
16
+ <% end %>
17
+ </table>
18
+
19
+ <br />
20
+
21
+ <%= link_to 'New Tasklist', new_tasklist_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New tasklist</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', tasklists_path %>
@@ -0,0 +1,5 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+
4
+ <%= link_to 'Edit', edit_tasklist_path(@tasklist) %> |
5
+ <%= link_to 'Back', tasklists_path %>
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'autospec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'autospec')
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'erubis' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('jquery_dynamic_fields', 'erubis')