rename projects
[arvados.git] / apps / workbench / app / views / application / _arvados_object_attr.html.erb
diff --git a/apps/workbench/app/views/application/_arvados_object_attr.html.erb b/apps/workbench/app/views/application/_arvados_object_attr.html.erb
new file mode 100644 (file)
index 0000000..cb296c5
--- /dev/null
@@ -0,0 +1,26 @@
+<% if attrvalue.is_a? Hash then attrvalue.each do |infokey, infocontent| %>
+<tr class="info">
+  <td><%= attr %>[<%= infokey %>]</td>
+  <td>
+    <tt>
+      <% if infocontent.is_a? Array and infocontent.collect(&:class).uniq.compact == [String] then infocontent.each do |message| %>
+      <%= message %><br />
+      <% end; elsif infocontent.is_a? String %>
+      <%= infocontent %>
+      <% else %>
+      <%= infocontent.inspect %>
+      <% end %>
+    </tt>
+  </td>
+</tr>
+<% end %>
+<% elsif attrvalue.is_a? String or attrvalue.respond_to? :to_s %>
+<tr class="<%= 'info' if %w(uuid owner created_at modified_at modified_by_user modified_by_client updated_at).index(attr.to_s).nil? %>">
+  <td><%= attr %></td>
+  <% if attr == 'uuid' and (uuid = attrvalue.split('-')).size == 3 %>
+  <td><%= uuid[0..-2].join('-') %>-<b><%= uuid[-1] %></b></td>
+  <% else %>
+  <td><%= link_to_if_arvados_object attrvalue, {referring_attr: attr, referring_object: @object, with_prefixes: true, with_class_name: true} %></td>
+  <% end %>
+</tr>
+<% end %>