Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Basic one day schedule and simple payform on dashboard

  • Loading branch information...
commit a97af00ea268ecabacb1637869e0a79af2d2f8a2 1 parent 9e61de6
@iamringo iamringo authored
View
6 app/controllers/dashboard_controller.rb
@@ -1,8 +1,8 @@
class DashboardController < ApplicationController
-
+ helper ShiftsHelper
def index
@upcoming_shifts = current_user.shifts.select{|shift| !(shift.submitted?) and shift.scheduled? and shift.end > Time.now and @department.locations.include?(shift.location)}.sort_by(&:start)[0..3]
+ @most_recent_payform= current_user.payforms.last
end
-
-end
+end
View
1  app/helpers/dashboard_helper.rb
@@ -1,2 +1,3 @@
module DashboardHelper
+
end
View
20 app/views/dashboard/_mini_payform.html.erb
@@ -0,0 +1,20 @@
+<table>
+
+<td>Date</td>
+<td>Description</td>
+<td>Hours</td>
+
+<% @most_recent_payform.payform_items.each do |item| %>
+<tr>
+<td><%= item.date.strftime('%b %d') %></td>
+<td><%= item.description %></td>
+<td><%= item.hours.to_s %></td>
+</tr>
+<% end %>
+<tr>
+<td><strong>Total:</strong><td>
+
+<td> <%= @most_recent_payform.hours %> </td>
+</tr>
+</table>
+
View
12 app/views/dashboard/index.html.erb
@@ -27,4 +27,16 @@
<%= render :partial => 'shifts/upcoming_shifts_layout' %>
</fieldset>
<% end %>
+<% if @most_recent_payform %>
+ <br />
+ <fieldset class ="index">
+ <legend>Summary of your most recent payform</legend>
+ <%= render :partial => "mini_payform" %>
+ </fieldset>
+<%end%>
+<br />
+ <fieldset class ="index">
+ <legend>Today's schedule</legend>
+ <%= render :partial => 'shifts/schedule/day', :collection => [Date.today], :spacer_template => 'shifts/schedule/spacer'%>
+ </fieldset>
View
11 preload_data/locations.yml
@@ -1,5 +1,5 @@
----
-locations_001:
+---
+locations_001:
active: t
created_at: 2009-06-22 17:35:10
id: "2"
@@ -11,7 +11,7 @@ locations_001:
short_name: io
updated_at: 2009-06-22 17:35:10
useful_links: ""
-locations_002:
+locations_002:
active: t
created_at: 2009-06-22 17:35:40
id: "3"
@@ -23,7 +23,7 @@ locations_002:
short_name: CT Hall
updated_at: 2009-06-22 17:35:40
useful_links: ""
-locations_003:
+locations_003:
active: t
created_at: 2009-06-22 17:36:41
id: "4"
@@ -32,6 +32,7 @@ locations_003:
min_staff: "1"
name: Technology Troubleshooting Office
priority: "100"
- short_name: CT Hall
+ short_name: TTO
updated_at: 2009-06-22 17:35:40
useful_links: ""
+
Please sign in to comment.
Something went wrong with that request. Please try again.