Skip to content

Commit 684d08c

Browse files
committed
Add occupancy to rooms, turn the row red if occupants > beds, add links to participants and families of participants for each room listed
1 parent fa3a1b3 commit 684d08c

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

app/views/layouts/_navigation.html.erb

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<li><%= link_to 'Participants', participants_url, :controller => :participants -%></li>
99
<li><%= link_to 'Staff', users_url, :controller => :users -%></li>
1010
<li><%= link_to 'Files', files_url, :controller => :files -%></li>
11+
<li><%= link_to 'Rooms', rooms_url, :controller => :rooms -%></li>
1112
<li><%= link_to 'Configuration', config_edit_url, :controller => :config_edit -%>
1213
</ul>
1314
</li>

app/views/rooms/_room.html.erb

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
<tr>
1+
<tr class="<%=room.beds.to_i < room.participants.count ? 'overload' : 'normal' -%>">
22
<td><%= room.id -%></td>
3-
<td><%= text_field_tag "beds[#{room.id}]", room.beds -%></td>
4-
<td><%= room.participants.count -%></td>
5-
<td><% room.participants.each do |p| -%>
6-
<%= link_to p.fullname, edit_participant_path(p) -%>&nbsp;
7-
<% end -%>
3+
<td><%= text_field_tag "beds[#{room.id}]", room.beds, :size => 3 -%></td>
4+
<td>&nbsp;<%= room.participants.count -%></td>
5+
<td>
6+
<% room.participants.each do |p| -%>
7+
<%= link_to p.fullname.gsub(' ','&nbsp;'), edit_participant_path(p) -%>
8+
<% end -%>
9+
</td>
10+
<td>
11+
<%=room.participants.collect{ |p| link_to p.family.familyname.gsub(' ','&nbsp;'), family_path(p.family) }.uniq.join(' ') -%>
812
</td>
913
</tr>

app/views/rooms/index.html.erb

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<th>Beds</th>
77
<th># Occupants</th>
88
<th>Occupants</th>
9+
<th>Families</th>
910
</tr>
1011
<%= render :partial => 'room', :collection => @rooms -%>
1112
</table>

public/stylesheets/style.css

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ body {
44
font:0.95em/1.2 Arial, sans-serif;
55
}
66

7+
tr.overload {
8+
background:#ff3366
9+
}
710
#messages {
811
display:none;
912
}
@@ -198,4 +201,4 @@ a.delete {
198201
float:left;
199202
background:url(/images/cross.png) no-repeat top left;
200203
text-indent:-9999px;
201-
}
204+
}

0 commit comments

Comments
 (0)