comable-frontend 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +97 -0
  4. data/app/assets/images/comable/frontend/home-one.jpg +0 -0
  5. data/app/assets/images/comable/frontend/home-top.jpg +0 -0
  6. data/app/assets/javascripts/comable/frontend/application.coffee +5 -0
  7. data/app/assets/stylesheets/comable/frontend/application.scss +527 -0
  8. data/app/assets/stylesheets/comable/frontend/products.scss +0 -0
  9. data/app/assets/stylesheets/comable/products.scss +0 -0
  10. data/app/controllers/comable/application_controller.rb +12 -0
  11. data/app/controllers/comable/carts_controller.rb +66 -0
  12. data/app/controllers/comable/home_controller.rb +14 -0
  13. data/app/controllers/comable/orders_controller.rb +97 -0
  14. data/app/controllers/comable/pages_controller.rb +19 -0
  15. data/app/controllers/comable/products_controller.rb +25 -0
  16. data/app/controllers/comable/users_controller.rb +29 -0
  17. data/app/controllers/concerns/comable/payment_action.rb +17 -0
  18. data/app/controllers/concerns/comable/shipment_action.rb +17 -0
  19. data/app/controllers/concerns/comable/signin_action.rb +55 -0
  20. data/app/views/comable/carts/show.slim +67 -0
  21. data/app/views/comable/home/show.slim +24 -0
  22. data/app/views/comable/orders/confirm.slim +83 -0
  23. data/app/views/comable/orders/create.slim +7 -0
  24. data/app/views/comable/orders/delivery.slim +48 -0
  25. data/app/views/comable/orders/orderer.slim +64 -0
  26. data/app/views/comable/orders/payment.slim +15 -0
  27. data/app/views/comable/orders/shipment.slim +15 -0
  28. data/app/views/comable/orders/signin.slim +22 -0
  29. data/app/views/comable/pages/show.slim +7 -0
  30. data/app/views/comable/products/index.slim +20 -0
  31. data/app/views/comable/products/show.slim +89 -0
  32. data/app/views/comable/shared/_address.slim +13 -0
  33. data/app/views/comable/shared/_address_form.slim +39 -0
  34. data/app/views/comable/shared/_footer.slim +39 -0
  35. data/app/views/comable/shared/_header.slim +74 -0
  36. data/app/views/comable/shared/_header_for_checkout.slim +18 -0
  37. data/app/views/comable/shared/_products.slim +23 -0
  38. data/app/views/comable/shared/_tracker.slim +2 -0
  39. data/app/views/comable/users/_address.slim +14 -0
  40. data/app/views/comable/users/addresses.slim +54 -0
  41. data/app/views/comable/users/show.slim +60 -0
  42. data/app/views/kaminari/comable_frontend/_gap.html.slim +2 -0
  43. data/app/views/kaminari/comable_frontend/_next_page.html.slim +7 -0
  44. data/app/views/kaminari/comable_frontend/_page.html.slim +3 -0
  45. data/app/views/kaminari/comable_frontend/_paginator.html.slim +11 -0
  46. data/app/views/kaminari/comable_frontend/_prev_page.html.slim +7 -0
  47. data/app/views/layouts/comable/application.slim +35 -0
  48. data/config/routes.rb +34 -0
  49. data/lib/comable/frontend/engine.rb +29 -0
  50. data/lib/comable/frontend.rb +1 -0
  51. data/lib/tasks/comable_backend_tasks.rake +4 -0
  52. metadata +295 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e98385eb72b43cc2581f2eaec94c9c7747e08a1a
4
+ data.tar.gz: a66e46e4b6d22d42b34f043b90c1ccb14e689cc3
5
+ SHA512:
6
+ metadata.gz: 7e7f28e268aaefd7239529bcd7aa6fe394a3d12dde754b3c87f315620920ff9c3cd78df566e6885112eef4307ada43696dc32ee7ec0102cad0cab4d203991af5
7
+ data.tar.gz: a0b7a73309dae2284202eef19a115fd4a25071663477243651565cc9fc01dfd3ac2d541bfe7547db1f81d66b25e2fbaa2792d820562c5fd59951d5795b4c70fd
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 YOSHIDA Hiroki
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,97 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Comable'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('lib/**/*.rb')
14
+ end
15
+
16
+ APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
17
+ load 'rails/tasks/engine.rake'
18
+
19
+ def command(string)
20
+ puts string
21
+ system string
22
+ end
23
+
24
+ if File.exist?('comable.gemspec')
25
+ $LOAD_PATH.unshift File.expand_path('..', __FILE__)
26
+ require 'tasks/release'
27
+
28
+ namespace :app do
29
+ namespace :spec do
30
+ desc 'Run the code examples'
31
+ RSpec::Core::RakeTask.new(:all) do |t|
32
+ FRAMEWORKS.each do |framework|
33
+ t.pattern << ",#{framework}/spec/**{,/*/**}/*_spec.rb"
34
+ end
35
+ end
36
+
37
+ FRAMEWORKS.each do |framework|
38
+ desc "Run the code examples in #{framework}/spec"
39
+ RSpec::Core::RakeTask.new(framework) do |t|
40
+ t.pattern = "../#{framework}/spec/**{,/*/**}/*_spec.rb"
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ namespace :db do
47
+ task 'migrate' => 'app:db:migrate'
48
+ task 'app:db:migrate' => 'migrate:all'
49
+
50
+ namespace :migrate do
51
+ task :all do
52
+ FRAMEWORKS.each do |framework|
53
+ command "cd #{framework} && test -d db/migrate && bundle exec rake db:migrate RAILS_ENV=#{Rails.env}"
54
+ end
55
+ end
56
+ end
57
+
58
+ namespace :migrate do
59
+ task 'reset' => 'app:db:migrate:reset'
60
+ task 'app:db:migrate:reset' => 'app:db:migrate'
61
+ task 'app:db:migrate' => 'reset:all'
62
+
63
+ namespace :reset do
64
+ task :all do
65
+ command "bundle exec rake db:drop db:create RAILS_ENV=#{Rails.env}"
66
+ Rake::Task['db:migrate'].invoke
67
+ end
68
+ end
69
+ end
70
+ end
71
+
72
+ task default: ['app:spec:all', 'rubocop', 'brakeman:all']
73
+ else
74
+ task default: ['app:spec', 'rubocop', 'brakeman']
75
+ end
76
+
77
+ Bundler::GemHelper.install_tasks
78
+
79
+ # from https://github.com/rspec/rspec-rails/issues/936
80
+ task 'test:prepare'
81
+
82
+ task :rubocop do
83
+ sh 'rubocop'
84
+ end
85
+
86
+ task :brakeman do
87
+ sh 'brakeman --exit-on-warn --ignore-config .brakeman.ignore'
88
+ end
89
+
90
+ namespace :brakeman do
91
+ task :all do
92
+ FRAMEWORKS.each do |framework|
93
+ next unless File.directory?("#{framework}/app")
94
+ sh "brakeman --exit-on-warn --ignore-config .brakeman.ignore #{framework}"
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,5 @@
1
+ #= require jquery
2
+ #= require jquery_ujs
3
+ #= require jquery-ui
4
+ #= require bootstrap-sprockets
5
+ #= require_tree
@@ -0,0 +1,527 @@
1
+ //= require jquery-ui
2
+ //= require_tree
3
+
4
+ $lighten-bg: #139bab;
5
+ $darken-bg: darken($lighten-bg, 10%);
6
+
7
+ // brand
8
+ $brand-primary: $lighten-bg;
9
+ // navbar
10
+ $navbar-default-bg: $lighten-bg;
11
+ $navbar-default-color: #fff;
12
+ // navbar > link
13
+ $navbar-default-link-color: $navbar-default-color;
14
+ $navbar-default-link-active-color: $navbar-default-link-color;
15
+ $navbar-default-link-hover-color: $navbar-default-link-color;
16
+ $navbar-default-link-hover-bg: $darken-bg;
17
+ $navbar-default-link-active-bg: $darken-bg;
18
+ $navbar-default-link-hover-bg: darken($navbar-default-bg, 10%);
19
+ $navbar-default-link-active-bg: darken($navbar-default-bg, 10%);
20
+ // navbar > brand
21
+ $navbar-default-brand-color: $navbar-default-link-color;
22
+ $navbar-default-brand-hover-color: $navbar-default-brand-color;
23
+ // navbar > toggle
24
+ $navbar-default-toggle-icon-bar-bg: $navbar-default-link-color;
25
+ $navbar-default-toggle-hover-bg: $navbar-default-link-hover-bg;
26
+ // button
27
+ $btn-primary-bg: invert($lighten-bg);
28
+ $btn-default-border: $btn-primary-bg;
29
+ $btn-default-border: $btn-primary-bg;
30
+ $btn-default-color: $btn-primary-bg;
31
+
32
+ @import "bootstrap-sprockets";
33
+ @import "bootstrap";
34
+ @import "compass/utilities";
35
+ @import "compass/css3";
36
+
37
+ body.comable-checkout-layout {
38
+ margin: 30px;
39
+
40
+ nav {
41
+ .navbar-brand,
42
+ .navbar-brand:hover, {
43
+ color: $lighten-bg;
44
+ }
45
+ background: transparent;
46
+ border: none;
47
+ }
48
+ }
49
+
50
+ nav {
51
+ &.navbar {
52
+ @include border-radius(0);
53
+ margin-bottom: 0;
54
+ }
55
+
56
+ .navbar-nav > li > a {
57
+ @include transition(all .15s ease-in);
58
+ }
59
+
60
+ // HACK:
61
+ // from http://stackoverflow.com/questions/18552714/bootstrap-3-how-to-maximize-input-width-inside-navbar/18562948#18562948
62
+ .form-group {
63
+ display: inline !important;
64
+ .input-group {
65
+ display: table;
66
+ padding: 0 6px;
67
+ .input-group-btn {
68
+ width: 1% !important;
69
+ }
70
+ }
71
+ }
72
+
73
+ .form-control,
74
+ .btn-default,
75
+ .btn-default:hover {
76
+ color: #333;
77
+ border-color: darken($navbar-default-bg, 10%);
78
+ }
79
+ }
80
+
81
+ .comable-navbar-top {
82
+ font-size: 11px;
83
+ height: 30px;
84
+ line-height: 30px;
85
+ font-weight: bold;
86
+ background-color: darken($navbar-default-bg, 10%);
87
+
88
+ .navbar-text {
89
+ margin-top: 0;
90
+ margin-bottom: 0;
91
+ }
92
+
93
+ .navbar-nav > li > a {
94
+ padding-top: 0;
95
+ padding-bottom: 0;
96
+ line-height: 30px;
97
+ &:hover {
98
+ color: lighten($navbar-default-link-hover-bg, 40%);
99
+ }
100
+ }
101
+
102
+ .container {
103
+ padding-left: 0;
104
+ }
105
+
106
+ a:hover {
107
+ background-color: transparent;
108
+ }
109
+ }
110
+
111
+ button {
112
+ @extend .btn;
113
+ }
114
+
115
+ input[type="submit"] {
116
+ @extend .btn;
117
+ @extend .btn-primary;
118
+
119
+ &.btn-default {
120
+ @extend .btn-default;
121
+ }
122
+ }
123
+
124
+ select,
125
+ input[type="password"],
126
+ input[type="email"],
127
+ input[type="text"] {
128
+ @extend .form-control;
129
+ margin-right: 0.5em;
130
+
131
+ &:last-child {
132
+ margin-right: 0;
133
+ }
134
+ }
135
+
136
+ table {
137
+ @extend .table;
138
+ }
139
+
140
+ // Megamenu
141
+ // from http://jsfiddle.net/apougher/ydcMQ/
142
+ .menu-large {
143
+ position: static !important;
144
+
145
+ .megamenu {
146
+ padding: 20px 0px;
147
+ width: 100%;
148
+ }
149
+
150
+ .megamenu > li > ul {
151
+ padding: 0;
152
+ margin: 0;
153
+ }
154
+
155
+ .megamenu > li > ul > li {
156
+ list-style: none;
157
+ }
158
+
159
+ .megamenu > li > ul > li > a {
160
+ display: block;
161
+ padding: 3px 20px;
162
+ clear: both;
163
+ font-weight: normal;
164
+ line-height: 1.428571429;
165
+ color: #333333;
166
+ white-space: normal;
167
+ }
168
+
169
+ .megamenu > li ul > li > a:hover,
170
+ .megamenu > li ul > li > a:focus {
171
+ text-decoration: none;
172
+ color: #262626;
173
+ background-color: #f5f5f5;
174
+ }
175
+
176
+ .megamenu.disabled > a,
177
+ .megamenu.disabled > a:hover,
178
+ .megamenu.disabled > a:focus {
179
+ color: #999999;
180
+ }
181
+
182
+ .megamenu.disabled > a:hover,
183
+ .megamenu.disabled > a:focus {
184
+ text-decoration: none;
185
+ background-color: transparent;
186
+ background-image: none;
187
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
188
+ cursor: not-allowed;
189
+ }
190
+
191
+ .megamenu.dropdown-header {
192
+ color: #428bca;
193
+ font-size: 18px;
194
+ }
195
+
196
+ @media(max-width: 768px) {
197
+ .megamenu {
198
+ margin-left: 0;
199
+ margin-right: 0;
200
+ }
201
+
202
+ .megamenu > li {
203
+ margin-bottom: 30px;
204
+ }
205
+
206
+ .megamenu > li:last-child {
207
+ margin-bottom: 0;
208
+ }
209
+
210
+ .megamenu.dropdown-header {
211
+ padding: 3px 15px !important;
212
+ }
213
+
214
+ .navbar-nav .open .dropdown-menu .dropdown-header {
215
+ color: #fff;
216
+ }
217
+ }
218
+ }
219
+
220
+ // checkout-flow
221
+ .comable-checkout-flow {
222
+ $weight: 1px;
223
+ $size: 11px + $weight;
224
+ $border-darken: #aaa;
225
+ $border-lighten: #fff;
226
+ $color-darken: #aaa;
227
+ $color-lighten: $lighten-bg;
228
+
229
+ font-size: 75%;
230
+ color: $color-darken;
231
+ height: $navbar-height;
232
+ position: relative;
233
+ background: url('data:image/gif;base64,R0lGODdhAQABAIAAAKqqqgAAACwAAAAAAQABAAACAkQBADs=') repeat-x 0 34px; // #aaa
234
+ background-size: $weight;
235
+ overflow: hidden;
236
+ width: 60%;
237
+
238
+ & > li {
239
+ padding-top: 7px;
240
+ width: 25%;
241
+ text-align: center;
242
+ vertical-align: top;
243
+
244
+ &:before {
245
+ width: $weight;
246
+ height: $size;
247
+ display: block;
248
+ background-color: $border-darken;
249
+ position: absolute;
250
+ top: 28px;
251
+ }
252
+
253
+ &:first-child:before {
254
+ content: '';
255
+ left: 0px;
256
+ }
257
+
258
+ &:last-child:before {
259
+ content: '';
260
+ right: 0px;
261
+ }
262
+
263
+ &:after {
264
+ content: '';
265
+ display: block;
266
+ width: $size;
267
+ height: $size;
268
+ border-radius: $size;
269
+ background-color: $border-darken;
270
+ border: 2px solid $border-lighten;
271
+ position: absolute;
272
+ top: 22px + ($size / 2);
273
+ left: 50%;
274
+ margin-left: -($size / 2);
275
+ }
276
+
277
+ &.active {
278
+ color: $color-lighten;
279
+
280
+ &:after {
281
+ background-color: $border-lighten;
282
+ border-color: $color-lighten;
283
+ }
284
+ }
285
+ }
286
+
287
+ @media(max-width: 768px) {
288
+ margin: 0;
289
+ padding: 0;
290
+ width: 100%;
291
+
292
+ & > li {
293
+ float: left;
294
+ }
295
+ }
296
+ }
297
+
298
+ // main
299
+ main.container {
300
+ margin-top: 20px;
301
+ }
302
+
303
+ #comable-order {
304
+ input[type="submit"] {
305
+ @extend .btn-block;
306
+ }
307
+ .comable-bill_address,
308
+ .comable-ship_address {
309
+ form {
310
+ @extend .form-horizontal;
311
+ @extend .col-sm-6;
312
+ }
313
+ }
314
+ }
315
+
316
+ .comable-mini-cart {
317
+ $width: 250px;
318
+ $image-size: 40px;
319
+ $padding: 10px;
320
+
321
+ width: $width + $padding * 3;
322
+
323
+ & > li > a {
324
+ display: block;
325
+ padding: $padding;
326
+ vertical-align: middle;
327
+
328
+ .comable-image {
329
+ float: left;
330
+ margin-right: $padding;
331
+ width: $image-size;
332
+ height: $image-size;
333
+ overflow: hidden;
334
+ }
335
+
336
+ .comable-name {
337
+ display: block;
338
+ color: $link-color;
339
+ white-space: nowrap;
340
+ overflow: hidden;
341
+ @include ellipsis;
342
+ }
343
+ }
344
+
345
+ .comable-show-cart {
346
+ margin: $padding;
347
+ text-align: center;
348
+
349
+ a {
350
+ @extend .btn;
351
+ @extend .btn-primary;
352
+ display: block;
353
+ color: $btn-primary-color;
354
+ }
355
+ }
356
+ }
357
+
358
+ .category {
359
+ & > ul:not(.category-path) {
360
+ list-style: none;
361
+ padding-left: 2em;
362
+ }
363
+
364
+ a {
365
+ display: block;
366
+ color: $text-color;
367
+ }
368
+ }
369
+
370
+ .category-path {
371
+ margin: 0;
372
+ padding: 0;
373
+ list-style: none;
374
+
375
+ & > li {
376
+ & > a:before {
377
+ @include inline-block;
378
+ content: '<';
379
+ width: 1em;
380
+ }
381
+
382
+ &.active {
383
+ font-weight: bold;
384
+
385
+ &:before {
386
+ @include inline-block;
387
+ content: ' ';
388
+ width: 1em;
389
+ }
390
+ }
391
+ }
392
+ }
393
+
394
+ .category-breadcrumb {
395
+ margin: 0;
396
+ padding: 0;
397
+ list-style: none;
398
+
399
+ & > li {
400
+ @include inline-block;
401
+
402
+ &:not(:last-child):after {
403
+ content: '>';
404
+ margin-left: 0.5em;
405
+ margin-right: 0.5em;
406
+ }
407
+ }
408
+ }
409
+
410
+ #comable-product {
411
+ .products > .row {
412
+ margin: 0;
413
+ padding: 0;
414
+ list-style: none;
415
+ margin-bottom: 20px;
416
+ padding-bottom: 20px;
417
+
418
+ a {
419
+ font-weight: normal;
420
+
421
+ &:link, &:visited, &:hover, &:active {
422
+ color: #444;
423
+ }
424
+ }
425
+
426
+ a {
427
+ display: block;
428
+ overflow: hidden;
429
+
430
+ img {
431
+ @include transition(all 0.5s ease 0s);
432
+ &:hover {
433
+ @include transform(scale(1.1) rotate(-1.5deg));
434
+ }
435
+ }
436
+ }
437
+ }
438
+ }
439
+
440
+ .without-titlebar .ui-dialog-titlebar {
441
+ display: none;
442
+ }
443
+
444
+ .stop-scrolling {
445
+ height: 100%;
446
+ overflow: hidden;
447
+ }
448
+
449
+ body.comable-checkout-layout footer {
450
+ margin-top: 30px;
451
+ text-align: center;
452
+
453
+ .container {
454
+ display: none;
455
+ }
456
+ }
457
+
458
+ body:not(.comable-checkout-layout) footer {
459
+ margin-top: 30px;
460
+ background-color: #edeff1;
461
+ border-top: 2px solid #e3e3e3;
462
+
463
+ .container {
464
+ padding: 30px;
465
+ color: #036;
466
+ }
467
+
468
+ h3 {
469
+ padding-bottom: 10px;
470
+ border-bottom: 1px solid $list-group-border;
471
+ }
472
+
473
+ li {
474
+ padding: 3px 0;
475
+ }
476
+
477
+ .credit {
478
+ border-top: 2px solid #ccc;
479
+ text-align: center;
480
+ padding: 20px;
481
+ background-color: #e3e3e3;
482
+ }
483
+ }
484
+
485
+ // home
486
+ #comable-home {
487
+ section {
488
+ padding: 100px;
489
+ text-align: center;
490
+
491
+ & > h2 {
492
+ margin: 0;
493
+ }
494
+
495
+ & > *:last-child {
496
+ margin-bottom: 0;
497
+ padding-bottom: 0;
498
+ }
499
+ }
500
+
501
+ .comable-home-top {
502
+ padding: 0;
503
+ overflow: hidden;
504
+ max-height: 600px;
505
+
506
+ img {
507
+ width: 100%;
508
+ height: auto;
509
+ }
510
+ }
511
+
512
+ .comable-home-one {
513
+ color: white;
514
+ background-color: #444;
515
+ background-image: image-url('comable/frontend/home-one.jpg');
516
+ background-position: top center;
517
+ background-size: cover;
518
+ }
519
+
520
+ .comable-home-two {
521
+ }
522
+
523
+ #comable-product {
524
+ padding-top: 100px;
525
+ padding-bottom: 60px;
526
+ }
527
+ }
File without changes
@@ -0,0 +1,12 @@
1
+ module Comable
2
+ class ApplicationController < ActionController::Base
3
+ include Comable::ApplicationHelper
4
+
5
+ protect_from_forgery with: :exception
6
+ before_filter :set_view_path
7
+
8
+ def set_view_path
9
+ prepend_view_path "themes/#{current_store.theme_name}" if current_store.theme_name
10
+ end
11
+ end
12
+ end