Skip to content

Commit

Permalink
only show relivant tables
Browse files Browse the repository at this point in the history
  • Loading branch information
zr2d2 committed Jun 6, 2012
1 parent 454e61e commit 0bae060
Showing 1 changed file with 89 additions and 63 deletions.
152 changes: 89 additions & 63 deletions app/views/users/_show_body.html.erb
Original file line number Diff line number Diff line change
@@ -1,68 +1,94 @@
<article>
<div class="default-padding">
<h2>Groups</h2>

<table>
<tr>
<th>Name</th>
<th>Roles</th>
</tr>

<% @user.memberships.each do |membership| %>
<tr>
<td><%= membership.group.name %></td>

<td>
<%= form_for([membership.group, membership]) do |f| %>
<%= f.select :level, Membership::LEVELS %>
<%= f.submit %>
<% end %>
</td>
</tr>
<% end %>
</table>

<br/><br/>

<h2>Screens</h2>

<table>
<tr>
<th>Name</th>
<th>Location</th>
<th>Dimensions</th>
</tr>

<% @user.screens.each do |screen| %>
<tr>
<td><%= screen.name %></td>
<td><%= screen.location %></td>
<td><%= screen.width %> X <%= screen.height %></td>
</tr>
<% end %>
</table>

<br/><br/>

<h2>Submissions</h2>

<table>
<tr>
<th>Name</th>
<th>Type</th>
<th>Airs</th>
</tr>

<% @user.contents.each do |content| %>
<tr>
<td><%= content.name %></td>
<td><%= content.type %></td>
<td><%= content.start_time %> - <%= content.end_time %></td>
</tr>
<% end %>
</table>

<br/><br/>
<% if !@user.memberships.empty? %>
<h2>Groups</h2>

<table>
<tr>
<th>Name</th>
<th>Roles</th>
</tr>

<% @user.memberships.each do |membership| %>
<tr>
<td><%= membership.group.name %></td>

<td>
<%= form_for([membership.group, membership]) do |f| %>
<%= f.select :level, Membership::LEVELS %>
<%= f.submit %>
<% end %>
</td>
</tr>
<% end %>
</table>

<br/><br/>
<% end %>
<% if !@user.screens.empty? %>
<h2>Screens</h2>

<table>
<tr>
<th>Name</th>
<th>Location</th>
<th>Dimensions</th>
</tr>

<% @user.screens.each do |screen| %>
<tr>
<td><%= screen.name %></td>
<td><%= screen.location %></td>
<td><%= screen.width %> X <%= screen.height %></td>
</tr>
<% end %>
</table>

<br/><br/>
<% end %>
<% Group.joins(:screens, :users).where(:users => {:id => @user}).group('groups.id').each do |group| %>
<h2><%= group.name %>'s Screens</h2>

<table>
<tr>
<th>Name</th>
<th>Location</th>
<th>Dimensions</th>
</tr>

<% group.screens.each do |screen| %>
<tr>
<td><%= screen.name %></td>
<td><%= screen.location %></td>
<td><%= screen.width %> X <%= screen.height %></td>
</tr>
<% end %>
</table>
<br/><br/>
<% end %>
<% if !@user.contents.empty? %>
<h2>Submissions</h2>

<table>
<tr>
<th>Name</th>
<th>Type</th>
<th>Airs</th>
</tr>

<% @user.contents.each do |content| %>
<tr>
<td><%= content.name %></td>
<td><%= content.type %></td>
<td><%= content.start_time %> - <%= content.end_time %></td>
</tr>
<% end %>
</table>
<br/><br/>
<% end %>

</div>

Expand Down

0 comments on commit 0bae060

Please sign in to comment.