Skip to content

Commit 0f2d202

Browse files
author
Alex Tharp
authored
Merge pull request #31 from cortex-cms/blog-content-item-edit-patch
Blog Content Item Edit Bug Fix
2 parents 16f6cbb + 01862e4 commit 0f2d202

8 files changed

+28
-5
lines changed

app/cells/plugins/core/content_item/popup.haml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
= render_field_id
2+
= render_content_item_id
3+
14
= render_label
25
%br
36
%button.content_item_button.text-center.popup--open

app/cells/plugins/core/content_item_cell.rb

+8
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@ def popup
77

88
private
99

10+
def value
11+
data&.[]('content_item_id')
12+
end
13+
1014
def render_label
1115
"Add #{field.name}"
1216
end
17+
18+
def render_content_item_id
19+
@options[:form].hidden_field 'data[content_item_id]', value: value
20+
end
1321
end
1422
end
1523
end

app/models/boolean_field_type.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def data=(data_hash)
77

88
def field_item_as_indexed_json_for_field_type(field_item, options = {})
99
json = {}
10-
json[mapping_field_name] = field_item.data['boolean']
10+
json[mapping_field_name] = field_item.data['value']
1111
json
1212
end
1313

app/models/content_item_field_type.rb

+12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
class ContentItemFieldType < FieldType
2+
attr_accessor :content_item_id
3+
4+
def data=(data_hash)
5+
@content_item_id = data_hash.deep_symbolize_keys[:content_item_id]
6+
end
7+
8+
def field_item_as_indexed_json_for_field_type(field_item, options = {})
9+
json = {}
10+
json[mapping_field_name] = field_item.data['content_item_id']
11+
json
12+
end
13+
214
def mapping
315
{ name: mapping_field_name, type: :string, analyzer: :snowball }
416
end

app/models/date_time_field_type.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def data=(data_hash)
1010

1111
def field_item_as_indexed_json_for_field_type(field_item, options = {})
1212
json = {}
13-
json[mapping_field_name] = field_item.data['date_time']
13+
json[mapping_field_name] = field_item.data['timestamp']
1414
json
1515
end
1616

app/models/tag_field_type.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def data=(data_hash)
1010

1111
def field_item_as_indexed_json_for_field_type(field_item, options = {})
1212
json = {}
13-
json[mapping_field_name] = field_item.data['tag']
13+
json[mapping_field_name] = field_item.data['tag_list']
1414
json
1515
end
1616

app/models/tree_field_type.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def data=(data_hash)
2121

2222
def field_item_as_indexed_json_for_field_type(field_item, options = {})
2323
json = {}
24-
json[mapping_field_name] = field_item.data['tree']
24+
json[mapping_field_name] = field_item.data['values']
2525
json
2626
end
2727

app/models/user_field_type.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def data=(data_hash)
1010

1111
def field_item_as_indexed_json_for_field_type(field_item, options = {})
1212
json = {}
13-
json[mapping_field_name] = field_item.data['user']
13+
json[mapping_field_name] = field_item.data['user_id']
1414
json
1515
end
1616

0 commit comments

Comments
 (0)