+ id = "#{object.uuid}-#{subattr.join('-')}"
+ dn = "[#{attr}]"
+ subattr.each do |a|
+ dn += "[#{a}]"
+ end
+ if value_info.is_a? Hash
+ dn += '[value]'
+ end
+
+ if dataclass == Collection
+ selection_param = object.class.to_s.underscore + dn
+ display_value = attrvalue
+ if value_info.is_a?(Hash)
+ if (link = Link.find? value_info[:link_uuid])
+ display_value = link.name
+ elsif value_info[:link_name]
+ display_value = value_info[:link_name]
+ end
+ end
+ modal_path = choose_collections_path \
+ ({ title: 'Choose a dataset:',
+ filters: [['tail_uuid', '=', object.owner_uuid]].to_json,
+ action_name: 'OK',
+ action_href: pipeline_instance_path(id: object.uuid),
+ action_method: 'patch',
+ action_data: {
+ merge: true,
+ selection_param: selection_param,
+ success: 'page-refresh'
+ }.to_json,
+ })
+ return content_tag('div', :class => 'input-group') do
+ html = text_field_tag(dn, display_value,
+ :class =>
+ "form-control #{'required' if required}")
+ html + content_tag('span', :class => 'input-group-btn') do
+ link_to('Choose',
+ modal_path,
+ { :class => "btn btn-primary",
+ :remote => true,
+ :method => 'get',
+ })
+ end
+ end
+ end
+