bensaufley/fitness_schedules — pull request #2 by shterrett (2012-07-28 11:50:56+00:00)
Title: Authorization and reports

Updated the authorization for schedules#edit and schedules#update so that the edit page cannot be accessed once the schedule is marked complete/cancelled. I previously had logic in the schedules#update action that redirected back to the schedules#show page with a note that the schedule could not be updated. I removed this logic and replaced it with a :before_filter on the schedules controller that applies to both :edit and :update; these are now inaccessible after a schedule is marked complete/cancelled.

I also added an admin column to the Trainer model. The reporting actions and the trainer#new actions are restricted to admins only (also the buttons will only appear to admin users). Currently Trainers can only be marked admins through the console using .toggle!(:admin).

The basic reporting function exists; I still need to review the railscast I found and make the columns individually sortable. For now, the trainer email is optional, and it will restrict the reports to within the dates if not present, and to within the dates for the specific trainer when a trainer email is present.