Skip to content

Commit 45835cc

Browse files
toastercupMKwenhua
authored andcommitted
link_to_asset in asset_info_cell should open Asset URLs in a new tab
Added ContentItemFieldType input added content item field type input added content item field type input
1 parent 503c6cd commit 45835cc

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
- if asset
2-
= image_tag(asset['style_urls'][config[:thumbnail_style]], height: '50px')
2+
= image_tag(asset_thumb(asset), height: '50px')

app/cells/plugins/core/asset_info_cell.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def updated_at
4141
end
4242

4343
def link_to_asset
44-
link_to(asset['url'], asset['url'])
44+
link_to asset['url'], asset['url'], target: '_blank'
4545
end
4646
end
4747
end

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
= render_field_id
2+
= render_popup
13
= render_label
24
%br
35
%button.content_item_button.text-center.popup--open

app/cells/plugins/core/content_item_cell.rb

Lines changed: 8 additions & 0 deletions
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_popup
19+
@options[:form].text_field 'data[content_item_id]', value: value, style: 'display:none;'
20+
end
1321
end
1422
end
1523
end

app/models/content_item_field_type.rb

Lines changed: 12 additions & 0 deletions
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']
11+
json
12+
end
13+
214
def mapping
315
{ name: mapping_field_name, type: :string, analyzer: :snowball }
416
end

0 commit comments

Comments
 (0)