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
feac21d8
Commit
feac21d8
authored
Aug 28, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix status_zh and some spell mistake
parent
abc08581
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
9 deletions
+14
-9
1_create_shotengai_products_and_orders.rb
db/migrate/1_create_shotengai_products_and_orders.rb
+1
-2
controllers_generator.rb
lib/generators/shotengai/controllers_generator.rb
+1
-1
show.json.jbuilder
...ors/templates/views/merchant/snapshots/show.json.jbuilder
+1
-1
series.rb
lib/shotengai/series.rb
+1
-1
snapshot.rb
lib/shotengai/snapshot.rb
+10
-4
No files found.
db/migrate/1_create_shotengai_products_and_orders.rb
View file @
feac21d8
...
...
@@ -82,4 +82,4 @@ class CreateShotengaiProductsAndOrders < ActiveRecord::Migration[5.1]
add_index
:shotengai_snapshots
,
:type
end
end
\ No newline at end of file
end
lib/generators/shotengai/controllers_generator.rb
View file @
feac21d8
...
...
@@ -41,7 +41,7 @@ module Shotengai
'products'
=>
options
[
:product
],
'orders'
=>
options
[
:order
],
'product_series'
=>
"
#{
options
[
:product
]
}
Series"
,
'product_snapshots'
=>
"
#{
options
[
:product
]
}
Snapshot
s
"
,
'product_snapshots'
=>
"
#{
options
[
:product
]
}
Snapshot"
,
}.
each
do
|
key
,
klass_name
|
@key
,
@klass_name
,
@role
=
key
,
klass_name
,
role
...
...
lib/generators/templates/views/merchant/snapshots/show.json.jbuilder
View file @
feac21d8
json.partial! "shotengai/share/sna
oshot", snao
shot: @resource
json.partial! "shotengai/share/sna
pshot", snap
shot: @resource
lib/shotengai/series.rb
View file @
feac21d8
...
...
@@ -27,7 +27,7 @@ module Shotengai
# Using validates_uniqueness_of do not work if the order of Hash is diff
validate
:uniq_spec
delegate
:title
,
:detail
,
:banners
,
:cover_image
,
to: :product
delegate
:title
,
:detail
,
:banners
,
:cover_image
,
:status
,
to: :product
scope
:query_spec_with_product
,
->
(
val
,
product
)
{
return
none
unless
val
.
keys
.
sort
==
product
.
spec
.
keys
.
sort
...
...
lib/shotengai/snapshot.rb
View file @
feac21d8
...
...
@@ -31,9 +31,6 @@ module Shotengai
validate
:check_spec
,
if: :spec
validates
:count
,
numericality:
{
only_integer:
true
,
greater_than:
0
}
delegate
:product_status_zh
,
to: :product
delegate
:order_status_zh
,
to: :order
class
<<
self
def
inherited
subclass
product_name
=
/^(.+)Snapshot/
.
match
(
subclass
.
name
)[
1
]
...
...
@@ -70,12 +67,21 @@ module Shotengai
###### view
def
total_price
count
*
price
revised_amount
||
count
*
price
end
def
total_original_price
count
*
original_price
end
def
product_status_zh
series
.
status_zh
end
def
order_status_zh
order
&
.
status_zh
end
######
private
...
...
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