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
abc08581
Commit
abc08581
authored
Aug 28, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add status_zh to Product & Snapshot & Order
parent
db2d7671
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
34 additions
and
7 deletions
+34
-7
_order.json.jbuilder
lib/generators/templates/views/share/_order.json.jbuilder
+3
-2
_order_simple.json.jbuilder
...erators/templates/views/share/_order_simple.json.jbuilder
+2
-2
_product.json.jbuilder
lib/generators/templates/views/share/_product.json.jbuilder
+2
-1
_product_simple.json.jbuilder
...ators/templates/views/share/_product_simple.json.jbuilder
+3
-2
_snapshot.json.jbuilder
lib/generators/templates/views/share/_snapshot.json.jbuilder
+2
-0
_snapshot_simple.json.jbuilder
...tors/templates/views/share/_snapshot_simple.json.jbuilder
+2
-0
order.rb
lib/shotengai/order.rb
+9
-0
product.rb
lib/shotengai/product.rb
+8
-0
snapshot.rb
lib/shotengai/snapshot.rb
+3
-0
No files found.
lib/generators/templates/views/share/_order.json.jbuilder
View file @
abc08581
json.extract! order, :id, :seq, :address,
json.extract! order, :id, :seq, :
status_zh, :
address,
:pay_time, :delivery_time, :receipt_time,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost,
:delivery_way, :delivery_cost,
:merchant_remark, :mark, :customer_remark,
:merchant_remark, :mark, :customer_remark,
:status, :meta
:status, :
status_zh, :
meta
json.snapshots, partial: 'shotengai/share/snapshot_simple', as: :series
json.snapshots, partial: 'shotengai/share/snapshot_simple', as: :series
\ No newline at end of file
lib/generators/templates/views/share/_order_simple.json.jbuilder
View file @
abc08581
...
@@ -2,4 +2,4 @@ json.extract! order, :id, :seq, :address,
...
@@ -2,4 +2,4 @@ json.extract! order, :id, :seq, :address,
:pay_time, :delivery_time, :receipt_time,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost,
:delivery_way, :delivery_cost,
:merchant_remark, :mark, :customer_remark,
:merchant_remark, :mark, :customer_remark,
:status, :meta
:status, :status_zh, :meta
\ No newline at end of file
\ No newline at end of file
lib/generators/templates/views/share/_product.json.jbuilder
View file @
abc08581
json.extract! product, :id, :title, :status, :need_express, :need_time_attr,
json.extract! product, :id, :title, :status, :status_zh,
:need_express, :need_time_attr,
:cover_image, :banners, :spec, :detail, :meta
:cover_image, :banners, :spec, :detail, :meta
# TODO: NOTE: catalog_list is only vaild in the template example
# TODO: NOTE: catalog_list is only vaild in the template example
json.catalog_list product.catalog_list
json.catalog_list product.catalog_list
...
...
lib/generators/templates/views/share/_product_simple.json.jbuilder
View file @
abc08581
json.extract! product, :id, :title, :status, :need_express, :cover_image
json.extract! product, :id, :title, :status, :status_zh,
\ No newline at end of file
:need_express, :cover_image
\ No newline at end of file
lib/generators/templates/views/share/_snapshot.json.jbuilder
View file @
abc08581
json.extract! snapshot, :id, :original_price, :price, :count,
json.extract! snapshot, :id, :original_price, :price, :count,
:product_status_zh, :order_status_zh,
:spec, :banners, :cover_image, :detail, :meta
:spec, :banners, :cover_image, :detail, :meta
\ No newline at end of file
lib/generators/templates/views/share/_snapshot_simple.json.jbuilder
View file @
abc08581
json.extract! snapshot, :id, :original_price, :price, :count,
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
:spec, :cover_image, :meta
\ No newline at end of file
lib/shotengai/order.rb
View file @
abc08581
...
@@ -47,7 +47,16 @@ module Shotengai
...
@@ -47,7 +47,16 @@ module Shotengai
}.
each
{
|
name
,
options
|
}.
each
{
|
name
,
options
|
event
(
name
)
{
transitions
options
}
event
(
name
)
{
transitions
options
}
}
}
end
def
status_zh
{
unpaid:
'未支付'
,
paid:
'已支付'
,
delivering:
'运送中'
,
received:
'已收货'
,
evaluated:
'已评价'
,
}[
status
]
end
end
def
fill_snapshot
def
fill_snapshot
...
...
lib/shotengai/product.rb
View file @
abc08581
...
@@ -38,6 +38,14 @@ module Shotengai
...
@@ -38,6 +38,14 @@ module Shotengai
event
:soft_delete
{
transitions
from:
[
:on_sale
,
:no_on
],
to: :deleted
}
event
:soft_delete
{
transitions
from:
[
:on_sale
,
:no_on
],
to: :deleted
}
end
end
def
status_zh
{
on_on:
'未上架'
,
on_sale:
'已上架'
,
deleted:
'已删除'
}[
status
]
end
def
default_series
def
default_series
Shotengai
::
Series
.
find_by_id
(
default_series_id
)
||
series
.
first
Shotengai
::
Series
.
find_by_id
(
default_series_id
)
||
series
.
first
end
end
...
...
lib/shotengai/snapshot.rb
View file @
abc08581
...
@@ -31,6 +31,9 @@ module Shotengai
...
@@ -31,6 +31,9 @@ module Shotengai
validate
:check_spec
,
if: :spec
validate
:check_spec
,
if: :spec
validates
:count
,
numericality:
{
only_integer:
true
,
greater_than:
0
}
validates
:count
,
numericality:
{
only_integer:
true
,
greater_than:
0
}
delegate
:product_status_zh
,
to: :product
delegate
:order_status_zh
,
to: :order
class
<<
self
class
<<
self
def
inherited
subclass
def
inherited
subclass
product_name
=
/^(.+)Snapshot/
.
match
(
subclass
.
name
)[
1
]
product_name
=
/^(.+)Snapshot/
.
match
(
subclass
.
name
)[
1
]
...
...
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