shoppe 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/Rakefile +18 -0
- data/app/assets/images/shoppe/document.svg +1 -0
- data/app/assets/images/shoppe/logo.svg +47 -0
- data/app/assets/images/shoppe/shoppe.svg +25 -0
- data/app/assets/images/shoppe/square.svg +9 -0
- data/app/assets/images/shoppe/statuses/accepted.svg +14 -0
- data/app/assets/images/shoppe/statuses/paid.svg +16 -0
- data/app/assets/images/shoppe/statuses/received.svg +15 -0
- data/app/assets/images/shoppe/statuses/rejected.svg +14 -0
- data/app/assets/images/shoppe/statuses/shipped.svg +14 -0
- data/app/assets/javascripts/shoppe/application.coffee +11 -0
- data/app/assets/stylesheets/shoppe/application.scss +302 -0
- data/app/assets/stylesheets/shoppe/elements.scss +73 -0
- data/app/assets/stylesheets/shoppe/reset.scss +93 -0
- data/app/assets/stylesheets/shoppe/sub.scss +90 -0
- data/app/assets/stylesheets/shoppe/variables.scss +1 -0
- data/app/controllers/shoppe/application_controller.rb +39 -0
- data/app/controllers/shoppe/attachments_controller.rb +12 -0
- data/app/controllers/shoppe/dashboard_controller.rb +7 -0
- data/app/controllers/shoppe/delivery_service_prices_controller.rb +42 -0
- data/app/controllers/shoppe/delivery_services_controller.rb +45 -0
- data/app/controllers/shoppe/orders_controller.rb +36 -0
- data/app/controllers/shoppe/product_categories_controller.rb +45 -0
- data/app/controllers/shoppe/products_controller.rb +45 -0
- data/app/controllers/shoppe/sessions_controller.rb +31 -0
- data/app/controllers/shoppe/users_controller.rb +46 -0
- data/app/helpers/shoppe/application_helper.rb +10 -0
- data/app/helpers/shoppe/shoppe_helper.rb +28 -0
- data/app/mailers/shoppe/order_mailer.rb +25 -0
- data/app/mailers/shoppe/user_mailer.rb +10 -0
- data/app/models/shoppe/delivery_service.rb +22 -0
- data/app/models/shoppe/delivery_service_price.rb +19 -0
- data/app/models/shoppe/order.rb +325 -0
- data/app/models/shoppe/order_item.rb +113 -0
- data/app/models/shoppe/product.rb +56 -0
- data/app/models/shoppe/product_category.rb +22 -0
- data/app/models/shoppe/user.rb +41 -0
- data/app/views/layouts/shoppe/application.html.haml +35 -0
- data/app/views/layouts/shoppe/sub.html.haml +10 -0
- data/app/views/shoppe/delivery_service_prices/_form.html.haml +28 -0
- data/app/views/shoppe/delivery_service_prices/edit.html.haml +5 -0
- data/app/views/shoppe/delivery_service_prices/index.html.haml +22 -0
- data/app/views/shoppe/delivery_service_prices/new.html.haml +5 -0
- data/app/views/shoppe/delivery_services/_form.html.haml +35 -0
- data/app/views/shoppe/delivery_services/edit.html.haml +5 -0
- data/app/views/shoppe/delivery_services/index.html.haml +24 -0
- data/app/views/shoppe/delivery_services/new.html.haml +5 -0
- data/app/views/shoppe/order_mailer/accepted.text.erb +12 -0
- data/app/views/shoppe/order_mailer/received.text.erb +12 -0
- data/app/views/shoppe/order_mailer/rejected.text.erb +10 -0
- data/app/views/shoppe/order_mailer/shipped.text.erb +16 -0
- data/app/views/shoppe/orders/index.html.haml +60 -0
- data/app/views/shoppe/orders/show.html.haml +117 -0
- data/app/views/shoppe/product_categories/_form.html.haml +25 -0
- data/app/views/shoppe/product_categories/edit.html.haml +6 -0
- data/app/views/shoppe/product_categories/index.html.haml +15 -0
- data/app/views/shoppe/product_categories/new.html.haml +5 -0
- data/app/views/shoppe/products/_form.html.haml +71 -0
- data/app/views/shoppe/products/edit.html.haml +5 -0
- data/app/views/shoppe/products/index.html.haml +27 -0
- data/app/views/shoppe/products/new.html.haml +5 -0
- data/app/views/shoppe/sessions/new.html.haml +12 -0
- data/app/views/shoppe/sessions/reset.html.haml +11 -0
- data/app/views/shoppe/user_mailer/new_password.text.erb +9 -0
- data/app/views/shoppe/users/_form.html.haml +26 -0
- data/app/views/shoppe/users/edit.html.haml +5 -0
- data/app/views/shoppe/users/index.html.haml +17 -0
- data/app/views/shoppe/users/new.html.haml +5 -0
- data/config/routes.rb +24 -0
- data/config/shoppe.example.yml +6 -0
- data/db/migrate/20130926094549_create_shoppe_initial_schema.rb +116 -0
- data/db/seeds.rb +85 -0
- data/db/seeds_data/poe400.jpg +0 -0
- data/db/seeds_data/snom-870-blk.jpg +0 -0
- data/db/seeds_data/snom-870-grey.jpg +0 -0
- data/db/seeds_data/snom-mm2.jpg +0 -0
- data/db/seeds_data/spa303.jpg +0 -0
- data/db/seeds_data/t18p.jpg +0 -0
- data/db/seeds_data/t20p.jpg +0 -0
- data/db/seeds_data/t22p.jpg +0 -0
- data/db/seeds_data/t26p.jpg +0 -0
- data/db/seeds_data/t41pn.jpg +0 -0
- data/db/seeds_data/t46gn.jpg +0 -0
- data/db/seeds_data/w52p.jpg +0 -0
- data/db/seeds_data/yhs32.jpg +0 -0
- data/lib/shoppe.rb +41 -0
- data/lib/shoppe/engine.rb +35 -0
- data/lib/shoppe/errors/inappropriate_delivery_service.rb +11 -0
- data/lib/shoppe/errors/insufficient_stock_to_fulfil.rb +19 -0
- data/lib/shoppe/errors/not_enough_stock.rb +19 -0
- data/lib/shoppe/errors/payment_declined.rb +15 -0
- data/lib/shoppe/setup_generator.rb +14 -0
- data/lib/shoppe/version.rb +3 -0
- data/lib/tasks/shoppe.rake +17 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/shoppe.yml +7 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +119 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +893 -0
- data/test/dummy/log/test.log +6397 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/models/shoppe/basket_test.rb +26 -0
- data/test/models/shoppe/user_test.rb +37 -0
- data/test/shoppe_test.rb +17 -0
- data/test/test_helper.rb +4 -0
- metadata +453 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
@import 'variables';
|
2
|
+
|
3
|
+
//
|
4
|
+
// Buttons styles
|
5
|
+
//
|
6
|
+
.button {
|
7
|
+
border:0;
|
8
|
+
padding:0;
|
9
|
+
background:none;
|
10
|
+
text-decoration:none;
|
11
|
+
font-size:12px;
|
12
|
+
font-weight:600;
|
13
|
+
text-transform:uppercase;
|
14
|
+
font-family:$font;
|
15
|
+
color:#fff !important;
|
16
|
+
letter-spacing:-0.5px;
|
17
|
+
padding:7px 20px;
|
18
|
+
border-radius:4px;
|
19
|
+
background-color:#888;
|
20
|
+
display:inline-block;
|
21
|
+
&:active {
|
22
|
+
background:#999;
|
23
|
+
}
|
24
|
+
|
25
|
+
&.green {
|
26
|
+
background-color:#96BF48;
|
27
|
+
border-color:#96BF48;
|
28
|
+
border-bottom-color:#86a350;
|
29
|
+
&:active { background-color:#A8D750}
|
30
|
+
}
|
31
|
+
|
32
|
+
&.loading {
|
33
|
+
background-image:url(/images/spinners/button-green.gif);
|
34
|
+
background-repeat:no-repeat;
|
35
|
+
background-position:50% 50%;
|
36
|
+
color:transparent !important;
|
37
|
+
}
|
38
|
+
|
39
|
+
&.purple {
|
40
|
+
background-color:#C17391;
|
41
|
+
border-color:#C17391;
|
42
|
+
border-bottom-color:#a7667f;
|
43
|
+
&:active { background:#DC83A6}
|
44
|
+
}
|
45
|
+
|
46
|
+
&.orange {
|
47
|
+
background-color:#c8541b;
|
48
|
+
border-color:#c8541b;
|
49
|
+
border-bottom-color:#974117;
|
50
|
+
&:active { background:#e75d19}
|
51
|
+
}
|
52
|
+
|
53
|
+
&.white {
|
54
|
+
background-color:#fff;
|
55
|
+
color:#333 !important;
|
56
|
+
}
|
57
|
+
|
58
|
+
&.white-green {
|
59
|
+
background-color:#fff;
|
60
|
+
color:#96BF48 !important;
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
&.button-mini {
|
65
|
+
font-size:11px;
|
66
|
+
padding:3px 5px;
|
67
|
+
box-shadow:none;
|
68
|
+
font-weight:normal;
|
69
|
+
text-shadow:none;
|
70
|
+
text-transform:none;
|
71
|
+
}
|
72
|
+
|
73
|
+
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
html, body, body div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, figure, footer, header, hgroup, menu, nav, section, time, mark, audio, video {
|
2
|
+
margin: 0;
|
3
|
+
padding: 0;
|
4
|
+
border: 0;
|
5
|
+
outline: 0;
|
6
|
+
font-size: 100%;
|
7
|
+
letter-spacing:0;
|
8
|
+
vertical-align: baseline;
|
9
|
+
background: transparent;
|
10
|
+
}
|
11
|
+
|
12
|
+
article, aside, figure, footer, header, hgroup, nav, section {display: block;}
|
13
|
+
|
14
|
+
img,object,embed {max-width: 100%;}
|
15
|
+
ul {list-style: none;}
|
16
|
+
blockquote, q {quotes: none;}
|
17
|
+
b,strong { font-weight:bold;}
|
18
|
+
blockquote:before, blockquote:after, q:before, q:after {content: ''; content: none;}
|
19
|
+
|
20
|
+
a {margin: 0; padding: 0; font-size: 100%; vertical-align: baseline; background: transparent;}
|
21
|
+
|
22
|
+
del {text-decoration: line-through;}
|
23
|
+
|
24
|
+
abbr[title], dfn[title] {border-bottom: 1px dotted #000; cursor: help;}
|
25
|
+
|
26
|
+
/* tables still need cellspacing="0" in the markup */
|
27
|
+
table {border-collapse: collapse; border-spacing: 0;}
|
28
|
+
th {font-weight: bold; vertical-align: bottom;}
|
29
|
+
td {font-weight: normal; vertical-align: top;}
|
30
|
+
|
31
|
+
hr {display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0;}
|
32
|
+
|
33
|
+
input, select {vertical-align: middle;}
|
34
|
+
|
35
|
+
pre {
|
36
|
+
white-space: pre; /* CSS2 */
|
37
|
+
white-space: pre-wrap; /* CSS 2.1 */
|
38
|
+
white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
|
39
|
+
word-wrap: break-word; /* IE */
|
40
|
+
}
|
41
|
+
|
42
|
+
input[type="radio"] {vertical-align: text-bottom;}
|
43
|
+
input[type="checkbox"] {vertical-align: bottom; *vertical-align: baseline;}
|
44
|
+
.ie6 input {vertical-align: text-bottom;}
|
45
|
+
|
46
|
+
select, input, textarea {font: 99% sans-serif;}
|
47
|
+
|
48
|
+
table {font-size: inherit; font: 100%;}
|
49
|
+
|
50
|
+
/* Accessible focus treatment
|
51
|
+
people.opera.com/patrickl/experiments/keyboard/test */
|
52
|
+
a:hover, a:active {outline: none;}
|
53
|
+
|
54
|
+
small {font-size: 85%;}
|
55
|
+
|
56
|
+
strong, th {font-weight: bold;}
|
57
|
+
|
58
|
+
td, td img {vertical-align: top;}
|
59
|
+
|
60
|
+
/* Make sure sup and sub don't screw with your line-heights
|
61
|
+
gist.github.com/413930 */
|
62
|
+
sub, sup {font-size: 75%; line-height: 0; position: relative;}
|
63
|
+
sup {top: -0.5em;}
|
64
|
+
sub {bottom: -0.25em;}
|
65
|
+
|
66
|
+
/* standardize any monospaced elements */
|
67
|
+
pre, code, kbd, samp {font-family: monospace, sans-serif;}
|
68
|
+
|
69
|
+
/* hand cursor on clickable elements */
|
70
|
+
.clickable,
|
71
|
+
label,
|
72
|
+
input[type=button],
|
73
|
+
input[type=submit],
|
74
|
+
button {cursor: pointer;}
|
75
|
+
|
76
|
+
/* Webkit browsers add a 2px margin outside the chrome of form elements */
|
77
|
+
button, input, select, textarea {margin: 0;}
|
78
|
+
|
79
|
+
/* make buttons play nice in IE */
|
80
|
+
button {width: auto; overflow: visible;}
|
81
|
+
|
82
|
+
/* scale images in IE7 more attractively */
|
83
|
+
.ie7 img {-ms-interpolation-mode: bicubic;}
|
84
|
+
|
85
|
+
/* prevent BG image flicker upon hover */
|
86
|
+
.ie6 html {filter: expression(document.execCommand("BackgroundImageCache", false, true));}
|
87
|
+
|
88
|
+
/* let's clear some floats */
|
89
|
+
.clearfix:before, .clearfix:after { content: "\0020"; display: block; height: 0; overflow: hidden; }
|
90
|
+
.clearfix:after { clear: both; }
|
91
|
+
.clearfix { zoom: 1; }
|
92
|
+
|
93
|
+
select, input, textarea { outline: none;}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/*
|
2
|
+
*= require shoppe/reset
|
3
|
+
*= require shoppe/elements
|
4
|
+
*= require_self
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
@import 'variables';
|
9
|
+
|
10
|
+
html { overflow-y: scroll; height:100%; background:#fff;}
|
11
|
+
body { font-family:$font; font-weight: normal; font-size: 100%; min-width:900px; height:100%; }
|
12
|
+
@import 'variables';
|
13
|
+
|
14
|
+
html.login {
|
15
|
+
background:image-url('shoppe/logo.svg') #40454D no-repeat center 100px;
|
16
|
+
background-size:70px;
|
17
|
+
|
18
|
+
#flash-alert {
|
19
|
+
background:#C17391;
|
20
|
+
position:absolute;
|
21
|
+
top:0;
|
22
|
+
width:100%;
|
23
|
+
text-align:center;
|
24
|
+
color:#fff;
|
25
|
+
padding:15px 0;
|
26
|
+
}
|
27
|
+
|
28
|
+
#flash-notice {
|
29
|
+
background:#94C164;
|
30
|
+
position:absolute;
|
31
|
+
top:0;
|
32
|
+
width:100%;
|
33
|
+
text-align:center;
|
34
|
+
color:#fff;
|
35
|
+
padding:15px 0;
|
36
|
+
}
|
37
|
+
|
38
|
+
|
39
|
+
//
|
40
|
+
// Primary login area
|
41
|
+
//
|
42
|
+
div.loginArea {
|
43
|
+
background:#fff;
|
44
|
+
width:400px;
|
45
|
+
margin:auto;
|
46
|
+
margin-top:200px;
|
47
|
+
padding-top:50px;
|
48
|
+
|
49
|
+
h2 {
|
50
|
+
text-align:center;
|
51
|
+
font-weight:300;
|
52
|
+
font-size:1.4em;
|
53
|
+
color:#40454D;
|
54
|
+
margin-bottom:30px;
|
55
|
+
}
|
56
|
+
p.field {
|
57
|
+
text-align:center;
|
58
|
+
margin-bottom:15px;
|
59
|
+
input {
|
60
|
+
padding:7px;
|
61
|
+
border:0;
|
62
|
+
border-radius:4px;
|
63
|
+
border:1px solid #c0c6ce;
|
64
|
+
width:275px;
|
65
|
+
font-family:$font;
|
66
|
+
font-weight:600;
|
67
|
+
background:#eef0f4;
|
68
|
+
box-shadow:inset 1px 1px 1px rgba(42,51,61,0.1);
|
69
|
+
text-align:center;
|
70
|
+
&::-webkit-input-placeholder { color:#b7bfcb; font-weight:normal;}
|
71
|
+
&:-moz-placeholder { color:#b7bfcb; font-weight:normal;}
|
72
|
+
&::-moz-placeholder { color:#b7bfcb; font-weight:normal;}
|
73
|
+
&:-ms-input-placeholder { color:#b7bfcb; font-weight:normal;}
|
74
|
+
}
|
75
|
+
&:last-child { margin-bottom:0;}
|
76
|
+
}
|
77
|
+
p.submit {
|
78
|
+
padding:15px 0 25px 0;
|
79
|
+
text-align:center;
|
80
|
+
}
|
81
|
+
p.reset {
|
82
|
+
background:#353A41;
|
83
|
+
font-size:0.9em;
|
84
|
+
padding:15px 0;
|
85
|
+
text-align:center;
|
86
|
+
a { color:rgba(255,255,255,0.5);}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
$font: 'Helvetica Neue', Arial, sans-serif;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Shoppe
|
2
|
+
class ApplicationController < ActionController::Base
|
3
|
+
|
4
|
+
# Require that a user is logged in for all parts of the Shoppe admin
|
5
|
+
# interface.
|
6
|
+
before_filter :login_required
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
# If not logged in, redirect users to the login page. This should be
|
11
|
+
# used in a before filter.
|
12
|
+
def login_required
|
13
|
+
unless logged_in?
|
14
|
+
redirect_to login_path
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Is there a user currently logged in?
|
19
|
+
def logged_in?
|
20
|
+
current_user.is_a?(User)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns the currently logged in user
|
24
|
+
def current_user
|
25
|
+
@current_user ||= login_from_session || :false
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attempt to find a user based on the value stored in the local session
|
29
|
+
def login_from_session
|
30
|
+
if session[:shoppe_user_id]
|
31
|
+
@user = User.find_by_id(session[:shoppe_user_id])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Expose a current_user and logged_in? as helpers to views
|
36
|
+
helper_method :current_user, :logged_in?
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class Shoppe::AttachmentsController < Shoppe::ApplicationController
|
2
|
+
|
3
|
+
def destroy
|
4
|
+
@attachment = Nifty::Attachments::Attachment.find(params[:id])
|
5
|
+
@attachment.destroy
|
6
|
+
respond_to do |wants|
|
7
|
+
wants.html { redirect_to request.referer, :notice => "Attachment removed successfully" }
|
8
|
+
wants.json { render :status => 'complete' }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class Shoppe::DeliveryServicePricesController < Shoppe::ApplicationController
|
2
|
+
|
3
|
+
before_filter { @delivery_service = Shoppe::DeliveryService.find(params[:delivery_service_id])}
|
4
|
+
before_filter { params[:id] && @delivery_service_price = @delivery_service.delivery_service_prices.find(params[:id])}
|
5
|
+
|
6
|
+
def index
|
7
|
+
@delivery_service_prices = @delivery_service.delivery_service_prices.ordered
|
8
|
+
end
|
9
|
+
|
10
|
+
def new
|
11
|
+
@delivery_service_price = @delivery_service.delivery_service_prices.build
|
12
|
+
end
|
13
|
+
|
14
|
+
def create
|
15
|
+
@delivery_service_price = @delivery_service.delivery_service_prices.build(safe_params)
|
16
|
+
if @delivery_service_price.save
|
17
|
+
redirect_to [@delivery_service, :delivery_service_prices], :notice => "Price has been created successfully"
|
18
|
+
else
|
19
|
+
render :action => "new"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def update
|
24
|
+
if @delivery_service_price.update(safe_params)
|
25
|
+
redirect_to [@delivery_service, :delivery_service_prices], :notice => "Price has been updated successfully"
|
26
|
+
else
|
27
|
+
render :action => "edit"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def destroy
|
32
|
+
@delivery_service_price.destroy
|
33
|
+
redirect_to [@delivery_service, :delivery_service_prices], :notice => "Price has been removed successfully"
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def safe_params
|
39
|
+
params[:delivery_service_price].permit(:price, :tax_rate, :min_weight, :max_weight, :code)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class Shoppe::DeliveryServicesController < Shoppe::ApplicationController
|
2
|
+
|
3
|
+
before_filter { @active_nav = :delivery_services }
|
4
|
+
before_filter { params[:id] && @delivery_service = Shoppe::DeliveryService.find(params[:id]) }
|
5
|
+
|
6
|
+
def index
|
7
|
+
@delivery_services = Shoppe::DeliveryService.all
|
8
|
+
end
|
9
|
+
|
10
|
+
def new
|
11
|
+
@delivery_service = Shoppe::DeliveryService.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def create
|
15
|
+
@delivery_service = DeliveryService.new(safe_params)
|
16
|
+
if @delivery_service.save
|
17
|
+
redirect_to :delivery_services, :flash => {:notice => "Delivery Service has been created successfully"}
|
18
|
+
else
|
19
|
+
render :action => "new"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def edit
|
24
|
+
end
|
25
|
+
|
26
|
+
def update
|
27
|
+
if @delivery_service.update(safe_params)
|
28
|
+
redirect_to [:edit, @delivery_service], :flash => {:notice => "Delivery Service has been updated successfully"}
|
29
|
+
else
|
30
|
+
render :action => "edit"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def destroy
|
35
|
+
@delivery_service.destroy
|
36
|
+
redirect_to :delivery_services, :flash => {:notice => "Delivery Service has been removed successfully"}
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def safe_params
|
42
|
+
params[:delivery_service].permit(:name, :code, :active, :default, :courier, :tracking_url)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Shoppe::OrdersController < Shoppe::ApplicationController
|
2
|
+
|
3
|
+
before_filter { @active_nav = :orders }
|
4
|
+
before_filter { params[:id] && @order = Shoppe::Order.find(params[:id])}
|
5
|
+
|
6
|
+
def index
|
7
|
+
@query = Shoppe::Order.ordered.received.includes(:order_items => :product).page(params[:page]).search(params[:q])
|
8
|
+
@orders = @query.result
|
9
|
+
end
|
10
|
+
|
11
|
+
def search
|
12
|
+
index
|
13
|
+
render :action => "index"
|
14
|
+
end
|
15
|
+
|
16
|
+
def accept
|
17
|
+
@order.accept!(current_user)
|
18
|
+
redirect_to @order, :notice => "Order has been accepted successfully"
|
19
|
+
end
|
20
|
+
|
21
|
+
def reject
|
22
|
+
@order.reject!(current_user)
|
23
|
+
redirect_to @order, :notice => "Order has been rejected successfully"
|
24
|
+
end
|
25
|
+
|
26
|
+
def ship
|
27
|
+
@order.ship!(current_user, params[:consignment_number])
|
28
|
+
redirect_to @order, :notice => "Order has been shipped successfully"
|
29
|
+
end
|
30
|
+
|
31
|
+
def pay
|
32
|
+
@order.pay!(params[:payment_reference], 'Manual')
|
33
|
+
redirect_to @order, :notice => "Order has been marked as paid successfully"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|