rad_store 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -4,6 +4,7 @@ project(
4
4
  name: "store",
5
5
  official_name: "rad_store",
6
6
  summary: "Simple Store",
7
+ dirs: ['app', 'config'],
7
8
  gem: true,
8
9
 
9
10
  author: "Alexey Petrushin",
@@ -0,0 +1,27 @@
1
+ class OrderMailer
2
+ # TODO3 use Rad::Mailer instead of Rad::Mailer::MailerController
3
+ inherit Rad::Mailer::MailerController
4
+
5
+ def submit order, product
6
+ request = workspace.request
7
+ store_url = "http://#{request.normalized_domain}"
8
+ product_url = path(product, host: request.normalized_domain)
9
+
10
+ @to = rad.store.order_processing_email
11
+ @from = rad.users.email
12
+ @subject = t :submit_order_title, product_name: product.name, product_price: product.price_with_currency
13
+ @body = t(
14
+ :submit_order_text,
15
+
16
+ store_url: "<a href='#{store_url}'>#{store_url}</a>",
17
+
18
+ product_name: product.name,
19
+ product_price: product.price_with_currency,
20
+ product_url: "<a href='#{product_url}'>#{product.name}</a>",
21
+
22
+ buyer_name: order.name,
23
+ buyer_phone: order.phone,
24
+ buyer_details: order.details
25
+ )
26
+ end
27
+ end
@@ -0,0 +1,19 @@
1
+ class Products < Items
2
+ def buy
3
+ @order = Models::Order.new
4
+ end
5
+
6
+ def checkout
7
+ @order = Models::Order.new params.order
8
+
9
+ respond_to do |f|
10
+ if @order.valid?
11
+ flash.sticky_info = t :order_created, name: @model.name, price: @model.price_with_currency
12
+ OrderMailer.submit(@order, @model).deliver
13
+ f.js
14
+ else
15
+ f.js{render action: :buy}
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ class Order
2
+ inherit Mongo::Model::Validation
3
+ include RubyExt::OpenConstructor
4
+
5
+ def valid? options = {}
6
+ run_model_validations && errors.empty?
7
+ end
8
+
9
+ def initialize options = {}
10
+ super
11
+ set! options
12
+ end
13
+
14
+ attr_accessor :name
15
+ attr_accessor :phone
16
+ attr_accessor :details
17
+
18
+ validates_presence_of :name
19
+ validates_presence_of :phone
20
+ end
@@ -0,0 +1,14 @@
1
+ class Product < Item
2
+ validates_presence_of :name
3
+
4
+ available_as_markup :text
5
+ assign :original_text, String, true
6
+ validates_presence_of :text
7
+
8
+ attr_writer :price
9
+ def price; @price ||= 0 end
10
+
11
+ def price_with_currency
12
+ "#{price} #{rad.store.currency}"
13
+ end
14
+ end
@@ -0,0 +1,975 @@
1
+ /*
2
+ Naming convention:
3
+ - global styles have 'the' prefix
4
+ - local styles have 'l' (local) prefix
5
+ - mixins have 'm' (mixin) prefix
6
+
7
+ - internal structural mixins have 't' (template) prefix
8
+ - internal style mixins have 's' (style) prefix
9
+ */
10
+ /*@small: 5px;
11
+ @normal: 10px;
12
+ @big: 20px;*/
13
+ .m_tiny {
14
+ color: #cccccc !important;
15
+ }
16
+ .m_tiny a {
17
+ color: #cccccc !important;
18
+ }
19
+ .m_bold {
20
+ font-weight: bold;
21
+ }
22
+ .m_hidden {
23
+ display: none !important;
24
+ }
25
+ /*.s_width () {max-width: @max_width; margin-left: auto; margin-right: auto;}*/
26
+ a {
27
+ color: black;
28
+ text-decoration: none;
29
+ }
30
+ a:visited {
31
+ color: black;
32
+ }
33
+ .css_clear {
34
+ display: block !important;
35
+ clear: both !important;
36
+ width: 0px !important;
37
+ height: 0px !important;
38
+ min-width: 0px !important;
39
+ min-height: 0px !important;
40
+ margin: 0px !important;
41
+ padding: 0px !important;
42
+ border: 0px !important;
43
+ }
44
+ table.css_table {
45
+ margin: 0;
46
+ padding: 0;
47
+ border: 0;
48
+ width: 100%;
49
+ }
50
+ table.css_table > tbody {
51
+ margin: 0;
52
+ padding: 0;
53
+ border: 0;
54
+ }
55
+ table.css_table > tbody > tr {
56
+ margin: 0;
57
+ padding: 0;
58
+ border: 0;
59
+ }
60
+ table.css_table > tbody > tr > td {
61
+ margin: 0;
62
+ padding: 0;
63
+ border: 0;
64
+ vertical-align: top;
65
+ }
66
+ .m_title {
67
+ font-size: 180%;
68
+ font-weight: bold;
69
+ padding-top: 5px;
70
+ padding-bottom: 5px;
71
+ margin-top: 0px;
72
+ margin-bottom: 0px;
73
+ margin-top: 0px;
74
+ padding-top: 0px;
75
+ }
76
+ .m_details {
77
+ float: right;
78
+ color: #cccccc;
79
+ }
80
+ .m_details > *, .m_details > a {
81
+ float: left;
82
+ }
83
+ .m_details a {
84
+ color: #2a5db0;
85
+ text-decoration: underline;
86
+ }
87
+ .m_details a:visited {
88
+ color: #2a5db0;
89
+ }
90
+ .m_details > * {
91
+ padding-right: 5px;
92
+ }
93
+ .m_details a {
94
+ color: #cccccc !important;
95
+ }
96
+ .m_tags {
97
+ float: left;
98
+ margin-top: 5px;
99
+ margin-bottom: 5px;
100
+ }
101
+ .m_tags > *, .m_tags > a {
102
+ float: left;
103
+ }
104
+ .m_tags > *, .m_tags > a {
105
+ -moz-border-radius: 3px;
106
+ -webkit-border-radius: 3px;
107
+ border-radius: 3px;
108
+ font-size: 90%;
109
+ padding-left: 5px;
110
+ padding-right: 5px;
111
+ background: #efefef;
112
+ margin-right: 5px;
113
+ }
114
+ .m_tags .m_owner_visibility,
115
+ .m_tags .m_member_visibility,
116
+ .m_tags .m_custom_visibility,
117
+ .m_tags .m_item_type {
118
+ background: white;
119
+ }
120
+ .m_tags .m_owner_visibility {
121
+ color: #dd0000;
122
+ }
123
+ .m_tags .m_member_visibility, .m_tags .m_custom_visibility {
124
+ color: #dddd00;
125
+ }
126
+ .m_tags .m_item_type {
127
+ color: #cccccc !important;
128
+ }
129
+ .m_tags .m_item_type a {
130
+ color: #cccccc !important;
131
+ }
132
+ .m_attachments {
133
+ float: left;
134
+ margin-top: 5px;
135
+ margin-bottom: 5px;
136
+ }
137
+ .m_attachments > *, .m_attachments > a {
138
+ float: left;
139
+ }
140
+ .m_attachments a {
141
+ color: #2a5db0;
142
+ text-decoration: underline;
143
+ }
144
+ .m_attachments a:visited {
145
+ color: #2a5db0;
146
+ }
147
+ .m_attachments > *, .m_attachments > a {
148
+ padding-right: 5px;
149
+ }
150
+ .m_hover_controls {
151
+ position: absolute;
152
+ right: 0px;
153
+ top: 0px;
154
+ z-index: 1;
155
+ display: none;
156
+ font-size: 100%;
157
+ text-align: right;
158
+ }
159
+ .m_hover_controls a {
160
+ color: #2a5db0;
161
+ text-decoration: underline;
162
+ }
163
+ .m_hover_controls a:visited {
164
+ color: #2a5db0;
165
+ }
166
+ .m_selectable > .m_hover_controls {
167
+ background: white;
168
+ border: solid 1px white;
169
+ padding: 5px;
170
+ margin: 5px;
171
+ border-color: #cccccc;
172
+ -moz-border-radius-bottomleft: 3px;
173
+ -webkit-border-bottom-left-radius: 3px;
174
+ border-bottom-left-radius: 3px;
175
+ border-right: 0px;
176
+ border-top: 0px;
177
+ margin: 0px;
178
+ }
179
+ .m_selectable_hover {
180
+ border-color: #cccccc !important;
181
+ }
182
+ /*.t_left () {float: left;}
183
+ .t_right () {float: right;}
184
+ */.m_markup a {
185
+ color: #2a5db0;
186
+ text-decoration: underline;
187
+ }
188
+ .m_markup a:visited {
189
+ color: #2a5db0;
190
+ }
191
+ .m_markup .left {
192
+ float: left;
193
+ margin-top: 2.5px;
194
+ margin-right: 5px;
195
+ }
196
+ .m_markup .right {
197
+ float: right;
198
+ margin-top: 2.5px;
199
+ margin-left: 5px;
200
+ }
201
+ .m_markup .clear {
202
+ clear: both;
203
+ }
204
+ .m_markup .space {
205
+ height: 10px;
206
+ clear: both;
207
+ }
208
+ .m_markup .tiny {
209
+ color: #cccccc !important;
210
+ }
211
+ .m_markup .tiny a {
212
+ color: #cccccc !important;
213
+ }
214
+ .m_markup table tr td {
215
+ vertical-align: top;
216
+ }
217
+ .m_markup p {
218
+ margin-bottom: 10px;
219
+ }
220
+ .m_markup h1,
221
+ .m_markup h2,
222
+ .m_markup h3,
223
+ .m_markup h4,
224
+ .m_markup h5,
225
+ .m_markup h6 {
226
+ clear: both;
227
+ }
228
+ .m_markup object {
229
+ clear: both;
230
+ display: block;
231
+ margin-bottom: 5px;
232
+ }
233
+ .m_markup pre {
234
+ padding: 5px;
235
+ margin-bottom: 5px;
236
+ -moz-border-radius: 5px;
237
+ -webkit-border-radius: 5px;
238
+ border-radius: 5px;
239
+ background-color: #efefef;
240
+ max-width: 807.2px;
241
+ }
242
+ .m_markup .left pre, .m_markup .right pre {
243
+ width: 450px;
244
+ margin-left: 5px;
245
+ }
246
+ body > .css_box {
247
+ max-width: 1024px;
248
+ margin-left: auto;
249
+ margin-right: auto;
250
+ }
251
+ body > .css_box > table.css_table > tbody > tr > td.css_td2 {
252
+ width: 20%;
253
+ }
254
+ .the_tools {
255
+ background: white;
256
+ border: solid 1px white;
257
+ padding: 5px;
258
+ margin: 5px;
259
+ border-color: #cccccc;
260
+ -moz-border-radius: 5px;
261
+ -webkit-border-radius: 5px;
262
+ border-radius: 5px;
263
+ }
264
+ .panel_s {
265
+ font-size: 90%;
266
+ }
267
+ .panel_s .l_left {
268
+ padding-left: 5px;
269
+ }
270
+ .panel_s .l_left .l_item {
271
+ padding-left: 5px;
272
+ padding-right: 5px;
273
+ padding-top: 1px;
274
+ padding-bottom: 1px;
275
+ }
276
+ .panel_s .l_right {
277
+ padding-right: 5px;
278
+ }
279
+ .panel_s .l_right .l_item {
280
+ padding-left: 5px;
281
+ padding-right: 5px;
282
+ padding-top: 1px;
283
+ padding-bottom: 1px;
284
+ }
285
+ .panel_s .css_box .l_left .l_logo {
286
+ font-weight: bold;
287
+ }
288
+ .the_top_panel {
289
+ font-size: 90%;
290
+ background: #cccccc;
291
+ }
292
+ .the_top_panel .l_left {
293
+ float: left;
294
+ }
295
+ .the_top_panel .l_left .l_item {
296
+ float: left;
297
+ }
298
+ .the_top_panel .l_right {
299
+ float: right;
300
+ }
301
+ .the_top_panel .l_right .l_item {
302
+ float: right;
303
+ }
304
+ .the_top_panel .css_box {
305
+ max-width: 1024px;
306
+ margin-left: auto;
307
+ margin-right: auto;
308
+ }
309
+ .the_top_panel .l_left {
310
+ padding-left: 5px;
311
+ }
312
+ .the_top_panel .l_left .l_item {
313
+ padding-left: 5px;
314
+ padding-right: 5px;
315
+ padding-top: 1px;
316
+ padding-bottom: 1px;
317
+ }
318
+ .the_top_panel .l_right {
319
+ padding-right: 5px;
320
+ }
321
+ .the_top_panel .l_right .l_item {
322
+ padding-left: 5px;
323
+ padding-right: 5px;
324
+ padding-top: 1px;
325
+ padding-bottom: 1px;
326
+ }
327
+ .the_top_panel .css_box .l_left .l_logo {
328
+ font-weight: bold;
329
+ }
330
+ .the_top_panel .css_box .l_left .l_logo {
331
+ font-weight: bold;
332
+ }
333
+ .the_bottom_panel {
334
+ font-size: 90%;
335
+ background-color: #cccccc;
336
+ padding-top: 10px;
337
+ padding-bottom: 10px;
338
+ }
339
+ .the_bottom_panel .l_left {
340
+ float: left;
341
+ }
342
+ .the_bottom_panel .l_left .l_item {
343
+ float: left;
344
+ }
345
+ .the_bottom_panel .l_right {
346
+ float: right;
347
+ }
348
+ .the_bottom_panel .l_right .l_item {
349
+ float: right;
350
+ }
351
+ .the_bottom_panel .css_box {
352
+ max-width: 1024px;
353
+ margin-left: auto;
354
+ margin-right: auto;
355
+ }
356
+ .the_bottom_panel .l_left {
357
+ padding-left: 5px;
358
+ }
359
+ .the_bottom_panel .l_left .l_item {
360
+ padding-left: 5px;
361
+ padding-right: 5px;
362
+ padding-top: 1px;
363
+ padding-bottom: 1px;
364
+ }
365
+ .the_bottom_panel .l_right {
366
+ padding-right: 5px;
367
+ }
368
+ .the_bottom_panel .l_right .l_item {
369
+ padding-left: 5px;
370
+ padding-right: 5px;
371
+ padding-top: 1px;
372
+ padding-bottom: 1px;
373
+ }
374
+ .the_bottom_panel .css_box .l_left .l_logo {
375
+ font-weight: bold;
376
+ }
377
+ .the_navigation {
378
+ font-size: 90%;
379
+ }
380
+ .the_navigation .l_left {
381
+ float: left;
382
+ }
383
+ .the_navigation .l_left .l_item {
384
+ float: left;
385
+ }
386
+ .the_navigation .l_right {
387
+ float: right;
388
+ }
389
+ .the_navigation .l_right .l_item {
390
+ float: right;
391
+ }
392
+ .the_navigation .css_box {
393
+ max-width: 1024px;
394
+ margin-left: auto;
395
+ margin-right: auto;
396
+ }
397
+ .the_navigation .l_left {
398
+ padding-left: 5px;
399
+ }
400
+ .the_navigation .l_left .l_item {
401
+ padding-left: 5px;
402
+ padding-right: 5px;
403
+ padding-top: 1px;
404
+ padding-bottom: 1px;
405
+ }
406
+ .the_navigation .l_right {
407
+ padding-right: 5px;
408
+ }
409
+ .the_navigation .l_right .l_item {
410
+ padding-left: 5px;
411
+ padding-right: 5px;
412
+ padding-top: 1px;
413
+ padding-bottom: 1px;
414
+ }
415
+ .the_navigation .css_box .l_left .l_logo {
416
+ font-weight: bold;
417
+ }
418
+ .the_navigation .css_box .l_active {
419
+ font-weight: bold;
420
+ background-color: #cccccc;
421
+ -moz-border-radius-bottomleft: 3px;
422
+ -webkit-border-bottom-left-radius: 3px;
423
+ border-bottom-left-radius: 3px;
424
+ -moz-border-radius-bottomright: 3px;
425
+ -webkit-border-bottom-right-radius: 3px;
426
+ border-bottom-right-radius: 3px;
427
+ }
428
+ /*.the_navigation_t {.t_tabs;
429
+ > .css_box {.t_max_width;}}
430
+ .the_navigation {.the_navigation_t; .s_tabs; .s_small_text; padding-left: 0; padding-right: 0;
431
+ > .css_box {
432
+ .l_item:first-child {margin-left: @normal + @small;}
433
+ .l_active {.s_round_bl(@small_radius); .s_round_br(@small_radius);}}}*/.the_controls {
434
+ font-size: 100%;
435
+ }
436
+ .the_controls a {
437
+ color: #2a5db0;
438
+ text-decoration: underline;
439
+ }
440
+ .the_controls a:visited {
441
+ color: #2a5db0;
442
+ }
443
+ .the_discussion > .l_controls {
444
+ float: right;
445
+ }
446
+ .the_discussion > .l_controls {
447
+ background: white;
448
+ border: solid 1px white;
449
+ padding: 5px;
450
+ margin: 5px;
451
+ font-size: 100%;
452
+ }
453
+ .the_discussion > .l_controls a {
454
+ color: #2a5db0;
455
+ text-decoration: underline;
456
+ }
457
+ .the_discussion > .l_controls a:visited {
458
+ color: #2a5db0;
459
+ }
460
+ .the_paginator {
461
+ background: white;
462
+ border: solid 1px white;
463
+ padding: 5px;
464
+ margin: 5px;
465
+ }
466
+ .the_paginator a {
467
+ color: #2a5db0;
468
+ text-decoration: underline;
469
+ }
470
+ .the_paginator a:visited {
471
+ color: #2a5db0;
472
+ }
473
+ .the_paginator > * {
474
+ margin-right: 5px;
475
+ }
476
+ .the_paginator .l_active {
477
+ font-weight: bold;
478
+ }
479
+ .the_more {
480
+ color: #cccccc !important;
481
+ color: #2a5db0;
482
+ text-decoration: underline;
483
+ }
484
+ .the_more a {
485
+ color: #cccccc !important;
486
+ }
487
+ .the_more:visited {
488
+ color: #2a5db0;
489
+ }
490
+ .the_narrow {
491
+ margin-left: 20%;
492
+ margin-right: 20%;
493
+ }
494
+ .the_tabs > .l_panel {
495
+ padding-left: 5px;
496
+ padding-right: 5px;
497
+ background: white;
498
+ border-bottom: 1px solid #cccccc;
499
+ }
500
+ .the_tabs > .l_panel .l_item {
501
+ float: left;
502
+ }
503
+ .the_tabs > .l_panel .l_item {
504
+ padding-left: 5px;
505
+ padding-right: 5px;
506
+ padding-top: 1px;
507
+ padding-bottom: 1px;
508
+ }
509
+ .the_tabs > .l_panel .l_active {
510
+ background: #cccccc;
511
+ font-weight: bold;
512
+ }
513
+ .the_tabs > .l_panel .l_active {
514
+ -moz-border-radius-topleft: 3px;
515
+ -webkit-border-top-left-radius: 3px;
516
+ border-top-left-radius: 3px;
517
+ -moz-border-radius-topright: 3px;
518
+ -webkit-border-top-right-radius: 3px;
519
+ border-top-right-radius: 3px;
520
+ cursor: text;
521
+ }
522
+ .the_tabs > .l_panel .l_active a {
523
+ cursor: text;
524
+ }
525
+ .the_tabs > .l_panel a {
526
+ outline: none;
527
+ }
528
+ .the_basic_list .l_item .l_check_box {
529
+ display: inline;
530
+ }
531
+ .the_basic_list .l_item .l_content {
532
+ display: inline;
533
+ }
534
+ .the_basic_list .l_item .l_content > div {
535
+ display: inline;
536
+ }
537
+ .the_basic_list .l_item a {
538
+ color: #2a5db0;
539
+ text-decoration: underline;
540
+ }
541
+ .the_basic_list .l_item a:visited {
542
+ color: #2a5db0;
543
+ }
544
+ .the_info_message {
545
+ background: white;
546
+ border: solid 1px white;
547
+ padding: 5px;
548
+ margin: 5px;
549
+ -moz-border-radius: 5px;
550
+ -webkit-border-radius: 5px;
551
+ border-radius: 5px;
552
+ margin-left: 20%;
553
+ margin-right: 20%;
554
+ background: #eeeebb;
555
+ }
556
+ .the_info_message a {
557
+ color: #2a5db0;
558
+ text-decoration: underline;
559
+ }
560
+ .the_info_message a:visited {
561
+ color: #2a5db0;
562
+ }
563
+ .the_error_message {
564
+ background: white;
565
+ border: solid 1px white;
566
+ padding: 5px;
567
+ margin: 5px;
568
+ -moz-border-radius: 5px;
569
+ -webkit-border-radius: 5px;
570
+ border-radius: 5px;
571
+ margin-left: 20%;
572
+ margin-right: 20%;
573
+ background: #eebbbb;
574
+ }
575
+ .the_error_message a {
576
+ color: #2a5db0;
577
+ text-decoration: underline;
578
+ }
579
+ .the_error_message a:visited {
580
+ color: #2a5db0;
581
+ }
582
+ .the_divider {
583
+ background: white;
584
+ border: solid 1px white;
585
+ padding: 5px;
586
+ margin: 5px;
587
+ clear: both;
588
+ font-size: 110%;
589
+ font-weight: bold;
590
+ text-align: right;
591
+ border-bottom: 1px solid black;
592
+ }
593
+ .the_table {
594
+ width: 100%;
595
+ }
596
+ .the_table a {
597
+ color: #2a5db0;
598
+ text-decoration: underline;
599
+ }
600
+ .the_table a:visited {
601
+ color: #2a5db0;
602
+ }
603
+ .the_table thead tr th {
604
+ background: #cccccc;
605
+ font-size: 110%;
606
+ font-weight: bold;
607
+ text-align: left;
608
+ padding: 5px;
609
+ }
610
+ .the_table thead tr th:first-child {
611
+ -moz-border-radius-topleft: 5px;
612
+ -webkit-border-top-left-radius: 5px;
613
+ border-top-left-radius: 5px;
614
+ }
615
+ .the_table thead tr th:last-child {
616
+ -moz-border-radius-topright: 5px;
617
+ -webkit-border-top-right-radius: 5px;
618
+ border-top-right-radius: 5px;
619
+ }
620
+ .the_table tbody tr td {
621
+ padding: 5px;
622
+ }
623
+ .the_table tbody .l_even {
624
+ background: #efefef;
625
+ }
626
+ .the_toolbar .l_left {
627
+ float: left;
628
+ }
629
+ .the_toolbar .l_left .l_item {
630
+ float: left;
631
+ }
632
+ .the_toolbar .l_right {
633
+ float: right;
634
+ }
635
+ .the_toolbar .l_right .l_item {
636
+ float: right;
637
+ }
638
+ .the_toolbar .l_left {
639
+ padding-left: 5px;
640
+ }
641
+ .the_toolbar .l_left .l_item {
642
+ padding-left: 5px;
643
+ padding-right: 5px;
644
+ padding-top: 1px;
645
+ padding-bottom: 1px;
646
+ }
647
+ .the_toolbar .l_right {
648
+ padding-right: 5px;
649
+ }
650
+ .the_toolbar .l_right .l_item {
651
+ padding-left: 5px;
652
+ padding-right: 5px;
653
+ padding-top: 1px;
654
+ padding-bottom: 1px;
655
+ }
656
+ .the_toolbar a {
657
+ color: #2a5db0;
658
+ text-decoration: underline;
659
+ }
660
+ .the_toolbar a:visited {
661
+ color: #2a5db0;
662
+ }
663
+ .the_dialog {
664
+ background: white;
665
+ border: solid 1px white;
666
+ padding: 5px;
667
+ margin: 5px;
668
+ border-width: 5px;
669
+ border-color: #cccccc;
670
+ -moz-border-radius: 5px;
671
+ -webkit-border-radius: 5px;
672
+ border-radius: 5px;
673
+ width: 60%;
674
+ }
675
+ .the_image_dialog {
676
+ background: white;
677
+ border: solid 1px white;
678
+ padding: 5px;
679
+ margin: 5px;
680
+ border-color: #cccccc;
681
+ -moz-border-radius: 5px;
682
+ -webkit-border-radius: 5px;
683
+ border-radius: 5px;
684
+ }
685
+ .the_context_menu {
686
+ background: white;
687
+ border: solid 1px white;
688
+ padding: 5px;
689
+ margin: 5px;
690
+ border-color: #cccccc;
691
+ -moz-border-radius: 3px;
692
+ -webkit-border-radius: 3px;
693
+ border-radius: 3px;
694
+ max-width: 100px;
695
+ }
696
+ .the_context_menu a {
697
+ color: #2a5db0;
698
+ text-decoration: underline;
699
+ }
700
+ .the_context_menu a:visited {
701
+ color: #2a5db0;
702
+ }
703
+ .the_inplace_editor {
704
+ background: white;
705
+ border: solid 1px white;
706
+ padding: 5px;
707
+ margin: 5px;
708
+ border-color: #cccccc;
709
+ -moz-border-radius: 5px;
710
+ -webkit-border-radius: 5px;
711
+ border-radius: 5px;
712
+ }
713
+ .the_form .l_field > table.css_table > tbody > tr > td.css_td1 {
714
+ width: 30%;
715
+ }
716
+ .the_form .l_line .l_item {
717
+ float: left;
718
+ }
719
+ .the_form .l_errors .l_error {
720
+ font-size: 90%;
721
+ color: #dd0000;
722
+ }
723
+ .the_form .l_field {
724
+ background: white;
725
+ border: solid 1px white;
726
+ padding-top: 1px;
727
+ padding-bottom: 1px;
728
+ margin-top: 1px;
729
+ margin-bottom: 1px;
730
+ }
731
+ .the_form .l_field a {
732
+ color: #2a5db0;
733
+ text-decoration: underline;
734
+ }
735
+ .the_form .l_field a:visited {
736
+ color: #2a5db0;
737
+ }
738
+ .the_form .l_field .l_required {
739
+ font-weight: bold;
740
+ }
741
+ .the_form .l_field .l_input select {
742
+ min-width: 30%;
743
+ }
744
+ .the_form .l_field .l_input input, .the_form .l_field .l_input textarea {
745
+ width: 100%;
746
+ }
747
+ .the_form .l_field .l_input textarea {
748
+ min-height: 60px !important;
749
+ }
750
+ .the_form .l_field .l_input input[type=checkbox] {
751
+ width: auto;
752
+ }
753
+ .the_form .l_field .l_input input[type=radio] {
754
+ width: auto;
755
+ }
756
+ .the_form .l_field .l_input label {
757
+ margin-left: 5px;
758
+ margin-right: 10px;
759
+ }
760
+ .the_form .l_field .l_description {
761
+ font-size: 90%;
762
+ color: #cccccc;
763
+ }
764
+ .the_form .l_line {
765
+ padding-left: 5px;
766
+ padding-right: 5px;
767
+ background: white;
768
+ background: white;
769
+ border: solid 1px white;
770
+ padding-top: 5px;
771
+ padding-bottom: 5px;
772
+ margin-top: 5px;
773
+ margin-bottom: 5px;
774
+ }
775
+ .the_form .l_line .l_item {
776
+ padding-left: 5px;
777
+ padding-right: 5px;
778
+ padding-top: 1px;
779
+ padding-bottom: 1px;
780
+ }
781
+ .the_form .l_line .l_active {
782
+ background: #cccccc;
783
+ font-weight: bold;
784
+ }
785
+ .the_form .l_line a {
786
+ color: #2a5db0;
787
+ text-decoration: underline;
788
+ }
789
+ .the_form .l_line a:visited {
790
+ color: #2a5db0;
791
+ }
792
+ .the_form .l_line .l_item a {
793
+ padding: 3px 0px 4px;
794
+ display: block;
795
+ }
796
+ .the_form .the_more {
797
+ float: right;
798
+ }
799
+ .the_attachments .l_item {
800
+ float: left;
801
+ }
802
+ .the_attachments .l_item > a, .the_attachments .l_item div {
803
+ float: left;
804
+ }
805
+ .the_attachments .l_item > a, .the_attachments .l_item div {
806
+ margin-right: 5px;
807
+ }
808
+ .the_attachments .l_item_style {
809
+ background: white;
810
+ border: solid 1px white;
811
+ padding: 5px;
812
+ margin: 5px;
813
+ -moz-border-radius: 5px;
814
+ -webkit-border-radius: 5px;
815
+ border-radius: 5px;
816
+ border-color: #cccccc;
817
+ margin-left: 0;
818
+ margin-right: 10px;
819
+ }
820
+ .the_attachments .l_empty_item_style {
821
+ background: white;
822
+ border: solid 1px white;
823
+ padding: 5px;
824
+ margin: 5px;
825
+ margin-left: 0;
826
+ margin-right: 10px;
827
+ }
828
+ .the_comment {
829
+ background: white;
830
+ border: solid 1px white;
831
+ padding: 5px;
832
+ margin: 5px;
833
+ -moz-border-radius: 5px;
834
+ -webkit-border-radius: 5px;
835
+ border-radius: 5px;
836
+ }
837
+ .the_comment > table.css_table > tbody > tr > td.css_td1 {
838
+ width: 50px;
839
+ }
840
+ .the_comment .l_image {
841
+ margin-right: 5px;
842
+ }
843
+ .the_thumb {
844
+ float: left;
845
+ background: white;
846
+ border: solid 1px white;
847
+ padding: 5px;
848
+ margin: 5px;
849
+ -moz-border-radius: 5px;
850
+ -webkit-border-radius: 5px;
851
+ border-radius: 5px;
852
+ min-width: 150px;
853
+ min-height: 150px;
854
+ margin: 0px;
855
+ }
856
+ .the_thumb .l_title {
857
+ display: block;
858
+ }
859
+ .the_thumb .m_hover_controls {
860
+ font-size: 90%;
861
+ }
862
+ .the_thumb .l_title {
863
+ font-size: 90%;
864
+ max-width: 150px;
865
+ }
866
+ .the_line {
867
+ background: white;
868
+ border: solid 1px white;
869
+ padding: 5px;
870
+ margin: 5px;
871
+ -moz-border-radius: 5px;
872
+ -webkit-border-radius: 5px;
873
+ border-radius: 5px;
874
+ }
875
+ .the_line > table.css_table > tbody > tr > td.css_td1 {
876
+ width: 50px;
877
+ }
878
+ .the_line .l_image {
879
+ width: 50px;
880
+ margin-right: 5px;
881
+ }
882
+ .the_line .l_title {
883
+ font-size: 110%;
884
+ font-weight: bold;
885
+ color: #2a5db0;
886
+ }
887
+ .the_line .l_title:visited {
888
+ color: #2a5db0;
889
+ }
890
+ .the_item {
891
+ background: white;
892
+ border: solid 1px white;
893
+ padding: 5px;
894
+ margin: 5px;
895
+ -moz-border-radius: 5px;
896
+ -webkit-border-radius: 5px;
897
+ border-radius: 5px;
898
+ }
899
+ .the_tool {
900
+ padding-bottom: 10px;
901
+ }
902
+ .the_tool > .l_title {
903
+ color: #cccccc;
904
+ font-weight: bold;
905
+ }
906
+ .the_tag_selector {
907
+ text-align: center;
908
+ }
909
+ .the_tag_selector .l_tag {
910
+ display: inline-block;
911
+ }
912
+ .the_tag_selector .l_selected {
913
+ -moz-border-radius: 3px;
914
+ -webkit-border-radius: 3px;
915
+ border-radius: 3px;
916
+ color: white;
917
+ padding-left: 5px;
918
+ padding-right: 5px;
919
+ background: #2a5db0;
920
+ }
921
+ .the_tag_selector .l_selected a {
922
+ color: white;
923
+ }
924
+ .the_tag_selector .l_tag {
925
+ margin: 1px;
926
+ }
927
+ .the_tag_selector .l_size_1 {
928
+ font-size: 90%;
929
+ }
930
+ .the_tag_selector .l_size_2 {
931
+ font-size: 120%;
932
+ }
933
+ .the_tag_selector .l_size_3 {
934
+ font-size: 130%;
935
+ }
936
+ .the_tag_selector .l_size_4 {
937
+ font-size: 140%;
938
+ }
939
+ .the_product {
940
+ /* .l_price {float: left;}
941
+ .l_currency {float: left;}
942
+ .l_buy {}*/
943
+ background: white;
944
+ border: solid 1px white;
945
+ padding: 5px;
946
+ margin: 5px;
947
+ -moz-border-radius: 5px;
948
+ -webkit-border-radius: 5px;
949
+ border-radius: 5px;
950
+ }
951
+ .the_product .l_cart {
952
+ background: white;
953
+ border: solid 1px white;
954
+ padding: 5px;
955
+ margin: 5px;
956
+ -moz-border-radius: 5px;
957
+ -webkit-border-radius: 5px;
958
+ border-radius: 5px;
959
+ }
960
+ .the_product .l_cart .l_price {
961
+ font-size: 180%;
962
+ font-weight: bold;
963
+ padding-top: 5px;
964
+ padding-bottom: 5px;
965
+ margin-top: 0px;
966
+ margin-bottom: 0px;
967
+ }
968
+ .the_product .l_cart .l_buy {
969
+ font-size: 180%;
970
+ font-weight: bold;
971
+ padding-top: 5px;
972
+ padding-bottom: 5px;
973
+ margin-top: 0px;
974
+ margin-bottom: 0px;
975
+ }
@@ -0,0 +1,10 @@
1
+ @import "../../../../../common_interface/app/static/themes/default/style";
2
+
3
+ .the_product_t () {
4
+ /* .l_price {float: left;}
5
+ .l_currency {float: left;}
6
+ .l_buy {}*/}
7
+ .the_product {.the_product_t; .s_box; .s_round;
8
+ .l_cart {.s_box; .s_round;
9
+ .l_price {.s_big_text;}
10
+ .l_buy {.s_big_text;}}}
@@ -0,0 +1,2 @@
1
+ - form = js render('checkout_form', locals: {form_action: checkout_path(@model, format: :js)})
2
+ rad.dialog().show('#{form}');
@@ -0,0 +1,14 @@
1
+ = b.title t(:checkout)
2
+
3
+ = b.text t(:checkout_details, name: @model.name, price: @model.price_with_currency)
4
+
5
+ - b.form_for :order, @order, action: form_action do |f|
6
+ = f.error_messages
7
+
8
+ = f.text_field :name, label: t(:order_name), required: true
9
+ = f.text_field :phone, label: t(:order_phone), required: true
10
+ = f.text_area :details, label: t(:order_details), description: t(:order_details_description)
11
+
12
+ = f.line
13
+
14
+ = f.line ok_button, cancel_button
@@ -0,0 +1,18 @@
1
+ = b.title form_title_for(@model)
2
+ - b.form_for :model, @model, action: form_action, enctype: "multipart/form-data" do |f|
3
+ = f.error_messages
4
+
5
+ = f.text_field :name
6
+ = f.text_field :price
7
+ / = f.text_field :quantity
8
+
9
+ = f.text_area :original_text, label: false, required: true
10
+
11
+ = f.attachments :attachments_as_attachments, label: t(:attachments) unless rad.user.anonymous?
12
+
13
+ = common_fields_for_item f
14
+ / = f.text_field :currency
15
+
16
+ = f.line
17
+
18
+ = f.line ok_button, cancel_button
@@ -0,0 +1,14 @@
1
+ - b.product id: @model.dom_id do |o|
2
+ - o.name h(@model.name)
3
+ - o.text @model.text
4
+ - o.price @model.price
5
+ - o.currency rad.store.currency
6
+ - o.buy link_to(t(:buy_product), buy_path(@model, format: :js))
7
+
8
+ - o.controls do |a|
9
+ - a.add link_to(t(:edit), edit_path(@model, format: :js)) if can? :update, @model
10
+ - a.add link_to(t(:delete), destroy_path(@model, format: :js), method: :post, confirm: t(:are_you_shure)) if can? :destroy, @model
11
+
12
+ - o.attachments @model.attachments_as_images
13
+ - o.tags render_item_tags(@model)
14
+ - o.details render_item_details(@model)
@@ -0,0 +1,30 @@
1
+ - tag :div, object.merge_html_attributes(class: " the_product m_selectable") do
2
+ - if object.controls?
3
+ .m_hover_controls= object.controls.join(' ')
4
+
5
+ - if object.name?
6
+ %h1.m_title= object.name
7
+
8
+ .l_text.m_markup
9
+ - if object.attachments?
10
+ .left
11
+ %a{href: object.attachments.first.url}
12
+ %img{src: object.attachments.first.thumb_url}
13
+
14
+ - if object.price? or object.currency? or object.buy?
15
+ .right.l_cart
16
+ .l_price= "#{object.price} #{object.currency}"
17
+ .l_buy= object.buy
18
+
19
+ = object.text
20
+
21
+ - if object.attachments.size > 1
22
+ .space
23
+
24
+ - object.attachments[1..-1].each do |attachment|
25
+ .left
26
+ %a{href: attachment.url}
27
+ %img{src: attachment.thumb_url}
28
+ .css_clear
29
+
30
+ = render themed_partial('/shared/details'), object: {tags: object.tags, details: object.details}.to_openobject
@@ -0,0 +1,33 @@
1
+ en:
2
+ buy_product: "Buy"
3
+ checkout: "Buy"
4
+ currency: "Currency"
5
+ # quantity: "Quantity"
6
+ price: "Price"
7
+ store: "Store"
8
+
9
+ # Product
10
+ product: "Product"
11
+ create_product: "Create product"
12
+ product_created: "Product created"
13
+ product_destroyed: "Product deleted"
14
+ product_updated: "Product updated"
15
+
16
+ # Order
17
+ checkout_details: "You are buying '%{name}' for %{price}"
18
+ order_created: "You are buyed '%{name}' for %{price}. Thank You for purchase."
19
+ order_details: "Details"
20
+ order_details_description: "Shipping addrress, other details"
21
+ order_name: "Your name"
22
+ order_phone: "Your phone"
23
+
24
+ # OrderMailer
25
+ submit_order_text: |
26
+ Order from %{store_url}
27
+ Product %{product_url} has been purchased for %{product_price}.
28
+ Buyer:
29
+ Name: %{buyer_name}
30
+ Phone: %{buyer_phone}
31
+ Details:
32
+ %{buyer_details}
33
+ submit_order_title: "Order: product '%{product_name}' for %{product_price}"
@@ -0,0 +1,34 @@
1
+ ru:
2
+ buy_product: "Купить"
3
+ checkout: "Купить"
4
+ currency: "Валюта"
5
+ # quantity: "Количество"
6
+ price: "Цена"
7
+ store: "Магазин"
8
+
9
+
10
+ # Product
11
+ product: "Товар"
12
+ create_product: "Создать продукт"
13
+ product_created: "Продукт создан"
14
+ product_destroyed: "Продукт удален"
15
+ product_updated: "Продукт обновлен"
16
+
17
+ # Order
18
+ checkout_details: "Вы покупаете '%{name}' за %{price}"
19
+ order_created: "Вы купили '%{name}', за %{price}. Спасибо за покупку."
20
+ order_details: "Примечания"
21
+ order_details_description: "Адрес доставки, замечания"
22
+ order_name: "Ваше имя"
23
+ order_phone: "Ваш телефон"
24
+
25
+ # Order Mailer
26
+ submit_order_text: |
27
+ Заказ из %{store_url}
28
+ Продукт: %{product_url} заказан за %{product_price}.
29
+ Покупатель:
30
+ Имя: %{buyer_name}
31
+ Телефон: %{buyer_phone}
32
+ Примечания:
33
+ %{buyer_details}
34
+ submit_order_title: "Заказ: продукт '%{product_name}' за %{product_price}"
data/config/routes.rb ADDED
@@ -0,0 +1,9 @@
1
+ # options = rad.extension(:routes_options){{}}
2
+ #
3
+ # rad.router.configure do |c|
4
+ # options[:url_root] ||= rad.config.url_root!
5
+ #
6
+ # c.with_options options do |c|
7
+ # c.resource :identities, class_name: 'Controllers::Identities'
8
+ # end
9
+ # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rad_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rad_kit
16
- requirement: &2773990 !ruby/object:Gem::Requirement
16
+ requirement: &2772990 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2773990
24
+ version_requirements: *2772990
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rad_users
27
- requirement: &2773750 !ruby/object:Gem::Requirement
27
+ requirement: &2772750 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2773750
35
+ version_requirements: *2772750
36
36
  description:
37
37
  email:
38
38
  executables: []
@@ -49,6 +49,20 @@ files:
49
49
  - spec/controllers/products_spec.rb
50
50
  - spec/emptygit
51
51
  - spec/spec_helper.rb
52
+ - app/controllers/order_mailer.rb
53
+ - app/controllers/products.rb
54
+ - app/models/order.rb
55
+ - app/models/product.rb
56
+ - app/static/themes/default/store.css
57
+ - app/static/themes/default/store.less
58
+ - app/views/controllers/products/buy.js.haml
59
+ - app/views/controllers/products/checkout_form.html.haml
60
+ - app/views/controllers/products/form.html.haml
61
+ - app/views/controllers/products/show.html.haml
62
+ - app/views/themes/default/product.html.haml
63
+ - config/locales/en.yml
64
+ - config/locales/ru.yml
65
+ - config/routes.rb
52
66
  homepage: http://github.com/alexeypetrushin/rad_store
53
67
  licenses: []
54
68
  post_install_message: