From: Tom Clegg Date: Tue, 19 Feb 2013 07:52:38 +0000 (-0800) Subject: tweak factory_jobs display X-Git-Tag: 1.1.0~3374^2~31 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/83e22fd49774c6e60ea4e743e93c7eaf63489b1a tweak factory_jobs display --- diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3d06144abf..8422ed247a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -13,8 +13,8 @@ module ApplicationHelper cooked = raw + cooked end - def link_to_if_orvos_object(attrvalue, opts={}) - if (resource_class = OrvosBase::resource_class_for_uuid(attrvalue, opts[:referring_attr], opts[:referring_object])) + def link_to_if_orvos_object(attrvalue, opts={}, style_opts={}) + if (resource_class = OrvosBase::resource_class_for_uuid(attrvalue, opts)) link_uuid = attrvalue.is_a?(OrvosBase) ? attrvalue.uuid : attrvalue link_name = opts[:link_text] if !link_name @@ -25,8 +25,9 @@ module ApplicationHelper if opts[:with_class_name] link_name = "#{resource_class.to_s} #{link_name}" end + style_opts = style_opts.merge(style: 'font-family: monospace') end - link_to link_name, { controller: resource_class.to_s.underscore.pluralize, action: 'show', id: link_uuid } + link_to link_name, { controller: resource_class.to_s.underscore.pluralize, action: 'show', id: link_uuid }, style_opts else attrvalue end diff --git a/app/models/orvos_base.rb b/app/models/orvos_base.rb index 1c6a7301fc..7abbc88d8f 100644 --- a/app/models/orvos_base.rb +++ b/app/models/orvos_base.rb @@ -9,6 +9,8 @@ class OrvosBase < ActiveRecord::Base 'ozdt8' => 'orvos#api_client', '57u5n' => 'orvos#log', 'j58dm' => 'orvos#specimen', + 'mxsvm' => 'orvos#pipeline', + 'uo14g' => 'orvos#pipeline_invocation', 'ldvyl' => 'orvos#project' } end @@ -179,13 +181,16 @@ class OrvosBase < ActiveRecord::Base } end - def self.resource_class_for_uuid(uuid, attr_name=nil, object=nil) + def self.resource_class_for_uuid(uuid, opts={}) if uuid.is_a? OrvosBase return uuid.class end unless uuid.is_a? String return nil end + if opts[:class].is_a? Class + return opts[:class] + end if uuid.match /^[0-9a-f]{32}(\+[^,]+)*(,[0-9a-f]{32}(\+[^,]+)*)*$/ return Collection end @@ -194,8 +199,13 @@ class OrvosBase < ActiveRecord::Base resource_class ||= $orvos_api_client. kind_class(self.uuid_infix_object_kind[re[1]]) end - if object and attr_name and attr_name.match /_uuid$/ - resource_class ||= $orvos_api_client.kind_class(object.attributes[attr_name.sub(/_uuid$/, '_kind')]) + if opts[:referring_object] and + opts[:referring_attr] and + opts[:referring_attr].match /_uuid$/ + resource_class ||= $orvos_api_client. + kind_class(opts[:referring_object]. + attributes[opts[:referring_attr]. + sub(/_uuid$/, '_kind')]) end resource_class end