dynamic_fields_for_rails 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/dynamic_fields_for_helper.rb +5 -2
- data/lib/dynamic_fields_for_rails/version.rb +1 -1
- data/test/dummy/config/environments/development.rb +1 -2
- data/test/dummy/config/environments/production.rb +1 -0
- data/test/dummy/config/environments/test.rb +1 -3
- data/test/dummy/config/initializers/secret_token.rb +1 -0
- data/test/dummy/log/test.log +120 -0
- data/test/link_to_add_fields_test.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e6bdd6eea27d942e0d7f82d2e7f59f76177ec36
|
4
|
+
data.tar.gz: 9a07cdba39a6e96728d7bc73019ac5486060a88c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27dd8d33a22ed0520c947f72728331089716f4a7f4bcf558acb45ec8113f3655cdab531854c79acb00b308579344fe05fee0d80f241b438fd8237fe58edeeec1
|
7
|
+
data.tar.gz: e1ee7d9044c5c5d994da03c2bcf9f1308f2f636474bbf3915371f580512e3ec8b9b4fd778ca5b5dc5d300ae9eed0344ea1cf30d1f0745fadfe237d17326b91fb
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module DynamicFieldsForHelper
|
3
3
|
|
4
|
-
def link_to_add_fields(form, association, options, &block)
|
4
|
+
def link_to_add_fields(form, association, options = {}, &block)
|
5
5
|
partial = options[:partial] || nil
|
6
6
|
name = options[:name] || nil
|
7
7
|
css_classes = options[:class] || nil
|
@@ -23,7 +23,10 @@ module DynamicFieldsForHelper
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def link_to_delete_fields(fields,
|
26
|
+
def link_to_delete_fields(fields, options = {}, &block)
|
27
|
+
name = options[:name] || nil
|
28
|
+
css_classes = options[:class] || nil
|
29
|
+
|
27
30
|
link = []
|
28
31
|
link << fields.hidden_field(:_destroy)
|
29
32
|
css_classes = css_classes(DynamicFieldsForRails.delete_css_classes, css_classes)
|
@@ -6,8 +6,7 @@ Dummy::Application.configure do
|
|
6
6
|
# since you don't have to restart the webserver when you make code changes.
|
7
7
|
config.cache_classes = false
|
8
8
|
|
9
|
-
|
10
|
-
config.whiny_nils = true
|
9
|
+
config.eager_load = false
|
11
10
|
|
12
11
|
# Show full error reports and disable caching
|
13
12
|
config.consider_all_requests_local = true
|
@@ -4,6 +4,7 @@ Dummy::Application.configure do
|
|
4
4
|
# The production environment is meant for finished, "live" apps.
|
5
5
|
# Code is not reloaded between requests
|
6
6
|
config.cache_classes = true
|
7
|
+
config.eager_load = true
|
7
8
|
|
8
9
|
# Full error reports are disabled and caching is turned on
|
9
10
|
config.consider_all_requests_local = false
|
@@ -6,9 +6,7 @@ Dummy::Application.configure do
|
|
6
6
|
# your test database is "scratch space" for the test suite and is wiped
|
7
7
|
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
|
-
|
10
|
-
# Log error messages when you accidentally call methods on nil.
|
11
|
-
config.whiny_nils = true
|
9
|
+
config.eager_load = false
|
12
10
|
|
13
11
|
# Show full error reports and disable caching
|
14
12
|
config.consider_all_requests_local = true
|
@@ -5,3 +5,4 @@
|
|
5
5
|
# Make sure the secret is at least 30 characters and all random,
|
6
6
|
# no regular words or you'll be exposed to dictionary attacks.
|
7
7
|
Dummy::Application.config.secret_token = '5d8d9599457d5f2fa50c978d19da955350fa36c215f514e6b572b9d1d843b844d477d70fe02eacec84742e0f252cf4d93339762e5d57fed7146063faad77a030'
|
8
|
+
Dummy::Application.config.secret_key_base = 'test_secret'
|
data/test/dummy/log/test.log
CHANGED
@@ -1149,3 +1149,123 @@ Connecting to database specified by database.yml
|
|
1149
1149
|
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
1150
1150
|
[1m[36mChild Load (0.1ms)[0m [1mSELECT "children".* FROM "children" WHERE "children"."parent_id" = 1[0m
|
1151
1151
|
[1m[35m (0.2ms)[0m rollback transaction
|
1152
|
+
[1m[36m (0.3ms)[0m [1mbegin transaction[0m
|
1153
|
+
--------------------------------------
|
1154
|
+
DynamicFieldsForHelperTest: test_truth
|
1155
|
+
--------------------------------------
|
1156
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1157
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1158
|
+
-----------------------------------------------------
|
1159
|
+
LinkToAddFieldsTest: test_generates_a_add_fields_link
|
1160
|
+
-----------------------------------------------------
|
1161
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1162
|
+
[1m[36mSQL (5.0ms)[0m [1mINSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 24 Dec 2013 22:38:22 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:38:22 UTC +00:00]]
|
1163
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1164
|
+
Rendered parents/_child_fields.html.erb (0.7ms)
|
1165
|
+
[1m[36m (1.0ms)[0m [1mrollback transaction[0m
|
1166
|
+
[1m[35m (0.1ms)[0m begin transaction
|
1167
|
+
-------------------------------------------------------------------------------
|
1168
|
+
LinkToAddFieldsTest: test_generates_a_add_fields_link_with_block_if_it_is_given
|
1169
|
+
-------------------------------------------------------------------------------
|
1170
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1171
|
+
[1m[35mSQL (1.2ms)[0m INSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Tue, 24 Dec 2013 22:38:22 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:38:22 UTC +00:00]]
|
1172
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1173
|
+
[1m[35m (0.6ms)[0m rollback transaction
|
1174
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
1175
|
+
-----------------------------------------------------------
|
1176
|
+
LinkToDeleteFieldsTest: test_generates_a_delete_fields_link
|
1177
|
+
-----------------------------------------------------------
|
1178
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1179
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 24 Dec 2013 22:38:22 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:38:22 UTC +00:00]]
|
1180
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
1181
|
+
[1m[36mChild Load (0.1ms)[0m [1mSELECT "children".* FROM "children" WHERE "children"."parent_id" = ?[0m [["parent_id", 1]]
|
1182
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
1183
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1184
|
+
--------------------------------------------------------------------------------------
|
1185
|
+
LinkToDeleteFieldsTest: test_generates_a_deletes_fields_link_with_block_if_it_is_given
|
1186
|
+
--------------------------------------------------------------------------------------
|
1187
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1188
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 24 Dec 2013 22:38:22 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:38:22 UTC +00:00]]
|
1189
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1190
|
+
[1m[36mChild Load (0.1ms)[0m [1mSELECT "children".* FROM "children" WHERE "children"."parent_id" = ?[0m [["parent_id", 1]]
|
1191
|
+
[1m[35m (0.7ms)[0m rollback transaction
|
1192
|
+
[1m[36m (0.3ms)[0m [1mbegin transaction[0m
|
1193
|
+
--------------------------------------
|
1194
|
+
DynamicFieldsForHelperTest: test_truth
|
1195
|
+
--------------------------------------
|
1196
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1197
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1198
|
+
-----------------------------------------------------
|
1199
|
+
LinkToAddFieldsTest: test_generates_a_add_fields_link
|
1200
|
+
-----------------------------------------------------
|
1201
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
1202
|
+
[1m[36mSQL (2.2ms)[0m [1mINSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 24 Dec 2013 22:39:46 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:39:46 UTC +00:00]]
|
1203
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1204
|
+
Rendered parents/_child_fields.html.erb (0.4ms)
|
1205
|
+
[1m[36m (0.3ms)[0m [1mrollback transaction[0m
|
1206
|
+
[1m[35m (0.0ms)[0m begin transaction
|
1207
|
+
-------------------------------------------------------------------------------
|
1208
|
+
LinkToAddFieldsTest: test_generates_a_add_fields_link_with_block_if_it_is_given
|
1209
|
+
-------------------------------------------------------------------------------
|
1210
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
1211
|
+
[1m[35mSQL (1.5ms)[0m INSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Tue, 24 Dec 2013 22:39:46 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:39:46 UTC +00:00]]
|
1212
|
+
[1m[36m (0.2ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1213
|
+
[1m[35m (1.1ms)[0m rollback transaction
|
1214
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
1215
|
+
-----------------------------------------------------------
|
1216
|
+
LinkToDeleteFieldsTest: test_generates_a_delete_fields_link
|
1217
|
+
-----------------------------------------------------------
|
1218
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1219
|
+
[1m[36mSQL (0.8ms)[0m [1mINSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 24 Dec 2013 22:39:46 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:39:46 UTC +00:00]]
|
1220
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1221
|
+
[1m[36mChild Load (0.4ms)[0m [1mSELECT "children".* FROM "children" WHERE "children"."parent_id" = ?[0m [["parent_id", 1]]
|
1222
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
1223
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1224
|
+
--------------------------------------------------------------------------------------
|
1225
|
+
LinkToDeleteFieldsTest: test_generates_a_deletes_fields_link_with_block_if_it_is_given
|
1226
|
+
--------------------------------------------------------------------------------------
|
1227
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1228
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 24 Dec 2013 22:39:46 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:39:46 UTC +00:00]]
|
1229
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
1230
|
+
[1m[36mChild Load (0.0ms)[0m [1mSELECT "children".* FROM "children" WHERE "children"."parent_id" = ?[0m [["parent_id", 1]]
|
1231
|
+
[1m[35m (0.3ms)[0m rollback transaction
|
1232
|
+
[1m[36m (0.6ms)[0m [1mbegin transaction[0m
|
1233
|
+
--------------------------------------
|
1234
|
+
DynamicFieldsForHelperTest: test_truth
|
1235
|
+
--------------------------------------
|
1236
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
1237
|
+
[1m[36m (0.3ms)[0m [1mbegin transaction[0m
|
1238
|
+
-----------------------------------------------------
|
1239
|
+
LinkToAddFieldsTest: test_generates_a_add_fields_link
|
1240
|
+
-----------------------------------------------------
|
1241
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1242
|
+
[1m[36mSQL (2.5ms)[0m [1mINSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 24 Dec 2013 22:40:57 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:40:57 UTC +00:00]]
|
1243
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1244
|
+
Rendered parents/_child_fields.html.erb (0.4ms)
|
1245
|
+
[1m[36m (0.8ms)[0m [1mrollback transaction[0m
|
1246
|
+
[1m[35m (0.1ms)[0m begin transaction
|
1247
|
+
-------------------------------------------------------------------------------
|
1248
|
+
LinkToAddFieldsTest: test_generates_a_add_fields_link_with_block_if_it_is_given
|
1249
|
+
-------------------------------------------------------------------------------
|
1250
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1251
|
+
[1m[35mSQL (0.8ms)[0m INSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Tue, 24 Dec 2013 22:40:57 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:40:57 UTC +00:00]]
|
1252
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1253
|
+
[1m[35m (0.3ms)[0m rollback transaction
|
1254
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1255
|
+
-----------------------------------------------------------
|
1256
|
+
LinkToDeleteFieldsTest: test_generates_a_delete_fields_link
|
1257
|
+
-----------------------------------------------------------
|
1258
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
1259
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 24 Dec 2013 22:40:57 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:40:57 UTC +00:00]]
|
1260
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
1261
|
+
[1m[36mChild Load (0.1ms)[0m [1mSELECT "children".* FROM "children" WHERE "children"."parent_id" = ?[0m [["parent_id", 1]]
|
1262
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
1263
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1264
|
+
--------------------------------------------------------------------------------------
|
1265
|
+
LinkToDeleteFieldsTest: test_generates_a_deletes_fields_link_with_block_if_it_is_given
|
1266
|
+
--------------------------------------------------------------------------------------
|
1267
|
+
[1m[35m (0.3ms)[0m SAVEPOINT active_record_1
|
1268
|
+
[1m[36mSQL (0.9ms)[0m [1mINSERT INTO "parents" ("created_at", "updated_at") VALUES (?, ?)[0m [["created_at", Tue, 24 Dec 2013 22:40:57 UTC +00:00], ["updated_at", Tue, 24 Dec 2013 22:40:57 UTC +00:00]]
|
1269
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1270
|
+
[1m[36mChild Load (0.0ms)[0m [1mSELECT "children".* FROM "children" WHERE "children"."parent_id" = ?[0m [["parent_id", 1]]
|
1271
|
+
[1m[35m (0.3ms)[0m rollback transaction
|
@@ -16,12 +16,12 @@ class LinkToAddFieldsTest < ActionView::TestCase
|
|
16
16
|
|
17
17
|
test "generates a add fields link" do
|
18
18
|
form_for(@parent, url: '/') do |form|
|
19
|
-
link_to_add_fields(form, 'children', "Test")
|
19
|
+
link_to_add_fields(form, 'children', name: "Test")
|
20
20
|
end
|
21
21
|
|
22
22
|
assert_match /<a(.*)class=\"add_fields(.*)\"(.*)>Test<\/a>/, @output_buffer
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
test "generates a add fields link with block if it is given" do
|
26
26
|
form_for(@parent, url: '/') do |form|
|
27
27
|
link_to_add_fields form, 'children' do
|
@@ -31,4 +31,4 @@ class LinkToAddFieldsTest < ActionView::TestCase
|
|
31
31
|
|
32
32
|
assert_match /<a(.*)class=\"add_fields(.*)\"(.*)><div>Test<\/div><\/a>/, @output_buffer
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|