fine_print 1.3.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +56 -44
  3. data/app/controllers/fine_print/application_controller.rb +0 -3
  4. data/app/models/fine_print/contract.rb +9 -8
  5. data/app/models/fine_print/signature.rb +1 -1
  6. data/config/initializers/fine_print.rb +20 -16
  7. data/db/migrate/0_install_fine_print.rb +4 -3
  8. data/lib/fine_print/controller_includes.rb +114 -0
  9. data/lib/fine_print/version.rb +1 -1
  10. data/lib/fine_print.rb +20 -24
  11. data/spec/controllers/contracts_controller_spec.rb +38 -36
  12. data/spec/controllers/home_controller_spec.rb +4 -4
  13. data/spec/controllers/signatures_controller_spec.rb +8 -8
  14. data/spec/dummy/Rakefile +0 -1
  15. data/spec/dummy/app/assets/javascripts/application.js +3 -5
  16. data/spec/dummy/app/views/layouts/application.html.erb +2 -2
  17. data/spec/dummy/bin/bundle +3 -0
  18. data/spec/dummy/bin/rails +4 -0
  19. data/spec/dummy/bin/rake +4 -0
  20. data/spec/dummy/config/application.rb +3 -37
  21. data/spec/dummy/config/boot.rb +4 -9
  22. data/spec/dummy/config/environment.rb +2 -2
  23. data/spec/dummy/config/environments/development.rb +11 -19
  24. data/spec/dummy/config/environments/production.rb +40 -27
  25. data/spec/dummy/config/environments/test.rb +13 -14
  26. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  27. data/spec/dummy/config/initializers/fine_print.rb +1 -34
  28. data/spec/dummy/config/initializers/inflections.rb +6 -5
  29. data/spec/dummy/config/initializers/secret_token.rb +7 -2
  30. data/spec/dummy/config/initializers/session_store.rb +1 -6
  31. data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
  32. data/spec/dummy/config/locales/en.yml +20 -2
  33. data/spec/dummy/config/routes.rb +2 -1
  34. data/spec/dummy/config.ru +1 -1
  35. data/spec/dummy/db/development.sqlite3 +0 -0
  36. data/spec/dummy/db/schema.rb +21 -21
  37. data/spec/dummy/db/test.sqlite3 +0 -0
  38. data/spec/dummy/log/development.log +15 -1849
  39. data/spec/dummy/log/test.log +10536 -53785
  40. data/spec/dummy/public/404.html +43 -11
  41. data/spec/dummy/public/422.html +43 -11
  42. data/spec/dummy/public/500.html +43 -11
  43. data/spec/factories/contract.rb +2 -2
  44. data/spec/lib/fine_print/{controller_additions_spec.rb → controller_includes_spec.rb} +16 -6
  45. metadata +104 -166
  46. data/app/assets/javascripts/application.js~ +0 -16
  47. data/app/controllers/fine_print/application_controller.rb~ +0 -15
  48. data/app/controllers/fine_print/contracts_controller.rb~ +0 -79
  49. data/app/controllers/fine_print/home_controller.rb~ +0 -6
  50. data/app/controllers/fine_print/signatures_controller.rb~ +0 -14
  51. data/app/helpers/fine_print/application_helper.rb~ +0 -7
  52. data/app/helpers/fine_print/contracts_helper.rb~ +0 -7
  53. data/app/models/fine_print/contract.rb~ +0 -100
  54. data/app/models/fine_print/signature.rb~ +0 -25
  55. data/app/views/fine_print/contracts/_form.html.erb~ +0 -35
  56. data/app/views/fine_print/contracts/index.html.erb~ +0 -43
  57. data/app/views/fine_print/contracts/show.html.erb~ +0 -35
  58. data/app/views/fine_print/home/index.html.erb~ +0 -15
  59. data/app/views/fine_print/signatures/index.html.erb~ +0 -32
  60. data/app/views/layouts/fine_print/application.html.erb~ +0 -20
  61. data/config/initializers/fine_print.rb~ +0 -36
  62. data/config/routes.rb~ +0 -12
  63. data/db/migrate/0_install_fine_print.rb~ +0 -26
  64. data/lib/fine_print/controller_additions.rb +0 -80
  65. data/lib/fine_print/controller_additions.rb~ +0 -86
  66. data/lib/fine_print/utilities.rb~ +0 -26
  67. data/lib/fine_print/version.rb~ +0 -3
  68. data/lib/fine_print.rb~ +0 -120
  69. data/spec/controllers/contracts_controller_spec.rb~ +0 -224
  70. data/spec/controllers/home_controller_spec.rb~ +0 -25
  71. data/spec/controllers/signatures_controller_spec.rb~ +0 -46
  72. data/spec/dummy/app/controllers/dummy_models_controller.rb~ +0 -29
  73. data/spec/dummy/app/models/dummy_user.rb~ +0 -4
  74. data/spec/dummy/app/models/user.rb~ +0 -78
  75. data/spec/dummy/config/application.rb~ +0 -60
  76. data/spec/dummy/config/initializers/fine_print.rb~ +0 -36
  77. data/spec/dummy/config/initializers/session_store.rb~ +0 -8
  78. data/spec/dummy/config/initializers/wrap_parameters.rb~ +0 -14
  79. data/spec/dummy/config/routes.rb~ +0 -4
  80. data/spec/dummy/db/migrate/1_create_dummy_users.rb~ +0 -8
  81. data/spec/dummy/script/rails +0 -6
  82. data/spec/factories/contract.rb~ +0 -26
  83. data/spec/factories/dummy_user.rb~ +0 -6
  84. data/spec/factories/signature.rb~ +0 -8
  85. data/spec/factories/user.rb~ +0 -6
  86. data/spec/fine_print_spec.rb~ +0 -18
  87. data/spec/lib/fine_print/controller_additions_spec.rb~ +0 -20
  88. data/spec/lib/fine_print_spec.rb~ +0 -47
  89. data/spec/models/contract_spec.rb~ +0 -80
  90. data/spec/models/signature_spec.rb~ +0 -28
  91. data/spec/spec_helper.rb~ +0 -32
  92. data/spec/test_helper.rb~ +0 -15
data/lib/fine_print.rb~ DELETED
@@ -1,120 +0,0 @@
1
- require 'fine_print/engine'
2
- require 'fine_print/security_transgression'
3
- require 'fine_print/controller_additions'
4
-
5
- module FinePrint
6
- # Attributes
7
-
8
- # Can be set in initializer only
9
- ENGINE_OPTIONS = [
10
- :current_user_proc,
11
- :user_admin_proc,
12
- :can_sign_contracts_proc,
13
- :pose_contracts_path,
14
- :redirect_path
15
- ]
16
-
17
- # Can be set in initializer or passed as an option to fine_print_get_signatures
18
- SIGNATURE_OPTIONS = [
19
- :pose_contracts_path
20
- ]
21
-
22
- (ENGINE_OPTIONS + SIGNATURE_OPTIONS).each do |option|
23
- mattr_accessor option
24
- end
25
-
26
- def self.configure
27
- yield self
28
- end
29
-
30
- # Gets a contract given either the contract's object, ID or name
31
- # If given a name, it returns the latest published version of that contract
32
- # - contract -- can be a Contract object, its ID, or its name as a String or Symbol
33
- #
34
- def self.get_contract(reference)
35
- ref = Integer(reference) rescue reference
36
- case ref
37
- when Contract
38
- ref
39
- when Integer
40
- Contract.find(ref)
41
- when String, Symbol
42
- Contract.where(:name => ref.to_s).published.first
43
- end
44
- end
45
-
46
- # Records that the given user has signed the given contract
47
- # - user -- the user in question
48
- # - contract -- can be a Contract object, its ID, or its name as a String or Symbol
49
- #
50
- def self.sign_contract(user, contract)
51
- raise_unless_can_sign(user)
52
- contract = get_contract(contract)
53
- raise IllegalState, 'Contract not found' if contract.nil?
54
-
55
- Signature.create do |signature|
56
- signature.user = user
57
- signature.contract = contract
58
- end
59
- end
60
-
61
- # Returns true iff the given user has signed the given contract
62
- # - user -- the user in question
63
- # - contract -- can be a Contract object, its ID, or its name as a String or Symbol
64
- #
65
- def self.signed_contract?(user, contract)
66
- raise_unless_can_sign(user)
67
- contract = get_contract(contract)
68
-
69
- !contract.signatures.where(:user_id => user.id,
70
- :user_type => user.class.name).first.nil?
71
- end
72
-
73
- # Returns true iff the given user has signed any version of the given contract
74
- # - user -- the user in question
75
- # - contract -- can be a Contract object, its ID, or its name as a String or Symbol
76
- def self.signed_any_contract_version?(user, contract)
77
- raise_unless_can_sign(user)
78
- contract = get_contract(contract)
79
- !Signature.joins(:contract)
80
- .where(:fine_print_contracts => {:name => contract.name},
81
- :user_type => user.class.name,
82
- :user_id => user.id).first.nil?
83
- end
84
-
85
- # Returns an array of names for the contracts whose latest published
86
- # version the given user has not signed.
87
- # - user -- the user in question
88
- # - names -- contract names to check
89
- #
90
- def self.get_unsigned_contract_names(user, *names)
91
- raise_unless_can_sign(user)
92
- names = names.flatten.collect{|name| name.to_s}
93
- return [] if names.blank?
94
-
95
- signed_contracts = Contract
96
- .joins(:signatures)
97
- .where({:name => names,
98
- :fine_print_signatures => {:user_id => user.id,
99
- :user_type => user.class.name}}).latest
100
- signed_contract_names = signed_contracts.collect{|c| c.name}
101
-
102
- return names - signed_contract_names
103
- end
104
-
105
- def self.can_sign?(user)
106
- can_sign_contracts_proc.call(user)
107
- end
108
-
109
- def self.is_admin?(user)
110
- !user.nil? && user_admin_proc.call(user)
111
- end
112
-
113
- def self.raise_unless_can_sign(user)
114
- raise IllegalState, 'User not signed in' unless can_sign?(user)
115
- end
116
-
117
- def self.raise_unless_admin(user)
118
- raise SecurityTransgression unless is_admin?(user)
119
- end
120
- end
@@ -1,224 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module FinePrint
4
- describe ContractsController do
5
- routes { FinePrint::Engine.routes }
6
-
7
- before do
8
- setup_controller_spec
9
- @contract = FactoryGirl.create(:contract)
10
- @contract.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 get new unless authorized" do
29
- get :new, :use_route => :fine_print
30
- assert_redirected_to FinePrint.redirect_path
31
-
32
- sign_in @user
33
- get :new, :use_route => :fine_print
34
- assert_redirected_to FinePrint.redirect_path
35
- end
36
-
37
- it 'must get new if authorized' do
38
- sign_in @admin
39
- get :new, :use_route => :fine_print
40
- assert_response :success
41
- end
42
-
43
- it "won't create unless authorized" do
44
- attributes = Hash.new
45
- attributes[:name] = 'some_name'
46
- attributes[:title] = 'Some title'
47
- attributes[:content] = 'Some content'
48
-
49
- post :create, :contract => attributes, :use_route => :fine_print
50
- assert_redirected_to FinePrint.redirect_path
51
- expect(assigns(:contract)).to be_nil
52
-
53
- sign_in @user
54
- post :create, :contract => attributes, :use_route => :fine_print
55
- assert_redirected_to FinePrint.redirect_path
56
- expect(assigns(:contract)).to be_nil
57
- end
58
-
59
- it 'must create if authorized' do
60
- sign_in @admin
61
- attributes = Hash.new
62
- attributes[:name] = 'some_name'
63
- attributes[:title] = 'Some title'
64
- attributes[:content] = 'Some content'
65
-
66
- post :create, :contract => attributes, :use_route => :fine_print
67
- assert_redirected_to assigns(:contract)
68
- expect(assigns(:contract).errors).to be_empty
69
- expect(assigns(:contract).name).to eq 'some_name'
70
- expect(assigns(:contract).title).to eq 'Some title'
71
- expect(assigns(:contract).content).to eq 'Some content'
72
- end
73
-
74
- it "won't edit unless authorized" do
75
- get :edit, :id => @contract.id, :use_route => :fine_print
76
- assert_redirected_to FinePrint.redirect_path
77
-
78
- sign_in @user
79
- get :edit, :id => @contract.id, :use_route => :fine_print
80
- assert_redirected_to FinePrint.redirect_path
81
- end
82
-
83
- it 'must edit if authorized' do
84
- sign_in @admin
85
- get :edit, :id => @contract.id, :use_route => :fine_print
86
- assert_response :success
87
- end
88
-
89
- it "won't update unless authorized" do
90
- attributes = Hash.new
91
- attributes[:name] = 'some_name'
92
- attributes[:title] = 'Some title'
93
- attributes[:content] = 'Some content'
94
- name = @contract.name
95
- title = @contract.title
96
- content = @contract.content
97
-
98
- put :update, :id => @contract.id, :contract => attributes, :use_route => :fine_print
99
- assert_redirected_to FinePrint.redirect_path
100
- expect(@contract.errors).not_to be_empty
101
- @contract.reload
102
- expect(@contract.name).to eq name
103
- expect(@contract.title).to eq title
104
- expect(@contract.content).to eq content
105
-
106
- sign_in @user
107
- put :update, :id => @contract.id, :contract => attributes, :use_route => :fine_print
108
- assert_redirected_to FinePrint.redirect_path
109
- expect(@contract.errors).not_to be_empty
110
- @contract.reload
111
- expect(@contract.name).to eq name
112
- expect(@contract.title).to eq title
113
- expect(@contract.content).to eq content
114
- end
115
-
116
- it 'must update if authorized' do
117
- attributes = Hash.new
118
- attributes[:name] = 'some_name'
119
- attributes[:title] = 'Some title'
120
- attributes[:content] = 'Some content'
121
-
122
- sign_in @admin
123
- put :update, :id => @contract.id, :contract => attributes, :use_route => :fine_print
124
- assert_redirected_to @contract
125
- @contract.reload
126
- expect(@contract.errors).to be_empty
127
- expect(@contract.name).to eq 'some_name'
128
- expect(@contract.title).to eq 'Some title'
129
- expect(@contract.content).to eq 'Some content'
130
- end
131
-
132
- it "won't destroy unless authorized" do
133
- delete :destroy, :id => @contract.id, :use_route => :fine_print
134
- assert_redirected_to FinePrint.redirect_path
135
- expect(Contract.find(@contract.id)).to eq @contract
136
-
137
- sign_in @user
138
- delete :destroy, :id => @contract.id, :use_route => :fine_print
139
- assert_redirected_to FinePrint.redirect_path
140
- expect(Contract.find(@contract.id)).to eq @contract
141
- end
142
-
143
- it 'must destroy if authorized' do
144
- sign_in @admin
145
- delete :destroy, :id => @contract.id, :use_route => :fine_print
146
- assert_redirected_to contracts_path
147
- expect(Contract.find_by_id(@contract.id)).to be_nil
148
- end
149
-
150
- it "won't publish unless authorized" do
151
- expect(@contract.is_published?).to eq false
152
- put :publish, :id => @contract.id, :use_route => :fine_print
153
- assert_redirected_to FinePrint.redirect_path
154
- @contract.reload
155
- expect(@contract.is_published?).to eq false
156
-
157
- sign_in @user
158
- put :publish, :id => @contract.id, :use_route => :fine_print
159
- assert_redirected_to FinePrint.redirect_path
160
- @contract.reload
161
- expect(@contract.is_published?).to eq false
162
- end
163
-
164
- it 'must publish if authorized' do
165
- expect(@contract.is_published?).to eq false
166
- sign_in @admin
167
-
168
- put :publish, :id => @contract.id, :use_route => :fine_print
169
- assert_redirected_to contracts_path
170
- @contract.reload
171
- expect(@contract.is_published?).to eq true
172
- end
173
-
174
- it "won't unpublish unless authorized" do
175
- @contract.publish
176
- expect(@contract.is_published?).to eq true
177
- put :unpublish, :id => @contract.id, :use_route => :fine_print
178
- assert_redirected_to FinePrint.redirect_path
179
- @contract.reload
180
- expect(@contract.is_published?).to eq true
181
-
182
- sign_in @user
183
- put :unpublish, :id => @contract.id, :use_route => :fine_print
184
- assert_redirected_to FinePrint.redirect_path
185
- @contract.reload
186
- expect(@contract.is_published?).to eq true
187
- end
188
-
189
- it 'must unpublish if authorized' do
190
- @contract.publish
191
- expect(@contract.is_published?).to eq true
192
-
193
- sign_in @admin
194
- put :unpublish, :id => @contract.id, :use_route => :fine_print
195
- assert_redirected_to contracts_path
196
- @contract.reload
197
- expect(@contract.is_published?).to eq false
198
- end
199
-
200
- it "won't new_version unless authorized" do
201
- @contract.publish
202
- expect(@contract.is_published?).to eq true
203
-
204
- put :new_version, :id => @contract.id, :use_route => :fine_print
205
- assert_redirected_to FinePrint.redirect_path
206
- expect(assigns(:contract)).to be_nil
207
-
208
- sign_in @user
209
- put :new_version, :id => @contract.id, :use_route => :fine_print
210
- assert_redirected_to FinePrint.redirect_path
211
- expect(assigns(:contract)).to be_nil
212
- end
213
-
214
- it 'must new_version if authorized' do
215
- @contract.publish
216
- expect(@contract.is_published?).to eq true
217
-
218
- sign_in @admin
219
- put :new_version, :id => @contract.id, :use_route => :fine_print
220
- assert_response :success
221
- expect(assigns(:contract)).not_to be_nil
222
- end
223
- end
224
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module FinePrint
4
- describe HomeController do
5
- before do
6
- setup_controller_spec
7
- end
8
-
9
- it 'wont get index unless authorized' do
10
- get :index, :use_route => :fine_print
11
- assert_response :redirect
12
-
13
- sign_in @user
14
- get :index, :use_route => :fine_print
15
- assert_response :redirect
16
- end
17
-
18
- it 'must get index if authorized' do
19
- sign_in @user
20
- @user.is_admin = true
21
- get :index, :use_route => :fine_print
22
- assert_response :success
23
- end
24
- end
25
- end
@@ -1,46 +0,0 @@
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
@@ -1,29 +0,0 @@
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,4 +0,0 @@
1
- module FinePrint
2
- class DummyUser < ActiveRecord::Base
3
- end
4
- end
@@ -1,78 +0,0 @@
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
@@ -1,60 +0,0 @@
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
-
@@ -1,36 +0,0 @@
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
- # Proc called with controller as argument that returns the current user.
7
- # Default: lambda { |controller| controller.current_user }
8
- config.current_user_proc = lambda { |controller| controller.current_user }
9
-
10
- # Proc called with user as argument that returns true iif 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 called with user as argument that returns true iif the 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 }
21
- config.can_sign_contracts_proc = lambda { |user| user }
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,8 +0,0 @@
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
@@ -1,14 +0,0 @@
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 +0,0 @@
1
- Rails.application.routes.draw do
2
-
3
- mount FinePrint::Engine => "/fine_print"
4
- end
@@ -1,8 +0,0 @@
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
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'