trust 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/MIT-LICENSE +23 -0
  2. data/README.md +244 -0
  3. data/Rakefile +37 -0
  4. data/lib/tasks/trust_tasks.rake +42 -0
  5. data/lib/trust/active_record.rb +65 -0
  6. data/lib/trust/authorization.rb +85 -0
  7. data/lib/trust/controller/properties.rb +134 -0
  8. data/lib/trust/controller/resource.rb +306 -0
  9. data/lib/trust/controller.rb +197 -0
  10. data/lib/trust/exceptions.rb +45 -0
  11. data/lib/trust/inheritable_attribute.rb +91 -0
  12. data/lib/trust/permissions.rb +268 -0
  13. data/lib/trust/test_helper.rb +56 -0
  14. data/lib/trust/version.rb +27 -0
  15. data/lib/trust.rb +39 -0
  16. data/test/dummy/README.rdoc +261 -0
  17. data/test/dummy/Rakefile +7 -0
  18. data/test/dummy/app/assets/javascripts/accounts.js +2 -0
  19. data/test/dummy/app/assets/javascripts/application.js +15 -0
  20. data/test/dummy/app/assets/javascripts/clients.js +2 -0
  21. data/test/dummy/app/assets/javascripts/users.js +2 -0
  22. data/test/dummy/app/assets/stylesheets/accounts.css +4 -0
  23. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  24. data/test/dummy/app/assets/stylesheets/clients.css +4 -0
  25. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  26. data/test/dummy/app/assets/stylesheets/users.css +4 -0
  27. data/test/dummy/app/controllers/accounts_controller.rb +100 -0
  28. data/test/dummy/app/controllers/application_controller.rb +31 -0
  29. data/test/dummy/app/controllers/clients_controller.rb +107 -0
  30. data/test/dummy/app/controllers/savings_accounts_controller.rb +27 -0
  31. data/test/dummy/app/controllers/settlements_controller.rb +26 -0
  32. data/test/dummy/app/controllers/users_controller.rb +107 -0
  33. data/test/dummy/app/helpers/accounts_helper.rb +26 -0
  34. data/test/dummy/app/helpers/application_helper.rb +26 -0
  35. data/test/dummy/app/helpers/clients_helper.rb +26 -0
  36. data/test/dummy/app/helpers/users_helper.rb +26 -0
  37. data/test/dummy/app/models/account/credit.rb +26 -0
  38. data/test/dummy/app/models/account.rb +35 -0
  39. data/test/dummy/app/models/client.rb +35 -0
  40. data/test/dummy/app/models/permissions.rb +68 -0
  41. data/test/dummy/app/models/savings_account.rb +26 -0
  42. data/test/dummy/app/models/user.rb +40 -0
  43. data/test/dummy/app/views/accounts/_form.html.erb +46 -0
  44. data/test/dummy/app/views/accounts/edit.html.erb +31 -0
  45. data/test/dummy/app/views/accounts/index.html.erb +48 -0
  46. data/test/dummy/app/views/accounts/new.html.erb +30 -0
  47. data/test/dummy/app/views/accounts/show.html.erb +35 -0
  48. data/test/dummy/app/views/clients/_form.html.erb +46 -0
  49. data/test/dummy/app/views/clients/edit.html.erb +31 -0
  50. data/test/dummy/app/views/clients/index.html.erb +48 -0
  51. data/test/dummy/app/views/clients/new.html.erb +30 -0
  52. data/test/dummy/app/views/clients/show.html.erb +35 -0
  53. data/test/dummy/app/views/layouts/application.html.erb +39 -0
  54. data/test/dummy/app/views/users/_form.html.erb +46 -0
  55. data/test/dummy/app/views/users/edit.html.erb +31 -0
  56. data/test/dummy/app/views/users/index.html.erb +48 -0
  57. data/test/dummy/app/views/users/new.html.erb +30 -0
  58. data/test/dummy/app/views/users/show.html.erb +35 -0
  59. data/test/dummy/config/application.rb +56 -0
  60. data/test/dummy/config/boot.rb +10 -0
  61. data/test/dummy/config/database.yml +25 -0
  62. data/test/dummy/config/environment.rb +5 -0
  63. data/test/dummy/config/environments/development.rb +37 -0
  64. data/test/dummy/config/environments/production.rb +67 -0
  65. data/test/dummy/config/environments/test.rb +37 -0
  66. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  67. data/test/dummy/config/initializers/inflections.rb +15 -0
  68. data/test/dummy/config/initializers/mime_types.rb +5 -0
  69. data/test/dummy/config/initializers/secret_token.rb +7 -0
  70. data/test/dummy/config/initializers/session_store.rb +8 -0
  71. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  72. data/test/dummy/config/locales/en.yml +5 -0
  73. data/test/dummy/config/routes.rb +38 -0
  74. data/test/dummy/config.ru +4 -0
  75. data/test/dummy/db/migrate/20120522115011_create_accounts.rb +36 -0
  76. data/test/dummy/db/migrate/20120522130322_create_users.rb +33 -0
  77. data/test/dummy/db/migrate/20120523144144_create_clients.rb +34 -0
  78. data/test/dummy/db/schema.rb +38 -0
  79. data/test/dummy/public/404.html +26 -0
  80. data/test/dummy/public/422.html +26 -0
  81. data/test/dummy/public/500.html +25 -0
  82. data/test/dummy/public/favicon.ico +0 -0
  83. data/test/dummy/script/rails +6 -0
  84. data/test/dummy/test/fixtures/accounts.yml +7 -0
  85. data/test/dummy/test/fixtures/clients.yml +7 -0
  86. data/test/dummy/test/fixtures/users.yml +7 -0
  87. data/test/dummy/test/functional/accounts_controller_test.rb +123 -0
  88. data/test/dummy/test/functional/clients_controller_test.rb +74 -0
  89. data/test/dummy/test/functional/users_controller_test.rb +74 -0
  90. data/test/dummy/test/unit/account_test.rb +31 -0
  91. data/test/dummy/test/unit/client_test.rb +31 -0
  92. data/test/dummy/test/unit/helpers/accounts_helper_test.rb +28 -0
  93. data/test/dummy/test/unit/helpers/clients_helper_test.rb +28 -0
  94. data/test/dummy/test/unit/helpers/users_helper_test.rb +28 -0
  95. data/test/dummy/test/unit/permissions_test.rb +171 -0
  96. data/test/dummy/test/unit/user_test.rb +31 -0
  97. data/test/test_helper.rb +45 -0
  98. data/test/trust_test.rb +31 -0
  99. data/test/unit/trust/active_record_test.rb +56 -0
  100. data/test/unit/trust/authorization_test.rb +108 -0
  101. data/test/unit/trust/controller/properties_test.rb +132 -0
  102. data/test/unit/trust/controller/resource_test.rb +251 -0
  103. data/test/unit/trust/controller_test.rb +160 -0
  104. data/test/unit/trust/inheritable_attribute_test.rb +65 -0
  105. data/test/unit/trust/permissions_test.rb +258 -0
  106. metadata +280 -0
@@ -0,0 +1,35 @@
1
+ # Copyright (c) 2012 Bingo Entreprenøren AS
2
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
3
+ # Copyright (c) 2012 Knut I. Stenmark
4
+ # Copyright (c) 2012 Patrick Hanevold
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining
7
+ # a copy of this software and associated documentation files (the
8
+ # "Software"), to deal in the Software without restriction, including
9
+ # without limitation the rights to use, copy, modify, merge, publish,
10
+ # distribute, sublicense, and/or sell copies of the Software, and to
11
+ # permit persons to whom the Software is furnished to do so, subject to
12
+ # the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be
15
+ # included in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ class Client < ActiveRecord::Base
26
+ attr_accessible :name
27
+ has_many :accounts
28
+ belongs_to :accountant, :class_name => 'User'
29
+
30
+ before_create :set_accountant
31
+
32
+ def set_accountant
33
+ self.accountant = User.current
34
+ end
35
+ end
@@ -0,0 +1,68 @@
1
+ # Copyright (c) 2012 Bingo Entreprenøren AS
2
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
3
+ # Copyright (c) 2012 Knut I. Stenmark
4
+ # Copyright (c) 2012 Patrick Hanevold
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining
7
+ # a copy of this software and associated documentation files (the
8
+ # "Software"), to deal in the Software without restriction, including
9
+ # without limitation the rights to use, copy, modify, merge, publish,
10
+ # distribute, sublicense, and/or sell copies of the Software, and to
11
+ # permit persons to whom the Software is furnished to do so, subject to
12
+ # the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be
15
+ # included in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ module Permissions
26
+ class Default < Trust::Permissions
27
+ role :system_admin do
28
+ can :manage
29
+ can :audit
30
+ end
31
+
32
+ def self.all
33
+ [:system_admin, :accountant, :department_manager, :guest]
34
+ end
35
+
36
+ def creator?
37
+ subject.created_by == user
38
+ end
39
+ end
40
+
41
+ class Client < Default
42
+ role :accountant, can(:manage)
43
+ role all, can(:read)
44
+ end
45
+
46
+ class Account < Default
47
+ role :accountant do
48
+ can :create, :if => :associated_with_client?
49
+ can :update, :if => :creator?
50
+ end
51
+ role :department_manager, :accountant do
52
+ can :create, :if => lambda { parent && parent.accountant == :superspecial }
53
+ end
54
+
55
+ def associated_with_client?
56
+ parent && parent.is_a?(::Client) && parent.accountant == user.name
57
+ end
58
+ end
59
+
60
+ class Account::Credit < Account
61
+ role :guest do
62
+ can :create, :if => lambda { user.name == 'wife'}
63
+ end
64
+
65
+ end
66
+
67
+
68
+ end
@@ -0,0 +1,26 @@
1
+ # Copyright (c) 2012 Bingo Entreprenøren AS
2
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
3
+ # Copyright (c) 2012 Knut I. Stenmark
4
+ # Copyright (c) 2012 Patrick Hanevold
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining
7
+ # a copy of this software and associated documentation files (the
8
+ # "Software"), to deal in the Software without restriction, including
9
+ # without limitation the rights to use, copy, modify, merge, publish,
10
+ # distribute, sublicense, and/or sell copies of the Software, and to
11
+ # permit persons to whom the Software is furnished to do so, subject to
12
+ # the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be
15
+ # included in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ class SavingsAccount < Account
26
+ end
@@ -0,0 +1,40 @@
1
+ # Copyright (c) 2012 Bingo Entreprenøren AS
2
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
3
+ # Copyright (c) 2012 Knut I. Stenmark
4
+ # Copyright (c) 2012 Patrick Hanevold
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining
7
+ # a copy of this software and associated documentation files (the
8
+ # "Software"), to deal in the Software without restriction, including
9
+ # without limitation the rights to use, copy, modify, merge, publish,
10
+ # distribute, sublicense, and/or sell copies of the Software, and to
11
+ # permit persons to whom the Software is furnished to do so, subject to
12
+ # the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be
15
+ # included in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ class User < ActiveRecord::Base
26
+ attr_accessible :name
27
+
28
+ def role_symbols
29
+ [ name && name.to_sym]
30
+ end
31
+
32
+ def self.current
33
+ Thread.current["current_user"]
34
+ end
35
+
36
+ def self.current= user
37
+ Thread.current["current_user"] = user
38
+ end
39
+
40
+ end
@@ -0,0 +1,46 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <%= form_for(@account, :url => client_accounts_path(@client)) do |f| %>
27
+ <% if @account.errors.any? %>
28
+ <div id="error_explanation">
29
+ <h2><%= pluralize(@account.errors.count, "error") %> prohibited this account from being saved:</h2>
30
+
31
+ <ul>
32
+ <% @account.errors.full_messages.each do |msg| %>
33
+ <li><%= msg %></li>
34
+ <% end %>
35
+ </ul>
36
+ </div>
37
+ <% end %>
38
+
39
+ <div class="field">
40
+ <%= f.label :name %><br />
41
+ <%= f.text_field :name %>
42
+ </div>
43
+ <div class="actions">
44
+ <%= f.submit %>
45
+ </div>
46
+ <% end %>
@@ -0,0 +1,31 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <h1>Editing account</h1>
27
+
28
+ <%= render 'form' %>
29
+
30
+ <%= link_to 'Show', client_account_path(@account) %> |
31
+ <%= link_to 'Back', client_accounts_path(@client) %>
@@ -0,0 +1,48 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <h1>Listing accounts</h1>
27
+
28
+ <table>
29
+ <tr>
30
+ <th>Name</th>
31
+ <th></th>
32
+ <th></th>
33
+ <th></th>
34
+ </tr>
35
+
36
+ <% @accounts.each do |account| %>
37
+ <tr>
38
+ <td><%= account.name %></td>
39
+ <td><%= link_to 'Show', client_account_path(account.client,account) %></td>
40
+ <td><%= link_to 'Edit', edit_client_account_path(account.client,account) %></td>
41
+ <td><%= link_to 'Destroy', client_account_path(account.client,account), confirm: 'Are you sure?', method: :delete %></td>
42
+ </tr>
43
+ <% end %>
44
+ </table>
45
+
46
+ <br />
47
+
48
+ <%= link_to 'New Account', new_client_account_path(@client) %>
@@ -0,0 +1,30 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <h1>New account</h1>
27
+
28
+ <%= render 'form' %>
29
+
30
+ <%= link_to 'Back', client_accounts_path(@client) %>
@@ -0,0 +1,35 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <p id="notice"><%= notice %></p>
27
+
28
+ <p>
29
+ <b>Name:</b>
30
+ <%= @account.name %>
31
+ </p>
32
+
33
+
34
+ <%= link_to 'Edit', edit_client_account_path(@account) %> |
35
+ <%= link_to 'Back', client_accounts_path(@client) %>
@@ -0,0 +1,46 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <%= form_for(@client) do |f| %>
27
+ <% if @client.errors.any? %>
28
+ <div id="error_explanation">
29
+ <h2><%= pluralize(@client.errors.count, "error") %> prohibited this client from being saved:</h2>
30
+
31
+ <ul>
32
+ <% @client.errors.full_messages.each do |msg| %>
33
+ <li><%= msg %></li>
34
+ <% end %>
35
+ </ul>
36
+ </div>
37
+ <% end %>
38
+
39
+ <div class="field">
40
+ <%= f.label :name %><br />
41
+ <%= f.text_field :name %>
42
+ </div>
43
+ <div class="actions">
44
+ <%= f.submit %>
45
+ </div>
46
+ <% end %>
@@ -0,0 +1,31 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <h1>Editing client</h1>
27
+
28
+ <%= render 'form' %>
29
+
30
+ <%= link_to 'Show', @client %> |
31
+ <%= link_to 'Back', clients_path %>
@@ -0,0 +1,48 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <h1>Listing clients</h1>
27
+
28
+ <table>
29
+ <tr>
30
+ <th>Name</th>
31
+ <th></th>
32
+ <th></th>
33
+ <th></th>
34
+ </tr>
35
+
36
+ <% @clients.each do |client| %>
37
+ <tr>
38
+ <td><%= client.name %></td>
39
+ <td><%= link_to 'Show', client %></td>
40
+ <td><%= link_to 'Edit', edit_client_path(client) %></td>
41
+ <td><%= link_to 'Destroy', client, confirm: 'Are you sure?', method: :delete %></td>
42
+ </tr>
43
+ <% end %>
44
+ </table>
45
+
46
+ <br />
47
+
48
+ <%= link_to 'New Client', new_client_path %>
@@ -0,0 +1,30 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <h1>New client</h1>
27
+
28
+ <%= render 'form' %>
29
+
30
+ <%= link_to 'Back', clients_path %>
@@ -0,0 +1,35 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <p id="notice"><%= notice %></p>
27
+
28
+ <p>
29
+ <b>Name:</b>
30
+ <%= @client.name %>
31
+ </p>
32
+
33
+
34
+ <%= link_to 'Edit', edit_client_path(@client) %> |
35
+ <%= link_to 'Back', clients_path %>
@@ -0,0 +1,39 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <!DOCTYPE html>
27
+ <html>
28
+ <head>
29
+ <title>Dummy</title>
30
+ <%= stylesheet_link_tag "application", :media => "all" %>
31
+ <%= javascript_include_tag "application" %>
32
+ <%= csrf_meta_tags %>
33
+ </head>
34
+ <body>
35
+
36
+ <%= yield %>
37
+
38
+ </body>
39
+ </html>
@@ -0,0 +1,46 @@
1
+ <%
2
+ # Copyright (c) 2012 Bingo Entreprenøren AS
3
+ # Copyright (c) 2012 Teknobingo Scandinavia AS
4
+ # Copyright (c) 2012 Knut I. Stenmark
5
+ # Copyright (c) 2012 Patrick Hanevold
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the
9
+ # "Software"), to deal in the Software without restriction, including
10
+ # without limitation the rights to use, copy, modify, merge, publish,
11
+ # distribute, sublicense, and/or sell copies of the Software, and to
12
+ # permit persons to whom the Software is furnished to do so, subject to
13
+ # the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be
16
+ # included in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+ %>
26
+ <%= form_for(@user) do |f| %>
27
+ <% if @user.errors.any? %>
28
+ <div id="error_explanation">
29
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
30
+
31
+ <ul>
32
+ <% @user.errors.full_messages.each do |msg| %>
33
+ <li><%= msg %></li>
34
+ <% end %>
35
+ </ul>
36
+ </div>
37
+ <% end %>
38
+
39
+ <div class="field">
40
+ <%= f.label :name %><br />
41
+ <%= f.text_field :name %>
42
+ </div>
43
+ <div class="actions">
44
+ <%= f.submit %>
45
+ </div>
46
+ <% end %>