accountant_clerk 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +67 -11
  3. data/.travis.yml +10 -0
  4. data/Gemfile +33 -0
  5. data/Gemfile.lock +306 -0
  6. data/README.md +13 -3
  7. data/Rakefile +6 -0
  8. data/accountant_clerk.gemspec +5 -3
  9. data/app/assets/javascripts/accountant_office.js.coffee +2 -0
  10. data/app/controllers/manage_controller_decorator.rb +4 -4
  11. data/app/views/manage/report.html.haml +20 -28
  12. data/config/locales/en.yml +7 -1
  13. data/lib/accountant_clerk/engine.rb +8 -2
  14. data/spec/controllers/orders_controller_spec.rb +88 -0
  15. data/spec/features/edit_spec.rb +28 -0
  16. data/spec/features/orders_spec.rb +32 -0
  17. data/spec/routing/orders_routing_spec.rb +36 -0
  18. data/spec/spec_helper.rb +31 -24
  19. data/spec/support/admin.rb +4 -0
  20. data/spec/support/capybara.rb +14 -0
  21. data/spec/support/cleaner.rb +22 -0
  22. data/spec/support/email.rb +6 -0
  23. data/spec/support/factory_girl.rb +3 -0
  24. data/spec/support/request_helper.rb +31 -0
  25. data/test_app/README.rdoc +28 -0
  26. data/test_app/app/assets/javascripts/application.js +15 -0
  27. data/test_app/app/assets/stylesheets/application.css +13 -0
  28. data/test_app/app/controllers/application_controller.rb +5 -0
  29. data/test_app/app/helpers/application_helper.rb +2 -0
  30. data/test_app/app/views/layouts/sales_clerk.haml +9 -0
  31. data/test_app/bin/bundle +3 -0
  32. data/test_app/bin/rails +4 -0
  33. data/test_app/bin/rake +4 -0
  34. data/test_app/config/application.rb +28 -0
  35. data/test_app/config/boot.rb +4 -0
  36. data/test_app/config/database.yml +25 -0
  37. data/test_app/config/environment.rb +5 -0
  38. data/test_app/config/environments/development.rb +32 -0
  39. data/test_app/config/environments/production.rb +80 -0
  40. data/test_app/config/environments/test.rb +39 -0
  41. data/test_app/config/initializers/backtrace_silencers.rb +7 -0
  42. data/test_app/config/initializers/filter_parameter_logging.rb +4 -0
  43. data/test_app/config/initializers/inflections.rb +16 -0
  44. data/test_app/config/initializers/mime_types.rb +5 -0
  45. data/test_app/config/initializers/secret_token.rb +12 -0
  46. data/test_app/config/initializers/session_store.rb +3 -0
  47. data/test_app/config/initializers/wrap_parameters.rb +14 -0
  48. data/test_app/config/locales/en.yml +23 -0
  49. data/test_app/config/routes.rb +4 -0
  50. data/test_app/config.ru +4 -0
  51. data/test_app/db/migrate/20141114205525_clerks.office.rb +16 -0
  52. data/test_app/db/migrate/20141114205526_suppliers.office.rb +10 -0
  53. data/test_app/db/migrate/20141114205527_categories.office.rb +19 -0
  54. data/test_app/db/migrate/20141114205528_items.office.rb +15 -0
  55. data/test_app/db/migrate/20141114205529_orders.office.rb +23 -0
  56. data/test_app/db/migrate/20141114205530_baskets.office.rb +13 -0
  57. data/test_app/db/migrate/20141114205531_purchases.office.rb +12 -0
  58. data/test_app/db/migrate/20141114205532_products.office.rb +28 -0
  59. data/test_app/db/schema.rb +141 -0
  60. data/test_app/db/seeds.rb +7 -0
  61. data/test_app/public/404.html +58 -0
  62. data/test_app/public/422.html +58 -0
  63. data/test_app/public/500.html +57 -0
  64. data/test_app/public/favicon.ico +0 -0
  65. data/test_app/public/robots.txt +5 -0
  66. metadata +74 -9
  67. data/app/assets/javascripts/accountant_office.js.rb +0 -4
  68. data/app/assets/javascripts/flotomatic.js +0 -177
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58fddb8a54c304129e479fa6e8a486f444308b8e
4
- data.tar.gz: d119808f6a3941f412d756918c545a2a0d9a42c8
3
+ metadata.gz: f843bf939d8b5a18418520caa9e99c6ee477fbef
4
+ data.tar.gz: e2fec3723a3faad2483b983fcf20647523f28d1a
5
5
  SHA512:
6
- metadata.gz: 826bb581c3340527b53e956373919b82d01c9ce7114dcc41d7886f100722a03593b2a52451ba5bb11a26ca0fabd2c3dfe09e2dc895fe5ae3b631aba045a862dd
7
- data.tar.gz: fe973490a1d248f2051c4d696192ef3c91612ac6e47b6e7ac7ebcec6cf8ebbfcc02f3c587a5375b4b35bec6ec5a6eeaddac89729e97267eeb49df83bc792ea11
6
+ metadata.gz: 3e5eff6e0e3fca79ec7996e52726f368d72762e3fb6e12ec7c9eb3984c689c9461042d27e87a223bee2dda05b58dcdbe3465f92fbe1c8f332786f5e0d77f087f
7
+ data.tar.gz: c5f71b30a1c19a6bb5968048c72aa52059625bea86eb9f4b34f618286c53a922a4cf3989215e82948966d375e0e0546331e6c651d0344c66a7d399e3adb454e7
data/.gitignore CHANGED
@@ -1,19 +1,75 @@
1
- *.rbc
2
- *.sassc
3
- .sass-cache
4
- capybara-*.html
5
- .rspec
6
- .rvmrc
1
+ # bundler state
7
2
  /.bundle
8
- /vendor/bundle
3
+ /vendor/bundle/
4
+ /vendor/ruby/
5
+
6
+ # minimal Rails specific artifacts
7
+ *.sqlite3
8
+ *.sqlite3-journal
9
9
  /log/*
10
10
  /tmp/*
11
+ .ruby-version
12
+ test_app/tmp
13
+ test_app/log
14
+
15
+ # configuration file introduced in Rails 4.1
16
+ /config/secrets.yml
17
+
18
+ .localeapp
19
+
20
+ # various artifacts
21
+ **.war
22
+ *.rbc
23
+ *.sassc
24
+ .rspec
25
+ .redcar/
26
+ .sass-cache
27
+ /coverage.data
28
+ /coverage/
29
+ /db/*.javadb/
11
30
  /db/*.sqlite3
31
+ /doc/api/
32
+ /doc/app/
33
+ /doc/features.html
34
+ /doc/specs.html
35
+ /public/cache
36
+ /public/assets
37
+ /public/stylesheets/compiled
12
38
  /public/system/*
13
- /coverage/
14
39
  /spec/tmp/*
15
- **.orig
40
+ /cache
41
+ /capybara*
42
+ /capybara-*.html
43
+ /gems
44
+ /specifications
16
45
  rerun.txt
17
46
  pickle-email-*.html
18
- .project
19
- config/initializers/secret_token.rb
47
+ .zeus.sock
48
+ webrat.log
49
+ public/images
50
+ public/extra_pictures/
51
+ public/main_pictures/
52
+ # If you find yourself ignoring temporary files generated by your text editor
53
+ # or operating system, you probably want to add a global ignore instead:
54
+ # git config --global core.excludesfile ~/.gitignore_global
55
+ #
56
+ # Here are some files you may want to ignore globally:
57
+
58
+ # scm revert files
59
+ **.orig
60
+
61
+ # Mac finder artifacts
62
+ .DS_Store
63
+
64
+ # Netbeans project directory
65
+ /nbproject/
66
+
67
+ # RubyMine project files
68
+ .idea
69
+
70
+ # Textmate project files
71
+ /*.tmproj
72
+
73
+ # vim artifacts
74
+ **.swp
75
+ .localeapp
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ sudo: false
3
+ cache: bundler
4
+ script:
5
+ - RAILS_ENV=test bundle exec rake db:migrate
6
+ - CODECLIMATE_REPO_TOKEN=a2e365694938ab5a19f07dff9a2ec48bdddd83a6afaf3a8574ef7052c5f3975b bundle exec rspec
7
+ rvm:
8
+ - 1.9.3
9
+ - 2.0.0
10
+ - 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,33 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "office_clerk" , :github => "rubyclerks/office_clerk"
4
+ gem "accountant_clerk" , :path => "../"
5
+
6
+ gem 'sqlite3'
7
+
8
+ #asset / production reelated
9
+ gem "therubyracer"
10
+ gem "libv8" , "3.16.14.3"
11
+ gem "rb-readline"
12
+ gem 'uglifier', '>= 1.3.0'
13
+
14
+ group :development do
15
+ gem 'better_errors' , :platforms=>[:mri_20, :mri_21, :rbx]
16
+ gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :mri_21,:rbx]
17
+ gem 'quiet_assets'
18
+ # gem "jeweler", "> 1.6.4"
19
+ end
20
+ group :test do
21
+ # gem "poltergeist"
22
+ # gem "phantomjs"
23
+ gem "codeclimate-test-reporter"
24
+ gem 'rspec-rails'
25
+ gem 'capybara'
26
+ gem 'capybara-screenshot'
27
+ gem 'database_cleaner'
28
+ gem "factory_girl_rails"
29
+ gem 'email_spec'
30
+ gem 'i18n-spec'
31
+ gem 'guard-rails'
32
+ gem 'guard-rspec'
33
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,306 @@
1
+ GIT
2
+ remote: git://github.com/rubyclerks/office_clerk.git
3
+ revision: 784f5f0ac4d419b766a9a2ff42dc16d20541923d
4
+ specs:
5
+ office_clerk (0.8)
6
+ bcrypt-ruby (~> 3.1)
7
+ best_in_place (~> 3.0)
8
+ bootstrap-sass (~> 3.1)
9
+ bootstrap_form (~> 2.2)
10
+ coffee-rails (~> 4.0)
11
+ gon (~> 5.2)
12
+ haml (~> 4.0)
13
+ jquery-rails (~> 3.1)
14
+ jquery-ui-rails (~> 5.0)
15
+ kramdown (~> 1.5)
16
+ paperclip (~> 4.1)
17
+ rails (~> 4.1, < 4.2)
18
+ rails-i18n (~> 4.0)
19
+ ransack (~> 1.5, >= 1.5.1)
20
+ sass-rails (~> 4.0)
21
+ valid_email (~> 0.0, >= 0.0.10)
22
+ will_paginate-bootstrap (~> 1.0)
23
+
24
+ PATH
25
+ remote: ../
26
+ specs:
27
+ accountant_clerk (0.6)
28
+ flot-rails (~> 0.0.6)
29
+ office_clerk (~> 0.8)
30
+
31
+ GEM
32
+ remote: https://rubygems.org/
33
+ specs:
34
+ actionmailer (4.1.8)
35
+ actionpack (= 4.1.8)
36
+ actionview (= 4.1.8)
37
+ mail (~> 2.5, >= 2.5.4)
38
+ actionpack (4.1.8)
39
+ actionview (= 4.1.8)
40
+ activesupport (= 4.1.8)
41
+ rack (~> 1.5.2)
42
+ rack-test (~> 0.6.2)
43
+ actionview (4.1.8)
44
+ activesupport (= 4.1.8)
45
+ builder (~> 3.1)
46
+ erubis (~> 2.7.0)
47
+ activemodel (4.1.8)
48
+ activesupport (= 4.1.8)
49
+ builder (~> 3.1)
50
+ activerecord (4.1.8)
51
+ activemodel (= 4.1.8)
52
+ activesupport (= 4.1.8)
53
+ arel (~> 5.0.0)
54
+ activesupport (4.1.8)
55
+ i18n (~> 0.6, >= 0.6.9)
56
+ json (~> 1.7, >= 1.7.7)
57
+ minitest (~> 5.1)
58
+ thread_safe (~> 0.1)
59
+ tzinfo (~> 1.1)
60
+ addressable (2.3.6)
61
+ arel (5.0.1.20140414130214)
62
+ bcrypt (3.1.9)
63
+ bcrypt-ruby (3.1.5)
64
+ bcrypt (>= 3.1.3)
65
+ best_in_place (3.0.2)
66
+ actionpack (>= 3.2)
67
+ railties (>= 3.2)
68
+ better_errors (2.0.0)
69
+ coderay (>= 1.0.0)
70
+ erubis (>= 2.6.6)
71
+ rack (>= 0.9.0)
72
+ binding_of_caller (0.7.2)
73
+ debug_inspector (>= 0.0.1)
74
+ bootstrap-sass (3.3.1.0)
75
+ sass (~> 3.2)
76
+ bootstrap_form (2.2.0)
77
+ builder (3.2.2)
78
+ capybara (2.4.4)
79
+ mime-types (>= 1.16)
80
+ nokogiri (>= 1.3.3)
81
+ rack (>= 1.0.0)
82
+ rack-test (>= 0.5.4)
83
+ xpath (~> 2.0)
84
+ capybara-screenshot (1.0.3)
85
+ capybara (>= 1.0, < 3)
86
+ colored
87
+ launchy
88
+ celluloid (0.16.0)
89
+ timers (~> 4.0.0)
90
+ climate_control (0.0.3)
91
+ activesupport (>= 3.0)
92
+ cocaine (0.5.5)
93
+ climate_control (>= 0.0.3, < 1.0)
94
+ codeclimate-test-reporter (0.4.1)
95
+ simplecov (>= 0.7.1, < 1.0.0)
96
+ coderay (1.1.0)
97
+ coffee-rails (4.1.0)
98
+ coffee-script (>= 2.2.0)
99
+ railties (>= 4.0.0, < 5.0)
100
+ coffee-script (2.3.0)
101
+ coffee-script-source
102
+ execjs
103
+ coffee-script-source (1.8.0)
104
+ colored (1.2)
105
+ database_cleaner (1.3.0)
106
+ debug_inspector (0.0.2)
107
+ diff-lcs (1.2.5)
108
+ docile (1.1.5)
109
+ email_spec (1.6.0)
110
+ launchy (~> 2.1)
111
+ mail (~> 2.2)
112
+ erubis (2.7.0)
113
+ execjs (2.2.2)
114
+ factory_girl (4.5.0)
115
+ activesupport (>= 3.0.0)
116
+ factory_girl_rails (4.5.0)
117
+ factory_girl (~> 4.5.0)
118
+ railties (>= 3.0.0)
119
+ ffi (1.9.6)
120
+ flot-rails (0.0.6)
121
+ jquery-rails
122
+ formatador (0.2.5)
123
+ gon (5.2.3)
124
+ actionpack (>= 2.3.0)
125
+ json
126
+ multi_json
127
+ request_store (>= 1.0.5)
128
+ guard (2.9.0)
129
+ formatador (>= 0.2.4)
130
+ listen (~> 2.7)
131
+ lumberjack (~> 1.0)
132
+ pry (>= 0.9.12)
133
+ thor (>= 0.18.1)
134
+ guard-rails (0.7.0)
135
+ guard (~> 2.0)
136
+ guard-rspec (4.3.1)
137
+ guard (~> 2.1)
138
+ rspec (>= 2.14, < 4.0)
139
+ haml (4.0.6)
140
+ tilt
141
+ hike (1.2.3)
142
+ hitimes (1.2.2)
143
+ i18n (0.7.0)
144
+ i18n-spec (0.6.0)
145
+ iso
146
+ iso (0.2.1)
147
+ i18n
148
+ jquery-rails (3.1.2)
149
+ railties (>= 3.0, < 5.0)
150
+ thor (>= 0.14, < 2.0)
151
+ jquery-ui-rails (5.0.3)
152
+ railties (>= 3.2.16)
153
+ json (1.8.1)
154
+ kramdown (1.5.0)
155
+ launchy (2.4.3)
156
+ addressable (~> 2.3)
157
+ libv8 (3.16.14.3)
158
+ listen (2.8.2)
159
+ celluloid (>= 0.15.2)
160
+ rb-fsevent (>= 0.9.3)
161
+ rb-inotify (>= 0.9)
162
+ lumberjack (1.0.9)
163
+ mail (2.6.3)
164
+ mime-types (>= 1.16, < 3)
165
+ method_source (0.8.2)
166
+ mime-types (2.4.3)
167
+ mini_portile (0.6.1)
168
+ minitest (5.5.0)
169
+ multi_json (1.10.1)
170
+ nokogiri (1.6.4.1)
171
+ mini_portile (~> 0.6.0)
172
+ paperclip (4.2.1)
173
+ activemodel (>= 3.0.0)
174
+ activesupport (>= 3.0.0)
175
+ cocaine (~> 0.5.3)
176
+ mime-types
177
+ polyamorous (1.1.0)
178
+ activerecord (>= 3.0)
179
+ pry (0.10.1)
180
+ coderay (~> 1.1.0)
181
+ method_source (~> 0.8.1)
182
+ slop (~> 3.4)
183
+ quiet_assets (1.0.3)
184
+ railties (>= 3.1, < 5.0)
185
+ rack (1.5.2)
186
+ rack-test (0.6.2)
187
+ rack (>= 1.0)
188
+ rails (4.1.8)
189
+ actionmailer (= 4.1.8)
190
+ actionpack (= 4.1.8)
191
+ actionview (= 4.1.8)
192
+ activemodel (= 4.1.8)
193
+ activerecord (= 4.1.8)
194
+ activesupport (= 4.1.8)
195
+ bundler (>= 1.3.0, < 2.0)
196
+ railties (= 4.1.8)
197
+ sprockets-rails (~> 2.0)
198
+ rails-i18n (4.0.3)
199
+ i18n (~> 0.6)
200
+ railties (~> 4.0)
201
+ railties (4.1.8)
202
+ actionpack (= 4.1.8)
203
+ activesupport (= 4.1.8)
204
+ rake (>= 0.8.7)
205
+ thor (>= 0.18.1, < 2.0)
206
+ rake (10.4.2)
207
+ ransack (1.5.1)
208
+ actionpack (>= 3.0)
209
+ activerecord (>= 3.0)
210
+ activesupport (>= 3.0)
211
+ i18n
212
+ polyamorous (~> 1.1)
213
+ rb-fsevent (0.9.4)
214
+ rb-inotify (0.9.5)
215
+ ffi (>= 0.5.0)
216
+ rb-readline (0.5.1)
217
+ ref (1.0.5)
218
+ request_store (1.1.0)
219
+ rspec (3.1.0)
220
+ rspec-core (~> 3.1.0)
221
+ rspec-expectations (~> 3.1.0)
222
+ rspec-mocks (~> 3.1.0)
223
+ rspec-core (3.1.7)
224
+ rspec-support (~> 3.1.0)
225
+ rspec-expectations (3.1.2)
226
+ diff-lcs (>= 1.2.0, < 2.0)
227
+ rspec-support (~> 3.1.0)
228
+ rspec-mocks (3.1.3)
229
+ rspec-support (~> 3.1.0)
230
+ rspec-rails (3.1.0)
231
+ actionpack (>= 3.0)
232
+ activesupport (>= 3.0)
233
+ railties (>= 3.0)
234
+ rspec-core (~> 3.1.0)
235
+ rspec-expectations (~> 3.1.0)
236
+ rspec-mocks (~> 3.1.0)
237
+ rspec-support (~> 3.1.0)
238
+ rspec-support (3.1.2)
239
+ sass (3.2.19)
240
+ sass-rails (4.0.5)
241
+ railties (>= 4.0.0, < 5.0)
242
+ sass (~> 3.2.2)
243
+ sprockets (~> 2.8, < 3.0)
244
+ sprockets-rails (~> 2.0)
245
+ simplecov (0.9.1)
246
+ docile (~> 1.1.0)
247
+ multi_json (~> 1.0)
248
+ simplecov-html (~> 0.8.0)
249
+ simplecov-html (0.8.0)
250
+ slop (3.6.0)
251
+ sprockets (2.12.3)
252
+ hike (~> 1.2)
253
+ multi_json (~> 1.0)
254
+ rack (~> 1.0)
255
+ tilt (~> 1.1, != 1.3.0)
256
+ sprockets-rails (2.2.2)
257
+ actionpack (>= 3.0)
258
+ activesupport (>= 3.0)
259
+ sprockets (>= 2.8, < 4.0)
260
+ sqlite3 (1.3.10)
261
+ therubyracer (0.12.1)
262
+ libv8 (~> 3.16.14.0)
263
+ ref
264
+ thor (0.19.1)
265
+ thread_safe (0.3.4)
266
+ tilt (1.4.1)
267
+ timers (4.0.1)
268
+ hitimes
269
+ tzinfo (1.2.2)
270
+ thread_safe (~> 0.1)
271
+ uglifier (2.5.3)
272
+ execjs (>= 0.3.0)
273
+ json (>= 1.8.0)
274
+ valid_email (0.0.10)
275
+ activemodel
276
+ mail (~> 2.6.1)
277
+ will_paginate (3.0.7)
278
+ will_paginate-bootstrap (1.0.1)
279
+ will_paginate (>= 3.0.3)
280
+ xpath (2.0.0)
281
+ nokogiri (~> 1.3)
282
+
283
+ PLATFORMS
284
+ ruby
285
+
286
+ DEPENDENCIES
287
+ accountant_clerk!
288
+ better_errors
289
+ binding_of_caller
290
+ capybara
291
+ capybara-screenshot
292
+ codeclimate-test-reporter
293
+ database_cleaner
294
+ email_spec
295
+ factory_girl_rails
296
+ guard-rails
297
+ guard-rspec
298
+ i18n-spec
299
+ libv8 (= 3.16.14.3)
300
+ office_clerk!
301
+ quiet_assets
302
+ rb-readline
303
+ rspec-rails
304
+ sqlite3
305
+ therubyracer
306
+ uglifier (>= 1.3.0)
data/README.md CHANGED
@@ -45,14 +45,23 @@ In fact I often alternate between two properties. Search by one property, group
45
45
  Installation
46
46
  ===========
47
47
 
48
- I'm not releasing gems now. It's not really beta yet, but may still be useful to some. So the well known gem line is:
48
+ Just add
49
49
 
50
- gem 'report_clerk', :git => 'git://github.com/dancinglightning/clerk_simple_reports.git'
50
+ gem "accountant_clerk"
51
+
52
+ to your Gemfile and bundle.
51
53
 
52
54
  There are no external dependencies and the only javascript file is referenced from the one template. So no further actions should be needed.
53
55
 
54
56
  Warning: Do not do silly queries as they will slow down your production environment. For intensive work I suggest to copy your database, ie with yaml_db, to your local machine first.
55
57
 
58
+ Status
59
+ ======
60
+
61
+ This is an old spree extension ported to clerks. As such it has been in use for 4-5 years.
62
+ While that doesn't make it perfect (see below) it does mean it is stable.
63
+ The version number (<1) refers more to the code cleanliness than it's functionlity (read help appreciated)
64
+
56
65
  Issues
57
66
  =======
58
67
 
@@ -60,7 +69,7 @@ The metasearch with subsequent ruby code approach has served well to get the pro
60
69
 
61
70
  As the search searches Items , items that are in non completed orders are included. Quite trivial fix, just never got around to it as we don't have that problem.
62
71
 
63
- Also it is quite simple to grind your database and server to a halt by grouping by variant, and reporting a year by day.
72
+ Also it is quite simple to grind your database and server to a halt by grouping by product, and reporting a year by day.
64
73
 
65
74
  Plans
66
75
  =====
@@ -71,5 +80,6 @@ Vague Plans exist to introduce also:
71
80
  - Reports about Order numbers
72
81
  - Grouping by customer
73
82
 
83
+ Started to use gon now, but still the code could use cleaning (and testing)
74
84
 
75
85
  Copyright (c) 2014 [Torsten Ruger], released under the New BSD License
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../test_app/config/application', __FILE__)
5
+
6
+ TestApp::Application.load_tasks
@@ -2,9 +2,11 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = 'accountant_clerk'
5
- s.version = '0.5'
6
- s.summary = 'Simple reports that are not so simple anymore'
5
+ s.version = '0.6'
6
+ s.summary = 'Simple reports for rubyclerks'
7
+ s.description = 'Simple reports that are not so simple anymore and let you analyse your shops performance'
7
8
  s.required_ruby_version = '>= 1.9.3'
9
+ s.homepage = 'https://github.com/rubyclerks/accountant_clerk'
8
10
 
9
11
  s.author = 'Torsten Ruger'
10
12
  s.email = 'torsten@villataika.fi'
@@ -15,7 +17,7 @@ Gem::Specification.new do |s|
15
17
  s.require_path = 'lib'
16
18
  s.requirements << 'none'
17
19
 
18
- s.add_runtime_dependency 'office_clerk', '~> 0.4'
20
+ s.add_runtime_dependency 'office_clerk', '~> 0.8'
19
21
  s.add_runtime_dependency 'flot-rails', '~> 0.0.6'
20
22
  end
21
23
 
@@ -0,0 +1,2 @@
1
+ $ ->
2
+ $(".manage_first").html '<div class="col-md-12"><h3><a href="/manage/report"> Reports </a></h3></div>'
@@ -4,7 +4,7 @@ ManageController.class_eval do
4
4
  search = params[:q] || {}
5
5
  search[:meta_sort] = "created_at asc"
6
6
  if search[:created_at_gt].blank?
7
- search[:created_at_gt] = Time.now - 3.months
7
+ search[:created_at_gt] = (Time.now - 3.months)
8
8
  else
9
9
  search[:created_at_gt] = Time.zone.parse(search[:created_at_gt]).beginning_of_day rescue Time.zone.now.beginning_of_month
10
10
  end
@@ -33,7 +33,7 @@ ManageController.class_eval do
33
33
  Item
34
34
  end
35
35
  @search = search_on.includes(:product).ransack(search)
36
- @flot_options = { :series => { :bars => { :show => true , :barWidth => @days * 24*60*60*1000 } , :stack => 0 } ,
36
+ gon.flot_options = { :series => { :bars => { :show => true , :barWidth => @days * 24*60*60*1000 } , :stack => 0 } ,
37
37
  :legend => { :container => "#legend"} ,
38
38
  :xaxis => { :mode => "time" }
39
39
  }
@@ -56,12 +56,12 @@ ManageController.class_eval do
56
56
  flot[ bucket ] << item
57
57
  end
58
58
  end
59
- @flot_data = flot.collect do |label , data |
59
+ flot_data = flot.collect do |label , data |
60
60
  buck = bucket_array( data , smallest , largest )
61
61
  sum = buck.inject(0.0){|total , val | total + val[1] }.round(2)
62
62
  { :label => "#{label} =#{sum}" , :data => buck }
63
63
  end
64
- @flot_data.sort!{ |a,b| b[:label].split("=")[1].to_f <=> a[:label].split("=")[1].to_f }
64
+ gon.flot_data = flot_data.sort{ |a,b| b[:label].split("=")[1].to_f <=> a[:label].split("=")[1].to_f }
65
65
  end
66
66
 
67
67
  def get_bucket item
@@ -1,6 +1,4 @@
1
1
  - content_for :head do
2
- %script#source{:type => "text/javascript"}
3
- var d = #{@flot_data.to_json.html_safe} ;
4
2
  = javascript_include_tag 'jquery.flot'
5
3
  = javascript_include_tag 'jquery.flot.resize'
6
4
  = javascript_include_tag 'jquery.flot.time'
@@ -9,57 +7,51 @@
9
7
  #placeholder{:style => "width:800px;height:400px;"}
10
8
  %script#source{:type => "text/javascript"}
11
9
  $(function () {
12
- $.plot($("#placeholder"), d , #{@flot_options.to_json.html_safe} );
10
+ $.plot($("#placeholder"), gon.flot_data , gon.flot_options );
13
11
  });
14
12
  #legend
15
13
  .col-md-3
16
- = search_form_for @search , :url => manage_reports_url , :html => { :class => "well well-small" } do |f|
17
- .form-group.row
18
- = f.label :type
19
- %br/
20
- = select_tag :type, options_for_select( { t("order") => "Order" , t("purchase") => "Purchase" } , @type)
21
- .form-group.row
14
+ = search_form_for @search , :url => manage_reports_url , :html => { :class => "form-horizontal" , :role => "form"} do |f|
15
+ .form-group
16
+ = select_tag :type, options_for_select( { t("order") => "Order" , t("purchase") => "Purchase" } , @type) , :class => "form-control"
17
+ .form-group
22
18
  .col-md-4
23
19
  = f.label :product_name_cont, t("name")
24
20
  .col-md-8
25
- = f.text_field :product_name_cont, :size => 15
21
+ = f.text_field :product_name_cont, :size => 15 , :class => "form-control"
26
22
  .col-md-4
27
- = f.label :supplier
23
+ = f.label :supplier , t(:supplier)
28
24
  .col-md-8
29
- = f.text_field :product_supplier_supplier_name_cont, :size => 15
25
+ = f.text_field :product_supplier_supplier_name_cont, :size => 15 , :class => "form-control"
30
26
  .form-group.row
31
27
  .col-md-4
32
- = f.label :category
28
+ = f.label :category, t(:category)
33
29
  .col-md-8
34
- = f.text_field :product_category_name_cont, :size => 15
30
+ = f.text_field :product_category_name_cont, :size => 15 , :class => "form-control"
35
31
  .col-md-4
36
- = f.label :property
32
+ = f.label :property , t(:property)
37
33
  .col-md-8
38
- = f.text_field :product_properties_cont, :size => 15
34
+ = f.text_field :product_properties_cont, :size => 15 , :class => "form-control"
39
35
  .form-group.row
40
36
  .col-md-3
41
- = f.label :price
37
+ = f.label :price , t(:price)
42
38
  .col-md-3
43
- = f.text_field :price_gt , :size => 6
39
+ = f.text_field :price_gt , :size => 6 , :class => "form-control"
44
40
  .col-md-1
45
41
 
46
42
  .col-md-3
47
- = f.text_field :price_lt , :size => 6
43
+ = f.text_field :price_lt , :size => 6 , :class => "form-control"
48
44
  .form-group.row
49
45
  %label= t("date_range")
50
46
  .date-range-filter
51
- .col-md-4
52
- = f.label :start
53
- .col-md-8
54
- = f.text_field :created_at_gt, :class => 'datepicker'
55
- .col-md-4
56
- = f.label :stop
57
- .col-md-8
58
- = f.text_field :created_at_lt, :class => 'datepicker'
47
+ .col-md-6
48
+ = f.text_field :created_at_gt, :class => 'datepicker form-control' , :value => sort_date(:created_at_gt)
49
+ .col-md-6
50
+ = f.text_field :created_at_lt, :class => 'datepicker form-control', :value => sort_date(:created_at_lt)
59
51
  .form-group.row
60
52
  %label= t("group_by")
61
53
  %br/
62
- = select_tag :group_by, options_for_select( group_options , @group_by)
54
+ = select_tag :group_by, options_for_select( group_options , @group_by) , :class => "form-control"
63
55
  .form-group.row
64
56
  .col-md-6
65
57
  = t(:price)
@@ -1,2 +1,8 @@
1
1
  en:
2
- some: ho
2
+ some: ho
3
+
4
+ fi:
5
+ date_range: Päivämäärä
6
+ group_by: Ryhmitellä
7
+ all: Kaikki
8
+ property: Omaisuus
@@ -2,6 +2,12 @@ module AccountantClerk
2
2
  class Engine < Rails::Engine
3
3
  engine_name 'accountant_clerk'
4
4
 
5
+ #indicate that we have stylesheet/js stuff to be added to office, with the given name
6
+ # files (css + js) must exist in asset path
7
+ def office_assets
8
+ "accountant_office"
9
+ end
10
+
5
11
  config.autoload_paths += %W(#{config.root}/lib)
6
12
 
7
13
  # use rspec for tests
@@ -17,8 +23,8 @@ module AccountantClerk
17
23
  Rails.application.config.cache_classes ? require(c) : load(c)
18
24
  end
19
25
  end
20
- initializer "office.assets.precompile", :group => :all do |app|
21
- app.config.assets.precompile += ["office_*"]
26
+ initializer "accountant.precompile", :group => :all do |app|
27
+ app.config.assets.precompile += ["accountant_office.css" , "accountant_office.js"]
22
28
  end
23
29
 
24
30
  config.to_prepare &method(:activate).to_proc