Diff
Modified: trunk/app/models/content_type.rb (2918 => 2919)
--- trunk/app/models/content_type.rb 2012-01-20 16:22:23 UTC (rev 2918)
+++ trunk/app/models/content_type.rb 2012-01-24 15:17:40 UTC (rev 2919)
@@ -10,4 +10,8 @@
validates_presence_of :title
validates_uniqueness_of :title
+
+ def label
+ title
+ end
end
Modified: trunk/app/models/experiment.rb (2918 => 2919)
--- trunk/app/models/experiment.rb 2012-01-20 16:22:23 UTC (rev 2918)
+++ trunk/app/models/experiment.rb 2012-01-24 15:17:40 UTC (rev 2919)
@@ -14,6 +14,10 @@
validates_presence_of :title
+ def label
+ title
+ end
+
def self.default_title(user)
s = "Experiment_#{Time.now.strftime('%Y%m%d-%H%M')}"
s = s + "_#{user.name}" if user
Modified: trunk/app/models/license.rb (2918 => 2919)
--- trunk/app/models/license.rb 2012-01-20 16:22:23 UTC (rev 2918)
+++ trunk/app/models/license.rb 2012-01-24 15:17:40 UTC (rev 2919)
@@ -22,4 +22,7 @@
return LicenseAttribute.find_by_sql("SELECT * FROM license_attributes INNER JOIN license_options on license_attributes.license_option_id=license_options.id WHERE license_id = #{self.id}")
end
+ def label
+ unique_name
+ end
end
Modified: trunk/app/models/ontology.rb (2918 => 2919)
--- trunk/app/models/ontology.rb 2012-01-20 16:22:23 UTC (rev 2918)
+++ trunk/app/models/ontology.rb 2012-01-24 15:17:40 UTC (rev 2919)
@@ -12,5 +12,9 @@
validates_presence_of(:uri, :title, :prefix)
validates_uniqueness_of(:uri, :prefix)
+
+ def label
+ title
+ end
end
Modified: trunk/app/models/predicate.rb (2918 => 2919)
--- trunk/app/models/predicate.rb 2012-01-20 16:22:23 UTC (rev 2918)
+++ trunk/app/models/predicate.rb 2012-01-24 15:17:40 UTC (rev 2919)
@@ -12,5 +12,8 @@
validates_presence_of(:title)
validates_presence_of(:ontology)
+ def label
+ title
+ end
end
Modified: trunk/app/models/taverna_enactor.rb (2918 => 2919)
--- trunk/app/models/taverna_enactor.rb 2012-01-20 16:22:23 UTC (rev 2918)
+++ trunk/app/models/taverna_enactor.rb 2012-01-24 15:17:40 UTC (rev 2919)
@@ -22,6 +22,10 @@
encrypts :password, :mode => :symmetric, :key => Conf.sym_encryption_key
+ def label
+ title
+ end
+
def self.find_by_contributor(contributor_type, contributor_id)
TavernaEnactor.find(:all, :conditions => ["contributor_type = ? AND contributor_id = ?", contributor_type, contributor_id])
end
Modified: trunk/config/tables.xml
(Binary files differ)
Modified: trunk/lib/rest.rb (2918 => 2919)
--- trunk/lib/rest.rb 2012-01-20 16:22:23 UTC (rev 2918)
+++ trunk/lib/rest.rb 2012-01-24 15:17:40 UTC (rev 2919)
@@ -17,7 +17,6 @@
{ 'Model' => { :indices => [ 'REST Entity' ],
:lists => [ 'REST Attribute', 'Encoding', 'Accessor',
'Create', 'Read', 'Update', 'Read by default',
- 'Foreign Accessor',
'List Element Name', 'List Element Accessor',
'Example', 'Versioned', 'Key type',
'Limited to user', 'Permission', 'Index filter' ] },
@@ -237,7 +236,7 @@
resource_uri = rest_resource_uri(item)
el['resource'] = resource_uri if resource_uri
el['uri'] = rest_access_uri(item)
- el << item.label if item.label
+ el << item.label if item.respond_to?(:label) && item.label
end
el
@@ -250,24 +249,19 @@
else
- foreign_ob = nil
- text = ""
+ text = ""
- if model_data['Foreign Accessor'][i]
- foreign_ob = eval("ob.#{model_data['Foreign Accessor'][i]}")
- end
-
if accessor
- if model_data['Foreign Accessor'][i].nil? || foreign_ob
- if query['version'] and model_data['Versioned'][i] == 'yes'
- text = eval("ob.find_version(#{query['version']}).#{accessor}").to_s
+ if query['version'] and model_data['Versioned'][i] == 'yes'
+ text = eval("ob.find_version(#{query['version']}).#{accessor}").to_s
+ else
+
+ val = eval("ob.#{accessor}")
+
+ if val.class == ActiveSupport::TimeWithZone
+ text = val.time().to_s
else
- val = eval("ob.#{accessor}")
- if val.class == ActiveSupport::TimeWithZone
- text = val.time().to_s
- else
- text = val.to_s
- end
+ text = val.to_s
end
end
end
@@ -276,15 +270,6 @@
text = Base64.encode64(text)
attrs = { 'type' => 'binary', 'encoding' => 'base64' }
end
-
- if model_data['Foreign Accessor'][i]
- foreign_ob = eval("ob.#{model_data['Foreign Accessor'][i]}")
- if foreign_ob != nil
- resource_uri = rest_resource_uri(foreign_ob)
- attrs['resource'] = resource_uri if resource_uri
- attrs['uri'] = rest_access_uri(foreign_ob)
- end
- end
end
# puts "ATTRIBUTE = #{model_data['REST Attribute'][i]}, ATTRS = #{attrs.inspect}, text = #{text.inspect}"
Modified: trunk/vendor/plugins/acts_as_taggable_redux/lib/tag.rb (2918 => 2919)
--- trunk/vendor/plugins/acts_as_taggable_redux/lib/tag.rb 2012-01-20 16:22:23 UTC (rev 2918)
+++ trunk/vendor/plugins/acts_as_taggable_redux/lib/tag.rb 2012-01-24 15:17:40 UTC (rev 2919)
@@ -85,5 +85,9 @@
Tag.find_by_sql([sql] + args)
end
+ def label
+ name
+ end
+
validates_presence_of :name
end