public
Description: Acts As Licensed is a plugin which provides a basic content licensing system to community centred Ruby On Rails applications. The plugin includes a set of Creative Commons New Zealand and Australian licenses, which can be imported (excluding the No Derivative Works variant).
Homepage:
Clone URL: git://github.com/kete/acts_as_licensed.git
KieranP (author)
Thu May 07 18:42:55 -0700 2009
commit  aa6639d7447e36d3f51eafe2f9ec34b068f46604
tree    d0216bf43a72a292d833e5e5da0d821fed205c4f
parent  6bfcd6e0fdfb2d08873fba11e3f7a3d6e4e48922
acts_as_licensed / README
100644 100 lines (58 sloc) 2.417 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
ActsAsLicenced
=====================
 
Some portions (rails generator) based on work by Rob Sanheim in the BrainBuster rails plugin.
 
 
INSTALL
=======
 
Install the plugin by running
 
  script/plugin install git://github.com/kete/acts_as_licensed.git
 
Add the migration and update your database by running
 
  ./script/generate acts_as_licensed_migration
  rake db:migrate
 
Install the licenses you want to assign to content. See a list of them by running
 
  rake -D acts_as_licensed
 
Finally, add the following line to the controller which you want to add the licensed plugin to
 
  acts_as_licensed
 
 
ADDITIONAL INSTALLATION
=======================
 
ActsAsLicensed relies on three methods within the class you add acts_as_licensed to.
 
They are title_for_license, author_for_license, and author_url_for_license
 
The defaults are usually similar to the following (adjust to suit your application):
 
  def title_for_license
    title
  end
  def author_for_license
    self.author.name
  end
  def author_url_for_license
    "/site/account/show/#{author_id}"
  end
 
You can also define a default license by setting DEFAULT_CONTENT_LICENSE somewhere in your initializers (the constant contains the id of a license in the license table).
 
 
USAGE
=====
 
Class Methods
-------------
 
You can get a list of all available licenses by using
 
  License.find_available
 
Instance Methods
----------------
 
Check whether the object has a license by using
 
  object.has_license?
 
Update the license, which raises an error if the object already have a license, by using
 
  object.license_id = id_of_new_license
 
Retrieve the metadata, html indicating the license type of the object, by using
 
  object.license_metadata
 
Helper Methods
--------------
 
Check whether licenses are available through
 
  licenses_are_available?
 
Get the default license if configured else nil through
 
  configured_default_license
 
Iterate over each license using
 
  available_licenses do |license|
    puts license.name
  end
 
Helper methods for license selection in forms include:
 
  radio_button_for_license_selection(object_name, license)
  radio_button_with_label_and_image(object_name, method, tag_value, label, image_url = nil, options = {}, options_for_label = {})
  radio_button_with_label(object_name, method, tag_value, label, options = {}, options_for_label = {})
 
 
Copyright (c) 2008 Katipo Communications LTD, released under the MIT license.