jquery_dynamic_fields 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/app/helpers/jquery_dynamic_fields/field_helper.rb +1 -1
- data/bin/autospec +16 -0
- data/bin/erubis +16 -0
- data/bin/guard +16 -0
- data/bin/htmldiff +16 -0
- data/bin/launchy +16 -0
- data/bin/ldiff +16 -0
- data/bin/nokogiri +16 -0
- data/bin/rackup +16 -0
- data/bin/rails +16 -0
- data/bin/rake +16 -0
- data/bin/rake2thor +16 -0
- data/bin/ri +16 -0
- data/bin/rspec +16 -0
- data/bin/thor +16 -0
- data/bin/tilt +16 -0
- data/bin/tt +16 -0
- data/jquery_dynamic_fields.gemspec +8 -0
- data/lib/jquery_dynamic_fields/version.rb +1 -1
- data/spec/dummy/.gitignore +15 -0
- data/spec/dummy/Gemfile +46 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/images/rails.png +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/javascripts/tasklists.js.coffee +3 -0
- data/spec/dummy/app/assets/javascripts/tasks.js.coffee +3 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/assets/stylesheets/scaffolds.css.scss +56 -0
- data/spec/dummy/app/assets/stylesheets/tasklists.css.scss +3 -0
- data/spec/dummy/app/assets/stylesheets/tasks.css.scss +3 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/tasklists_controller.rb +83 -0
- data/spec/dummy/app/controllers/tasks_controller.rb +83 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/tasklists_helper.rb +2 -0
- data/spec/dummy/app/helpers/tasks_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/task.rb +4 -0
- data/spec/dummy/app/models/tasklist.rb +5 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/tasklists/_form.html.erb +30 -0
- data/spec/dummy/app/views/tasklists/_task_fields.html.erb +7 -0
- data/spec/dummy/app/views/tasklists/edit.html.erb +6 -0
- data/spec/dummy/app/views/tasklists/index.html.erb +21 -0
- data/spec/dummy/app/views/tasklists/new.html.erb +5 -0
- data/spec/dummy/app/views/tasklists/show.html.erb +5 -0
- data/spec/dummy/bin/autospec +16 -0
- data/spec/dummy/bin/erubis +16 -0
- data/spec/dummy/bin/guard +16 -0
- data/spec/dummy/bin/htmldiff +16 -0
- data/spec/dummy/bin/ldiff +16 -0
- data/spec/dummy/bin/nokogiri +16 -0
- data/spec/dummy/bin/rackup +16 -0
- data/spec/dummy/bin/rails +16 -0
- data/spec/dummy/bin/rake +16 -0
- data/spec/dummy/bin/rake2thor +16 -0
- data/spec/dummy/bin/ri +16 -0
- data/spec/dummy/bin/rspec +16 -0
- data/spec/dummy/bin/sass +16 -0
- data/spec/dummy/bin/sass-convert +16 -0
- data/spec/dummy/bin/scss +16 -0
- data/spec/dummy/bin/thor +16 -0
- data/spec/dummy/bin/tilt +16 -0
- data/spec/dummy/bin/tt +16 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +68 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +59 -0
- data/spec/dummy/db/migrate/20120618180254_create_tasklists.rb +9 -0
- data/spec/dummy/db/migrate/20120618180402_create_tasks.rb +10 -0
- data/spec/dummy/db/schema.rb +29 -0
- data/spec/dummy/db/seeds.rb +7 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/lib/tasks/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/index.html +241 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/dummy/vendor/plugins/.gitkeep +0 -0
- data/spec/requests/jquery_dynamic_fields_spec.rb +22 -0
- data/spec/spec_helper.rb +44 -0
- metadata +313 -4
data/spec/dummy/Rakefile
ADDED
@@ -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
|
Binary file
|
@@ -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,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,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
|
File without changes
|
File without changes
|
@@ -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,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,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')
|