fine_print 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +74 -45
  3. data/Rakefile +9 -9
  4. data/app/assets/javascripts/application.js~ +16 -0
  5. data/app/assets/javascripts/fine_print/application.js +8 -2
  6. data/app/controllers/fine_print/application_controller.rb +9 -7
  7. data/app/controllers/fine_print/application_controller.rb~ +9 -7
  8. data/app/controllers/fine_print/contracts_controller.rb +79 -0
  9. data/app/controllers/fine_print/contracts_controller.rb~ +79 -0
  10. data/app/controllers/fine_print/home_controller.rb +1 -11
  11. data/app/controllers/fine_print/home_controller.rb~ +2 -11
  12. data/app/controllers/fine_print/signatures_controller.rb +14 -0
  13. data/app/controllers/fine_print/signatures_controller.rb~ +14 -0
  14. data/app/helpers/fine_print/application_helper.rb +7 -0
  15. data/app/helpers/fine_print/application_helper.rb~ +7 -0
  16. data/app/helpers/fine_print/contracts_helper.rb~ +7 -0
  17. data/app/models/fine_print/contract.rb +96 -0
  18. data/app/models/fine_print/contract.rb~ +100 -0
  19. data/app/models/fine_print/signature.rb +25 -0
  20. data/app/models/fine_print/signature.rb~ +25 -0
  21. data/app/views/fine_print/contracts/_form.html.erb +35 -0
  22. data/app/views/fine_print/contracts/_form.html.erb~ +35 -0
  23. data/app/views/fine_print/contracts/edit.html.erb +10 -0
  24. data/app/views/fine_print/contracts/index.html.erb +43 -0
  25. data/app/views/fine_print/contracts/index.html.erb~ +43 -0
  26. data/app/views/fine_print/contracts/new.html.erb +9 -0
  27. data/app/views/fine_print/contracts/new_version.html.erb +9 -0
  28. data/app/views/fine_print/contracts/show.html.erb +33 -0
  29. data/app/views/fine_print/contracts/show.html.erb~ +35 -0
  30. data/app/views/fine_print/home/index.html.erb +15 -6
  31. data/app/views/fine_print/home/index.html.erb~ +12 -4
  32. data/app/views/fine_print/signatures/index.html.erb +36 -0
  33. data/app/views/fine_print/signatures/index.html.erb~ +32 -0
  34. data/app/views/layouts/fine_print/application.html.erb +6 -0
  35. data/app/views/layouts/fine_print/application.html.erb~ +20 -0
  36. data/config/initializers/fine_print.rb +27 -44
  37. data/config/initializers/fine_print.rb~ +23 -40
  38. data/config/routes.rb +9 -3
  39. data/config/routes.rb~ +9 -4
  40. data/db/migrate/0_install_fine_print.rb +26 -0
  41. data/db/migrate/0_install_fine_print.rb~ +26 -0
  42. data/lib/fine_print/controller_additions.rb +69 -0
  43. data/lib/fine_print/controller_additions.rb~ +69 -0
  44. data/lib/fine_print/engine.rb +8 -0
  45. data/lib/fine_print/security_transgression.rb +1 -2
  46. data/lib/fine_print/utilities.rb~ +26 -0
  47. data/lib/fine_print/version.rb +1 -1
  48. data/lib/fine_print.rb +89 -42
  49. data/lib/fine_print.rb~ +89 -41
  50. data/lib/tasks/fine_print_tasks.rake +11 -8
  51. data/spec/controllers/contracts_controller_spec.rb +222 -0
  52. data/spec/controllers/contracts_controller_spec.rb~ +224 -0
  53. data/spec/controllers/home_controller_spec.rb +25 -0
  54. data/spec/controllers/home_controller_spec.rb~ +25 -0
  55. data/spec/controllers/signatures_controller_spec.rb +46 -0
  56. data/spec/controllers/signatures_controller_spec.rb~ +46 -0
  57. data/spec/dummy/README.md +1 -1
  58. data/spec/dummy/app/controllers/dummy_models_controller.rb +2 -0
  59. data/spec/dummy/app/controllers/dummy_models_controller.rb~ +29 -0
  60. data/spec/dummy/app/helpers/application_helper.rb +13 -0
  61. data/spec/dummy/app/models/dummy_user.rb +3 -0
  62. data/spec/dummy/app/models/dummy_user.rb~ +4 -0
  63. data/spec/dummy/app/models/user.rb~ +78 -0
  64. data/spec/dummy/config/application.rb +2 -2
  65. data/spec/dummy/config/application.rb~ +60 -0
  66. data/spec/dummy/config/initializers/fine_print.rb +36 -0
  67. data/spec/dummy/config/initializers/fine_print.rb~ +36 -0
  68. data/spec/dummy/config/initializers/session_store.rb +1 -1
  69. data/spec/dummy/config/initializers/session_store.rb~ +8 -0
  70. data/spec/dummy/config/initializers/wrap_parameters.rb +1 -1
  71. data/spec/dummy/config/initializers/wrap_parameters.rb~ +14 -0
  72. data/spec/dummy/config/routes.rb +1 -2
  73. data/spec/dummy/config/routes.rb~ +4 -0
  74. data/spec/dummy/db/development.sqlite3 +0 -0
  75. data/spec/dummy/db/migrate/1_create_dummy_users.rb +9 -0
  76. data/spec/dummy/db/migrate/1_create_dummy_users.rb~ +8 -0
  77. data/spec/dummy/db/schema.rb +20 -12
  78. data/spec/dummy/db/test.sqlite3 +0 -0
  79. data/spec/dummy/log/development.log +1635 -0
  80. data/spec/dummy/log/test.log +46188 -0
  81. data/spec/factories/contract.rb +25 -0
  82. data/spec/factories/contract.rb~ +26 -0
  83. data/spec/factories/dummy_user.rb +4 -0
  84. data/spec/factories/dummy_user.rb~ +6 -0
  85. data/spec/factories/signature.rb +6 -0
  86. data/spec/factories/signature.rb~ +8 -0
  87. data/spec/factories/user.rb~ +6 -0
  88. data/spec/fine_print_spec.rb~ +15 -4
  89. data/spec/lib/fine_print/controller_additions_spec.rb +20 -0
  90. data/spec/lib/fine_print/controller_additions_spec.rb~ +20 -0
  91. data/spec/lib/fine_print_spec.rb +47 -0
  92. data/spec/lib/fine_print_spec.rb~ +47 -0
  93. data/spec/models/contract_spec.rb +79 -0
  94. data/spec/models/contract_spec.rb~ +80 -0
  95. data/spec/models/signature_spec.rb +28 -0
  96. data/spec/models/signature_spec.rb~ +28 -0
  97. data/spec/spec_helper.rb +31 -0
  98. data/spec/spec_helper.rb~ +32 -0
  99. data/spec/test_helper.rb~ +15 -0
  100. metadata +153 -91
  101. data/app/assets/javascripts/fine_print/agreements.js +0 -19
  102. data/app/assets/javascripts/fine_print/agreements.js~ +0 -19
  103. data/app/assets/javascripts/fine_print/application.js~ +0 -5
  104. data/app/assets/javascripts/fine_print/dialog.js +0 -2
  105. data/app/assets/javascripts/fine_print/dialog.js~ +0 -2
  106. data/app/assets/javascripts/fine_print/user_agreements.js +0 -20
  107. data/app/assets/javascripts/fine_print/user_agreements.js~ +0 -20
  108. data/app/assets/stylesheets/fine_print/agreements.css +0 -11
  109. data/app/assets/stylesheets/fine_print/agreements.css~ +0 -11
  110. data/app/assets/stylesheets/fine_print/application.css~ +0 -60
  111. data/app/assets/stylesheets/fine_print/user_agreements.css~ +0 -3
  112. data/app/assets/stylesheets/scaffold.css~ +0 -56
  113. data/app/controllers/fine_print/agreements_controller.rb +0 -114
  114. data/app/controllers/fine_print/agreements_controller.rb~ +0 -113
  115. data/app/controllers/fine_print/user_agreements_controller.rb +0 -63
  116. data/app/controllers/fine_print/user_agreements_controller.rb~ +0 -63
  117. data/app/models/fine_print/agreement.rb +0 -50
  118. data/app/models/fine_print/agreement.rb~ +0 -50
  119. data/app/models/fine_print/user_agreement.rb +0 -19
  120. data/app/models/fine_print/user_agreement.rb~ +0 -21
  121. data/app/views/fine_print/agreements/_agreement.html.erb +0 -77
  122. data/app/views/fine_print/agreements/_agreement.html.erb~ +0 -77
  123. data/app/views/fine_print/agreements/_dialog.html.erb +0 -27
  124. data/app/views/fine_print/agreements/_dialog.html.erb~ +0 -27
  125. data/app/views/fine_print/agreements/_form.html.erb +0 -51
  126. data/app/views/fine_print/agreements/_form.html.erb~ +0 -51
  127. data/app/views/fine_print/agreements/edit.html.erb +0 -8
  128. data/app/views/fine_print/agreements/edit.html.erb~ +0 -8
  129. data/app/views/fine_print/agreements/index.html.erb +0 -32
  130. data/app/views/fine_print/agreements/index.html.erb~ +0 -32
  131. data/app/views/fine_print/agreements/new.html.erb +0 -7
  132. data/app/views/fine_print/agreements/new.html.erb~ +0 -7
  133. data/app/views/fine_print/agreements/new_version.html.erb +0 -7
  134. data/app/views/fine_print/agreements/new_version.html.erb~ +0 -7
  135. data/app/views/fine_print/agreements/show.html.erb +0 -15
  136. data/app/views/fine_print/agreements/show.html.erb~ +0 -14
  137. data/app/views/fine_print/user_agreements/cancel.js.erb +0 -1
  138. data/app/views/fine_print/user_agreements/cancel.js.erb~ +0 -2
  139. data/app/views/fine_print/user_agreements/create.js.erb +0 -2
  140. data/app/views/fine_print/user_agreements/create.js.erb~ +0 -2
  141. data/app/views/fine_print/user_agreements/index.html.erb +0 -25
  142. data/app/views/fine_print/user_agreements/index.html.erb~ +0 -25
  143. data/db/migrate/0_create_fine_print_agreements.rb~ +0 -22
  144. data/db/migrate/0_install.rb +0 -28
  145. data/db/migrate/0_install.rb~ +0 -28
  146. data/lib/fine_print/agreements_helper.rb +0 -13
  147. data/lib/fine_print/agreements_helper.rb~ +0 -11
  148. data/lib/fine_print/fine_print_agreement.rb +0 -26
  149. data/lib/fine_print/fine_print_agreement.rb~ +0 -26
  150. data/lib/fine_print/require_agreement.rb~ +0 -22
  151. data/lib/fine_print/security_transgression.rb~ +0 -3
  152. data/lib/fine_print/version.rb~ +0 -3
  153. data/lib/tasks/fine_print_tasks.rake~ +0 -42
  154. data/spec/dummy/README.md~ +0 -3
  155. data/spec/fine_print_spec.rb +0 -7
  156. data/spec/minitest_helper.rb +0 -12
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ module FinePrint
4
+ describe SignaturesController do
5
+ routes { FinePrint::Engine.routes }
6
+
7
+ before do
8
+ setup_controller_spec
9
+ @signature = FactoryGirl.create(:signature)
10
+ @signature.reload
11
+ end
12
+
13
+ it "won't get index unless authorized" do
14
+ get :index, :use_route => :fine_print
15
+ assert_redirected_to FinePrint.redirect_path
16
+
17
+ sign_in @user
18
+ get :index, :use_route => :fine_print
19
+ assert_redirected_to FinePrint.redirect_path
20
+ end
21
+
22
+ it 'must get index if authorized' do
23
+ sign_in @admin
24
+ get :index, :use_route => :fine_print
25
+ assert_response :success
26
+ end
27
+
28
+ it "won't destroy unless authorized" do
29
+ delete :destroy, :id => @signature.id, :use_route => :fine_print
30
+ assert_redirected_to FinePrint.redirect_path
31
+ expect(Signature.find(@signature.id)).to eq @signature
32
+
33
+ sign_in @user
34
+ delete :destroy, :id => @signature.id, :use_route => :fine_print
35
+ assert_redirected_to FinePrint.redirect_path
36
+ expect(Signature.find(@signature.id)).to eq @signature
37
+ end
38
+
39
+ it 'must destroy if authorized' do
40
+ sign_in @admin
41
+ delete :destroy, :id => @signature.id, :use_route => :fine_print
42
+ assert_redirected_to signatures_path
43
+ expect(Signature.find_by_id(@signature.id)).to be_nil
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ module FinePrint
4
+ describe SignaturesController do
5
+ routes { FinePrint::Engine.routes }
6
+
7
+ before do
8
+ setup_controller_spec
9
+ @signature = FactoryGirl.create(:signature)
10
+ @signature.reload
11
+ end
12
+
13
+ it 'won''t get index unless authorized' do
14
+ get :index, :use_route => :fine_print
15
+ assert_redirected_to FinePrint.redirect_path
16
+
17
+ sign_in @user
18
+ get :index, :use_route => :fine_print
19
+ assert_redirected_to FinePrint.redirect_path
20
+ end
21
+
22
+ it 'must get index if authorized' do
23
+ sign_in @admin
24
+ get :index, :use_route => :fine_print
25
+ assert_response :success
26
+ end
27
+
28
+ it 'won''t destroy unless authorized' do
29
+ delete :destroy, :id => @signature.id, :use_route => :fine_print
30
+ assert_redirected_to FinePrint.redirect_path
31
+ expect(Signature.find(@signature.id)).to eq @signature
32
+
33
+ sign_in @user
34
+ delete :destroy, :id => @signature.id, :use_route => :fine_print
35
+ assert_redirected_to FinePrint.redirect_path
36
+ expect(Signature.find(@signature.id)).to eq @signature
37
+ end
38
+
39
+ it 'must destroy if authorized' do
40
+ sign_in @admin
41
+ delete :destroy, :id => @signature.id, :use_route => :fine_print
42
+ assert_redirected_to signatures_path
43
+ expect(Signature.find_by_id(@signature.id)).to be_nil
44
+ end
45
+ end
46
+ end
data/spec/dummy/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  ## Dummy
2
2
 
3
- A dummy application used to test the Fine Print engine.
3
+ A dummy application used to test the FinePrint engine.
@@ -0,0 +1,2 @@
1
+ class DummyModelsController < ActionController::Base
2
+ end
@@ -0,0 +1,29 @@
1
+ class DummyModelsController < ActionController::Base
2
+ before_filter :get_dummy
3
+
4
+ def hide
5
+ render :show
6
+ end
7
+
8
+ def show
9
+ commontator_thread_show(@dummy_model)
10
+ end
11
+
12
+ def url_options
13
+ return Hash.new if request.nil?
14
+ super
15
+ end
16
+
17
+ def view_context
18
+ view_context = view_context_class.new
19
+ view_context.view_paths = view_paths
20
+ view_context.controller = self
21
+ view_context
22
+ end
23
+
24
+ protected
25
+
26
+ def get_dummy
27
+ @dummy_model = DummyModel.find(params[:id])
28
+ end
29
+ end
@@ -1,2 +1,15 @@
1
1
  module ApplicationHelper
2
+ @@user = nil
3
+
4
+ def current_user
5
+ @@user
6
+ end
7
+
8
+ def sign_in(user)
9
+ @@user = user
10
+ end
11
+
12
+ def sign_out
13
+ @@user = nil
14
+ end
2
15
  end
@@ -0,0 +1,3 @@
1
+ class DummyUser < ActiveRecord::Base
2
+ # attr_accessible :title, :body
3
+ end
@@ -0,0 +1,4 @@
1
+ module FinePrint
2
+ class DummyUser < ActiveRecord::Base
3
+ end
4
+ end
@@ -0,0 +1,78 @@
1
+ module FinePrint
2
+ class User < ActiveRecord::Base
3
+ has_many :signatures, :inverse_of => :contract
4
+
5
+ has_many :same_name, :class_name => 'Contract', :primary_key => :name, :foreign_key => :name
6
+
7
+ attr_accessible :content, :title, :name
8
+
9
+ before_validation :downcase_name
10
+
11
+ validates_presence_of :name, :title, :content
12
+ validates_format_of :name, :with => /\A\w+\z/
13
+ validates_uniqueness_of :version, :scope => :name, :case_sensitive => false
14
+
15
+ default_scope order(:name, 'version DESC')
16
+
17
+ scope :published, where(arel_table[:version].not_eq(nil))
18
+ scope :latest, published
19
+ .joins(:same_name)
20
+ .group(:id)
21
+ .having(:version => arel_table.alias(:same_names_fine_print_contracts)[:version]
22
+ .maximum.tap{|mvq| mvq.alias = nil})
23
+
24
+ def is_published?
25
+ !version.nil?
26
+ end
27
+
28
+ def is_latest?
29
+ is_published? && version == same_name.maximum(:version)
30
+ end
31
+
32
+ def sign(user)
33
+ FinePrint.sign_contract(self, user)
34
+ end
35
+
36
+ def signed_by?(user)
37
+ FinePrint.signed_contract?(self, user)
38
+ end
39
+
40
+ def publish
41
+ self.version = (same_name.published.first.try(:version) || 0) + 1
42
+ save
43
+ end
44
+
45
+ def unpublish
46
+ self.version = nil
47
+ save
48
+ end
49
+
50
+ def draft_copy
51
+ dup.tap{|contract| contract.version = nil}
52
+ end
53
+
54
+ ##################
55
+ # Access Control #
56
+ ##################
57
+
58
+ def can_be_updated?
59
+ signatures.empty?
60
+ end
61
+
62
+ def can_be_published?
63
+ signatures.empty? && !is_published?
64
+ end
65
+
66
+ def can_be_unpublished?
67
+ signatures.empty? && is_latest?
68
+ end
69
+
70
+ alias_method :can_be_destroyed?, :can_be_updated?
71
+
72
+ protected
73
+
74
+ def downcase_name
75
+ self.name = name.downcase
76
+ end
77
+ end
78
+ end
@@ -3,7 +3,7 @@ require File.expand_path('../boot', __FILE__)
3
3
  require 'rails/all'
4
4
 
5
5
  Bundler.require
6
- require "fine_print"
6
+ require 'fine_print'
7
7
 
8
8
  module Dummy
9
9
  class Application < Rails::Application
@@ -30,7 +30,7 @@ module Dummy
30
30
  # config.i18n.default_locale = :de
31
31
 
32
32
  # Configure the default encoding used in templates for Ruby 1.9.
33
- config.encoding = "utf-8"
33
+ config.encoding = 'utf-8'
34
34
 
35
35
  # Configure sensitive parameters which will be filtered from the log file.
36
36
  config.filter_parameters += [:password]
@@ -0,0 +1,60 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require
6
+ require 'fine_print'
7
+ require 'devise'
8
+
9
+ module Dummy
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Custom directories with classes and modules you want to be autoloadable.
16
+ # config.autoload_paths += %W(#{config.root}/extras)
17
+
18
+ # Only load the plugins named here, in the order given (default is alphabetical).
19
+ # :all can be used as a placeholder for all plugins not explicitly named.
20
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
21
+
22
+ # Activate observers that should always be running.
23
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
24
+
25
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27
+ # config.time_zone = 'Central Time (US & Canada)'
28
+
29
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
30
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31
+ # config.i18n.default_locale = :de
32
+
33
+ # Configure the default encoding used in templates for Ruby 1.9.
34
+ config.encoding = 'utf-8'
35
+
36
+ # Configure sensitive parameters which will be filtered from the log file.
37
+ config.filter_parameters += [:password]
38
+
39
+ # Enable escaping HTML in JSON.
40
+ config.active_support.escape_html_entities_in_json = true
41
+
42
+ # Use SQL instead of Active Record's schema dumper when creating the database.
43
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
44
+ # like if you have constraints or database-specific column types
45
+ # config.active_record.schema_format = :sql
46
+
47
+ # Enforce whitelist mode for mass assignment.
48
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
49
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
50
+ # parameters by using an attr_accessible or attr_protected declaration.
51
+ config.active_record.whitelist_attributes = true
52
+
53
+ # Enable the asset pipeline
54
+ config.assets.enabled = true
55
+
56
+ # Version of your assets, change this if you want to expire all your assets
57
+ config.assets.version = '1.0'
58
+ end
59
+ end
60
+
@@ -0,0 +1,36 @@
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
+ # Engine Configuration
5
+
6
+ # Name of the ApplicationController helper method that returns the current user.
7
+ # Default: 'current_user'
8
+ config.current_user_method = 'current_user'
9
+
10
+ # Proc called with user as argument that should return true if and only if the user is an admin.
11
+ # Admins can create and edit agreements and terminate accepted agreements.
12
+ # Default: lambda { |user| false } (no admins)
13
+ config.user_admin_proc = lambda { |user| user.is_admin }
14
+
15
+ # Proc that returns true if and only if the provided user is logged in.
16
+ # In many systems, a non-logged-in user is represented by nil.
17
+ # However, some systems use something like an AnonymousUser class to represent this state.
18
+ # This proc is mostly used to help the developer realize that they should only be asking
19
+ # signed in users to sign contracts; without this, developers would get a cryptic SQL error.
20
+ # Default: lambda { |user| !user.nil? }
21
+ config.user_signed_in_proc = lambda { |user| !user.nil? }
22
+
23
+ # Path to redirect users to when an error occurs (e.g. permission denied on admin pages).
24
+ # Default: '/'
25
+ config.redirect_path = '/'
26
+
27
+ # Signature (fine_print_get_signatures) Configuration
28
+
29
+ # Path to redirect users to when they need to agree to contract(s).
30
+ # A list of contract names that must be agreed to will be available in the 'contracts' parameter.
31
+ # Your code doesn't have to deal with all of them at once, e.g. you can get
32
+ # the user to agree to the first one and then they'll just eventually be
33
+ # redirected back to this page with the remaining contract names.
34
+ # Default: '/'
35
+ config.pose_contracts_path = '/'
36
+ end
@@ -0,0 +1,36 @@
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
+ # Engine Configuration
5
+
6
+ # Name of the ApplicationController helper method that returns the current user.
7
+ # Default: 'current_user'
8
+ config.current_user_method = 'current_user'
9
+
10
+ # Proc called with user as argument that should return true if and only if the user is an admin.
11
+ # Admins can create and edit agreements and terminate accepted agreements.
12
+ # Default: lambda { |user| false } (no admins)
13
+ config.user_admin_proc = lambda { |user| false }
14
+
15
+ # Proc that returns true if and only if the provided user is logged in.
16
+ # In many systems, a non-logged-in user is represented by nil.
17
+ # However, some systems use something like an AnonymousUser class to represent this state.
18
+ # This proc is mostly used to help the developer realize that they should only be asking
19
+ # signed in users to sign contracts; without this, developers would get a cryptic SQL error.
20
+ # Default: lambda { |user| !user.nil? }
21
+ config.user_signed_in_proc = lambda { |user| !user.nil? }
22
+
23
+ # Path to redirect users to when an error occurs (e.g. permission denied on admin pages).
24
+ # Default: '/'
25
+ config.redirect_path = '/'
26
+
27
+ # Signature (fine_print_get_signatures) Configuration
28
+
29
+ # Path to redirect users to when they need to agree to contract(s).
30
+ # A list of contract names that must be agreed to will be available in the 'contracts' parameter.
31
+ # Your code doesn't have to deal with all of them at once, e.g. you can get
32
+ # the user to agree to the first one and then they'll just eventually be
33
+ # redirected back to this page with the remaining contract names.
34
+ # Default: '/'
35
+ config.pose_contracts_path = '/'
36
+ end
@@ -1,6 +1,6 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
3
+ Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
4
4
 
5
5
  # Use the database for sessions instead of the cookie-based default,
6
6
  # which shouldn't be used to store highly confidential information
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -5,7 +5,7 @@
5
5
 
6
6
  # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
7
  ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json]
8
+ wrap_parameters :format => [:json]
9
9
  end
10
10
 
11
11
  # Disable root element in JSON by default.
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -1,4 +1,3 @@
1
1
  Rails.application.routes.draw do
2
-
3
- mount FinePrint::Engine => "/fine_print"
2
+ mount FinePrint::Engine => '/fine_print'
4
3
  end
@@ -0,0 +1,4 @@
1
+ Rails.application.routes.draw do
2
+
3
+ mount FinePrint::Engine => "/fine_print"
4
+ end
Binary file
@@ -0,0 +1,9 @@
1
+ class CreateDummyUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :dummy_users do |t|
4
+ t.boolean :is_admin, :null => false, :default => false
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ class CreateDummyUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :dummy_users do |t|
4
+
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -11,26 +11,34 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 0) do
14
+ ActiveRecord::Schema.define(:version => 1) do
15
15
 
16
- create_table "fine_print_agreements", :force => true do |t|
17
- t.string "name"
18
- t.text "content"
16
+ create_table "dummy_users", :force => true do |t|
17
+ t.boolean "is_admin", :default => false, :null => false
18
+ t.datetime "created_at", :null => false
19
+ t.datetime "updated_at", :null => false
20
+ end
21
+
22
+ create_table "fine_print_contracts", :force => true do |t|
23
+ t.string "name", :null => false
19
24
  t.integer "version"
25
+ t.string "title", :null => false
26
+ t.text "content", :null => false
20
27
  t.datetime "created_at", :null => false
21
28
  t.datetime "updated_at", :null => false
22
29
  end
23
30
 
24
- add_index "fine_print_agreements", ["name", "version"], :name => "index_fine_print_agreements_on_name_and_version"
31
+ add_index "fine_print_contracts", ["name", "version"], :name => "index_fine_print_contracts_on_name_and_version", :unique => true
25
32
 
26
- create_table "fine_print_user_agreements", :force => true do |t|
27
- t.integer "user_id"
28
- t.integer "agreement_id"
29
- t.datetime "created_at", :null => false
30
- t.datetime "updated_at", :null => false
33
+ create_table "fine_print_signatures", :force => true do |t|
34
+ t.integer "contract_id", :null => false
35
+ t.integer "user_id", :null => false
36
+ t.string "user_type", :null => false
37
+ t.datetime "created_at", :null => false
38
+ t.datetime "updated_at", :null => false
31
39
  end
32
40
 
33
- add_index "fine_print_user_agreements", ["agreement_id"], :name => "index_fine_print_user_agreements_on_agreement_id"
34
- add_index "fine_print_user_agreements", ["user_id", "agreement_id"], :name => "index_fine_print_user_agreements_on_user_id_and_agreement_id"
41
+ add_index "fine_print_signatures", ["contract_id"], :name => "index_fine_print_signatures_on_contract_id"
42
+ add_index "fine_print_signatures", ["user_id", "user_type", "contract_id"], :name => "index_fine_print_s_on_u_id_and_u_type_and_c_id", :unique => true
35
43
 
36
44
  end
Binary file