Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shotengai
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
shotengai
Commits
ea8c9629
Commit
ea8c9629
authored
Aug 29, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the class_varibale problem for Controller::Base by a crude way
parent
81f27000
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
63 deletions
+23
-63
cart_controller.rb
lib/shotengai/controllers/customer/cart_controller.rb
+0
-59
orders_controller.rb
lib/shotengai/controllers/customer/orders_controller.rb
+4
-1
product_series_controller.rb
...otengai/controllers/customer/product_series_controller.rb
+3
-2
products_controller.rb
lib/shotengai/controllers/customer/products_controller.rb
+3
-0
orders_controller.rb
lib/shotengai/controllers/merchant/orders_controller.rb
+5
-1
product_series_controller.rb
...otengai/controllers/merchant/product_series_controller.rb
+4
-0
products_controller.rb
lib/shotengai/controllers/merchant/products_controller.rb
+4
-0
No files found.
lib/shotengai/controllers/customer/cart_controller.rb
deleted
100644 → 0
View file @
81f27000
module
Shotengai
module
Controller
module
Customer
class
OrdersController
<
Shotengai
::
Controller
::
Base
self
.
resources
=
Cart
self
.
template_dir
=
'shotengai/customer/orders/'
remove_actions
index_query
do
|
resource
,
params
|
resource
.
status_is
(
params
[
:status
])
end
def
add_to_cart
buyer_type
,
buyer_id
=
add_to_cart_params
.
values_at
(
:buyer_type
,
:buyer_id
)
buyer
=
buyer_type
.
constantize
.
find
(
buyer_id
)
@snapshot
=
buyer
.
order_cart
.
snapshots
.
create!
(
add_to_cart_params
)
head
201
end
def
create_by_snapshot
end
def
create_directly
end
def
pay
@resource
.
pay!
respond_with
@resource
,
template:
"
#{
@@template_dir
}
/show"
end
def
cancel
@resource
.
cancel!
respond_with
@resource
,
template:
"
#{
@@template_dir
}
/show"
end
def
get_it
@resource
.
get_it
respond_with
@resource
,
template:
"
#{
@@template_dir
}
/show"
end
private
def
resource_params
params
.
require
(
resource_key
).
permit
(
:address
,
:customer_remark
,
snapshot_ids:
[]
)
end
def
add_to_cart_params
params
.
require
(
:snapshot
).
permit
(
:series_id
,
:count
,
:buyer_type
,
:buyer_id
)
end
end
end
end
end
lib/shotengai/controllers/customer/orders_controller.rb
View file @
ea8c9629
...
...
@@ -11,7 +11,10 @@ module Shotengai
skip_before_action
:set_resource
,
only:
[
:cart
,
:add_to_cart
,
:create_directly
]
remove_actions
:destroy
default_query
do
|
resource
,
params
|
end
index_query
do
|
resource
,
params
|
resource
.
status_is
(
params
[
:status
])
end
...
...
lib/shotengai/controllers/customer/product_series_controller.rb
View file @
ea8c9629
...
...
@@ -11,8 +11,9 @@ module Shotengai
params
[
:product_id
]
&&
{
shotengai_product_id:
params
[
:product_id
]
}
)
end
private
index_query
do
|
resource
,
params
|
end
end
end
end
...
...
lib/shotengai/controllers/customer/products_controller.rb
View file @
ea8c9629
...
...
@@ -6,6 +6,9 @@ module Shotengai
self
.
template_dir
=
'shotengai/customer/products/'
remove_actions
:create
,
:update
,
:destroy
default_query
do
|
resource
,
params
|
end
index_query
do
|
resource
,
params
|
params
[
:catalog_list
]
?
...
...
lib/shotengai/controllers/merchant/orders_controller.rb
View file @
ea8c9629
...
...
@@ -6,7 +6,11 @@ module Shotengai
self
.
template_dir
=
'shotengai/merchant/orders/'
remove_actions
:create
,
:destroy
default_query
do
|
resource
,
params
|
end
index_query
do
|
resource
,
params
|
resource
.
status_is
(
params
[
:status
])
end
...
...
lib/shotengai/controllers/merchant/product_series_controller.rb
View file @
ea8c9629
...
...
@@ -11,6 +11,10 @@ module Shotengai
)
end
index_query
do
|
resource
,
params
|
end
private
def
resource_params
spec
=
params
.
require
(
resource_key
).
fetch
(
:spec
,
nil
).
try
(
:permit!
)
...
...
lib/shotengai/controllers/merchant/products_controller.rb
View file @
ea8c9629
...
...
@@ -5,6 +5,10 @@ module Shotengai
self
.
resources
=
Product
self
.
template_dir
=
'shotengai/merchant/products/'
default_query
do
|
resource
,
params
|
end
index_query
do
|
resource
,
params
|
params
[
:catalog_list
]
?
resource
.
tagged_with
(
params
[:
catalog_list
],
on: :catalogs
)
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment