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
b810f251
Commit
b810f251
authored
Sep 18, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve join_catalog_system with a new option :validate_name_chain
parent
60799c69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
_product.json.jbuilder
lib/generators/templates/views/share/_product.json.jbuilder
+0
-2
product.rb
lib/shotengai/product.rb
+2
-1
No files found.
lib/generators/templates/views/share/_product.json.jbuilder
View file @
b810f251
...
...
@@ -4,4 +4,3 @@ json.extract! product, :id, :title, :status, :status_zh,
# TODO: NOTE: catalog_list is only vaild in the template example
json.catalog_list product.catalog_list if product.respond_to?(:catalog_list)
json.default_series product.default_series, partial: 'shotengai/share/series_simple', as: :series
json.series product.series, partial: 'shotengai/share/series_simple', as: :series
\ No newline at end of file
lib/shotengai/product.rb
View file @
b810f251
...
...
@@ -107,9 +107,10 @@ module Shotengai
catalog_class
=
catalog_class_name
.
constantize
tag_name
=
options
[
:as
]
||
catalog_class
.
model_name
.
singular
acts_as_taggable_on
tag_name
.
to_sym
# set { validate_name_chain: false } to skip the validate_name_chain
# 只有完整替换(只属于一个分类)的时候才进行验证,add remove 暂时未添加
# Just catalogs_list= have a validation
class_eval
do
options
[
:validate_name_chain
].
eql?
(
false
)
||
class_eval
do
define_method
(
"
#{
tag_name
}
_list="
)
{
|
value
|
super
catalog_class
.
validate_name_chain
(
value
)
}
...
...
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