This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
LICENSE | Tue Jul 08 19:19:28 -0700 2008 | [Erik Peterson] |
| |
README | Thu Jul 31 19:42:55 -0700 2008 | [subwindow] |
| |
Rakefile | Tue Jul 08 19:27:00 -0700 2008 | [Erik Peterson] |
| |
example_app/ | Tue Jul 22 17:02:54 -0700 2008 | [Erik Peterson] |
| |
generators/ | Tue Jul 08 19:14:30 -0700 2008 | [Erik Peterson] |
| |
init.rb | Thu Jul 31 19:42:55 -0700 2008 | [subwindow] |
| |
install.rb | Tue Jul 08 16:12:30 -0700 2008 | [Erik Peterson] |
| |
lib/ | Thu Jul 31 19:42:55 -0700 2008 | [subwindow] |
| |
meta.yml | Tue Jul 08 19:27:36 -0700 2008 | [Erik Peterson] |
| |
test/ | Tue Jul 08 16:17:03 -0700 2008 | [Erik Peterson] |
| |
uninstall.rb | Tue Jul 08 16:12:30 -0700 2008 | [Erik Peterson] |
README
Needs Approval Plugin
================
This is a pretty simple plugin designed to help you manage approval flows. If you have records that need to be approved
by users, this plugin might help you out. It also has the following features:
-Ladder-based approvals (where one user can only approve after the users listed previous to him have approved as well)
-Approval requirement conditions (where a user only needs to approve on certain conditions)
-Optional, built-in authentication (where a user must enter in their password whenever they approve something- often
required by 21 CFR Part 11 and ISO 9001)
Install using the command
script/plugin install git://github.com/subwindow/needs_approval.git
Generate a scaffolded approval model/controller using the command
script/generate approval APPROVALMODEL USERMODEL [--include-authentication] [--skip-migration]
Example
script/generate approval approval user
Put the approval structure definition in your desired models
class Order < ActiveRecord::Base
needs_approval do
of User.find_by_login("boss")
of User.find_by_login("bigboss") if total_price > 1000
end
end
For ladder-based approvals, use the following. The function next_approvers goes in order of approval definition.
needs_approval(:ladder => true)
Include approval information in the show page of an approved object
<%= approvals_for(@order) %>
Other useful functions:
# Boolean, returns true if all approvals have been satisfied
@order.has_all_approvals?
# Returns an array of all users that are required to approve this object
@order.approvals_needed
# Returns an array of users that have approved this object
@order.approvals
# Returns an array of users that need to approve this object, but have not yet
@order.failed_approvals
# Boolean, returns true if this object requires and does not yet have the approval of this user
@order.needs_approval_of(user)
# Boolean, returns true if this user has approved this object
@order.passes_approval(user)
# Returns an array of users that are set to approve this next (for ladder-based approvals)
@order.next_approvers # Useful for email notifications!
Note
This plugin kind of depends on restful_authentication or something similar. A "current_user" method must be
accessible which returns the currently logged in user.
If the current_user function is named differently, either:
define an alias, or
change the references in the approvals controller and pass in the current user as a second argument to the
approvals_for helper [eg: "approvals_for(@order, active_user)"]
An example app is located in the directory example_app. You can delete this if you don't want it (especially if you use
TextMate-style "Go To File").
To run, execute the following commands:
cd vendor/plugins/needs_approval/example_app
script/plugin install git://github.com/subwindow/needs_approval.git
rake db:create
rake db:migrate
rake db:fixtures:load
script/server



