fine_print 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.md +124 -0
- data/Rakefile +23 -0
- data/app/assets/javascripts/fine_print/agreements.js +19 -0
- data/app/assets/javascripts/fine_print/agreements.js~ +19 -0
- data/app/assets/javascripts/fine_print/application.js +4 -0
- data/app/assets/javascripts/fine_print/application.js~ +5 -0
- data/app/assets/javascripts/fine_print/dialog.js +2 -0
- data/app/assets/javascripts/fine_print/dialog.js~ +2 -0
- data/app/assets/javascripts/fine_print/user_agreements.js +20 -0
- data/app/assets/javascripts/fine_print/user_agreements.js~ +20 -0
- data/app/assets/stylesheets/fine_print/agreements.css +11 -0
- data/app/assets/stylesheets/fine_print/agreements.css~ +11 -0
- data/app/assets/stylesheets/fine_print/application.css +5 -0
- data/app/assets/stylesheets/fine_print/application.css~ +60 -0
- data/app/assets/stylesheets/fine_print/scaffold.css +56 -0
- data/app/assets/stylesheets/fine_print/user_agreements.css~ +3 -0
- data/app/assets/stylesheets/scaffold.css~ +56 -0
- data/app/controllers/fine_print/agreements_controller.rb +114 -0
- data/app/controllers/fine_print/agreements_controller.rb~ +113 -0
- data/app/controllers/fine_print/application_controller.rb +13 -0
- data/app/controllers/fine_print/application_controller.rb~ +13 -0
- data/app/controllers/fine_print/home_controller.rb +14 -0
- data/app/controllers/fine_print/home_controller.rb~ +15 -0
- data/app/controllers/fine_print/user_agreements_controller.rb +63 -0
- data/app/controllers/fine_print/user_agreements_controller.rb~ +63 -0
- data/app/models/fine_print/agreement.rb +50 -0
- data/app/models/fine_print/agreement.rb~ +50 -0
- data/app/models/fine_print/user_agreement.rb +19 -0
- data/app/models/fine_print/user_agreement.rb~ +21 -0
- data/app/views/fine_print/agreements/_agreement.html.erb +77 -0
- data/app/views/fine_print/agreements/_agreement.html.erb~ +77 -0
- data/app/views/fine_print/agreements/_dialog.html.erb +27 -0
- data/app/views/fine_print/agreements/_dialog.html.erb~ +27 -0
- data/app/views/fine_print/agreements/_form.html.erb +51 -0
- data/app/views/fine_print/agreements/_form.html.erb~ +51 -0
- data/app/views/fine_print/agreements/edit.html.erb +8 -0
- data/app/views/fine_print/agreements/edit.html.erb~ +8 -0
- data/app/views/fine_print/agreements/index.html.erb +32 -0
- data/app/views/fine_print/agreements/index.html.erb~ +32 -0
- data/app/views/fine_print/agreements/new.html.erb +7 -0
- data/app/views/fine_print/agreements/new.html.erb~ +7 -0
- data/app/views/fine_print/agreements/new_version.html.erb +7 -0
- data/app/views/fine_print/agreements/new_version.html.erb~ +7 -0
- data/app/views/fine_print/agreements/show.html.erb +15 -0
- data/app/views/fine_print/agreements/show.html.erb~ +14 -0
- data/app/views/fine_print/home/index.html.erb +7 -0
- data/app/views/fine_print/home/index.html.erb~ +7 -0
- data/app/views/fine_print/user_agreements/cancel.js.erb +1 -0
- data/app/views/fine_print/user_agreements/cancel.js.erb~ +2 -0
- data/app/views/fine_print/user_agreements/create.js.erb +2 -0
- data/app/views/fine_print/user_agreements/create.js.erb~ +2 -0
- data/app/views/fine_print/user_agreements/index.html.erb +25 -0
- data/app/views/fine_print/user_agreements/index.html.erb~ +25 -0
- data/app/views/layouts/fine_print/application.html.erb +14 -0
- data/config/initializers/fine_print.rb +53 -0
- data/config/initializers/fine_print.rb~ +53 -0
- data/config/routes.rb +7 -0
- data/config/routes.rb~ +7 -0
- data/db/migrate/0_create_fine_print_agreements.rb~ +22 -0
- data/db/migrate/0_install.rb +28 -0
- data/db/migrate/0_install.rb~ +28 -0
- data/lib/fine_print/agreements_helper.rb +13 -0
- data/lib/fine_print/agreements_helper.rb~ +11 -0
- data/lib/fine_print/engine.rb +5 -0
- data/lib/fine_print/fine_print_agreement.rb +26 -0
- data/lib/fine_print/fine_print_agreement.rb~ +26 -0
- data/lib/fine_print/require_agreement.rb~ +22 -0
- data/lib/fine_print/security_transgression.rb +4 -0
- data/lib/fine_print/security_transgression.rb~ +3 -0
- data/lib/fine_print/version.rb +3 -0
- data/lib/fine_print/version.rb~ +3 -0
- data/lib/fine_print.rb +69 -0
- data/lib/fine_print.rb~ +68 -0
- data/lib/tasks/fine_print_tasks.rake +42 -0
- data/lib/tasks/fine_print_tasks.rake~ +85 -0
- data/spec/dummy/README.md +3 -0
- data/spec/dummy/README.md~ +3 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +59 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +36 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +41 -0
- data/spec/dummy/log/test.log +3 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/fine_print_spec.rb +7 -0
- data/spec/fine_print_spec.rb~ +7 -0
- data/spec/minitest_helper.rb +12 -0
- metadata +277 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
<%= form_for(@agreement) do |f| %>
|
2
|
+
<% if @agreement.errors.any? %>
|
3
|
+
<div id="error_explanation" class="fine_print errors">
|
4
|
+
<h2 class="fine_print heading"><%= pluralize(@agreement.errors.count, "error") %> prohibited this agreement from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @agreement.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :name, :class => "fine_print label" %><br/>
|
16
|
+
<%= f.text_field :name, :size => 40, :class => "fine_print text_field" %><br/>
|
17
|
+
(e.g., "Terms of Use"; changing this will reset the version count)<br/><br/>
|
18
|
+
</div>
|
19
|
+
<div class="field">
|
20
|
+
<%= f.label :content, :class => "fine_print label" %><br/>
|
21
|
+
<%= f.text_area :content, :cols => 56, :class => "fine_print text_area" %><br/><br/>
|
22
|
+
</div>
|
23
|
+
<div class="field">
|
24
|
+
<%= f.label :confirmation_text, :class => "fine_print label" %><br/>
|
25
|
+
<%= f.text_field :confirmation_text, :size => 40, :class => "fine_print text_field" %><br/>
|
26
|
+
(e.g., "I have read and agree to the terms and conditions above")<br/><br/>
|
27
|
+
</div>
|
28
|
+
<div class="field">
|
29
|
+
<%= f.label :ready, "Display the agreement's name to users as a heading?", :class => "fine_print label" %>
|
30
|
+
<%= f.check_box :display_name, :class => "fine_print checkbox" %><br/><br/>
|
31
|
+
</div>
|
32
|
+
<div class="field">
|
33
|
+
<%= f.label :ready, "Display the agreement's version to users?", :class => "fine_print label" %>
|
34
|
+
<%= f.check_box :display_version, :class => "fine_print checkbox" %><br/><br/>
|
35
|
+
</div>
|
36
|
+
<div class="field">
|
37
|
+
<%= f.label :ready, "Display the agreement's last updated date to users?", :class => "fine_print label" %>
|
38
|
+
<%= f.check_box :display_updated, :class => "fine_print checkbox" %><br/><br/>
|
39
|
+
</div>
|
40
|
+
<div class="field">
|
41
|
+
<%= f.label :ready, "Display a confirmation checkbox that users have to click?", :class => "fine_print label" %>
|
42
|
+
<%= f.check_box :display_confirmation, :class => "fine_print checkbox" %><br/><br/>
|
43
|
+
</div>
|
44
|
+
<div class="field">
|
45
|
+
<%= f.label :ready, "Ready to be used?", :class => "fine_print label" %>
|
46
|
+
<%= f.check_box :ready, :class => "fine_print checkbox" %><br/><br/>
|
47
|
+
</div>
|
48
|
+
<div class="actions">
|
49
|
+
<%= f.submit nil, :class => "fine_print submit" %>
|
50
|
+
</div>
|
51
|
+
<% end %>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<%= form_for(@agreement) do |f| %>
|
2
|
+
<% if @agreement.errors.any? %>
|
3
|
+
<div id="error_explanation" class="fine_print errors">
|
4
|
+
<h2 class="fine_print heading"><%= pluralize(@agreement.errors.count, "error") %> prohibited this agreement from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @agreement.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :name, :class => "fine_print label" %><br/>
|
16
|
+
<%= f.text_field :name, :size => 40, :class => "fine_print text_field" %><br/>
|
17
|
+
(e.g., "Terms of Use"; changing this will reset the version count)<br/><br/>
|
18
|
+
</div>
|
19
|
+
<div class="field">
|
20
|
+
<%= f.label :content, :class => "fine_print label" %><br/>
|
21
|
+
<%= f.text_area :content, :cols => 56, :class => "fine_print text_area" %><br/><br/>
|
22
|
+
</div>
|
23
|
+
<div class="field">
|
24
|
+
<%= f.label :confirmation_text, :class => "fine_print label" %><br/>
|
25
|
+
<%= f.text_field :confirmation_text, :size => 40, :class => "fine_print text_field" %><br/>
|
26
|
+
(e.g., "I have read and agree to the terms and conditions above")<br/><br/>
|
27
|
+
</div>
|
28
|
+
<div class="field">
|
29
|
+
<%= f.label :ready, "Display the agreement's name to users (as a heading)?", :class => "fine_print label" %>
|
30
|
+
<%= f.check_box :display_name, :class => "fine_print checkbox" %><br/><br/>
|
31
|
+
</div>
|
32
|
+
<div class="field">
|
33
|
+
<%= f.label :ready, "Display the agreement's version to users?", :class => "fine_print label" %>
|
34
|
+
<%= f.check_box :display_version, :class => "fine_print checkbox" %><br/><br/>
|
35
|
+
</div>
|
36
|
+
<div class="field">
|
37
|
+
<%= f.label :ready, "Display the agreement's last updated date to users?", :class => "fine_print label" %>
|
38
|
+
<%= f.check_box :display_updated, :class => "fine_print checkbox" %><br/><br/>
|
39
|
+
</div>
|
40
|
+
<div class="field">
|
41
|
+
<%= f.label :ready, "Display a confirmation checkbox that users have to click?", :class => "fine_print label" %>
|
42
|
+
<%= f.check_box :display_confirmation, :class => "fine_print checkbox" %><br/><br/>
|
43
|
+
</div>
|
44
|
+
<div class="field">
|
45
|
+
<%= f.label :ready, "Ready to be used?", :class => "fine_print label" %>
|
46
|
+
<%= f.check_box :ready, :class => "fine_print checkbox" %><br/><br/>
|
47
|
+
</div>
|
48
|
+
<div class="actions">
|
49
|
+
<%= f.submit nil, :class => "fine_print submit" %>
|
50
|
+
</div>
|
51
|
+
<% end %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<h1 class="fine_print heading">FinePrint agreements</h1>
|
2
|
+
|
3
|
+
<table class="fine_print index">
|
4
|
+
<tr>
|
5
|
+
<th>Name</th>
|
6
|
+
<th>Version</th>
|
7
|
+
<th></th>
|
8
|
+
<th></th>
|
9
|
+
<th></th>
|
10
|
+
</tr>
|
11
|
+
|
12
|
+
<% @agreements.each do |agreement| %>
|
13
|
+
<tr>
|
14
|
+
<td><%= agreement.name %></td>
|
15
|
+
<td><%= agreement.version %></td>
|
16
|
+
<td><%= link_to 'Show', agreement, :class => "fine_print link" %></td>
|
17
|
+
<td><% if agreement.can_be_edited_by?(@user) %>
|
18
|
+
<%= link_to 'Edit', edit_agreement_path(agreement), :class => "fine_print link" %>
|
19
|
+
<% else %>
|
20
|
+
<%= link_to 'New version', agreement_new_version_path(agreement), :class => "fine_print link" %>
|
21
|
+
<% end %></td>
|
22
|
+
<td><% if agreement.can_be_destroyed_by?(@user) %>
|
23
|
+
<%= link_to 'Delete', agreement, method: :delete, data: { confirm: 'Are you sure you wish to delete this agreement?' }, :class => "fine_print link" %>
|
24
|
+
<% end %></td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</table>
|
28
|
+
|
29
|
+
<br />
|
30
|
+
|
31
|
+
<%= link_to 'New Agreement', new_agreement_path, :class => "fine_print link" %> |
|
32
|
+
<%= link_to 'Back', root_path, :class => "fine_print link" %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<h1 class="fine_print heading">FinePrint agreements</h1>
|
2
|
+
|
3
|
+
<table class="fine_print index">
|
4
|
+
<tr>
|
5
|
+
<th>Name</th>
|
6
|
+
<th>Version</th>
|
7
|
+
<th></th>
|
8
|
+
<th></th>
|
9
|
+
<th></th>
|
10
|
+
</tr>
|
11
|
+
|
12
|
+
<% @agreements.each do |agreement| %>
|
13
|
+
<tr>
|
14
|
+
<td><%= agreement.name %></td>
|
15
|
+
<td><%= agreement.version %></td>
|
16
|
+
<td><%= link_to 'Show', agreement, :class => "fine_print link" %></td>
|
17
|
+
<td><% if agreement.can_be_edited_by?(@user) %>
|
18
|
+
<%= link_to 'Edit', edit_agreement_path(agreement), :class => "fine_print link" %>
|
19
|
+
<% else %>
|
20
|
+
<%= link_to 'New version', agreement_new_version_path(agreement), :class => "fine_print link" %>
|
21
|
+
<% end %></td>
|
22
|
+
<td><% if agreement.can_be_destroyed_by?(@user) %>
|
23
|
+
<%= link_to 'Delete', agreement, method: :delete, data: { confirm: 'Are you sure?' }, :class => "fine_print link" %>
|
24
|
+
<% end %></td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</table>
|
28
|
+
|
29
|
+
<br />
|
30
|
+
|
31
|
+
<%= link_to 'New Agreement', new_agreement_path, :class => "fine_print link" %> |
|
32
|
+
<%= link_to 'Back', root_path, :class => "fine_print link" %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= render :partial => 'agreement', :locals => {
|
2
|
+
:agreement => @agreement,
|
3
|
+
:user => @user,
|
4
|
+
:notice => @notice,
|
5
|
+
:accept_path => @accept_path,
|
6
|
+
:cancel_path => @cancel_path,
|
7
|
+
:url => @url,
|
8
|
+
:ref => @ref } %>
|
9
|
+
|
10
|
+
<br/>
|
11
|
+
|
12
|
+
<% if @agreement.can_be_edited_by?(@user) %>
|
13
|
+
<%= link_to 'Edit', edit_agreement_path(@agreement), :class => "fine_print link" %> |
|
14
|
+
<%= link_to 'Back', agreements_path, :class => "fine_print link" %>
|
15
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= render :partial => 'agreement', :locals => {
|
2
|
+
:agreement => @agreement,
|
3
|
+
:user => @user,
|
4
|
+
:notice => @notice,
|
5
|
+
:accept_path => @accept_path,
|
6
|
+
:url => @url,
|
7
|
+
:ref => @ref } %>
|
8
|
+
|
9
|
+
<br/>
|
10
|
+
|
11
|
+
<% if @agreement.can_be_edited_by?(@user) %>
|
12
|
+
<%= link_to 'Edit', edit_agreement_path(@agreement), :class => "fine_print link" %> |
|
13
|
+
<%= link_to 'Back', agreements_path, :class => "fine_print link" %>
|
14
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
window.history.back();
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h1 class="fine_print heading">Accepted FinePrint agreements</h1>
|
2
|
+
|
3
|
+
<table class="fine_print index">
|
4
|
+
<tr>
|
5
|
+
<th>User ID</th>
|
6
|
+
<th>Agreement name</th>
|
7
|
+
<th>Agreement version</th>
|
8
|
+
<th>Date accepted</th>
|
9
|
+
<th></th>
|
10
|
+
</tr>
|
11
|
+
|
12
|
+
<% @user_agreements.each do |user_agreement| %>
|
13
|
+
<tr>
|
14
|
+
<td><%= user_agreement.user.id %></td>
|
15
|
+
<td><%= user_agreement.agreement.name %></td>
|
16
|
+
<td><%= user_agreement.agreement.version %></td>
|
17
|
+
<td><%= user_agreement.created_at %></td>
|
18
|
+
<td><%= link_to 'Terminate', user_agreement, method: :delete, data: { confirm: 'User will be asked to accept the agreement again. Are you sure?' }, :class => "fine_print link" %></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</table>
|
22
|
+
|
23
|
+
<br />
|
24
|
+
|
25
|
+
<%= link_to 'Back', root_path, :class => "fine_print link" %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h1 class="fine_print heading">Accepted FinePrint agreements</h1>
|
2
|
+
|
3
|
+
<table class="fine_print index">
|
4
|
+
<tr>
|
5
|
+
<th>User ID</th>
|
6
|
+
<th>Agreement name</th>
|
7
|
+
<th>Agreement version</th>
|
8
|
+
<th>Date accepted</th>
|
9
|
+
<th></th>
|
10
|
+
</tr>
|
11
|
+
|
12
|
+
<% @user_agreements.each do |user_agreement| %>
|
13
|
+
<tr>
|
14
|
+
<td><%= user_agreement.user.id %></td>
|
15
|
+
<td><%= user_agreement.agreement.name %></td>
|
16
|
+
<td><%= user_agreement.agreement.version %></td>
|
17
|
+
<td><%= user_agreement.created_at %></td>
|
18
|
+
<td><%= link_to 'Terminate', user_agreement, method: :delete, data: { confirm: 'Are you sure? User will be asked to accept the agreement again.' }, :class => "fine_print link" %></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</table>
|
22
|
+
|
23
|
+
<br />
|
24
|
+
|
25
|
+
<%= link_to 'Back', root_path, :class => "fine_print link" %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>FinePrint</title>
|
5
|
+
<%= stylesheet_link_tag "fine_print/application", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "fine_print/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Change the settings below to suit your needs
|
2
|
+
# All settings are initially set to their default values
|
3
|
+
FinePrint.configure do |config|
|
4
|
+
|
5
|
+
# Engine Options (initializer only)
|
6
|
+
|
7
|
+
# Name of the ApplicationController helper method that returns the current user
|
8
|
+
# Default: "current_user"
|
9
|
+
config.current_user_method = "current_user"
|
10
|
+
|
11
|
+
# Proc called with user as argument that should return true if and only if the user is an admin
|
12
|
+
# Admins can create and edit agreements and terminate accepted agreements
|
13
|
+
# Default: lambda { |user| false } (no admins)
|
14
|
+
config.user_admin_proc = lambda { |user| false }
|
15
|
+
|
16
|
+
# Path to redirect users to when an error occurs (e.g. permission denied on admin pages)
|
17
|
+
# Default: "/"
|
18
|
+
config.redirect_path = "/"
|
19
|
+
|
20
|
+
# Path to link users to if they need to sign in
|
21
|
+
# Set to nil to disable the link
|
22
|
+
# Default: "/"
|
23
|
+
config.sign_in_path = "/"
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
# Agreement Options (initializer or inline)
|
28
|
+
|
29
|
+
# Message to be displayed to the user explaining that they need to accept an agreement
|
30
|
+
# Set to nil to disable
|
31
|
+
# Default: "You must accept the following agreement to proceed."
|
32
|
+
config.agreement_notice = "You must accept the following agreement to proceed."
|
33
|
+
|
34
|
+
# Path to redirect users to when an agreement is accepted and referer information is unavailable
|
35
|
+
# Default: "/"
|
36
|
+
config.accept_path = "/"
|
37
|
+
|
38
|
+
# Path to redirect users to when an agreement is not accepted and referer information is unavailable
|
39
|
+
# Default: "/"
|
40
|
+
config.cancel_path = "/"
|
41
|
+
|
42
|
+
# Whether to use referer information to redirect users after (not) accepting an agreement
|
43
|
+
# Default: true
|
44
|
+
config.use_referers = true
|
45
|
+
|
46
|
+
# If set to true, modal jQuery UI dialogs will be used instead of redirecting the user to the agreement page
|
47
|
+
# Note: users with javascript disabled will not even see the agreement and will be able to proceed without accepting it
|
48
|
+
# if users are not supposed to ever see or interact with a certain page without accepting the agreement,
|
49
|
+
# disable this option for that particular controller action
|
50
|
+
# Default: false
|
51
|
+
config.use_modal_dialogs = false
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Change the settings below to suit your needs
|
2
|
+
# All settings are initially set to their default values
|
3
|
+
FinePrint.configure do |config|
|
4
|
+
|
5
|
+
# Engine Options (initializer only)
|
6
|
+
|
7
|
+
# Name of the ApplicationController helper method that returns the current user
|
8
|
+
# Default: "current_user"
|
9
|
+
config.current_user_method = "current_user"
|
10
|
+
|
11
|
+
# Proc called with user as argument that should return true if and only if the user is an admin
|
12
|
+
# Admins can create and edit agreements and terminate accepted agreements
|
13
|
+
# Default: lambda { |user| false } (no admins)
|
14
|
+
config.user_admin_proc = lambda { |user| false }
|
15
|
+
|
16
|
+
# Path to redirect users to when an error occurs (e.g. permission denied on admin pages)
|
17
|
+
# Default: "/"
|
18
|
+
config.redirect_path = "/"
|
19
|
+
|
20
|
+
# Path to link users to if they need to sign in
|
21
|
+
# Set to nil to disable the link
|
22
|
+
# Default: "/"
|
23
|
+
config.sign_in_path = "/"
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
# Agreement Options (initializer or inline)
|
28
|
+
|
29
|
+
# Message to be displayed to the user explaining that they need to accept an agreement
|
30
|
+
# Set to nil to disable
|
31
|
+
# Default: "You must accept the following agreement to proceed."
|
32
|
+
config.agreement_notice = "You must accept the following agreement to proceed."
|
33
|
+
|
34
|
+
# Path to redirect users to when an agreement is accepted and referer information is unavailable
|
35
|
+
# Default: "/"
|
36
|
+
config.accept_path = "/"
|
37
|
+
|
38
|
+
# Path to redirect users to when an agreement is not accepted and referer information is unavailable
|
39
|
+
# Default: "/"
|
40
|
+
config.cancel_path = "/"
|
41
|
+
|
42
|
+
# Whether to use referer information to redirect users after (not) accepting an agreement
|
43
|
+
# Default: true
|
44
|
+
config.use_referers = true
|
45
|
+
|
46
|
+
# If set to true, modal jQuery UI dialogs will be used instead of redirecting the user to the agreement page
|
47
|
+
# Note: users with javascript disabled will not even see the agreement and will be able to proceed without accepting it
|
48
|
+
# if users are not supposed to ever see or interact with a certain page without accepting the agreement,
|
49
|
+
# disable this option for that particular controller action
|
50
|
+
# Default: false
|
51
|
+
config.use_modal_dialogs = false
|
52
|
+
|
53
|
+
end
|
data/config/routes.rb
ADDED
data/config/routes.rb~
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateFinePrintAgreements < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :fine_print_agreements do |t|
|
4
|
+
t.string :name
|
5
|
+
t.text :content
|
6
|
+
t.integer :version
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
create_table :fine_print_user_agreements do |t|
|
12
|
+
t.integer :user_id
|
13
|
+
t.integer :agreement_id
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
|
18
|
+
add_index :fine_print_agreements, [:name, :version]
|
19
|
+
add_index :fine_print_user_agreements, [:user_id, :agreement_id]
|
20
|
+
add_index :fine_print_user_agreements, :agreement_id
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Install < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :fine_print_agreements do |t|
|
4
|
+
t.string :name, :null => false
|
5
|
+
t.integer :version, :null => false
|
6
|
+
t.text :content, :null => false
|
7
|
+
t.string :confirmation_text, :default => 'I have read and agree to the terms and conditions above', :null => false
|
8
|
+
t.boolean :display_name, :default => true
|
9
|
+
t.boolean :display_version, :default => false
|
10
|
+
t.boolean :display_updated, :default => false
|
11
|
+
t.boolean :display_confirmation, :default => true
|
12
|
+
t.boolean :ready, :default => false
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
create_table :fine_print_user_agreements do |t|
|
18
|
+
t.integer :agreement_id, :null => false
|
19
|
+
t.references :user, :polymorphic => true, :null => false
|
20
|
+
|
21
|
+
t.timestamps
|
22
|
+
end
|
23
|
+
|
24
|
+
add_index :fine_print_agreements, [:name, :version]
|
25
|
+
add_index :fine_print_user_agreements, :agreement_id
|
26
|
+
add_index :fine_print_user_agreements, [:user_id, :user_type, :agreement_id], :name => 'index_fine_print_u_a_on_u_id_and_u_type_and_a_id'
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Install < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :fine_print_agreements do |t|
|
4
|
+
t.string :name, :null => false
|
5
|
+
t.integer :version, :null => false
|
6
|
+
t.text :content, :null => false
|
7
|
+
t.string :confirmation_text, :default => 'I have read and agree to the terms and conditions above', :null => false
|
8
|
+
t.boolean :display_name, :default => true
|
9
|
+
t.boolean :display_version, :default => false
|
10
|
+
t.boolean :display_updated, :default => false
|
11
|
+
t.boolean :display_confirmation, :default => true
|
12
|
+
t.boolean :ready, :default => false
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
create_table :fine_print_user_agreements do |t|
|
18
|
+
t.integer :agreement_id, :null => false
|
19
|
+
t.references :user, :polymorphic => true
|
20
|
+
|
21
|
+
t.timestamps
|
22
|
+
end
|
23
|
+
|
24
|
+
add_index :fine_print_agreements, [:name, :version]
|
25
|
+
add_index :fine_print_user_agreements, :agreement_id
|
26
|
+
add_index :fine_print_user_agreements, [:user_id, :user_type, :agreement_id], :name => 'index_fine_print_u_a_on_u_id_and_u_type_and_a_id'
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module FinePrint
|
2
|
+
module AgreementsHelper
|
3
|
+
def fine_print_dialog(options = {})
|
4
|
+
render :partial => 'fine_print/agreements/dialog',
|
5
|
+
:locals => {:agreements => @fine_print_dialog_agreements,
|
6
|
+
:user => @fine_print_user,
|
7
|
+
:notice => @fine_print_dialog_notice,
|
8
|
+
:width => options[:width],
|
9
|
+
:height => options[:height]} \
|
10
|
+
unless @fine_print_dialog_agreements.blank?
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module FinePrint
|
2
|
+
module AgreementsHelper
|
3
|
+
def fine_print_dialog(options = {})
|
4
|
+
render :partial => 'fine_print/agreements/dialog',
|
5
|
+
:locals => {:agreements => @fine_print_dialog_agreements,
|
6
|
+
:user => @fine_print_user,
|
7
|
+
:notice => @fine_print_dialog_notice} \
|
8
|
+
unless @fine_print_dialog_agreements.blank?
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'fine_print/agreements_helper'
|
2
|
+
|
3
|
+
module FinePrint
|
4
|
+
module FinePrintAgreement
|
5
|
+
def self.included(base)
|
6
|
+
base.helper FinePrint::AgreementsHelper
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def fine_print_agreement(*args)
|
12
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
13
|
+
class_eval do
|
14
|
+
before_filter(options.except(*FinePrint::AGREEMENT_OPTIONS)) do |controller|
|
15
|
+
FinePrint.require_agreements(controller, args, options.slice(*FinePrint::AGREEMENT_OPTIONS))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
alias_method :fine_print_agreements, :fine_print_agreement
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
ActionController::Base.send :include, FinePrint::FinePrintAgreement
|
26
|
+
|