if opts[:friendly_name]
if attrvalue.respond_to? :friendly_link_name
- link_name = attrvalue.friendly_link_name
+ link_name = attrvalue.friendly_link_name opts[:lookup]
else
begin
if resource_class.name == 'Collection'
def render_editable_attribute(object, attr, attrvalue=nil, htmloptions={})
attrvalue = object.send(attr) if attrvalue.nil?
- if !object.attribute_editable?(attr, :ever) or
- (!object.editable? and
- !object.owner_uuid.in?(my_projects.collect(&:uuid)))
+ if not object.attribute_editable?(attr)
if attrvalue && attrvalue.length > 0
return render_attribute_as_textile( object, attr, attrvalue, false )
else
preconfigured_search_str = value_info[:search_for]
end
- if !object or
- !object.attribute_editable?(attr, :ever) or
- (!object.editable? and
- !object.owner_uuid.in?(my_projects.collect(&:uuid)))
+ if not object.andand.attribute_editable?(attr)
return link_to_if_arvados_object attrvalue
end
display_value = link.name
elsif value_info[:link_name]
display_value = value_info[:link_name]
+ elsif value_info[:selection_name]
+ display_value = value_info[:selection_name]
end
end
if (attr == :components) and (subattr.size > 2)
end
end
- def move_or_copy_items action, uuids_to_add, target_uuid
- uuids_to_add = [ uuids_to_add ] unless uuids_to_add.is_a? Array
- uuids_to_add.
- collect { |x| ArvadosBase::resource_class_for_uuid(x) }.
- uniq.
- each do |resource_class|
- resource_class.filter([['uuid','in',uuids_to_add]]).each do |src|
- if resource_class == Collection and not Collection.attribute_info.include?(:name)
- dst = Link.new(owner_uuid: target_uuid,
- tail_uuid: target_uuid,
- head_uuid: src.uuid,
- link_class: 'name',
- name: src.uuid)
- else
- case action
- when :copy
- dst = src.dup
- if dst.respond_to? :'name='
- if dst.name
- dst.name = "Copy of #{dst.name}"
- else
- dst.name = "Copy of unnamed #{dst.class_for_display.downcase}"
- end
- end
- if resource_class == Collection
- dst.manifest_text = Collection.select([:manifest_text]).where(uuid: src.uuid).first.manifest_text
- end
- when :move
- dst = src
- else
- raise ArgumentError.new "Unsupported action #{action}"
- end
- dst.owner_uuid = target_uuid
- dst.tail_uuid = target_uuid if dst.class == Link
- end
- begin
- dst.save!
- rescue
- dst.name += " (#{Time.now.localtime})" if dst.respond_to? :name=
- dst.save!
- end
- end
- end
+ def render_localized_date(date, opts="")
+ raw("<span class='utc-date' data-utc-date='#{date}' data-utc-date-opts='noseconds'>#{date}</span>")
end
private