Skip to content

Commit

Permalink
generating class documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
yasonk committed May 12, 2015
1 parent cb39163 commit 9c809da
Show file tree
Hide file tree
Showing 50 changed files with 5,579 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/controllers/support_assignments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,15 @@ def destroy
end
end

# GET /support_assignments/today
# GET /support_assignments/today.json
def today
@support_assignment = SupportAssignment.where(date: Date.today).first
render :show
end

# GET /support_assignments/month/1
# GET /support_assignments/month/1.json
def month
@support_assignments = SupportAssignment.where("strftime('%m', date) + 0 = ?", params[:month].to_i).order :date
render :index
Expand Down
2 changes: 0 additions & 2 deletions app/helpers/application_helper.rb

This file was deleted.

2 changes: 2 additions & 0 deletions app/helpers/support_assignments_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module SupportAssignmentsHelper
#Produces link for creating new assignments depending on whether the user_id param is available
def new_assignment_link
if params[:user_id].present?
link_to('New Support assignment', new_user_support_assignment_path)
Expand All @@ -7,6 +8,7 @@ def new_assignment_link
end
end

#Produces link for support assignments depending on wheher the user_id param is available
def support_assignments_link
if params[:user_id].present?
link_to 'Back', user_support_assignments_path
Expand Down
2 changes: 0 additions & 2 deletions app/helpers/users_helper.rb

This file was deleted.

8 changes: 7 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@ class User < ActiveRecord::Base
has_many :support_assignments, :dependent => :destroy
validates :name, presence: true

# Returns true if the user is available on the specified date.
def available? date
date != unavailable_date
end

# Assigns the user to support duty, if the user is available on the specified date.
def assign_duty date
support_assignments.create(date: date) if available? date
end

# Marks the user as unavailable for duty on the specified date.
# If the user was assigned to duty on this date, another user swaps duty with this user.
def unavailable_date= date
reconcile_schedule_conflicts date
write_attribute :unavailable_date, date
end

# Returns a support assignment for the user with the date in the future
def future_assignment
support_assignments.select{ |assignment| assignment.date.future? }.first
end

# Produces a array of users who are available on the specified date
def self.available_users date
User.where(unavailable_date: nil) | User.where.not(unavailable_date: date)
(User.where(unavailable_date: nil) | User.where.not(unavailable_date: date)).to_a
end

private
Expand Down
Binary file added doc/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions doc/classes/ApplicationController.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>ApplicationController</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>
<div class="banner">

<h1>
<span class="type">Class</span>
ApplicationController

<span class="parent">&lt;

ActionController::Base

</span>

</h1>
<ul class="files">

<li><a href="../files/controllers/application_controller_rb.html">controllers/application_controller.rb</a></li>

</ul>
</div>
<div id="bodyContent">
<div id="content">































<!-- Methods -->
</div>

</div>
</body>
</html>
76 changes: 76 additions & 0 deletions doc/classes/SupportAssignment.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>SupportAssignment</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>
<div class="banner">

<h1>
<span class="type">Class</span>
SupportAssignment

<span class="parent">&lt;

ActiveRecord::Base

</span>

</h1>
<ul class="files">

<li><a href="../files/models/support_assignment_rb.html">models/support_assignment.rb</a></li>

</ul>
</div>
<div id="bodyContent">
<div id="content">































<!-- Methods -->
</div>

</div>
</body>
</html>
Loading

0 comments on commit 9c809da

Please sign in to comment.