tienda 1.1.2 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/tienda/application.coffee +114 -84
  3. data/app/assets/javascripts/tienda/custom-scripts.js +182 -0
  4. data/app/assets/javascripts/tienda/custom.js +200 -0
  5. data/app/assets/javascripts/tienda/jquery.metisMenu.js +45 -0
  6. data/app/assets/javascripts/tienda/morris.js +1913 -0
  7. data/app/assets/javascripts/tienda/raphael-2.1.0.min.js +10 -0
  8. data/app/assets/stylesheets/tienda/application.scss +2 -577
  9. data/app/assets/stylesheets/tienda/custom-styles.scss +518 -0
  10. data/app/assets/stylesheets/tienda/morris-0.4.3.min.css +2 -0
  11. data/app/controllers/tienda/dashboard_controller.rb +11 -1
  12. data/app/controllers/tienda/products_controller.rb +7 -3
  13. data/app/controllers/tienda/sessions_controller.rb +1 -1
  14. data/app/controllers/tienda/stock_level_adjustments_controller.rb +1 -5
  15. data/app/helpers/tienda/application_helper.rb +10 -4
  16. data/app/models/tienda/country.rb +3 -5
  17. data/app/models/tienda/delivery_service.rb +5 -7
  18. data/app/models/tienda/order/actions.rb +3 -3
  19. data/app/models/tienda/order/delivery.rb +1 -1
  20. data/app/models/tienda/order.rb +8 -8
  21. data/app/models/tienda/order_item.rb +11 -11
  22. data/app/models/tienda/product.rb +38 -54
  23. data/app/models/tienda/stock_level_adjustment.rb +9 -7
  24. data/app/models/tienda/tax_rate.rb +5 -7
  25. data/app/models/tienda/user.rb +4 -4
  26. data/app/validators/permalink_validator.rb +1 -1
  27. data/app/views/layouts/tienda/application.html.haml +29 -22
  28. data/app/views/layouts/tienda/sub.html.haml +44 -6
  29. data/app/views/tienda/application/_navbar.html.haml +164 -0
  30. data/app/views/tienda/application/_sidebar.html.haml +6 -0
  31. data/app/views/tienda/countries/_form.html.haml +40 -34
  32. data/app/views/tienda/countries/edit.html.haml +12 -3
  33. data/app/views/tienda/countries/index.html.haml +31 -21
  34. data/app/views/tienda/countries/new.html.haml +11 -3
  35. data/app/views/tienda/dashboard/home.html.haml +156 -0
  36. data/app/views/tienda/delivery_service_prices/_form.html.haml +53 -39
  37. data/app/views/tienda/delivery_service_prices/edit.html.haml +12 -3
  38. data/app/views/tienda/delivery_service_prices/index.html.haml +28 -19
  39. data/app/views/tienda/delivery_service_prices/new.html.haml +12 -3
  40. data/app/views/tienda/delivery_services/_form.html.haml +48 -35
  41. data/app/views/tienda/delivery_services/edit.html.haml +11 -5
  42. data/app/views/tienda/delivery_services/index.html.haml +34 -24
  43. data/app/views/tienda/delivery_services/new.html.haml +12 -3
  44. data/app/views/tienda/orders/_form.html.haml +78 -53
  45. data/app/views/tienda/orders/_order_details.html.haml +57 -54
  46. data/app/views/tienda/orders/_order_items.html.haml +5 -3
  47. data/app/views/tienda/orders/_payments_form.html.haml +18 -14
  48. data/app/views/tienda/orders/_payments_table.html.haml +6 -5
  49. data/app/views/tienda/orders/_search_form.html.haml +40 -24
  50. data/app/views/tienda/orders/_status_bar.html.haml +36 -32
  51. data/app/views/tienda/orders/index.html.haml +41 -34
  52. data/app/views/tienda/orders/new.html.haml +22 -11
  53. data/app/views/tienda/orders/show.html.haml +24 -18
  54. data/app/views/tienda/product_categories/_form.html.haml +34 -22
  55. data/app/views/tienda/product_categories/edit.html.haml +12 -4
  56. data/app/views/tienda/product_categories/index.html.haml +26 -16
  57. data/app/views/tienda/product_categories/new.html.haml +11 -3
  58. data/app/views/tienda/products/_form.html.haml +163 -126
  59. data/app/views/tienda/products/_table.html.haml +49 -40
  60. data/app/views/tienda/products/edit.html.haml +14 -6
  61. data/app/views/tienda/products/index.html.haml +35 -7
  62. data/app/views/tienda/sessions/new.html.haml +8 -6
  63. data/app/views/tienda/sessions/reset.html.haml +5 -5
  64. data/app/views/tienda/settings/edit.html.haml +20 -14
  65. data/app/views/tienda/stock_level_adjustments/_table.html.haml +33 -0
  66. data/app/views/tienda/stock_level_adjustments/index.html.haml +20 -39
  67. data/app/views/tienda/tax_rates/form.html.haml +41 -25
  68. data/app/views/tienda/tax_rates/index.html.haml +23 -13
  69. data/app/views/tienda/users/_form.html.haml +36 -24
  70. data/app/views/tienda/users/edit.html.haml +12 -3
  71. data/app/views/tienda/users/index.html.haml +23 -13
  72. data/app/views/tienda/users/new.html.haml +10 -3
  73. data/app/views/tienda/variants/form.html.haml +98 -57
  74. data/app/views/tienda/variants/index.html.haml +47 -29
  75. data/config/initializers/assets.rb +9 -0
  76. data/config/locales/en.yml +3 -2
  77. data/config/routes.rb +1 -1
  78. data/db/migrate/20150517191600_add_stock_counter_cache.rb +5 -0
  79. data/db/migrate/20150517195800_remove_stock_level_item_polymorphism.rb +6 -0
  80. data/db/migrate/20150517212100_update_stock_counter_cache.rb +5 -0
  81. data/db/migrate/20150603235417_add_document_to_orders.rb +5 -0
  82. data/lib/tienda/default_navigation.rb +9 -8
  83. data/lib/tienda/navigation_manager.rb +2 -5
  84. data/lib/tienda/version.rb +1 -1
  85. data/lib/tienda.rb +2 -6
  86. metadata +54 -65
@@ -0,0 +1,518 @@
1
+ /*----------------------------------------------
2
+ Author : www.webthemez.com
3
+ License: Commons Attribution 3.0
4
+ http://creativecommons.org/licenses/by/3.0/
5
+ ------------------------------------------------*/
6
+
7
+
8
+ /*----------------------------------------------
9
+ COMMON STYLES
10
+ ------------------------------------------------*/
11
+ body {
12
+ font-family: 'Open Sans', sans-serif;
13
+ }
14
+
15
+ #wrapper {
16
+ width: 100%;
17
+ background:#09192A;
18
+ }
19
+
20
+ #page-wrapper {
21
+ padding: 15px 15px;
22
+ min-height: 600px;
23
+ background:#E5EBF2;
24
+
25
+ }
26
+ #page-inner {
27
+ width:100%;
28
+ margin:10px 20px 10px 0px;
29
+ background-color:transparent;
30
+ padding:10px;
31
+ min-height:1200px;
32
+ }
33
+
34
+ .text-center {
35
+ text-align:center;
36
+ }
37
+ .no-boder {
38
+ border:1px solid #f3f3f3;
39
+ }
40
+
41
+ h1, .h1, h2, .h2, h3, .h3 {
42
+ margin-top: 7px;
43
+ margin-bottom: -5px;
44
+ }
45
+ h2 {
46
+ color: #000;
47
+ }
48
+ h4 {
49
+ padding-top:10px;
50
+ }
51
+ .square-btn-adjust {
52
+ border: 0px solid transparent;
53
+ -webkit-border-radius: 0px;
54
+ -moz-border-radius: 0px;
55
+ border-radius: 0px;
56
+
57
+ }
58
+ p {
59
+ font-size:16px;
60
+ line-height:25px;
61
+ padding-top:20px;
62
+ }
63
+ /*----------------------------------------------
64
+ DASHBOARD STYLES
65
+ ------------------------------------------------*/
66
+ .page-header {
67
+ padding-bottom: 9px;
68
+ margin: 10px 0 45px;
69
+ border-bottom: 1px solid #C7D1DD;
70
+ }
71
+ .panel-back {
72
+ background-color:#fff;
73
+
74
+ }
75
+ .panel-default > .panel-heading {
76
+ color: #000;
77
+ background-color: #FFFFFF;
78
+ border-color: #ddd;
79
+ font-weight:bold;
80
+ }
81
+ .jumbotron, .well{
82
+ background:#fff;
83
+ }
84
+ .noti-box {
85
+ min-height: 100px;
86
+ padding: 20px;
87
+ }
88
+
89
+ .noti-box .icon-box {
90
+ display: block;
91
+ float: left;
92
+ margin: 0 15px 10px 0;
93
+ width: 70px;
94
+ height: 70px;
95
+ line-height: 75px;
96
+ vertical-align: middle;
97
+ text-align: center;
98
+ font-size: 40px;
99
+ }
100
+ .text-box p{
101
+ margin: 0 0 3px;
102
+ }
103
+ .main-text {
104
+ font-size: 25px;
105
+ font-weight:600;
106
+ }
107
+ .set-icon {
108
+ -webkit-border-radius: 50px;
109
+ -moz-border-radius: 50px;
110
+ border-radius: 50px;
111
+
112
+ }
113
+ .bg-color-green {
114
+ background-color: #fff;
115
+ color: #5cb85c;
116
+ }
117
+ .bg-color-blue {
118
+ background-color: #fff;
119
+ color: #4CB1CF
120
+ }
121
+ .bg-color-red {
122
+ background-color: #fff;
123
+ color:#F0433D;
124
+ }
125
+ .bg-color-brown {
126
+ background-color: #fff;
127
+ color:#f0ad4e;
128
+ }
129
+ .back-footer-green {
130
+ background-color: #5cb85c;
131
+ color:#fff;
132
+ border-top: 0px solid #fff;
133
+ }
134
+ .back-footer-red {
135
+ background-color: #F0433D;
136
+ color:#fff;
137
+ border-top: 0px solid #fff;
138
+ }
139
+ .back-footer-blue {
140
+ background-color: #4CB1CF;
141
+ color:#fff;
142
+ border-top: 0px solid #fff;
143
+ }
144
+ .back-footer-brown {
145
+ background-color: #f0ad4e;
146
+ color:#fff;
147
+ border-top: 0px solid #fff;
148
+ }
149
+ .icon-box-right {
150
+ display: block;
151
+ float: right;
152
+ margin: 0 15px 10px 0;
153
+ width: 70px;
154
+ height: 70px;
155
+ line-height: 75px;
156
+ vertical-align: middle;
157
+ text-align: center;
158
+ font-size: 40px;
159
+ }
160
+
161
+ .main-temp-back {
162
+ background: #8702A8;
163
+ color: #FFFFFF;
164
+ font-size: 16px;
165
+ font-weight: 300;
166
+ text-align: center;
167
+ }
168
+ .main-temp-back .text-temp {
169
+ font-size: 40px;
170
+ }
171
+ .back-dash {
172
+ padding:20px;
173
+ font-size:20px;
174
+ font-weight:500;
175
+ -webkit-border-radius: 0px;
176
+ -moz-border-radius: 0px;
177
+ border-radius: 0px;
178
+ background-color:#2EA7EB;
179
+ color:#fff;
180
+ }
181
+ .back-dash p {
182
+ padding-top:16px;
183
+ font-size:13px;
184
+ color:#fff;
185
+ line-height:25px;
186
+ text-align:justify;
187
+ }
188
+
189
+ .color-bottom-txt {
190
+ color: #000;
191
+ font-size: 16px;
192
+ line-height: 30px;
193
+ }
194
+ /*CHAT PANEL*/
195
+ .chat-panel .panel-body {
196
+ height: 450px;
197
+ overflow-y: scroll;
198
+ }
199
+ .chat-box {
200
+ margin: 0;
201
+ padding: 0;
202
+ list-style: none;
203
+ }
204
+ .chat-box li {
205
+ margin-bottom: 15px;
206
+ padding-bottom: 5px;
207
+ border-bottom: 1px dotted #808080;
208
+ }
209
+ .chat-box li.left .chat-body {
210
+ margin-left: 90px;
211
+ }
212
+ .chat-box li .chat-body p {
213
+ margin: 0;
214
+ color: #8d8888;
215
+ }
216
+ .chat-img>img {
217
+ margin-left:20px;
218
+ }
219
+ footer p{
220
+ font-size: 14px;
221
+ }
222
+ /*----------------------------------------------
223
+ MENU STYLES
224
+ ------------------------------------------------*/
225
+
226
+
227
+ .user-image {
228
+ margin: 25px auto;
229
+ -webkit-border-radius: 10px;
230
+ -moz-border-radius: 10px;
231
+ border-radius: 10px;
232
+ max-height:170px;
233
+ max-width:170px;
234
+ }
235
+ .top-navbar{
236
+ margin:0px;
237
+ }
238
+ .top-navbar .navbar-brand {
239
+ color: #fff;
240
+ width: 260px;
241
+ text-align: left;
242
+ height: 60px;
243
+ font-size: 30px;
244
+ font-weight: 700;
245
+ text-transform: uppercase;
246
+ line-height: 30px;
247
+ }
248
+ .top-navbar .nav > li {
249
+ position: relative;
250
+ display: inline-block;
251
+ }
252
+ .top-navbar .nav > li > a {
253
+ position: relative;
254
+ display: block;
255
+ padding: 19px 15px;
256
+ color: #77C0FD;
257
+ }
258
+ .top-navbar .nav > li > a:hover, .top-navbar .nav > li > a:focus {
259
+ text-decoration: none;
260
+ background-color: #225081;
261
+ color: #fff;
262
+ }
263
+ .top-navbar .dropdown-menu{
264
+ min-width: 230px;
265
+ border-radius: 0 0 4px 4px;
266
+ }
267
+ .top-navbar .dropdown-menu > li > a:hover, .top-navbar .dropdown-menu > li > a:focus{
268
+ color: #225081;
269
+ background:none;
270
+ }
271
+ .dropdown-tasks{
272
+ width: 255px;
273
+ }
274
+ .dropdown-tasks .progress {
275
+ height: 8px;
276
+ margin-bottom: 8px;
277
+ overflow: hidden;
278
+ background-color: #f5f5f5;
279
+ border-radius: 0px;
280
+ }
281
+ .dropdown-tasks > li > a {
282
+ padding: 0px 15px;
283
+ }
284
+ .dropdown-tasks p {
285
+ font-size: 13px;
286
+ line-height: 21px;
287
+ padding-top: 4px;
288
+ }
289
+ .active-menu {
290
+ background-color:#225081!important;
291
+ }
292
+
293
+ .arrow {
294
+ float: right;
295
+ }
296
+
297
+ .fa.arrow:before {
298
+ content: "\f104";
299
+ }
300
+
301
+ .active > a > .fa.arrow:before {
302
+ content: "\f107";
303
+ }
304
+
305
+
306
+ .nav-second-level li,
307
+ .nav-third-level li {
308
+ border-bottom: none !important;
309
+ }
310
+
311
+ .nav-second-level li a {
312
+ padding-left: 37px;
313
+ }
314
+
315
+ .nav-third-level li a {
316
+ padding-left: 55px;
317
+ }
318
+ .sidebar-collapse , .sidebar-collapse .nav{
319
+ background:none;
320
+ }
321
+ .sidebar-collapse .nav {
322
+ padding:0;
323
+ }
324
+ .sidebar-collapse .nav > li > a {
325
+ color:#fff;
326
+ background:transparent;
327
+ text-shadow:none;
328
+
329
+ }
330
+ .sidebar-collapse > .nav > li > a {
331
+ padding:15px 10px;
332
+ }
333
+ .sidebar-collapse > .nav > li {
334
+ border-bottom: 1px solid rgba(107, 108, 109, 0.19);
335
+ }
336
+ ul.nav.nav-second-level.collapse.in {
337
+ background: #172D44;
338
+ }
339
+ .sidebar-collapse .nav > li > a:hover,
340
+ .sidebar-collapse .nav > li > a:focus {
341
+
342
+ outline:0;
343
+ }
344
+
345
+ .navbar-side {
346
+ border:none;
347
+ background-color: transparent;
348
+
349
+ }
350
+ .top-navbar {
351
+ background:#09192A;
352
+ border-bottom:none;
353
+
354
+ }
355
+ .top-navbar .nav > li > a > i {
356
+ margin-right: 2px;
357
+ }
358
+ .top-navbar .navbar-brand:hover {
359
+ color:#fff;
360
+
361
+ }
362
+ .dropdown-user li {
363
+ margin: 8px 0;
364
+ }
365
+ .navbar-default {
366
+ border:0px solid black;
367
+
368
+ }
369
+ .navbar-header {
370
+ background: #09192A;
371
+ }
372
+ .navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus {
373
+ background-color: #B40101;
374
+ }
375
+ .navbar-default .navbar-toggle {
376
+ border-color: #fff;
377
+ }
378
+
379
+ .navbar-default .navbar-toggle .icon-bar {
380
+ background-color: #FFF;
381
+ }
382
+ .nav > li > a > i {
383
+ margin-right:10px;
384
+ }
385
+ /*----------------------------------------------
386
+ UI ELEMENTS STYLES
387
+ ------------------------------------------------*/
388
+ .btn-circle {
389
+ width: 50px;
390
+ height: 50px;
391
+ padding: 6px 0;
392
+ -webkit-border-radius: 25px;
393
+ -moz-border-radius: 25px;
394
+ border-radius: 25px;
395
+ text-align: center;
396
+ font-size: 12px;
397
+ line-height: 1.428571429;
398
+ }
399
+
400
+ /*----------------------------------------------
401
+ MODAL STYLES
402
+ ------------------------------------------------*/
403
+
404
+ #stockModal .modal-dialog {
405
+ width: 75%;
406
+ }
407
+
408
+ /*----------------------------------------------
409
+ PRODUCT STYLES
410
+ ------------------------------------------------*/
411
+
412
+ .productAttributes td.handle {
413
+ background: image-url('tienda/move.svg') no-repeat center;
414
+ background-size: 16px
415
+ }
416
+
417
+ /*----------------------------------------------
418
+ ORDER STATUS STYLES
419
+ ------------------------------------------------*/
420
+
421
+ .status-bar {
422
+ background: image-url("tienda/square.svg") repeat-x 0 15px;
423
+ background-size: 8px;
424
+ margin: 45px 0;
425
+ overflow: hidden;
426
+ }
427
+
428
+ .status-bar ul {
429
+ list-style: none;
430
+ }
431
+
432
+ .status-bar ul li {
433
+ width: 33%;
434
+ float: left;
435
+ text-align: center;
436
+ background: image-url("tienda/statuses/shipped.svg") no-repeat center 0;
437
+ background-size: 36px;
438
+ padding-top: 42px;
439
+ z-index: 10;
440
+ }
441
+
442
+ .status-bar ul h4 {
443
+ color: #E32479;
444
+ }
445
+
446
+ .status-bar ul li p {
447
+ margin-top: 5px;
448
+ font-size: 0.9em;
449
+ color: #999;
450
+ }
451
+
452
+ .status-bar ul li a {
453
+ color: inherit;
454
+ }
455
+
456
+ .status-bar ul li.payment {
457
+ background-image: image-url("tienda/statuses/paid.svg");
458
+ }
459
+
460
+ .status-bar ul li.payment h4 {
461
+ color: #3DB3E2;
462
+ }
463
+
464
+ .status-bar ul li.received {
465
+ background-image: image-url("tienda/statuses/received.svg");
466
+ }
467
+
468
+ .status-bar ul li.received h4 {
469
+ color: #909091;
470
+ }
471
+
472
+ .status-bar ul li.accepted {
473
+ background-image: image-url("tienda/statuses/accepted.svg");
474
+ }
475
+
476
+ .status-bar ul li.accepted h4 {
477
+ color: #89BD2F;
478
+ }
479
+
480
+ .status-bar ul li.rejected {
481
+ background-image: image-url("tienda/statuses/rejected.svg");
482
+ }
483
+
484
+ .status-bar ul li.rejected h4 {
485
+ color: #E33127;
486
+ }
487
+
488
+ /*----------------------------------------------
489
+ MEDIA QUERIES
490
+ ------------------------------------------------*/
491
+
492
+ @media(min-width:768px) {
493
+ #page-wrapper{
494
+ margin: 0 0 0 260px;
495
+ padding: 15px 30px;
496
+ min-height: 1200px;
497
+
498
+ }
499
+
500
+
501
+ .navbar-side {
502
+ z-index: 1;
503
+ position: absolute;
504
+ width: 260px;
505
+ }
506
+
507
+ .navbar {
508
+ border-radius: 0px;
509
+ }
510
+
511
+ }
512
+ @media(max-width:480px) {
513
+ .page-header small {
514
+ display: block;
515
+ padding-top: 14px;
516
+ font-size: 19px;
517
+ }
518
+ }
@@ -0,0 +1,2 @@
1
+ .morris-hover{position:absolute;z-index:1000;}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255, 255, 255, 0.8);border:solid 2px rgba(230, 230, 230, 0.8);font-family:sans-serif;font-size:12px;text-align:center;}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0;}
2
+ .morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:0.1em 0;}
@@ -1,8 +1,18 @@
1
1
  module Tienda
2
2
  class DashboardController < Tienda::ApplicationController
3
3
 
4
+ before_filter { @active_nav = :root }
5
+
4
6
  def home
5
- redirect_to :orders
7
+ @last_30_days_orders = {}
8
+ end_date = Date.today
9
+ start_date = end_date - 30.days
10
+ last_30_days_orders = Tienda::Order.group('DATE(created_at)').where(created_at: start_date..end_date).count
11
+ (start_date..end_date).each do |day|
12
+ @last_30_days_orders[day] = last_30_days_orders[day] || 0
13
+ end
14
+ @sales_by_category = Tienda::Order.joins(products: [:product_category]).where(created_at: start_date..end_date).group('tienda_product_categories.name').count
15
+ @users_count = Tienda::User.count
6
16
  end
7
17
 
8
18
  end
@@ -5,7 +5,11 @@ module Tienda
5
5
  before_filter { params[:id] && @product = Tienda::Product.root.find(params[:id]) }
6
6
 
7
7
  def index
8
- @products = Tienda::Product.root.includes(:stock_level_adjustments, :default_image, :product_category, :variants).order(:name).group_by(&:product_category).sort_by { |cat,pro| cat.name }
8
+ if params[:filter].blank?
9
+ @products = Tienda::Product.root.includes(:stock_level_adjustments, :default_image, :product_category, :variants).order(:name).group_by(&:product_category).sort_by { |cat, pro| cat.name }
10
+ else
11
+ @products = Tienda::Product.root.send(params[:filter]).includes(:stock_level_adjustments, :default_image, :product_category, :variants).order(:name).group_by(&:product_category).sort_by { |cat, pro| cat.name }
12
+ end
9
13
  end
10
14
 
11
15
  def new
@@ -17,7 +21,7 @@ module Tienda
17
21
  if @product.save
18
22
  redirect_to :products, flash: { notice: t('tienda.products.create_notice') }
19
23
  else
20
- render action: "new"
24
+ render :new
21
25
  end
22
26
  end
23
27
 
@@ -28,7 +32,7 @@ module Tienda
28
32
  if @product.update(safe_params)
29
33
  redirect_to [:edit, @product], flash: { notice: t('tienda.products.update_notice') }
30
34
  else
31
- render action: "edit"
35
+ render :edit
32
36
  end
33
37
  end
34
38
 
@@ -7,7 +7,7 @@ module Tienda
7
7
  def create
8
8
  if user = Tienda::User.authenticate(params[:email_address], params[:password])
9
9
  session[:tienda_user_id] = user.id
10
- redirect_to :orders
10
+ redirect_to :root
11
11
  else
12
12
  flash.now[:alert] = t('tienda.sessions.create_alert')
13
13
  render action: "new"
@@ -1,11 +1,7 @@
1
1
  module Tienda
2
2
  class StockLevelAdjustmentsController < ApplicationController
3
3
 
4
- SUITABLE_OBJECTS = ['Tienda::Product']
5
- before_filter do
6
- raise Tienda::Error, t('tienda.stock_level_adjustments.invalid_item_type', suitable_objects: SUITABLE_OBJECTS.to_sentence) unless SUITABLE_OBJECTS.include?(params[:item_type])
7
- @item = params[:item_type].constantize.find(params[:item_id].to_i)
8
- end
4
+ before_filter { @item = Tienda::Product.find(params[:item_id].to_i) }
9
5
  before_filter { params[:id] && @sla = @item.stock_level_adjustments.find(params[:id].to_i) }
10
6
 
11
7
  def index
@@ -1,8 +1,14 @@
1
1
  module Tienda
2
2
  module ApplicationHelper
3
3
 
4
+ def body_class
5
+ "#{params[:controller].gsub('/', '_')}_#{params[:action]}"
6
+ end
7
+
4
8
  def navigation_manager_link(item)
5
- link_to item.description, item.url(self), item.link_options.merge(:class => item.active?(self) ? 'active' : 'inactive')
9
+ link_to item.url(self), item.link_options.merge(class: item.active?(self) ? 'active-menu' : 'inactive') do
10
+ "<i class='fa #{item.icon}'></i>#{item.description}".html_safe
11
+ end
6
12
  end
7
13
 
8
14
  def status_tag(status)
@@ -32,8 +38,8 @@ module Tienda
32
38
  end
33
39
  end
34
40
 
35
- def settings_label(field)
36
- "<label for='settings_#{field}'>#{t("tienda.settings.labels.#{field}")}</label>".html_safe
41
+ def settings_label(field, html_class)
42
+ "<label for='settings_#{field}' class='#{html_class}'>#{t("tienda.settings.labels.#{field}")}</label>".html_safe
37
43
  end
38
44
 
39
45
  def settings_field(field, options = {})
@@ -52,7 +58,7 @@ module Tienda
52
58
  s << "</div>"
53
59
  end.html_safe
54
60
  else
55
- text_field_tag "settings[#{field}]", value, options.merge(:placeholder => default, :class => 'text')
61
+ text_field_tag "settings[#{field}]", value, options.merge(:placeholder => default, :class => options[:class])
56
62
  end
57
63
  end
58
64
 
@@ -9,19 +9,17 @@ module Tienda
9
9
 
10
10
  class Country < ActiveRecord::Base
11
11
 
12
- self.table_name = 'tienda_countries'
13
-
14
12
  # All orders which have this country set as their billing country
15
- has_many :billed_orders, :dependent => :restrict_with_exception, :class_name => 'Tienda::Order', :foreign_key => 'billing_country_id'
13
+ has_many :billed_orders, dependent: :restrict_with_exception, class_name: 'Tienda::Order', foreign_key: 'billing_country_id'
16
14
 
17
15
  # All orders which have this country set as their delivery country
18
- has_many :delivered_orders, :dependent => :restrict_with_exception, :class_name => 'Tienda::Order', :foreign_key => 'delivery_country_id'
16
+ has_many :delivered_orders, dependent: :restrict_with_exception, class_name: 'Tienda::Order', foreign_key: 'delivery_country_id'
19
17
 
20
18
  # All countries ordered by their name asending
21
19
  scope :ordered, -> { order(:name => :asc) }
22
20
 
23
21
  # Validations
24
- validates :name, :presence => true
22
+ validates :name, presence: true
25
23
 
26
24
  end
27
25
  end
@@ -1,20 +1,18 @@
1
1
  module Tienda
2
2
  class DeliveryService < ActiveRecord::Base
3
3
 
4
- self.table_name = 'tienda_delivery_services'
5
-
6
4
  # Validations
7
- validates :name, :presence => true
8
- validates :courier, :presence => true
5
+ validates :name, presence: true
6
+ validates :courier, presence: true
9
7
 
10
8
  # Orders which are assigned to this delivery service
11
- has_many :orders, :dependent => :restrict_with_exception, :class_name => 'Tienda::Order'
9
+ has_many :orders, dependent: :restrict_with_exception
12
10
 
13
11
  # Prices for the different levels of service within this delivery service
14
- has_many :delivery_service_prices, :dependent => :destroy, :class_name => 'Tienda::DeliveryServicePrice'
12
+ has_many :delivery_service_prices, dependent: :destroy
15
13
 
16
14
  # All active delivery services
17
- scope :active, -> { where(:active => true)}
15
+ scope :active, -> { where(active: true)}
18
16
 
19
17
  # Returns a tracking URL for the passed order
20
18
  #
@@ -83,15 +83,15 @@ module Tienda
83
83
  end
84
84
 
85
85
  def deliver_accepted_order_email
86
- Tienda::OrderMailer.accepted(self).deliver
86
+ Tienda::OrderMailer.accepted(self).deliver_now
87
87
  end
88
88
 
89
89
  def deliver_rejected_order_email
90
- Tienda::OrderMailer.rejected(self).deliver
90
+ Tienda::OrderMailer.rejected(self).deliver_now
91
91
  end
92
92
 
93
93
  def deliver_received_order_email
94
- Tienda::OrderMailer.received(self).deliver
94
+ Tienda::OrderMailer.received(self).deliver_now
95
95
  end
96
96
 
97
97
  end
@@ -221,7 +221,7 @@ module Tienda
221
221
  self.status = 'shipped'
222
222
  self.consignment_number = consignment_number
223
223
  self.save!
224
- Tienda::OrderMailer.shipped(self).deliver
224
+ Tienda::OrderMailer.shipped(self).deliver_now
225
225
  end
226
226
  end
227
227