editmode 1.1.7 → 1.1.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a278337d6551c478182ab117612d042fdd8e2ff02f4cebbcb7acad50f453d90
4
- data.tar.gz: 94f704ae1f80a190424b24019dffe3ae2aedb20cb092f89e56b2382f64540ced
3
+ metadata.gz: 611f68ffcb87c0e259a2c087f322ac8477933621d8253c35e7c59c1a9515d8a4
4
+ data.tar.gz: 4427afba193aab085412cc8fb07ad01c4c7628721daef9f7b8183c325cb36e0a
5
5
  SHA512:
6
- metadata.gz: 8238f3fa1c5e60c0277dee06e02691e833a858a525d6d4d00ddef62cba336699015309f4b75e31b4a1a98239ad12badae6f314cc2f6a5810c7376a59282eb5ca
7
- data.tar.gz: 538ed505b343dce47388922818fc297b67b111297538be1035248b0007f3691afa1324e233b438bbdc6c811d2065c0652b846376bb3d12616836dc2bf10ed6f6
6
+ metadata.gz: ee37e1c259186a2592ca9bd6c643999a639d9e01866eeac03f904d1b102145c79949116a680a64bebb1509399164fe837d183a4474801ec555e8ba197d438718
7
+ data.tar.gz: b4f7fab610eafa729f0dea3c70d221aba14d593e79998b1253a07d19f09854f1ef11870a05b17b1db7c0af57091fbafb0fd11cabafa364fd117b1468d4418412
@@ -19,6 +19,9 @@ module Editmode
19
19
  branch_id = params[:em_branch_id].presence
20
20
  tags = options[:tags].presence || []
21
21
  limit = options[:limit].presence
22
+
23
+ parent_class = options[:class] || ""
24
+ item_class = options[:item_class] || ""
22
25
 
23
26
  begin
24
27
  url_params = {
@@ -49,12 +52,22 @@ module Editmode
49
52
  end
50
53
 
51
54
  if chunks.any?
52
- content_tag :div, class: "chunks-collection-wrapper", data: {chunk_collection_identifier: collection_identifier} do
55
+ content_tag :div, class: "chunks-collection-wrapper #{parent_class}", data: {chunk_collection_identifier: collection_identifier} do
53
56
  chunks.each do |chunk|
54
57
  @custom_field_chunk = chunk
55
- yield
58
+ concat(content_tag(:div, class: "chunks-collection-item--wrapper #{item_class}") do
59
+ yield
60
+ end)
56
61
  end
57
- end
62
+
63
+ # Placeholder element for new collection item
64
+ @custom_field_chunk = chunks.first.merge!({placeholder: true})
65
+ concat(content_tag(:div, class: "chunks-hide chunks-col-placeholder-wrapper") do
66
+ yield
67
+ end)
68
+ end
69
+ else
70
+ content_tag(:span, "&nbsp".html_safe)
58
71
  end
59
72
  end
60
73
  rescue => error
@@ -73,12 +86,17 @@ module Editmode
73
86
 
74
87
  options[:field] = custom_field_identifier
75
88
 
89
+ if parent_chunk_object[:placeholder]
90
+ custom_field_item["identifier"] = ""
91
+ custom_field_item["content"] = ""
92
+ end
93
+
76
94
  if custom_field_item.present?
77
95
  render_chunk_content(
78
96
  custom_field_item["identifier"],
79
97
  custom_field_item["content"],
80
98
  custom_field_item["chunk_type"],
81
- { parent_identifier: chunk_identifier }.merge(options)
99
+ { parent_identifier: chunk_identifier, custom_field_identifier: custom_field_identifier}.merge(options)
82
100
  )
83
101
  end
84
102
  rescue => errors
@@ -104,11 +122,9 @@ module Editmode
104
122
 
105
123
  chunk_data = { :chunk => chunk_identifier, :chunk_editable => false, :chunk_type => chunk_type }
106
124
 
107
- if options[:parent_identifier].present?
108
- chunk_data.merge!({parent_identifier: options[:parent_identifier]})
109
- end
110
-
111
-
125
+ chunk_data.merge!({parent_identifier: options[:parent_identifier]}) if options[:parent_identifier].present?
126
+ chunk_data.merge!({custom_field_identifier: options[:custom_field_identifier]}) if options[:custom_field_identifier].present?
127
+
112
128
  case display_type
113
129
  when "span"
114
130
  if chunk_type == "rich_text"
@@ -121,6 +137,7 @@ module Editmode
121
137
  end
122
138
  end
123
139
  when "image"
140
+ chunk_content = chunk_content.blank? || chunk_content == "/images/original/missing.png" ? 'https://www.editmode.com/upload.png' : chunk_content
124
141
  image_tag(chunk_content, :data => chunk_data, :class => css_class)
125
142
  end
126
143
  rescue => errors
@@ -1,3 +1,3 @@
1
1
  module Editmode
2
- VERSION = "1.1.7"
2
+ VERSION = "1.1.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: editmode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Ennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-03 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler