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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8381f72a7b4a040ec6fa54efae00061444298d91
4
- data.tar.gz: 44b718e8c67121a9c58a6516710f4aecde01e3f1
3
+ metadata.gz: 2e6bdd6eea27d942e0d7f82d2e7f59f76177ec36
4
+ data.tar.gz: 9a07cdba39a6e96728d7bc73019ac5486060a88c
5
5
  SHA512:
6
- metadata.gz: 87872c789074360034d4dee33965471b0be10c8d371b7da40f1c6873259a9c56f4893d2cff6575f24ded05a3c9b5ee8d130a94fa8ae9cc1f73c77c962309dcbe
7
- data.tar.gz: a78a73e194b4e71402d914d0298f660a1883dde5067a7f9e9ce9e48b64f86874cf0abf8f7d6bf388ec0e8c3fd77474b4f4405aa740189a1f4a6428028d90e303
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, name=nil, css_classes=nil, &block)
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)
@@ -1,3 +1,3 @@
1
1
  module DynamicFieldsForRails
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -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
- # Log error messages when you accidentally call methods on nil.
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'
@@ -1149,3 +1149,123 @@ Connecting to database specified by database.yml
1149
1149
   (0.0ms) RELEASE SAVEPOINT active_record_1
1150
1150
  Child Load (0.1ms) SELECT "children".* FROM "children" WHERE "children"."parent_id" = 1
1151
1151
   (0.2ms) rollback transaction
1152
+  (0.3ms) begin transaction
1153
+ --------------------------------------
1154
+ DynamicFieldsForHelperTest: test_truth
1155
+ --------------------------------------
1156
+  (0.0ms) rollback transaction
1157
+  (0.1ms) begin transaction
1158
+ -----------------------------------------------------
1159
+ LinkToAddFieldsTest: test_generates_a_add_fields_link
1160
+ -----------------------------------------------------
1161
+  (0.1ms) SAVEPOINT active_record_1
1162
+ SQL (5.0ms) 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]]
1163
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1164
+ Rendered parents/_child_fields.html.erb (0.7ms)
1165
+  (1.0ms) rollback transaction
1166
+  (0.1ms) begin transaction
1167
+ -------------------------------------------------------------------------------
1168
+ LinkToAddFieldsTest: test_generates_a_add_fields_link_with_block_if_it_is_given
1169
+ -------------------------------------------------------------------------------
1170
+  (0.1ms) SAVEPOINT active_record_1
1171
+ SQL (1.2ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1173
+  (0.6ms) rollback transaction
1174
+  (0.2ms) begin transaction
1175
+ -----------------------------------------------------------
1176
+ LinkToDeleteFieldsTest: test_generates_a_delete_fields_link
1177
+ -----------------------------------------------------------
1178
+  (0.1ms) SAVEPOINT active_record_1
1179
+ SQL (0.5ms) 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]]
1180
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1181
+ Child Load (0.1ms) SELECT "children".* FROM "children" WHERE "children"."parent_id" = ? [["parent_id", 1]]
1182
+  (0.4ms) rollback transaction
1183
+  (0.1ms) begin transaction
1184
+ --------------------------------------------------------------------------------------
1185
+ LinkToDeleteFieldsTest: test_generates_a_deletes_fields_link_with_block_if_it_is_given
1186
+ --------------------------------------------------------------------------------------
1187
+  (0.1ms) SAVEPOINT active_record_1
1188
+ SQL (0.5ms) 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]]
1189
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1190
+ Child Load (0.1ms) SELECT "children".* FROM "children" WHERE "children"."parent_id" = ? [["parent_id", 1]]
1191
+  (0.7ms) rollback transaction
1192
+  (0.3ms) begin transaction
1193
+ --------------------------------------
1194
+ DynamicFieldsForHelperTest: test_truth
1195
+ --------------------------------------
1196
+  (0.0ms) rollback transaction
1197
+  (0.0ms) begin transaction
1198
+ -----------------------------------------------------
1199
+ LinkToAddFieldsTest: test_generates_a_add_fields_link
1200
+ -----------------------------------------------------
1201
+  (0.0ms) SAVEPOINT active_record_1
1202
+ SQL (2.2ms) 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]]
1203
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1204
+ Rendered parents/_child_fields.html.erb (0.4ms)
1205
+  (0.3ms) rollback transaction
1206
+  (0.0ms) begin transaction
1207
+ -------------------------------------------------------------------------------
1208
+ LinkToAddFieldsTest: test_generates_a_add_fields_link_with_block_if_it_is_given
1209
+ -------------------------------------------------------------------------------
1210
+  (0.0ms) SAVEPOINT active_record_1
1211
+ SQL (1.5ms) 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
+  (0.2ms) RELEASE SAVEPOINT active_record_1
1213
+  (1.1ms) rollback transaction
1214
+  (0.2ms) begin transaction
1215
+ -----------------------------------------------------------
1216
+ LinkToDeleteFieldsTest: test_generates_a_delete_fields_link
1217
+ -----------------------------------------------------------
1218
+  (0.1ms) SAVEPOINT active_record_1
1219
+ SQL (0.8ms) 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]]
1220
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1221
+ Child Load (0.4ms) SELECT "children".* FROM "children" WHERE "children"."parent_id" = ? [["parent_id", 1]]
1222
+  (0.4ms) rollback transaction
1223
+  (0.1ms) begin transaction
1224
+ --------------------------------------------------------------------------------------
1225
+ LinkToDeleteFieldsTest: test_generates_a_deletes_fields_link_with_block_if_it_is_given
1226
+ --------------------------------------------------------------------------------------
1227
+  (0.1ms) SAVEPOINT active_record_1
1228
+ SQL (0.4ms) 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]]
1229
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1230
+ Child Load (0.0ms) SELECT "children".* FROM "children" WHERE "children"."parent_id" = ? [["parent_id", 1]]
1231
+  (0.3ms) rollback transaction
1232
+  (0.6ms) begin transaction
1233
+ --------------------------------------
1234
+ DynamicFieldsForHelperTest: test_truth
1235
+ --------------------------------------
1236
+  (0.1ms) rollback transaction
1237
+  (0.3ms) begin transaction
1238
+ -----------------------------------------------------
1239
+ LinkToAddFieldsTest: test_generates_a_add_fields_link
1240
+ -----------------------------------------------------
1241
+  (0.1ms) SAVEPOINT active_record_1
1242
+ SQL (2.5ms) 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]]
1243
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1244
+ Rendered parents/_child_fields.html.erb (0.4ms)
1245
+  (0.8ms) rollback transaction
1246
+  (0.1ms) begin transaction
1247
+ -------------------------------------------------------------------------------
1248
+ LinkToAddFieldsTest: test_generates_a_add_fields_link_with_block_if_it_is_given
1249
+ -------------------------------------------------------------------------------
1250
+  (0.1ms) SAVEPOINT active_record_1
1251
+ SQL (0.8ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1253
+  (0.3ms) rollback transaction
1254
+  (0.0ms) begin transaction
1255
+ -----------------------------------------------------------
1256
+ LinkToDeleteFieldsTest: test_generates_a_delete_fields_link
1257
+ -----------------------------------------------------------
1258
+  (0.0ms) SAVEPOINT active_record_1
1259
+ SQL (0.3ms) 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]]
1260
+  (0.0ms) RELEASE SAVEPOINT active_record_1
1261
+ Child Load (0.1ms) SELECT "children".* FROM "children" WHERE "children"."parent_id" = ? [["parent_id", 1]]
1262
+  (0.4ms) rollback transaction
1263
+  (0.1ms) begin transaction
1264
+ --------------------------------------------------------------------------------------
1265
+ LinkToDeleteFieldsTest: test_generates_a_deletes_fields_link_with_block_if_it_is_given
1266
+ --------------------------------------------------------------------------------------
1267
+  (0.3ms) SAVEPOINT active_record_1
1268
+ SQL (0.9ms) 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]]
1269
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1270
+ Child Load (0.0ms) SELECT "children".* FROM "children" WHERE "children"."parent_id" = ? [["parent_id", 1]]
1271
+  (0.3ms) 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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_fields_for_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Klitzke