Created
November 12, 2012 22:15
-
-
Save anonymous/4062341 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#nextmonth').click(fuction(e)) { | |
$.get('/rota_days/show.json?mon=12').success(function(data) { | |
$('#nextmonth').on('click', fuction(e)) { | |
$.get('/rota_days/show.json?mon=12').success(function(data) { | |
for ( i = 0; i < rota_days.length; i++) | |
{ | |
rota_days = data | |
} | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table class = "rota"> | |
<thead> | |
<th>Date</th> | |
<% @hospitals.each do |hosp| %> | |
<th><%= hosp.name%></th> | |
<% end %> | |
</thead> | |
<tbody> | |
<% @dates.each do |date| %> | |
<tr> | |
<td><%= date.to_s(:short) %></td> | |
<% ([email protected]).each do %> | |
<td></td> | |
<% end %> | |
</tr> | |
<% end %> | |
</tbody> | |
</table> | |
<%= link_to 'Next Month', rota_days_path(:month => 12), :remote => true %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RotaDaysController < ApplicationController | |
# GET /rota_days | |
# GET /rota_days.json | |
# load_and_authorize_resource | |
respond_to :json, :html | |
def index | |
@rota_days = RotaDay.all | |
# @dates = @rota_days.collect(&:day) | |
@hospitals = Hospital.all | |
t1 = Date.today.at_beginning_of_month | |
t2 = Date.today.end_of_month | |
@dates = (t1..t2).to_a | |
@title = "Rota" | |
respond_to do |format| | |
format.html # index.html.erb | |
format.json { render json: @rota_days } | |
end | |
end | |
def nextmonth | |
@rota_days = RotaDay.all | |
respond_with(@rota_days) | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment