kaui 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -3
  3. data/Gemfile.lock +142 -89
  4. data/app/assets/javascripts/application.js +4 -1
  5. data/app/assets/javascripts/kaui/bootstrap-tweaks.js +1 -1
  6. data/app/assets/javascripts/kaui/datatables-tweaks.js +3 -0
  7. data/app/assets/stylesheets/application.css +2 -0
  8. data/app/assets/stylesheets/bootstrap_and_overrides.css +0 -41
  9. data/app/assets/stylesheets/datatables.scss +14 -0
  10. data/app/assets/stylesheets/layout.scss +19 -0
  11. data/app/controllers/kaui/account_timelines_controller.rb +6 -14
  12. data/app/controllers/kaui/sessions_controller.rb +3 -0
  13. data/app/controllers/kaui/subscriptions_controller.rb +8 -8
  14. data/app/models/kaui/ability.rb +1 -3
  15. data/app/models/kaui/allowed_user.rb +7 -2
  16. data/app/models/kaui/invoice.rb +21 -0
  17. data/app/views/kaui/account_emails/_account_emails_table.html.erb +1 -1
  18. data/app/views/kaui/account_timelines/show.html.erb +27 -27
  19. data/app/views/kaui/accounts/_form.html.erb +107 -111
  20. data/app/views/kaui/accounts/index.html.erb +1 -1
  21. data/app/views/kaui/accounts/show.html.erb +6 -6
  22. data/app/views/kaui/admin_allowed_users/new.html.erb +2 -2
  23. data/app/views/kaui/admin_tenants/new.html.erb +3 -3
  24. data/app/views/kaui/admin_tenants/show.html.erb +1 -1
  25. data/app/views/kaui/bundles/index.html.erb +1 -1
  26. data/app/views/kaui/bundles/show.html.erb +1 -1
  27. data/app/views/kaui/chargebacks/_form.html.erb +1 -1
  28. data/app/views/kaui/charges/_form.html.erb +2 -2
  29. data/app/views/kaui/credits/_form.html.erb +2 -2
  30. data/app/views/kaui/custom_fields/index.html.erb +1 -1
  31. data/app/views/kaui/home/index.html.erb +1 -1
  32. data/app/views/kaui/invoice_items/edit.html.erb +1 -1
  33. data/app/views/kaui/invoices/index.html.erb +1 -1
  34. data/app/views/kaui/invoices/show.html.erb +2 -2
  35. data/app/views/kaui/layouts/kaui_application.html.erb +14 -10
  36. data/app/views/kaui/payment_methods/_form.html.erb +3 -3
  37. data/app/views/kaui/payment_methods/_new_creditcard_payment_method.html.erb +2 -2
  38. data/app/views/kaui/payment_methods/_payment_methods_table.html.erb +5 -5
  39. data/app/views/kaui/payment_methods/index.html.erb +1 -1
  40. data/app/views/kaui/payments/index.html.erb +1 -1
  41. data/app/views/kaui/payments/new.html.erb +1 -1
  42. data/app/views/kaui/refunds/new.html.erb +2 -2
  43. data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +5 -5
  44. data/app/views/kaui/subscriptions/new.html.erb +1 -1
  45. data/app/views/kaui/subscriptions/show.html.erb +5 -5
  46. data/app/views/kaui/tags/_tags_table.html.erb +2 -2
  47. data/app/views/kaui/tags/index.html.erb +1 -1
  48. data/app/views/kaui/tenants/index.html.erb +1 -1
  49. data/app/views/kaui/transactions/_form.html.erb +2 -2
  50. data/config/initializers/devise.rb +28 -243
  51. data/config/routes.rb +1 -1
  52. data/db/migrate/20150112232813_create_kaui_allowed_users.rb +2 -2
  53. data/kaui.gemspec +11 -5
  54. data/lib/kaui/engine.rb +2 -0
  55. data/lib/kaui/version.rb +1 -1
  56. data/test/dummy/.gitignore +1 -0
  57. data/test/dummy/config/database.yml +6 -2
  58. data/test/dummy/config/environments/development.rb +3 -8
  59. data/test/dummy/config/environments/production.rb +2 -0
  60. data/test/dummy/config/environments/test.rb +5 -4
  61. data/test/dummy/config/initializers/killbill_client.rb +0 -1
  62. data/test/dummy/config/initializers/secret_token.rb +1 -1
  63. data/test/dummy/db/schema.rb +27 -27
  64. data/test/functional/kaui/subscriptions_controller_test.rb +2 -2
  65. data/test/functional/kaui/tenants_controller_test.rb +1 -7
  66. data/test/integration/kaui/integration_test_helper.rb +4 -4
  67. data/test/killbill_test_helper.rb +7 -8
  68. data/test/test_helper.rb +1 -0
  69. data/test/unit/kaui/money_helper_test.rb +7 -1
  70. data/vendor/assets/stylesheets/css/bootstrap-datepicker.cd46d38.css +2 -2
  71. metadata +63 -24
  72. data/test/dummy/db/migrate/20150116052157_devise_create_kaui_users.kaui.rb +0 -13
  73. data/test/dummy/db/migrate/20150116052158_create_kaui_tenants.kaui.rb +0 -13
  74. data/test/dummy/db/migrate/20150116052159_create_kaui_allowed_users.kaui.rb +0 -20
  75. data/vendor/assets/javascripts/jquery.dataTables.min.js +0 -155
  76. data/vendor/assets/stylesheets/css/bootstrap.v2.2.1.min.css +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a70faa01f0b175623fe4193632ac3e9f1cd64442
4
- data.tar.gz: c3257458ed844df34f244fee6137646129bfc311
3
+ metadata.gz: 3f5da37e2d8165a6c2c89ead5c48533481ac6c81
4
+ data.tar.gz: 5869633c618869d65bdd3a2c10a2cddec24ae499
5
5
  SHA512:
6
- metadata.gz: b87e8fb8edb7c0600836d4656e78d8648c6c2097d9e38d066d2b91a48554cf7af7d25d18319c091cbca0d5ecd0a284f73961bc26d3090aa114e6535fddb44ce7
7
- data.tar.gz: adcdb96bf73e373660f3ebc74b770200fa660a81eb7b66cc4eaf24c632d84e010bffa091a25242e40a30e9e1f3bd389f99888b7d41aa540d601f95ed6aa1dcee
6
+ metadata.gz: 430649a0642308886a6b93fa5e833470096f4f976af8c9a4ec41f851350a81a1f98bb7af8deca21e60e4afe592ffde6c7b968cce386f6b9149c1d72a5cb963bd
7
+ data.tar.gz: fb7a3088bfa85b4672a80ce863ed6ac4ed7db1fe75731a0103cca5823c5b733dd469e56a56c0508f9f72483d7c86547798154529645127aa8e52e385314e248e
data/.travis.yml CHANGED
@@ -5,7 +5,6 @@ notifications:
5
5
  - kill-bill-commits@googlegroups.com
6
6
 
7
7
  rvm:
8
- - 1.9.2
9
8
  - 1.9.3
10
9
  - 2.0.0
11
10
  - ruby-head
@@ -19,9 +18,9 @@ jdk:
19
18
 
20
19
  before_script:
21
20
  - mysql -e 'create database kaui_test;'
21
+ - RAILS_ENV=test bundle exec rake db:migrate
22
22
 
23
23
  script:
24
- - pushd test/dummy && RAILS_ENV=test bundle exec rake db:migrate --trace && RAILS_ENV=test bundle exec rake db:test:prepare && popd
25
24
  - bundle exec rake test:units
26
25
 
27
26
  matrix:
@@ -30,7 +29,7 @@ matrix:
30
29
  - rvm: jruby-head
31
30
 
32
31
  env:
33
- - MYSQL_PASSWORD=''
32
+ - MYSQL_PASSWORD='' MYSQL_USER='travis'
34
33
 
35
34
  #force travis to use only 'bundle install' instead of 'bundle install --deployments'
36
35
  bundler_args: ''
data/Gemfile.lock CHANGED
@@ -1,157 +1,210 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kaui (0.9.0)
4
+ kaui (0.10.0)
5
5
  cancan (~> 1.6.10)
6
6
  carmen-rails (~> 1.0.0)
7
7
  d3_rails (~> 3.2.8)
8
- devise (~> 3.0.2)
8
+ devise (~> 3.4.1)
9
+ jquery-datatables-rails (~> 3.3.0)
9
10
  jquery-rails (~> 3.0.4)
10
11
  killbill-client (~> 0.13.0)
11
- money-rails (~> 0.8.1)
12
- rails (~> 3.2.14)
12
+ money-rails (~> 1.3.0)
13
+ protected_attributes (~> 1.0.6)
14
+ rails (~> 4.2.0)
15
+ sass-rails (~> 5.0.2)
13
16
  symmetric-encryption (~> 3.6.0)
14
- twitter-bootstrap-rails (~> 2.2.8)
17
+ twitter-bootstrap-rails (~> 3.2.0)
15
18
 
16
19
  GEM
17
20
  remote: http://rubygems.org/
18
21
  specs:
19
- actionmailer (3.2.21)
20
- actionpack (= 3.2.21)
21
- mail (~> 2.5.4)
22
- actionpack (3.2.21)
23
- activemodel (= 3.2.21)
24
- activesupport (= 3.2.21)
25
- builder (~> 3.0.0)
22
+ actionmailer (4.2.1)
23
+ actionpack (= 4.2.1)
24
+ actionview (= 4.2.1)
25
+ activejob (= 4.2.1)
26
+ mail (~> 2.5, >= 2.5.4)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ actionpack (4.2.1)
29
+ actionview (= 4.2.1)
30
+ activesupport (= 4.2.1)
31
+ rack (~> 1.6)
32
+ rack-test (~> 0.6.2)
33
+ rails-dom-testing (~> 1.0, >= 1.0.5)
34
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
35
+ actionview (4.2.1)
36
+ activesupport (= 4.2.1)
37
+ builder (~> 3.1)
26
38
  erubis (~> 2.7.0)
27
- journey (~> 1.0.4)
28
- rack (~> 1.4.5)
29
- rack-cache (~> 1.2)
30
- rack-test (~> 0.6.1)
31
- sprockets (~> 2.2.1)
32
- activemodel (3.2.21)
33
- activesupport (= 3.2.21)
34
- builder (~> 3.0.0)
35
- activerecord (3.2.21)
36
- activemodel (= 3.2.21)
37
- activesupport (= 3.2.21)
38
- arel (~> 3.0.2)
39
- tzinfo (~> 0.3.29)
40
- activeresource (3.2.21)
41
- activemodel (= 3.2.21)
42
- activesupport (= 3.2.21)
43
- activesupport (3.2.21)
44
- i18n (~> 0.6, >= 0.6.4)
45
- multi_json (~> 1.0)
46
- arel (3.0.3)
39
+ rails-dom-testing (~> 1.0, >= 1.0.5)
40
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
41
+ activejob (4.2.1)
42
+ activesupport (= 4.2.1)
43
+ globalid (>= 0.3.0)
44
+ activemodel (4.2.1)
45
+ activesupport (= 4.2.1)
46
+ builder (~> 3.1)
47
+ activerecord (4.2.1)
48
+ activemodel (= 4.2.1)
49
+ activesupport (= 4.2.1)
50
+ arel (~> 6.0)
51
+ activesupport (4.2.1)
52
+ i18n (~> 0.7)
53
+ json (~> 1.7, >= 1.7.7)
54
+ minitest (~> 5.1)
55
+ thread_safe (~> 0.3, >= 0.3.4)
56
+ tzinfo (~> 1.1)
57
+ arel (6.0.0)
47
58
  bcrypt (3.1.10)
48
- bcrypt-ruby (3.1.5)
49
- bcrypt (>= 3.1.3)
50
- builder (3.0.4)
59
+ builder (3.2.2)
51
60
  cancan (1.6.10)
52
61
  carmen (1.0.2)
53
62
  activesupport (>= 3.0.0)
54
63
  carmen-rails (1.0.1)
55
64
  carmen (~> 1.0.0)
56
65
  rails
66
+ coderay (1.1.0)
57
67
  coercible (1.0.0)
58
68
  descendants_tracker (~> 0.0.1)
59
69
  d3_rails (3.2.8)
60
70
  railties (>= 3.1.0)
61
71
  descendants_tracker (0.0.4)
62
72
  thread_safe (~> 0.3, >= 0.3.1)
63
- devise (3.0.4)
64
- bcrypt-ruby (~> 3.0)
73
+ devise (3.4.1)
74
+ bcrypt (~> 3.0)
65
75
  orm_adapter (~> 0.1)
66
76
  railties (>= 3.2.6, < 5)
77
+ responders
78
+ thread_safe (~> 0.1)
67
79
  warden (~> 1.2.3)
68
80
  docile (1.1.5)
69
81
  erubis (2.7.0)
70
82
  execjs (2.5.2)
71
83
  fakeweb (1.3.0)
72
- hike (1.2.3)
73
- i18n (0.6.11)
74
- journey (1.0.4)
84
+ ffi (1.9.8-java)
85
+ globalid (0.3.5)
86
+ activesupport (>= 4.1.0)
87
+ i18n (0.7.0)
88
+ jquery-datatables-rails (3.3.0)
89
+ actionpack (>= 3.1)
90
+ jquery-rails
91
+ railties (>= 3.1)
92
+ sass-rails
75
93
  jquery-rails (3.0.4)
76
94
  railties (>= 3.0, < 5.0)
77
95
  thor (>= 0.14, < 2.0)
78
- json (1.8.2)
96
+ json (1.8.3)
79
97
  killbill-client (0.13.0)
80
98
  json (>= 1.2.0)
81
- mail (2.5.4)
82
- mime-types (~> 1.16)
83
- treetop (~> 1.4.8)
84
- mime-types (1.25.1)
85
- money (5.1.1)
86
- i18n (~> 0.6.0)
87
- money-rails (0.8.1)
99
+ loofah (2.0.2)
100
+ nokogiri (>= 1.5.9)
101
+ mail (2.6.3)
102
+ mime-types (>= 1.16, < 3)
103
+ method_source (0.8.2)
104
+ mime-types (2.6.1)
105
+ mini_portile (0.6.2)
106
+ minitest (5.7.0)
107
+ monetize (1.1.0)
108
+ money (~> 6.5.0)
109
+ money (6.5.1)
110
+ i18n (>= 0.6.4, <= 0.7.0)
111
+ money-rails (1.3.0)
88
112
  activesupport (>= 3.0)
89
- money (~> 5.1.0)
113
+ monetize (~> 1.1.0)
114
+ money (~> 6.5.0)
90
115
  railties (>= 3.0)
91
116
  multi_json (1.10.1)
92
117
  mysql2 (0.3.18)
118
+ nokogiri (1.6.6.2)
119
+ mini_portile (~> 0.6.0)
93
120
  orm_adapter (0.5.0)
94
- polyglot (0.3.5)
95
- rack (1.4.5)
96
- rack-cache (1.2)
97
- rack (>= 0.4)
98
- rack-ssl (1.3.4)
99
- rack
121
+ protected_attributes (1.0.9)
122
+ activemodel (>= 4.0.1, < 5.0)
123
+ pry (0.10.1)
124
+ coderay (~> 1.1.0)
125
+ method_source (~> 0.8.1)
126
+ slop (~> 3.4)
127
+ pry (0.10.1-java)
128
+ coderay (~> 1.1.0)
129
+ method_source (~> 0.8.1)
130
+ slop (~> 3.4)
131
+ spoon (~> 0.0)
132
+ pry-rails (0.3.4)
133
+ pry (>= 0.9.10)
134
+ rack (1.6.1)
100
135
  rack-test (0.6.3)
101
136
  rack (>= 1.0)
102
- rails (3.2.21)
103
- actionmailer (= 3.2.21)
104
- actionpack (= 3.2.21)
105
- activerecord (= 3.2.21)
106
- activeresource (= 3.2.21)
107
- activesupport (= 3.2.21)
108
- bundler (~> 1.0)
109
- railties (= 3.2.21)
110
- railties (3.2.21)
111
- actionpack (= 3.2.21)
112
- activesupport (= 3.2.21)
113
- rack-ssl (~> 1.3.2)
137
+ rails (4.2.1)
138
+ actionmailer (= 4.2.1)
139
+ actionpack (= 4.2.1)
140
+ actionview (= 4.2.1)
141
+ activejob (= 4.2.1)
142
+ activemodel (= 4.2.1)
143
+ activerecord (= 4.2.1)
144
+ activesupport (= 4.2.1)
145
+ bundler (>= 1.3.0, < 2.0)
146
+ railties (= 4.2.1)
147
+ sprockets-rails
148
+ rails-deprecated_sanitizer (1.0.3)
149
+ activesupport (>= 4.2.0.alpha)
150
+ rails-dom-testing (1.0.6)
151
+ activesupport (>= 4.2.0.beta, < 5.0)
152
+ nokogiri (~> 1.6.0)
153
+ rails-deprecated_sanitizer (>= 1.0.1)
154
+ rails-html-sanitizer (1.0.2)
155
+ loofah (~> 2.0)
156
+ railties (4.2.1)
157
+ actionpack (= 4.2.1)
158
+ activesupport (= 4.2.1)
114
159
  rake (>= 0.8.7)
115
- rdoc (~> 3.4)
116
- thor (>= 0.14.6, < 2.0)
160
+ thor (>= 0.18.1, < 2.0)
117
161
  rake (10.4.2)
118
- rdoc (3.12.2)
119
- json (~> 1.4)
120
- simplecov (0.9.2)
162
+ responders (2.1.0)
163
+ railties (>= 4.2.0, < 5)
164
+ sass (3.4.14)
165
+ sass-rails (5.0.3)
166
+ railties (>= 4.0.0, < 5.0)
167
+ sass (~> 3.1)
168
+ sprockets (>= 2.8, < 4.0)
169
+ sprockets-rails (>= 2.0, < 4.0)
170
+ tilt (~> 1.1)
171
+ simplecov (0.9.1)
121
172
  docile (~> 1.1.0)
122
173
  multi_json (~> 1.0)
123
- simplecov-html (~> 0.9.0)
124
- simplecov-html (0.9.0)
125
- sprockets (2.2.3)
126
- hike (~> 1.2)
127
- multi_json (~> 1.0)
174
+ simplecov-html (~> 0.8.0)
175
+ simplecov-html (0.8.0)
176
+ slop (3.6.0)
177
+ spoon (0.0.4)
178
+ ffi
179
+ sprockets (3.2.0)
128
180
  rack (~> 1.0)
129
- tilt (~> 1.1, != 1.3.0)
130
- sqlite3 (1.3.10)
181
+ sprockets-rails (2.3.1)
182
+ actionpack (>= 3.0)
183
+ activesupport (>= 3.0)
184
+ sprockets (>= 2.8, < 4.0)
131
185
  symmetric-encryption (3.6.0)
132
186
  coercible (>= 1.0.0)
133
187
  thor (0.19.1)
134
188
  thread_safe (0.3.5)
135
189
  tilt (1.4.1)
136
- treetop (1.4.15)
137
- polyglot
138
- polyglot (>= 0.3.1)
139
- twitter-bootstrap-rails (2.2.8)
140
- actionpack (>= 3.1)
141
- execjs
142
- rails (>= 3.1)
143
- railties (>= 3.1)
144
- tzinfo (0.3.44)
190
+ twitter-bootstrap-rails (3.2.0)
191
+ actionpack (~> 4.1)
192
+ execjs (~> 2.2)
193
+ rails (~> 4.1)
194
+ railties (~> 4.1)
195
+ tzinfo (1.2.2)
196
+ thread_safe (~> 0.1)
145
197
  warden (1.2.3)
146
198
  rack (>= 1.0)
147
199
 
148
200
  PLATFORMS
201
+ java
149
202
  ruby
150
203
 
151
204
  DEPENDENCIES
152
205
  fakeweb (~> 1.3)
153
206
  kaui!
154
207
  mysql2
208
+ pry-rails
155
209
  rake (>= 0.8.7)
156
210
  simplecov
157
- sqlite3
@@ -6,8 +6,11 @@
6
6
  //
7
7
  //= require jquery
8
8
  //= require jquery_ujs
9
+ //= require dataTables/jquery.dataTables
10
+ //= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
11
+ //= require dataTables/jquery.dataTables
9
12
  //= require d3
10
13
  //= require twitter/bootstrap
11
- //= require jquery.dataTables.min
12
14
  //= require kaui/bootstrap-tweaks
13
15
  //= require kaui/validation
16
+ //= require kaui/datatables-tweaks
@@ -28,7 +28,7 @@ function makeDataTable(tableObj) {
28
28
  }
29
29
  }
30
30
  tableObj.dataTable({
31
- "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
31
+ "sDom": "<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>",
32
32
  "sPaginationType": "bootstrap",
33
33
  "oLanguage": {
34
34
  "sLengthMenu": "_MENU_ records per page"
@@ -0,0 +1,3 @@
1
+ $(document).on('init.dt', function(){
2
+ $('.dataTables_paginate').find('ul').addClass('pagination');
3
+ });
@@ -4,4 +4,6 @@
4
4
  * the top of the compiled file, but it's generally better to create a new file per style scope.
5
5
  *= require_self
6
6
  *= require_tree .
7
+ *= require dataTables/jquery.dataTables
8
+ *= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
7
9
  */
@@ -5,44 +5,3 @@
5
5
  To use Glyphicons sprites instead of Font Awesome, replace with "require twitter-bootstrap-static/sprites"
6
6
  =require twitter-bootstrap-static/fontawesome
7
7
  */
8
-
9
- /* Fixing corners on nav */
10
- .kauiNav .navbar-inner {
11
- border-radius: 0;
12
- -moz-border-radius: 0;
13
- -webkit-border-radius: 0;
14
- }
15
-
16
- /* Moving pagination to right side of page */
17
- .pagination {
18
- margin: 0;
19
- }
20
- .pagination ul {
21
- float: right;
22
- }
23
-
24
- /* Moving search to right side of page */
25
- .dataTables_filter label {
26
- float: right;
27
- }
28
-
29
- .dataTables_length select {
30
- width: auto;
31
- }
32
-
33
- /* Removing header margin */
34
- .pageHeader {
35
- margin: 0 0 20px 0;
36
- line-height: 30px;
37
- }
38
-
39
- /* Removing form action background and border */
40
- .form-actions {
41
- background: none;
42
- border: none;
43
- }
44
-
45
- /** New account page **/
46
- .groupWrapper {
47
- margin: 0;
48
- }
@@ -0,0 +1,14 @@
1
+ table.dataTable thead th {
2
+ position: relative;
3
+ }
4
+
5
+ table.dataTable thead th,
6
+ table.dataTable tbody td{
7
+ vertical-align: middle;
8
+ }
9
+
10
+ table.dataTable thead th.sorting:after,
11
+ table.dataTable thead th.sorting_asc:after,
12
+ table.dataTable thead th.sorting_desc:after {
13
+ content: '' !important;
14
+ }
@@ -0,0 +1,19 @@
1
+ .navbar{
2
+ border-radius: 0;
3
+ }
4
+
5
+ .top_navbar{
6
+ li{
7
+ display: inline-block;
8
+
9
+ a{
10
+ color: #B3B3B3;
11
+ &:hover { color: black; }
12
+ }
13
+ }
14
+ }
15
+
16
+ .main-footer{
17
+ min-height: 50px;
18
+ margin-top: 100px;
19
+ }
@@ -32,13 +32,7 @@ class Kaui::AccountTimelinesController < Kaui::EngineController
32
32
  end
33
33
 
34
34
  # Lookup all invoices
35
- @invoices_by_id = {}
36
- @timeline.payments.each do |payment|
37
- load_invoice_id_for_timeline(payment.target_invoice_id)
38
- end
39
- @timeline.invoices.each do |invoice|
40
- load_invoice_id_for_timeline(invoice.invoice_id)
41
- end
35
+ load_invoices_for_timeline
42
36
 
43
37
  if params.has_key?(:external_key)
44
38
  @selected_bundle = @bundle_names[params[:external_key]]
@@ -51,13 +45,11 @@ class Kaui::AccountTimelinesController < Kaui::EngineController
51
45
  @bundle_names[bundle_key] ||= Kaui.bundle_key_display_string.call(bundle_key)
52
46
  end
53
47
 
54
- def load_invoice_id_for_timeline(invoice_id)
55
- return if invoice_id.blank? or @invoices_by_id.has_key?(invoice_id)
48
+ def load_invoices_for_timeline
49
+ all_invoices = @account.invoices(true, options_for_klient)
50
+ return {} if all_invoices.nil? || all_invoices.empty?
56
51
 
57
- begin
58
- @invoices_by_id[invoice_id] = Kaui::Invoice.find_by_id_or_number(invoice_id, true, 'NONE', options_for_klient)
59
- rescue => e
60
- flash.now[:error] = "Could not get invoice information for the timeline #{@account_id}: #{as_string(e)}"
61
- end
52
+ # Convert into Kaui::Invoice to benefit from additional methods xxx_to_money
53
+ @invoices_by_id = all_invoices.inject({}) {|hsh, invoice| hsh[invoice.invoice_id] = Kaui::Invoice.build_from_raw_invoice(invoice); hsh}
62
54
  end
63
55
  end
@@ -14,5 +14,8 @@ module Kaui
14
14
  Kaui.tenant_home_path.call
15
15
  end
16
16
 
17
+ def after_sign_out_path_for(resource)
18
+ kaui_path
19
+ end
17
20
  end
18
21
  end
@@ -11,10 +11,10 @@ class Kaui::SubscriptionsController < Kaui::EngineController
11
11
 
12
12
  begin
13
13
  if @subscription.product_category == 'ADD_ON'
14
- @bundle = Kaui::Bundle::find_by_id(@subscription.bundle_id, options_for_klient)
15
- plans_details = Kaui::Catalog::available_addons(@base_product_name, options_for_klient)
14
+ @bundle = Kaui::Bundle.find_by_id(@subscription.bundle_id, options_for_klient)
15
+ plans_details = Kaui::Catalog.available_addons(@base_product_name, options_for_klient)
16
16
  else
17
- plans_details = Kaui::Catalog::available_base_plans(options_for_klient)
17
+ plans_details = Kaui::Catalog.available_base_plans(options_for_klient)
18
18
  end
19
19
  @plans = plans_details.map { |p| p.plan }
20
20
  rescue => e
@@ -28,10 +28,10 @@ class Kaui::SubscriptionsController < Kaui::EngineController
28
28
 
29
29
  begin
30
30
  if @subscription.product_category == 'ADD_ON'
31
- @bundle = Kaui::Bundle::find_by_id(@subscription.bundle_id, options_for_klient)
32
- plans_details = Kaui::Catalog::available_addons(params[:base_product_name], options_for_klient)
31
+ @bundle = Kaui::Bundle.find_by_id(@subscription.bundle_id, options_for_klient)
32
+ plans_details = Kaui::Catalog.available_addons(params[:base_product_name], options_for_klient)
33
33
  else
34
- plans_details = Kaui::Catalog::available_base_plans(options_for_klient)
34
+ plans_details = Kaui::Catalog.available_base_plans(options_for_klient)
35
35
  end
36
36
 
37
37
  plan_details = plans_details.find { |p| p.plan == params[:plan_name] }
@@ -39,7 +39,7 @@ class Kaui::SubscriptionsController < Kaui::EngineController
39
39
  @subscription.product_name = plan_details.product
40
40
  @subscription.price_list = plan_details.price_list
41
41
 
42
- @subscription = @subscription.create(current_user.kb_username, params[:reason], params[:comment], options_for_klient)
42
+ @subscription = @subscription.create(current_user.kb_username, params[:reason], params[:comment], nil, false, options_for_klient)
43
43
  redirect_to bundle_path(@subscription.bundle_id), :notice => 'Subscription was successfully created'
44
44
  rescue => e
45
45
  @plans = plans_details.nil? ? [] : plans_details.map { |p| p.plan }
@@ -79,7 +79,7 @@ class Kaui::SubscriptionsController < Kaui::EngineController
79
79
  billing_policy = params[:policy] unless params[:policy].blank?
80
80
  wait_for_completion = params[:wait_for_completion] == '1'
81
81
 
82
- subscription = Kaui::Subscription.new(:subscription_id => params[:id])
82
+ subscription = Kaui::Subscription.find_by_id(params[:id], options_for_klient)
83
83
 
84
84
  begin
85
85
  plans_details = Kaui::Catalog::available_base_plans(options_for_klient)
@@ -33,9 +33,7 @@ module Kaui
33
33
  #
34
34
  to_be_model, action = permission.split(':')
35
35
  # Currently the only actions implemented for overdue and catalog (upload_config) are those implemented at the tenant level:
36
- if to_be_model == 'tenant' ||
37
- to_be_model == 'overdue' ||
38
- to_be_model == 'catalog'
36
+ if ['tenant', 'overdue', 'catalog'].include?(to_be_model)
39
37
  to_be_model = 'admin_tenant'
40
38
  end
41
39
  if to_be_model == 'entitlement'
@@ -2,7 +2,12 @@ module Kaui
2
2
  class AllowedUser < ActiveRecord::Base
3
3
  attr_accessible :kb_username, :description
4
4
 
5
- has_many :kaui_allowed_user_tenants, :class_name => 'Kaui::AllowedUserTenant', :foreign_key => 'kaui_allowed_user_id'
6
- has_many :kaui_tenants, :through => :kaui_allowed_user_tenants, :source => :kaui_tenant, :uniq => true
5
+ has_many :kaui_allowed_user_tenants,
6
+ :class_name => 'Kaui::AllowedUserTenant',
7
+ :foreign_key => 'kaui_allowed_user_id'
8
+
9
+ has_many :kaui_tenants, -> { uniq },
10
+ :through => :kaui_allowed_user_tenants,
11
+ :source => :kaui_tenant
7
12
  end
8
13
  end
@@ -1,5 +1,26 @@
1
1
  class Kaui::Invoice < KillBillClient::Model::Invoice
2
2
 
3
+ def self.build_from_raw_invoice(raw_invoice)
4
+ # There is probably a meta-programming trick to avoid writing that copy ctor by hand...
5
+ result = Kaui::Invoice.new
6
+ result.amount = raw_invoice.amount
7
+ result.currency = raw_invoice.currency
8
+ result.credit_adj = raw_invoice.credit_adj
9
+ result.refund_adj = raw_invoice.refund_adj
10
+ result.invoice_id = raw_invoice.invoice_id
11
+ result.invoice_date = raw_invoice.invoice_date
12
+ result.target_date = raw_invoice.target_date
13
+ result.invoice_number = raw_invoice.invoice_number
14
+ result.balance = raw_invoice.balance
15
+ result.account_id = raw_invoice.account_id
16
+ result.external_bundle_keys = raw_invoice.external_bundle_keys
17
+ result.credits = raw_invoice.credits
18
+ result.items = raw_invoice.items
19
+ result.audit_logs = raw_invoice.audit_logs
20
+ result
21
+ end
22
+
23
+
3
24
  [:amount, :balance, :credits].each do |type|
4
25
  define_method "#{type}_to_money" do
5
26
  Kaui::Base.to_money(send(type), currency)
@@ -6,5 +6,5 @@
6
6
  <% end %>
7
7
  <br/>
8
8
  <% end %>
9
- <%= link_to 'Add/Remove', kaui_engine.account_email_path(account_id), :class => 'btn btn-mini' %>
9
+ <%= link_to 'Add/Remove', kaui_engine.account_email_path(account_id), :class => 'btn btn-xs' %>
10
10
  </dd>