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
2ef915a2
Commit
2ef915a2
authored
Oct 13, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fit the controllers to the new change
parent
757e76d6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
16 deletions
+21
-16
product_snapshots_controller.rb
...engai/controller/customer/product_snapshots_controller.rb
+3
-3
product_series_controller.rb
...hotengai/controller/merchant/product_series_controller.rb
+9
-5
product_snapshots_controller.rb
...engai/controller/merchant/product_snapshots_controller.rb
+2
-2
products_controller.rb
lib/shotengai/controller/merchant/products_controller.rb
+7
-6
No files found.
lib/shotengai/controller/customer/product_snapshots_controller.rb
View file @
2ef915a2
...
...
@@ -30,11 +30,11 @@ module Shotengai
private
def
resource_params
remark_
input
=
params
.
require
(
resource_key
).
fetch
(
:remark_input
,
nil
)
&
.
map
(
&
:permit!
)
info_
input
=
params
.
require
(
resource_key
).
fetch
(
:info_input
,
nil
)
&
.
map
(
&
:permit!
)
remark_
value
=
params
.
require
(
resource_key
).
fetch
(
:remark_value
,
nil
)
&
.
map
(
&
:permit!
)
info_
value
=
params
.
require
(
resource_key
).
fetch
(
:info_value
,
nil
)
&
.
map
(
&
:permit!
)
params
.
require
(
resource_key
).
permit
(
:count
,
:shotengai_series_id
).
merge
({
remark_
input:
remark_input
,
info_input:
info_input
})
).
merge
({
remark_
value:
remark_value
,
info_value:
info_value
})
end
def
edit_only_unpaid
...
...
lib/shotengai/controller/merchant/product_series_controller.rb
View file @
2ef915a2
...
...
@@ -39,15 +39,19 @@ module Shotengai
private
def
resource_params
spec_input
=
params
.
require
(
resource_key
).
fetch
(
:spec_input
,
nil
)
&
.
map
(
&
:permit!
)
info_input
=
params
.
require
(
resource_key
).
fetch
(
:info_input
,
nil
)
&
.
map
(
&
:permit!
)
spec_value
=
params
.
require
(
resource_key
).
fetch
(
:spec_value
,
nil
)
&
.
map
(
&
:permit!
)
info_value
=
params
.
require
(
resource_key
).
fetch
(
:info_value
,
nil
)
&
.
map
(
&
:permit!
)
remark_value
=
params
.
require
(
resource_key
).
fetch
(
:remark_value
,
nil
)
&
.
map
(
&
:permit!
)
meta
=
params
.
require
(
resource_key
).
fetch
(
:meta
,
nil
).
try
(
:permit!
)
# ????????!!!!!, spec_
input
: [:key, :val] 一样的输出值 却在test报错???
# ????????!!!!!, spec_
value
: [:key, :val] 一样的输出值 却在test报错???
# QUESTION: WARNING: 文档bug吧?????
params
.
require
(
resource_key
).
permit
(
:original_price
,
:price
,
:stock
#, spec_
input
: [:key, :val]
:original_price
,
:price
,
:stock
#, spec_
value
: [:key, :val]
).
merge
(
{
spec_input:
spec_input
,
info_input:
info_input
,
meta:
meta
}
{
spec_value:
spec_value
,
info_value:
info_value
,
remark_value:
remark_value
,
meta:
meta
}
)
end
...
...
lib/shotengai/controller/merchant/product_snapshots_controller.rb
View file @
2ef915a2
...
...
@@ -22,10 +22,10 @@ module Shotengai
private
def
resource_params
remark_
input
=
params
.
require
(
resource_key
).
fetch
(
:remark_input
,
nil
)
&
.
map
(
&
:permit!
)
remark_
value
=
params
.
require
(
resource_key
).
fetch
(
:remark_value
,
nil
)
&
.
map
(
&
:permit!
)
params
.
require
(
resource_key
).
permit
(
:revised_amount
).
merge
({
remark_
input:
remark_input
})
).
merge
({
remark_
value:
remark_value
})
end
def
edit_only_unpaid
...
...
lib/shotengai/controller/merchant/products_controller.rb
View file @
2ef915a2
...
...
@@ -63,9 +63,9 @@ module Shotengai
def
resource_params
# QUESTION: need these ?
# spec = params.require(resource_key).fetch(:spec, nil).try(:permit!)
spec_
input
=
params
.
require
(
resource_key
).
fetch
(
:spec_input
,
nil
)
&
.
map
(
&
:permit!
)
remark_
input
=
params
.
require
(
resource_key
).
fetch
(
:remark_input
,
nil
)
&
.
map
(
&
:permit!
)
info_
input
=
params
.
require
(
resource_key
).
fetch
(
:info_input
,
nil
)
&
.
map
(
&
:permit!
)
spec_
template
=
params
.
require
(
resource_key
).
fetch
(
:spec_template
,
nil
)
&
.
map
(
&
:permit!
)
remark_
template
=
params
.
require
(
resource_key
).
fetch
(
:remark_template
,
nil
)
&
.
map
(
&
:permit!
)
info_
template
=
params
.
require
(
resource_key
).
fetch
(
:info_template
,
nil
)
&
.
map
(
&
:permit!
)
detail
=
params
.
require
(
resource_key
).
fetch
(
:detail
,
nil
).
try
(
:permit!
)
meta
=
params
.
require
(
resource_key
).
fetch
(
:meta
,
nil
).
try
(
:permit!
)
# NOTE: :catalog_list is a default catalog list for template example, maybe should move it to the template controller, but it need add controller template for every controller
...
...
@@ -73,11 +73,12 @@ module Shotengai
:title
,
:default_series_id
,
:need_express
,
:need_time_attr
,
:cover_image
,
catalog_ids:
[],
banners:
[],
# spec_
input
: [:key, val: []],
# remark_
input
: [:key, :val],
# spec_
template
: [:key, val: []],
# remark_
template
: [:key, :val],
).
merge
(
{
spec_input:
spec_input
,
remark_input:
remark_input
,
info_input:
info_input
,
spec_template:
spec_template
,
remark_template:
remark_template
,
info_template:
info_template
,
detail:
detail
,
meta:
meta
}
)
...
...
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