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
75149d8b
Commit
75149d8b
authored
Aug 28, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish Merchant Snapshot Controller
parent
dad4f10a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
9 deletions
+36
-9
_snapshot.json.jbuilder
lib/generators/templates/views/share/_snapshot.json.jbuilder
+5
-4
_snapshot_simple.json.jbuilder
...tors/templates/views/share/_snapshot_simple.json.jbuilder
+2
-1
product_series_controller.rb
...otengai/controllers/merchant/product_series_controller.rb
+4
-2
product_snapshots_controller.rb
...ngai/controllers/merchant/product_snapshots_controller.rb
+25
-2
No files found.
lib/generators/templates/views/share/_snapshot.json.jbuilder
View file @
75149d8b
json.extract! snapshot, :id, :original_price, :price, :count,
:product_status_zh, :order_status_zh,
:spec, :banners, :cover_image, :detail, :meta
\ No newline at end of file
json.extract! snapshot, :id, :original_price, :price, :count,
:product_status_zh, :order_status_zh,
:total_price, :total_original_price, :revised_amount,
:spec, :cover_image, :banners, :detail, :meta
\ No newline at end of file
lib/generators/templates/views/share/_snapshot_simple.json.jbuilder
View file @
75149d8b
json.extract! snapshot, :id, :original_price, :price, :count,
:product_status_zh, :order_status_zh,
:total_price, :total_original_price, :revised_amount
:total_price, :total_original_price, :revised_amount
,
:spec, :cover_image, :meta
\ No newline at end of file
lib/shotengai/controllers/merchant/product_series_controller.rb
View file @
75149d8b
...
...
@@ -5,8 +5,10 @@ module Shotengai
self
.
resources
=
ProductSeries
self
.
template_dir
=
'shotengai/merchant/series/'
default_query
do
|
klass
,
params
|
klass
.
where
(
shotengai_product_id:
params
[
:product_id
])
default_query
do
|
resource
,
params
|
resource
.
where
(
params
[
:product_id
]
&&
{
shotengai_product_id:
params
[
:product_id
]
}
)
end
private
...
...
lib/shotengai/controllers/merchant/product_snapshots_controller.rb
View file @
75149d8b
module
Shotengai
module
Controller
module
Merchant
class
SnapshotsController
<
Shotengai
::
Controller
::
Base
class
ProductSnapshotsController
<
Shotengai
::
Controller
::
Base
self
.
resources
=
ProductSnapshot
self
.
template_dir
=
'shotengai/merchant/snapshots/'
remove_actions
:create
,
:destroy
default_query
do
|
resource
,
params
|
resource
.
in_order
end
index_query
do
|
resource
,
params
|
# where(nil) will skip the where
resource
.
where
(
params
[
:order_id
]
&&
{
shotengai_order_id:
params
[
:order_id
]
}
).
where
(
params
[
:product_series_id
]
&&
{
shotengai_series_id:
params
[
:product_series_id
]
}
)
end
private
def
resource_params
params
.
require
(
resource_key
).
permit
(
:revised_amount
)
end
end
end
end
...
...
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