X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/343892aa0ef79cf607abbfd85a04a612990022e1..fca114122bb204b34414a17e278748ec8e87e136:/apps/workbench/app/helpers/application_helper.rb diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb index 5500938587..2927be8739 100644 --- a/apps/workbench/app/helpers/application_helper.rb +++ b/apps/workbench/app/helpers/application_helper.rb @@ -55,20 +55,22 @@ module ApplicationHelper link_name = link_uuid if opts[:friendly_name] - begin - friendly_name = resource_class.find(link_uuid).friendly_link_name - if friendly_name and not friendly_name.empty? - link_name = friendly_name + if attrvalue.respond_to? :friendly_link_name + link_name = attrvalue.friendly_link_name + else + begin + link_name = resource_class.find(link_uuid).friendly_link_name + rescue RuntimeError + # If that lookup failed, the link will too. So don't make one. + return attrvalue end - rescue RuntimeError - # If that lookup failed, the link will too. So don't make one. - return attrvalue end end if opts[:with_class_name] link_name = "#{resource_class.to_s}: #{link_name}" end end + style_opts[:class] = (style_opts[:class] || '') + ' nowrap' link_to link_name, { controller: resource_class.to_s.underscore.pluralize, action: 'show', id: link_uuid }, style_opts else attrvalue @@ -95,10 +97,10 @@ module ApplicationHelper "data-emptytext" => "none", "data-placement" => "bottom", "data-type" => input_type, - "data-resource" => object.class.to_s.underscore, - "data-name" => attr, "data-url" => url_for(action: "update", id: object.uuid, controller: object.class.to_s.pluralize.underscore), - "data-original-title" => "Update #{attr.gsub '_', ' '}", + "data-title" => "Update #{attr.gsub '_', ' '}", + "data-name" => attr, + "data-pk" => "{id: \"#{object.uuid}\", key: \"#{object.class.to_s.underscore}\"}", :class => "editable" }.merge(htmloptions) end