checkboxes[i].checked = false;
}
}
-
+
$('.remove-selection').on('click', remove_selection_click);
$('#clear_selections_button').on('click', clear_selections);
};
on('change', '.persistent-selection:checkbox', function(e) {
//console.log($(this));
//console.log($(this).val());
-
+
var inc = 0;
if ($(this).is(":checked")) {
add_selection($(this).val(), $(this).attr('friendly_name'), $(this).attr('href'), $(this).attr('friendly_type'));
for (var i = 0; i < lst.length; i++) {
if (lst[i].type == type) {
- ret.push({text: lst[i].name, value: lst[i].uuid})
+ var n = lst[i].name;
+ n = n.replace(/<span[^>]*>/i, "[");
+ n = n.replace(/<\/span>/i, "]");
+ ret.push({text: n, value: lst[i].uuid})
}
}
}
return ret;
};
})();
-
def show_pane_list
%w(Files Attributes Metadata Provenance_graph Used_by JSON API)
end
+
def index
if params[:search].andand.length.andand > 0
tags = Link.where(any: ['contains', params[:search]])
end
end
end
-
+
return h(n)
#raw = n.to_s
#cooked = ''
if opts[:with_class_name]
link_name = "#{resource_class.to_s}: #{link_name}"
end
+ if !opts[:no_tags] and resource_class == Collection
+ Link.where(head_uuid: link_uuid, link_class: ["tag", "identifier"]).each do |tag|
+ link_name += ' <span class="label label-info">' + html_escape(tag.name) + '</span>'
+ end
+ end
end
style_opts[:class] = (style_opts[:class] || '') + ' nowrap'
- link_to link_name, { controller: resource_class.to_s.tableize, action: 'show', id: link_uuid }, style_opts
+ if opts[:no_link]
+ raw(link_name)
+ else
+ link_to raw(link_name), { controller: resource_class.to_s.tableize, action: 'show', id: link_uuid }, style_opts
+ end
else
attrvalue
end
attrvalue = attrvalue.strip
end
+ attrtext = attrvalue
if dataclass and dataclass.is_a? Class
items = []
if attrvalue and !attrvalue.empty?
- items.append({name: attrvalue, uuid: attrvalue, type: dataclass.to_s})
+ Link.where(head_uuid: attrvalue, link_class: ["tag", "identifier"]).each do |tag|
+ attrtext += " [#{tag.name}]"
+ end
+ items.append({name: attrtext, uuid: attrvalue, type: dataclass.to_s})
end
#dataclass.where(uuid: attrvalue).each do |item|
# items.append({name: item.uuid, uuid: item.uuid, type: dataclass.to_s})
#end
+ itemuuids = []
dataclass.limit(10).each do |item|
+ itemuuids << item.uuid
items.append({name: item.uuid, uuid: item.uuid, type: dataclass.to_s})
end
+ Link.where(head_uuid: itemuuids, link_class: ["tag", "identifier"]).each do |tag|
+ items.each do |item|
+ if item.uuid == tag.head_uuid
+ item.name += ' [' + tag.name + ']'
+ end
+ end
+ end
end
- lt = link_to attrvalue, '#', {
+ lt = link_to attrtext, '#', {
"data-emptytext" => "none",
"data-placement" => "bottom",
"data-type" => datatype,
}.merge(htmloptions)
lt += raw("\n<script>")
-
+
if items and items.length > 0
lt += raw("add_form_selection_sources(#{items.to_json});\n")
end
lt += raw("</script>")
- lt
+ lt
end
end
<%if object %>
+ <% fn = if defined? friendly_name
+ friendly_name
+ else
+ link_to_if_arvados_object object, {no_link: true}
+ end
+ %>
+ <% # This 'fn' string may contain embedded HTML which is already marked html_safe.
+ # Since we are putting it into a tag attribute, we need to copy into an
+ # unsafe string so that rails will escape it for us.
+ fn = String.new fn %>
<%= check_box_tag 'uuids[]', object.uuid, false, {
- :class => 'persistent-selection',
- :friendly_type => object.class.name,
- :friendly_name => object.selection_label,
- :href => "#{url_for controller: object.class.name.tableize, action: 'show', id: object.uuid }"
+ :class => 'persistent-selection',
+ :friendly_type => object.class.name,
+ :friendly_name => fn,
+ :href => "#{url_for controller: object.class.name.tableize, action: 'show', id: object.uuid }",
+ :title => "Click to add this item to your selection list"
} %>
<% end %>
<tr class="collection" data-object-uuid="<%= c.uuid %>">
<td>
- <%= render :partial => "selection_checkbox", :locals => {:object => c} %>
+ <% friendly_name = c.friendly_link_name %>
+ <% @collection_info[c.uuid][:tag_links].each do |tag_link| %>
+ <% friendly_name += raw(" <span class='label label-info'>#{tag_link.name}</span>") %>
+ <% end %>
+ <%= render :partial => "selection_checkbox", :locals => {:object => c, :friendly_name => friendly_name} %>
</td>
<td>
- <%= link_to_if_arvados_object c.uuid %>
+ <%= link_to_if_arvados_object c.uuid, {:no_tags => true } %>
</td>
<td>
<% i = 0 %>
<tr>
<td>
<%= check_box_tag 'uuids[]', @object.uuid+'/'+file_path, false, {
- :class => 'persistent-selection',
+ :class => 'persistent-selection',
:friendly_type => "File",
:friendly_name => "#{@object.uuid}/#{file_path}",
- :href => "#{url_for controller: 'collections', action: 'show', id: @object.uuid }/#{file_path}"
+ :href => "#{url_for controller: 'collections', action: 'show', id: @object.uuid }/#{file_path}",
+ :title => "Click to add this item to your selection list"
} %>
</td>
<td>
<span class="glyphicon glyphicon-arrow-right"></span>
</li>
<li>
- <%= link_to controller.breadcrumb_page_name, request.fullpath %>
+ <%= link_to_if_arvados_object @object %>
</li>
<li style="padding: 14px 0 14px">
<%= form_tag do |f| %>