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 (
Erik Peterson (author)
Tue Jul 22 17:02:54 -0700 2008
commit 9ccc38681737ddfc598c0d6f58f1b7fd9195d56a
tree 2ac177ddb386547882a786499d8731e65704e8a5
parent 988165987bff4db97a97c4efa44ed792872cbfd5
tree 2ac177ddb386547882a786499d8731e65704e8a5
parent 988165987bff4db97a97c4efa44ed792872cbfd5
| name | age | message | |
|---|---|---|---|
| |
LICENSE | ||
| |
README | ||
| |
Rakefile | ||
| |
example_app/ | ||
| |
generators/ | ||
| |
init.rb | ||
| |
install.rb | ||
| |
lib/ | ||
| |
meta.yml | ||
| |
test/ | ||
| |
uninstall.rb |
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
rake db:create
rake db:migrate
rake db:fixtures:load
script/server







