forked from e621ng/e621ng
[Uploader] Correctly show tag category for implications
When a character implies a copyright both would display as copyright
This commit is contained in:
parent
1b0ebe4504
commit
ca66c01856
@ -29,16 +29,16 @@
|
||||
switch (tag.type) {
|
||||
default:
|
||||
case 'tag':
|
||||
return h('span', {staticClass: 'tag-preview'}, [create_tag_link(tag.a, tag.tagType)]);
|
||||
return h('span', {staticClass: 'tag-preview'}, [create_tag_link(tag.a, tag.tagTypeA)]);
|
||||
case 'alias':
|
||||
return h('span', {staticClass: 'tag-preview tag-preview-alias'}, [
|
||||
h('del', undefined, [
|
||||
create_tag_link(tag.a, tag.tagType)
|
||||
]), ' → ', create_tag_link(tag.b, tag.tagType)
|
||||
create_tag_link(tag.a, tag.tagTypeA)
|
||||
]), ' → ', create_tag_link(tag.b, tag.tagTypeB)
|
||||
]);
|
||||
case 'implication':
|
||||
return h('span', {staticClass: 'tag-preview tag-preview-implication'}, [
|
||||
create_tag_link(tag.a, tag.tagType), ' ⇐ ', create_tag_link(tag.b, tag.tagType)
|
||||
create_tag_link(tag.a, tag.tagTypeA), ' ⇐ ', create_tag_link(tag.b, tag.tagTypeB)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -27,10 +27,11 @@ class TagsPreview
|
||||
end
|
||||
|
||||
def tag_types
|
||||
names = @tags.map { |tag| tag[:b] || tag[:a] }
|
||||
names = @tags.map { |tag| [tag[:a], tag[:b]] }.flatten.compact.uniq
|
||||
categories = Tag.categories_for(names)
|
||||
@tags.map! do |tag|
|
||||
tag[:tagType] = categories.fetch(tag[:b] || tag[:a], -1)
|
||||
tag[:tagTypeA] = categories.fetch(tag[:a], -1)
|
||||
tag[:tagTypeB] = categories.fetch(tag[:b], -1) if tag[:b]
|
||||
tag
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user