push_type_core 0.5.0.alpha.5 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/fields/push_type/asset_field.rb +5 -1
  3. data/app/fields/push_type/markdown_field.rb +2 -5
  4. data/app/fields/push_type/matrix_field.rb +1 -1
  5. data/app/fields/push_type/node_field.rb +9 -2
  6. data/app/fields/push_type/repeater_field.rb +1 -1
  7. data/app/fields/push_type/taxonomy_field.rb +4 -2
  8. data/lib/push_type/fields/relations.rb +3 -3
  9. data/lib/push_type/version.rb +1 -1
  10. data/test/dummy/config/initializers/push_type.rb +1 -1
  11. data/test/dummy/config/secrets.yml +2 -2
  12. data/test/dummy/db/schema.rb +1 -1
  13. data/test/dummy/log/test.log +7124 -2620
  14. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{YfvOcAtfd0a4AoZRwhfEPbutzGvytNV3PLH99tHHVec.cache → M0EVptJKeB1GMjwoMb3w3mgp8VB55MSbItnFhItY4hA.cache} +1 -1
  15. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{-Sjd8yE8radAZWLZz1Hn9eTc5vPZke6_-U1eg-KNjy8.cache → g97nJc5YmnbscVR5pZZoxgfj652ml7dLjUIu0FHDwLA.cache} +0 -0
  16. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/utXmZy0kE8zUnHIqwtbjUUJlYlFcGDJreK2YPDuR3n8.cache +1 -0
  17. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{RwmiAHIoiRN917L4TQ8saQaj1DsQgMpS97RYvkK2D5M.cache → vlJujjzOikOTUvCvT3C4o3vK0ySfxbQQ3RBE37vXH0U.cache} +0 -0
  18. data/test/dummy/tmp/generators/config/initializers/push_type.rb +38 -0
  19. data/test/dummy/tmp/generators/config/routes.rb +59 -0
  20. data/test/fields/push_type/asset_field_test.rb +37 -0
  21. data/test/fields/push_type/date_field_test.rb +14 -0
  22. data/test/fields/push_type/markdown_field_test.rb +35 -0
  23. data/test/fields/push_type/matrix_field_test.rb +35 -0
  24. data/test/fields/push_type/node_field_test.rb +71 -0
  25. data/test/fields/push_type/number_field_test.rb +13 -0
  26. data/test/fields/push_type/repeater_field_test.rb +21 -0
  27. data/test/fields/push_type/select_field_test.rb +40 -0
  28. data/test/fields/push_type/tag_list_field_test.rb +33 -0
  29. data/test/fields/push_type/taxonomy_field_test.rb +57 -0
  30. data/test/fields/push_type/text_field_test.rb +12 -0
  31. data/test/fields/push_type/time_field_test.rb +15 -0
  32. data/test/lib/push_type/field_type_test.rb +1 -57
  33. data/test/test_helper.rb +11 -1
  34. metadata +66 -42
  35. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/H3MYWnNh74SPmIVutQpgqiLFgQBaPIZ8rUXz8S1IXfQ.cache +0 -1
  36. data/test/dummy/tmp/generators/app/models/category.rb +0 -6
  37. data/test/dummy/tmp/generators/app/views/taxonomies/category.html.erb +0 -3
  38. /data/test/dummy/db/migrate/{20150601132816_create_push_type_users.push_type.rb → 20150716155017_create_push_type_users.push_type.rb} +0 -0
  39. /data/test/dummy/db/migrate/{20150601132817_create_push_type_nodes.push_type.rb → 20150716155018_create_push_type_nodes.push_type.rb} +0 -0
  40. /data/test/dummy/db/migrate/{20150601132818_create_push_type_node_hierarchies.push_type.rb → 20150716155019_create_push_type_node_hierarchies.push_type.rb} +0 -0
  41. /data/test/dummy/db/migrate/{20150601132819_create_push_type_assets.push_type.rb → 20150716155020_create_push_type_assets.push_type.rb} +0 -0
  42. /data/test/dummy/db/migrate/{20150601132820_create_push_type_taxonomies.push_type.rb → 20150716155021_create_push_type_taxonomies.push_type.rb} +0 -0
  43. /data/test/dummy/db/migrate/{20150601132821_create_push_type_taxonomy_hierarchies.push_type.rb → 20150716155022_create_push_type_taxonomy_hierarchies.push_type.rb} +0 -0
  44. /data/test/dummy/db/migrate/{20150601132822_add_field_store_default_values.push_type.rb → 20150716155023_add_field_store_default_values.push_type.rb} +0 -0
  45. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{H_FtcM4uZms6K7jOADXRW2-Q5luNbbboPJ8haQyA17A.cache → 0tutfZEltPbqMrjMJpcgLOWDEBEA1_i4wAlgfGmDMaM.cache} +0 -0
  46. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{0_aw7up97T_NTvobuzf-o1Xpynz3Eqo7lyRTdE_M3kg.cache → 5hBD45unr3-A8x6pxXjxq708mnY9gJisy1yA5AojZWQ.cache} +0 -0
  47. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{khjpnuHaHw24GnTbWlsRS6uIuTqIkrfvc2dY1aZWtpk.cache → DIGO2XX0gV_Ebgs43ap-65y0MyrcySF3iz56xum2NCQ.cache} +0 -0
  48. /data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/{I6zXuKkTIFbRK1A1tWK7nMeIhOXwx4iMRyZCdQatqy8.cache → MSjNaQjz3SH1LnDyk7nWta_i3hcCEV9m1eoNFbOXjwI.cache} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb3e621dc6b8ce662cccabe0ba874589b55f29e1
4
- data.tar.gz: 6ab6388e7e490ba3a2541b357e2568114386fbf3
3
+ metadata.gz: 6aa55009b4f8a6c03b6fb102406df0571d67b025
4
+ data.tar.gz: 84db15a256012cfade4359e65df44e3ad25c6e0b
5
5
  SHA512:
6
- metadata.gz: 620dc4421f678cf7bfa6f920e226388a3720c11e3fd22cb6377b5d699218afeb40cb58d2d6df9befda44d8388cde9ad3390504591d8c30407904a3167f31c628
7
- data.tar.gz: 936eac7a240842849a9fa5de47477357ad54e8f415c956a1fba08066ca8153f1e59fdea341d12ebe12bf38ef93dd691253a900fd2c6387fbe0a5dd9dfe8c4f4c
6
+ metadata.gz: 23d987c95bedbc81a6391c0204cb1d6b499b8dc98ad70d291f0a8f348423264b0cf76a030a6e233d0b11644363726ac1a5f307203354ab3fa895bff600408225
7
+ data.tar.gz: 1bd32879b186951bbf24ac36320fdbd101b75547040a7e9f30e0fdba476cc12e83dc2941f6741d000a6e7ae0d71e0db8e6ff69197b5bc1757e620c897cd4f5d7
@@ -9,10 +9,14 @@ module PushType
9
9
  "#{ name }-asset-modal"
10
10
  end
11
11
 
12
+ def relation_class
13
+ PushType::Asset
14
+ end
15
+
12
16
  initialized_on_node do |object, field|
13
17
  object.class_eval do
14
18
  define_method field.name.to_sym do
15
- PushType::Asset.find send(field.json_key) if send(field.json_key).present?
19
+ field.relation_class.not_trash.find send(field.json_key) if send(field.json_key).present?
16
20
  end
17
21
  end
18
22
  end
@@ -13,10 +13,6 @@ module PushType
13
13
  underline: true
14
14
  }
15
15
 
16
- def form_helper
17
- @opts[:form_helper] || :text_area
18
- end
19
-
20
16
  def markdown
21
17
  @markdown ||= Redcarpet::Markdown.new(renderer, @opts[:extensions])
22
18
  end
@@ -29,7 +25,8 @@ module PushType
29
25
  object.presenter_class.class_eval do
30
26
 
31
27
  define_method field.name.to_sym do
32
- fields[field.json_key].markdown.render super()
28
+ raw = super()
29
+ fields[field.json_key].markdown.render raw unless raw.nil?
33
30
  end
34
31
 
35
32
  end
@@ -3,7 +3,7 @@ module PushType
3
3
 
4
4
  include PushType::Fields::Arrays
5
5
 
6
- options template: :matrix, mapping: [:key, :value]
6
+ options template: 'matrix', mapping: [:key, :value]
7
7
 
8
8
  def param
9
9
  { json_key => mapping.keys }
@@ -5,15 +5,22 @@ module PushType
5
5
 
6
6
  options template: 'relation', field_options: {}, root: '/'
7
7
 
8
+ def relation_class
9
+ super
10
+ rescue NameError
11
+ PushType::Node
12
+ end
13
+
8
14
  def relation_root
9
- root = @opts[:root] == '/' ? PushType::Node : PushType::Node.find_by_path(@opts[:root].split('/'))
15
+ root = relation_class.not_trash
16
+ root = root.find_by_path(@opts[:root].split('/')) unless @opts[:root] == '/'
10
17
  root or raise "Cannot find root node at path '#{ @opts[:root] }'"
11
18
  end
12
19
 
13
20
  initialized_on_node do |object, field|
14
21
  object.class_eval do
15
22
  define_method field.name.to_sym do
16
- field.relation_class.find send(field.json_key) if send(field.json_key).present?
23
+ field.relation_class.not_trash.find send(field.json_key) if send(field.json_key).present?
17
24
  end
18
25
  end
19
26
  end
@@ -3,7 +3,7 @@ module PushType
3
3
 
4
4
  include PushType::Fields::Arrays
5
5
 
6
- options template: :repeater
6
+ options template: 'repeater'
7
7
 
8
8
  def to_json(val)
9
9
  super.reject(&:blank?) if val.present?
@@ -5,8 +5,10 @@ module PushType
5
5
 
6
6
  options template: 'relation', field_options: {}
7
7
 
8
- def relation_option
9
- @opts[:taxonomy_class]
8
+ def relation_class
9
+ super
10
+ rescue NameError
11
+ PushType::Taxonomy
10
12
  end
11
13
 
12
14
  initialized_on_node do |object, field|
@@ -7,12 +7,12 @@ module PushType
7
7
  (name.singularize + suffix).to_sym
8
8
  end
9
9
 
10
- def relation_option
11
- @opts[:relation_class]
10
+ def relation_class
11
+ (@opts[:class] || name).to_s.classify.constantize
12
12
  end
13
13
 
14
14
  def relation_root
15
- (relation_option || name.singularize).to_s.classify.constantize
15
+ relation_class
16
16
  end
17
17
 
18
18
  def relation_tree
@@ -1,3 +1,3 @@
1
1
  module PushType
2
- VERSION = '0.5.0.alpha.5'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -33,6 +33,6 @@ PushType.setup do |config|
33
33
  # secret_access_key: ENV['SECRET_ACCESS_KEY_ID']
34
34
  # }
35
35
 
36
- # config.dragonfly_secret = '83a5792fddd87faa448f1d6c1c82929f94672e15ac409d8ca86f2831d0afe0c9'
36
+ # config.dragonfly_secret = 'ecd8c099d97873bfcba21a3f63d298e86a7b4342be8493eb56b291d0ca46b187'
37
37
 
38
38
  end
@@ -11,10 +11,10 @@
11
11
  # if you're sharing your code publicly.
12
12
 
13
13
  development:
14
- secret_key_base: 3e76757bba6f2b80ef66fdc027eaeced7d1fd31949061a510701a7180f1abbc94671d0d7fec047c6d98c3af15afa5e43831601a3ee567ccde83e716f3e0294e2
14
+ secret_key_base: b88deb276072e733b6a6b83a5d5362b6e21a3b0d083b025c5317c5f5a52c037bf58548da93d789c587f33d73484df50681fd5389ba378a9c3a2431cc1a01ad7f
15
15
 
16
16
  test:
17
- secret_key_base: 13ff88a99d182c14e823d02cac1b0ca49fa0008e05d73dcdd3186480d81adefd1421ed548456d76e0f0511eaba9ce0d161976737c3405223eec818ba43697864
17
+ secret_key_base: 2bdc9c611035f1a8d28c68f1fccfc3a9917277fb2785620953a8d30c8665e88a0f5fd52195a4e815f63687233bc57fa358aad0a71d8531d64f252b44841d25c8
18
18
 
19
19
  # Do not keep production secrets in the repository,
20
20
  # instead read values from the environment.
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20150601132822) do
14
+ ActiveRecord::Schema.define(version: 20150716155023) do
15
15
 
16
16
  # These are extensions that must be enabled in order to support this database
17
17
  enable_extension "plpgsql"