add logs#show
authorTom Clegg <tom@clinicalfuture.com>
Thu, 7 Feb 2013 02:24:54 +0000 (21:24 -0500)
committerTom Clegg <tom@clinicalfuture.com>
Thu, 7 Feb 2013 02:24:54 +0000 (21:24 -0500)
app/controllers/application_controller.rb
app/views/logs/show.html.erb [new file with mode: 0644]

index a0b4fd9892990981b9e8152aaca7e41311147462..5c9bce9ba30eb97895a8ab0301a908c196be7800 100644 (file)
@@ -60,6 +60,7 @@ class ApplicationController < ActionController::Base
     end
     respond_to do |f|
       f.json { render json: @object }
+      f.html { render }
     end
   end
 
diff --git a/app/views/logs/show.html.erb b/app/views/logs/show.html.erb
new file mode 100644 (file)
index 0000000..7a09bd8
--- /dev/null
@@ -0,0 +1,30 @@
+<table class="table topalign">
+  <thead>
+  </thead>
+  <tbody>
+    <% %w(summary created_at modified_at info).each do |attr| %>
+    <% attrvalue = @object.send attr %>
+    <% if attrvalue.is_a? Hash then attrvalue.each do |infokey, infocontent| %>
+    <tr>
+      <td><%= infokey %></td>
+      <td>
+        <tt>
+          <% if infocontent.is_a? Array 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>
+      <td><%= attr %></td>
+      <td><%= attrvalue %></td>
+    </tr>
+    <% end; end %>
+  </tbody>
+</table>