Skip to content

Instantly share code, notes, and snippets.

Created December 18, 2012 22:30
Show Gist options
  • Select an option

  • Save anonymous/4332686 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/4332686 to your computer and use it in GitHub Desktop.
<%= form_for booking do |f| %>
<br />
<%= f.label :name %>
<br />
<%= f.text_field :name %>
<br />
<div class="actions">
<%= f.submit %>
</div>
<% end %>
$('table').on('click', 'td', function(e) {
$('.create_booking').dialog
});
<table class="rota">
<thead>
<tr>
<!-- Element will carry the month number for initializing this table correctly. -->
<th class="month"-<%= @date_range %>">Days</th>
<% @hospitals.each do |hsp| %>
<th class="hospital-<%= hsp.shortname %>"><%= hsp.name %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @date_range.each do |d| %>
<tr>
<th><%= d.to_s(:short) %></th>
<% @hospitals.each do |hsp| %>
<td class="day-<%= d.to_s(:short) %> hospital-<%= hsp.shortname %>">&nbsp;</td> <!--Class on each td to make it identifiable -->
<% end %>
</tr>
<% end %>
</tbody>
<!--%@hospitals.each { |hospital| hospital.hospital_bookings.each { |booking| booking.id } } %-->
<%@hospitals.each do |hospital|
hospital.hospital_bookings.each do |booking| booking.id %>
<div class="create_booking" data-hospital-id="<%= hospital.id %>" title="Create Booking">
<% if booking.nil? %>
<div style="display: none;">
<%= render :partial => "booking_dialog", :locals => { :booking => booking } %>
</div>
<% end %>
<% end %>
</div>
<% end %>
</table>
<%= form_tag rota_days_path, :method => 'get' do %>
<p>
<%= link_to '<< Previous Month', rota_days_path(:beginning_of_month => @beginning_previous) %> |
<%= link_to 'Current Month ', rota_days_path(:beginning_of_month => @beginning_current) %> |
<%= link_to 'Next Month >>', rota_days_path(:beginning_of_month => @beginning_next) %>
</p>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment