add group#index and group#show pages. refs #1415
authorTom Clegg <tom@clinicalfuture.com>
Tue, 19 Mar 2013 06:24:35 +0000 (23:24 -0700)
committerTom Clegg <tom@clinicalfuture.com>
Tue, 19 Mar 2013 06:24:35 +0000 (23:24 -0700)
app/controllers/groups_controller.rb
app/views/application/_orvos_object.html.erb
app/views/groups/index.html.erb [new file with mode: 0644]
app/views/jobs/show.html.erb
app/views/layouts/application.html.erb
app/views/pipelines/show.html.erb

index 4dc56c4a86fcb8126fb16380d6c3bb8cc8eba35d..3eda3acc77d8c2226fc9c8ed6e02ced8af5b3920 100644 (file)
@@ -1,3 +1,11 @@
 class GroupsController < ApplicationController
   before_filter :ensure_current_user_is_admin
+
+  def index
+    @groups = Group.limit(10000).all
+    @group_uuids = @groups.collect &:uuid
+    @owned_users = User.where owner: @group_uuids
+    @links_from = Link.where link_class: 'permission', tail_uuid: @group_uuids
+    @links_to = Link.where link_class: 'permission', head_uuid: @group_uuids
+  end
 end
index 5f86de8b3a61dd3e6a12a969cd14d14b640e3638..5702d30cb8a0c2a40a847dbebb67ccc720e04180 100644 (file)
@@ -7,3 +7,6 @@
     <% end %>
   </tbody>
 </table>
+<pre>
+<%= JSON.pretty_generate(@object.attributes) rescue nil %>
+</pre>
diff --git a/app/views/groups/index.html.erb b/app/views/groups/index.html.erb
new file mode 100644 (file)
index 0000000..51e66d8
--- /dev/null
@@ -0,0 +1,42 @@
+<table class="table table-hover">
+  <thead>
+    <tr class="contain-align-left">
+      <th>
+       id
+      </th><th>
+       name
+      </th><th>
+       owner
+      </th><th>
+       incoming permissions
+      </th><th>
+       outgoing permissions
+      </th><th>
+       owned
+      </th>
+    </tr>
+  </thead>
+  <tbody>
+
+    <% @groups.sort_by { |g| g[:created_at] }.reverse.each do |g| %>
+
+    <tr>
+      <td>
+        <%= link_to_if_orvos_object g %>
+      </td><td>
+        <%= g.name %>
+      </td><td>
+        <%= g.owner %>
+      </td><td>
+        <%= @links_to.select { |x| x.head_uuid == g.uuid }.collect(&:tail_uuid).uniq.count %>
+      </td><td>
+        <%= @links_from.select { |x| x.tail_uuid == g.uuid }.collect(&:head_uuid).uniq.count %>
+      </td><td>
+        <%= @owned_users.select { |x| x.owner == g.uuid }.count %> users<br />
+      </td>
+    </tr>
+
+    <% end %>
+
+  </tbody>
+</table>
index d4fad9feb62c660cdb0fa21aeca3d983aec9b4b3..68f5fa9a549ca3c88602de47015223ed711475f1 100644 (file)
@@ -1,12 +1 @@
-<table class="table table-condensed table-hover topalign">
-  <thead>
-  </thead>
-  <tbody>
-    <% @object.attributes_for_display.each do |attr, attrvalue| %>
-    <%= render partial: 'application/orvos_object_attr', locals: { attr: attr, attrvalue: attrvalue } %>
-    <% end %>
-  </tbody>
-</table>
-<pre>
-<%= JSON.pretty_generate(@object.attributes) rescue nil %>
-</pre>
+<%= render :partial => 'application/orvos_object' %>
index 62ad6239cf818e55c41e9289295b0b446fded50e..259b6f2ac2026cf49a4b124ad0d9a122b7a60cfe 100644 (file)
@@ -35,6 +35,7 @@
            <% [
               [true, 'Data', collections_path],
               [true, 'FactoryJobs', factory_jobs_path],
+              [true, 'Groups', groups_path],
               [true, 'Jobs', jobs_path]
               ].each do |admin_only, name, path| %>
            <% if !admin_only or (current_user and current_user.is_admin) %>
index 24ac9784145785a408b3cf285ab85d947104b2ea..6af7f4eb6247234f61706274819f1e9880b7447e 100644 (file)
@@ -38,5 +38,5 @@
   </tbody>
 </table>
 <pre>
-<%= JSON.pretty_generate(@object.components) rescue nil %>
+<%= JSON.pretty_generate(@object.attributes) rescue nil %>
 </pre>