Merge pull request #3353 from BrokenEagle/feat-add-meta-tag-category
Migrated tag logic into config file and added fifth tag category meta
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
Danbooru.Autocomplete.initialize_all = function() {
|
||||
if (Danbooru.meta("enable-auto-complete") === "true") {
|
||||
Danbooru.Autocomplete.enable_local_storage = this.test_local_storage();
|
||||
this.update_static_metatags();
|
||||
this.initialize_tag_autocomplete();
|
||||
this.initialize_mention_autocomplete();
|
||||
this.prune_local_storage();
|
||||
@@ -94,7 +95,7 @@
|
||||
var $fields_multiple = $('[data-autocomplete="tag-query"], [data-autocomplete="tag-edit"]');
|
||||
var $fields_single = $('[data-autocomplete="tag"]');
|
||||
|
||||
var prefixes = "-|~|general:|gen:|artist:|art:|copyright:|copy:|co:|character:|char:|ch:";
|
||||
var prefixes = "-|~|" + $.map(JSON.parse(Danbooru.meta("tag-category-names")), function (category) { return category + ':'}).join('|');
|
||||
var metatags = "order|-status|status|-rating|rating|-locked|locked|child|filetype|-filetype|" +
|
||||
"-user|user|-approver|approver|commenter|comm|noter|noteupdater|artcomm|-fav|fav|ordfav|" +
|
||||
"-pool|pool|ordpool|favgroup|-search|search";
|
||||
@@ -326,10 +327,6 @@
|
||||
"portrait", "landscape",
|
||||
"filesize", "filesize_asc",
|
||||
"tagcount", "tagcount_asc",
|
||||
"gentags", "gentags_asc",
|
||||
"arttags", "arttags_asc",
|
||||
"chartags", "chartags_asc",
|
||||
"copytags", "copytags_asc",
|
||||
"rank",
|
||||
"random"
|
||||
],
|
||||
@@ -350,6 +347,11 @@
|
||||
],
|
||||
}
|
||||
|
||||
//This must be done as a separate function as Danbooru.meta does not exist at program initialization
|
||||
Danbooru.Autocomplete.update_static_metatags = function () {
|
||||
Array.prototype.push.apply(Danbooru.Autocomplete.static_metatags.order,$.map(JSON.parse(Danbooru.meta("short-tag-category-names")), function(shorttag) { return [shorttag + "tags", shorttag + "tags_asc"]}));
|
||||
}
|
||||
|
||||
Danbooru.Autocomplete.static_metatag_source = function(term, resp, metatag) {
|
||||
var sub_metatags = this.static_metatags[metatag];
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Danbooru.RelatedTag = {};
|
||||
|
||||
Danbooru.RelatedTag.initialize_all = function() {
|
||||
if ($("#c-posts").length || $("#c-uploads").length) {
|
||||
if ($("#c-posts #a-show").length || $("#c-uploads #a-new").length) {
|
||||
this.initialize_buttons();
|
||||
$("#related-tags-container").hide();
|
||||
$("#artist-tags-container").hide();
|
||||
@@ -12,10 +12,9 @@
|
||||
|
||||
Danbooru.RelatedTag.initialize_buttons = function() {
|
||||
this.common_bind("#related-tags-button", "");
|
||||
this.common_bind("#related-general-button", "general");
|
||||
this.common_bind("#related-artists-button", "artist");
|
||||
this.common_bind("#related-characters-button", "character");
|
||||
this.common_bind("#related-copyrights-button", "copyright");
|
||||
$.each(JSON.parse(Danbooru.meta("related-tag-button-list")), function(i,category) {
|
||||
Danbooru.RelatedTag.common_bind("#related-" + category + "-button", category);
|
||||
});
|
||||
$("#find-artist-button").click(Danbooru.RelatedTag.find_artist);
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,14 @@ body[data-user-can-approve-posts="true"] .post-preview {
|
||||
}
|
||||
}
|
||||
|
||||
.category-5 a, a.tag-type-5, .ui-state-focus a.tag-type-5 {
|
||||
color: #F80;
|
||||
|
||||
&:hover {
|
||||
color: #FA6;
|
||||
}
|
||||
}
|
||||
|
||||
.category-banned a, a.tag-type-banned,, .ui-state-focus a.tag-type-banned {
|
||||
color: black;
|
||||
background-color: red;
|
||||
|
||||
@@ -118,10 +118,9 @@ class PostQueryBuilder
|
||||
relation = add_range_relation(q[:filesize], "posts.file_size", relation)
|
||||
relation = add_range_relation(q[:date], "posts.created_at", relation)
|
||||
relation = add_range_relation(q[:age], "posts.created_at", relation)
|
||||
relation = add_range_relation(q[:general_tag_count], "posts.tag_count_general", relation)
|
||||
relation = add_range_relation(q[:artist_tag_count], "posts.tag_count_artist", relation)
|
||||
relation = add_range_relation(q[:copyright_tag_count], "posts.tag_count_copyright", relation)
|
||||
relation = add_range_relation(q[:character_tag_count], "posts.tag_count_character", relation)
|
||||
TagCategory.categories.each do |category|
|
||||
relation = add_range_relation(q["#{category}_tag_count".to_sym], "posts.tag_count_#{category}", relation)
|
||||
end
|
||||
relation = add_range_relation(q[:post_tag_count], "posts.tag_count", relation)
|
||||
relation = add_range_relation(q[:pixiv_id], "posts.pixiv_id", relation)
|
||||
|
||||
@@ -513,29 +512,11 @@ class PostQueryBuilder
|
||||
when "tagcount_asc"
|
||||
relation = relation.order("posts.tag_count ASC")
|
||||
|
||||
when "gentags", "gentags_desc"
|
||||
relation = relation.order("posts.tag_count_general DESC")
|
||||
when /(#{TagCategory.short_name_regex})tags(?:\Z|_desc)/
|
||||
relation = relation.order("posts.tag_count_#{TagCategory.short_name_mapping[$1]} DESC")
|
||||
|
||||
when "gentags_asc"
|
||||
relation = relation.order("posts.tag_count_general ASC")
|
||||
|
||||
when "arttags", "arttags_desc"
|
||||
relation = relation.order("posts.tag_count_artist DESC")
|
||||
|
||||
when "arttags_asc"
|
||||
relation = relation.order("posts.tag_count_artist ASC")
|
||||
|
||||
when "chartags", "chartags_desc"
|
||||
relation = relation.order("posts.tag_count_character DESC")
|
||||
|
||||
when "chartags_asc"
|
||||
relation = relation.order("posts.tag_count_character ASC")
|
||||
|
||||
when "copytags", "copytags_desc"
|
||||
relation = relation.order("posts.tag_count_copyright DESC")
|
||||
|
||||
when "copytags_asc"
|
||||
relation = relation.order("posts.tag_count_copyright ASC")
|
||||
when /(#{TagCategory.short_name_regex})tags_asc/
|
||||
relation = relation.order("posts.tag_count_#{TagCategory.short_name_mapping[$1]} ASC")
|
||||
|
||||
when "rank"
|
||||
relation = relation.order("log(3, posts.score) + (extract(epoch from posts.created_at) - extract(epoch from timestamp '2005-05-24')) / 35000 DESC")
|
||||
|
||||
78
app/logical/tag_category.rb
Normal file
78
app/logical/tag_category.rb
Normal file
@@ -0,0 +1,78 @@
|
||||
class TagCategory
|
||||
module Mappings
|
||||
# Returns a hash mapping various tag categories to a numerical value.
|
||||
def mapping
|
||||
@@mapping ||= Hash[
|
||||
Danbooru.config.full_tag_config_info.map {|k,v| v["extra"].map {|y| [y,v["category"]]}}
|
||||
.reduce([],:+)]
|
||||
.update(Hash[Danbooru.config.full_tag_config_info.map {|k,v| [v["short"],v["category"]]}])
|
||||
.update( Hash[Danbooru.config.full_tag_config_info.map {|k,v| [k,v["category"]]}])
|
||||
end
|
||||
|
||||
# Returns a hash mapping more suited for views
|
||||
def canonical_mapping
|
||||
@@canonical_mapping ||= Hash[Danbooru.config.full_tag_config_info.map {|k,v| [k.capitalize,v["category"]]}]
|
||||
end
|
||||
|
||||
# Returns a hash mapping numerical category values to their string equivalent.
|
||||
def reverse_mapping
|
||||
@@reverse_mapping ||= Hash[Danbooru.config.full_tag_config_info.map {|k,v| [v["category"],k]}]
|
||||
end
|
||||
|
||||
# Returns a hash mapping for the short name usage in metatags
|
||||
def short_name_mapping
|
||||
@@short_name_mapping ||= Hash[Danbooru.config.full_tag_config_info.map {|k,v| [v["short"],k]}]
|
||||
end
|
||||
|
||||
# Returns a hash mapping for humanized_essential_tag_string (models/post.rb)
|
||||
def humanized_mapping
|
||||
@@humanized_mapping ||= Hash[Danbooru.config.full_tag_config_info.map {|k,v| [k,v["humanized"]]}]
|
||||
end
|
||||
|
||||
# Returns a hash mapping for humanized_essential_tag_string (models/post.rb)
|
||||
def header_mapping
|
||||
@@header_mapping ||= Hash[Danbooru.config.full_tag_config_info.map {|k,v| [k,v["header"]]}]
|
||||
end
|
||||
|
||||
# Returns a hash mapping for related tag buttons (javascripts/related_tag.js)
|
||||
def related_button_mapping
|
||||
@@related_button_mapping ||= Hash[Danbooru.config.full_tag_config_info.map {|k,v| [k,v["relatedbutton"]]}]
|
||||
end
|
||||
end
|
||||
|
||||
module Lists
|
||||
def categories
|
||||
@@categories ||= Danbooru.config.full_tag_config_info.keys
|
||||
end
|
||||
|
||||
def short_name_list
|
||||
@@short_name_list ||= short_name_mapping.keys
|
||||
end
|
||||
|
||||
def humanized_list
|
||||
Danbooru.config.humanized_tag_category_list
|
||||
end
|
||||
|
||||
def split_header_list
|
||||
Danbooru.config.split_tag_header_list
|
||||
end
|
||||
|
||||
def categorized_list
|
||||
Danbooru.config.categorized_tag_list
|
||||
end
|
||||
|
||||
def related_button_list
|
||||
Danbooru.config.related_tag_button_list
|
||||
end
|
||||
end
|
||||
|
||||
module Regexes
|
||||
def short_name_regex
|
||||
@@short_name_regex ||= short_name_list.join("|")
|
||||
end
|
||||
end
|
||||
|
||||
extend Mappings
|
||||
extend Lists
|
||||
extend Regexes
|
||||
end
|
||||
@@ -616,30 +616,21 @@ class Post < ApplicationRecord
|
||||
Post.expire_cache_for_all([""]) if new_record? || id <= 100_000
|
||||
end
|
||||
|
||||
def set_tag_count(category,tagcount)
|
||||
self.send("tag_count_#{category}=",tagcount)
|
||||
end
|
||||
|
||||
def inc_tag_count(category)
|
||||
set_tag_count(category,self.send("tag_count_#{category}") + 1)
|
||||
end
|
||||
|
||||
def set_tag_counts
|
||||
self.tag_count = 0
|
||||
self.tag_count_general = 0
|
||||
self.tag_count_artist = 0
|
||||
self.tag_count_copyright = 0
|
||||
self.tag_count_character = 0
|
||||
|
||||
TagCategory.categories {|x| set_tag_count(x,0)}
|
||||
categories = Tag.categories_for(tag_array, :disable_caching => true)
|
||||
categories.each_value do |category|
|
||||
self.tag_count += 1
|
||||
|
||||
case category
|
||||
when Tag.categories.general
|
||||
self.tag_count_general += 1
|
||||
|
||||
when Tag.categories.artist
|
||||
self.tag_count_artist += 1
|
||||
|
||||
when Tag.categories.copyright
|
||||
self.tag_count_copyright += 1
|
||||
|
||||
when Tag.categories.character
|
||||
self.tag_count_character += 1
|
||||
end
|
||||
inc_tag_count(TagCategory.reverse_mapping[category])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -918,31 +909,11 @@ class Post < ApplicationRecord
|
||||
@tag_categories ||= Tag.categories_for(tag_array)
|
||||
end
|
||||
|
||||
def copyright_tags
|
||||
typed_tags("copyright")
|
||||
end
|
||||
|
||||
def character_tags
|
||||
typed_tags("character")
|
||||
end
|
||||
|
||||
def artist_tags
|
||||
typed_tags("artist")
|
||||
end
|
||||
|
||||
def artist_tags_excluding_hidden
|
||||
artist_tags - %w(banned_artist)
|
||||
end
|
||||
|
||||
def general_tags
|
||||
typed_tags("general")
|
||||
end
|
||||
|
||||
def typed_tags(name)
|
||||
@typed_tags ||= {}
|
||||
@typed_tags[name] ||= begin
|
||||
tag_array.select do |tag|
|
||||
tag_categories[tag] == Danbooru.config.tag_category_mapping[name]
|
||||
tag_categories[tag] == TagCategory.mapping[name]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -955,52 +926,36 @@ class Post < ApplicationRecord
|
||||
@humanized_essential_tag_string ||= Cache.get("hets-#{id}", 1.hour.to_i) do
|
||||
string = []
|
||||
|
||||
if character_tags.any?
|
||||
chartags = character_tags.slice(0, 5)
|
||||
if character_tags.length > 5
|
||||
chartags << "others"
|
||||
TagCategory.humanized_list.each do |category|
|
||||
typetags = typed_tags(category) - TagCategory.humanized_mapping[category]["exclusion"]
|
||||
if TagCategory.humanized_mapping[category]["slice"] > 0
|
||||
typetags = typetags.slice(0,TagCategory.humanized_mapping[category]["slice"]) + (typetags.length > TagCategory.humanized_mapping[category]["slice"] ? ["others"] : [])
|
||||
end
|
||||
chartags = chartags.map do |tag|
|
||||
tag.match(/^(.+?)(?:_\(.+\))?$/)[1]
|
||||
if TagCategory.humanized_mapping[category]["regexmap"] != //
|
||||
typetags = typetags.map do |tag|
|
||||
tag.match(TagCategory.humanized_mapping[category]["regexmap"])[1]
|
||||
end
|
||||
end
|
||||
string << chartags.to_sentence
|
||||
end
|
||||
|
||||
if copyright_tags.any?
|
||||
copytags = copyright_tags.slice(0, 5)
|
||||
if copyright_tags.length > 5
|
||||
copytags << "others"
|
||||
if typetags.any?
|
||||
if category != "copyright" || typed_tags("character").any?
|
||||
string << TagCategory.humanized_mapping[category]["formatstr"] % typetags.to_sentence
|
||||
else
|
||||
string << typetags.to_sentence
|
||||
end
|
||||
end
|
||||
copytags = copytags.to_sentence
|
||||
string << (character_tags.any? ? "(#{copytags})" : copytags)
|
||||
end
|
||||
|
||||
if artist_tags_excluding_hidden.any?
|
||||
string << "drawn by"
|
||||
string << artist_tags_excluding_hidden.to_sentence
|
||||
end
|
||||
|
||||
string.empty? ? "##{id}" : string.join(" ").tr("_", " ")
|
||||
end
|
||||
end
|
||||
|
||||
def tag_string_copyright
|
||||
copyright_tags.join(" ")
|
||||
end
|
||||
|
||||
def tag_string_character
|
||||
character_tags.join(" ")
|
||||
end
|
||||
|
||||
def tag_string_artist
|
||||
artist_tags.join(" ")
|
||||
end
|
||||
|
||||
def tag_string_general
|
||||
general_tags.join(" ")
|
||||
TagCategory.categories.each do |category|
|
||||
define_method("tag_string_#{category}") do
|
||||
typed_tags(category).join(" ")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
module FavoriteMethods
|
||||
def clean_fav_string?
|
||||
true
|
||||
@@ -1182,15 +1137,10 @@ class Post < ApplicationRecord
|
||||
end
|
||||
|
||||
module CountMethods
|
||||
def fix_post_counts
|
||||
def fix_post_counts(post)
|
||||
post.set_tag_counts
|
||||
post.update_columns(
|
||||
:tag_count => post.tag_count,
|
||||
:tag_count_general => post.tag_count_general,
|
||||
:tag_count_artist => post.tag_count_artist,
|
||||
:tag_count_copyright => post.tag_count_copyright,
|
||||
:tag_count_character => post.tag_count_character
|
||||
)
|
||||
args = Hash[TagCategory.categories.map {|x| ["tag_count_#{x}",post.send("tag_count_#{x}")]}].update(:tag_count => post.tag_count)
|
||||
post.update_columns(args)
|
||||
end
|
||||
|
||||
def get_count_from_cache(tags)
|
||||
@@ -1572,7 +1522,7 @@ class Post < ApplicationRecord
|
||||
end
|
||||
|
||||
def method_attributes
|
||||
list = super + [:uploader_name, :has_large, :tag_string_artist, :tag_string_character, :tag_string_copyright, :tag_string_general, :has_visible_children, :children_ids]
|
||||
list = super + [:uploader_name, :has_large, :has_visible_children, :children_ids] + TagCategory.categories.map {|x| "tag_string_#{x}".to_sym}
|
||||
if visible?
|
||||
list += [:file_url, :large_file_url, :preview_file_url]
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Tag < ApplicationRecord
|
||||
COSINE_SIMILARITY_RELATED_TAG_THRESHOLD = 1000
|
||||
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|noteupdater|artcomm|-pool|pool|ordpool|-favgroup|favgroup|-fav|fav|ordfav|md5|-rating|rating|-locked|locked|width|height|mpixels|ratio|score|favcount|filesize|source|-source|id|-id|date|age|order|limit|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|child|pixiv_id|pixiv|search|upvote|downvote|filetype|-filetype|flagger|-flagger|appealer|-appealer"
|
||||
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|noteupdater|artcomm|-pool|pool|ordpool|-favgroup|favgroup|-fav|fav|ordfav|md5|-rating|rating|-locked|locked|width|height|mpixels|ratio|score|favcount|filesize|source|-source|id|-id|date|age|order|limit|-status|status|tagcount|parent|-parent|child|pixiv_id|pixiv|search|upvote|downvote|filetype|-filetype|flagger|-flagger|appealer|-appealer|" +
|
||||
TagCategory.short_name_list.map {|x| "#{x}tags"}.join("|")
|
||||
SUBQUERY_METATAGS = "commenter|comm|noter|noteupdater|artcomm|flagger|-flagger|appealer|-appealer"
|
||||
attr_accessible :category, :as => [:moderator, :gold, :platinum, :member, :anonymous, :default, :builder, :admin]
|
||||
attr_accessible :is_locked, :as => [:moderator, :admin]
|
||||
@@ -26,18 +27,18 @@ class Tag < ApplicationRecord
|
||||
end
|
||||
|
||||
class CategoryMapping
|
||||
Danbooru.config.reverse_tag_category_mapping.each do |value, category|
|
||||
define_method(category.downcase) do
|
||||
TagCategory.reverse_mapping.each do |value, category|
|
||||
define_method(category) do
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
def regexp
|
||||
@regexp ||= Regexp.compile(Danbooru.config.tag_category_mapping.keys.sort_by {|x| -x.size}.join("|"))
|
||||
@regexp ||= Regexp.compile(TagCategory.mapping.keys.sort_by {|x| -x.size}.join("|"))
|
||||
end
|
||||
|
||||
def value_for(string)
|
||||
Danbooru.config.tag_category_mapping[string.to_s.downcase] || 0
|
||||
TagCategory.mapping[string.to_s.downcase] || 0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -124,7 +125,7 @@ class Tag < ApplicationRecord
|
||||
end
|
||||
|
||||
def category_name
|
||||
Danbooru.config.reverse_tag_category_mapping[category]
|
||||
TagCategory.reverse_mapping[category].capitalize
|
||||
end
|
||||
|
||||
def update_category_cache_for_all
|
||||
@@ -140,7 +141,8 @@ class Tag < ApplicationRecord
|
||||
Post.raw_tag_match(name).where("true /* Tag#update_category_post_counts */").find_each do |post|
|
||||
post.reload
|
||||
post.set_tag_counts
|
||||
Post.where(:id => post.id).update_all(:tag_count => post.tag_count, :tag_count_general => post.tag_count_general, :tag_count_artist => post.tag_count_artist, :tag_count_copyright => post.tag_count_copyright, :tag_count_character => post.tag_count_character)
|
||||
args = Hash[TagCategory.categories {|x| ["tag_count_#{x}",post.send("tag_count_#{x}")]}].update(:tag_count => post.tag_count)
|
||||
Post.where(:id => post.id).update_all(args)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -175,7 +177,7 @@ class Tag < ApplicationRecord
|
||||
counts = counts.to_a.select {|x| x[1] > trending_count_limit}
|
||||
counts = counts.map do |tag_name, recent_count|
|
||||
tag = Tag.find_or_create_by_name(tag_name)
|
||||
if tag.category == Danbooru.config.tag_category_mapping["artist"]
|
||||
if tag.category == Tag.categories.artist
|
||||
# we're not interested in artists in the trending list
|
||||
[tag_name, 0]
|
||||
else
|
||||
@@ -317,19 +319,19 @@ class Tag < ApplicationRecord
|
||||
when :filesize
|
||||
object =~ /\A(\d+(?:\.\d*)?|\d*\.\d+)([kKmM]?)[bB]?\Z/
|
||||
|
||||
size = $1.to_f
|
||||
unit = $2
|
||||
size = $1.to_f
|
||||
unit = $2
|
||||
|
||||
conversion_factor = case unit
|
||||
when /m/i
|
||||
1024 * 1024
|
||||
when /k/i
|
||||
1024
|
||||
else
|
||||
1
|
||||
end
|
||||
conversion_factor = case unit
|
||||
when /m/i
|
||||
1024 * 1024
|
||||
when /k/i
|
||||
1024
|
||||
else
|
||||
1
|
||||
end
|
||||
|
||||
(size * conversion_factor).to_i
|
||||
(size * conversion_factor).to_i
|
||||
end
|
||||
end
|
||||
|
||||
@@ -429,296 +431,289 @@ class Tag < ApplicationRecord
|
||||
q[:tag_count] += 1 unless token == "status:deleted" || token =~ /\Alimit:.+\Z/
|
||||
|
||||
if token =~ /\A(#{METATAGS}):(.+)\Z/i
|
||||
case $1.downcase
|
||||
g1 = $1.downcase
|
||||
g2 = $2
|
||||
case g1
|
||||
when "-user"
|
||||
q[:uploader_id_neg] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:uploader_id_neg] << user_id unless user_id.blank?
|
||||
|
||||
when "user"
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:uploader_id] = user_id unless user_id.blank?
|
||||
|
||||
when "-approver"
|
||||
if $2 == "none"
|
||||
if g2 == "none"
|
||||
q[:approver_id] = "any"
|
||||
elsif $2 == "any"
|
||||
elsif g2 == "any"
|
||||
q[:approver_id] = "none"
|
||||
else
|
||||
q[:approver_id_neg] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:approver_id_neg] << user_id unless user_id.blank?
|
||||
end
|
||||
|
||||
when "approver"
|
||||
if $2 == "none"
|
||||
if g2 == "none"
|
||||
q[:approver_id] = "none"
|
||||
elsif $2 == "any"
|
||||
elsif g2 == "any"
|
||||
q[:approver_id] = "any"
|
||||
else
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:approver_id] = user_id unless user_id.blank?
|
||||
end
|
||||
|
||||
when "flagger"
|
||||
q[:flagger_ids] ||= []
|
||||
|
||||
if $2 == "none"
|
||||
if g2 == "none"
|
||||
q[:flagger_ids] << "none"
|
||||
elsif $2 == "any"
|
||||
elsif g2 == "any"
|
||||
q[:flagger_ids] << "any"
|
||||
else
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:flagger_ids] << user_id unless user_id.blank?
|
||||
end
|
||||
|
||||
when "-flagger"
|
||||
if $2 == "none"
|
||||
if g2 == "none"
|
||||
q[:flagger_ids] ||= []
|
||||
q[:flagger_ids] << "any"
|
||||
elsif $2 == "any"
|
||||
elsif g2 == "any"
|
||||
q[:flagger_ids] ||= []
|
||||
q[:flagger_ids] << "none"
|
||||
else
|
||||
q[:flagger_ids_neg] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:flagger_ids_neg] << user_id unless user_id.blank?
|
||||
end
|
||||
|
||||
when "appealer"
|
||||
q[:appealer_ids] ||= []
|
||||
|
||||
if $2 == "none"
|
||||
if g2 == "none"
|
||||
q[:appealer_ids] << "none"
|
||||
elsif $2 == "any"
|
||||
elsif g2 == "any"
|
||||
q[:appealer_ids] << "any"
|
||||
else
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:appealer_ids] << user_id unless user_id.blank?
|
||||
end
|
||||
|
||||
when "-appealer"
|
||||
if $2 == "none"
|
||||
if g2 == "none"
|
||||
q[:appealer_ids] ||= []
|
||||
q[:appealer_ids] << "any"
|
||||
elsif $2 == "any"
|
||||
elsif g2 == "any"
|
||||
q[:appealer_ids] ||= []
|
||||
q[:appealer_ids] << "none"
|
||||
else
|
||||
q[:appealer_ids_neg] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:appealer_ids_neg] << user_id unless user_id.blank?
|
||||
end
|
||||
|
||||
when "commenter", "comm"
|
||||
q[:commenter_ids] ||= []
|
||||
|
||||
if $2 == "none"
|
||||
if g2 == "none"
|
||||
q[:commenter_ids] << "none"
|
||||
elsif $2 == "any"
|
||||
elsif g2 == "any"
|
||||
q[:commenter_ids] << "any"
|
||||
else
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:commenter_ids] << user_id unless user_id.blank?
|
||||
end
|
||||
|
||||
when "noter"
|
||||
q[:noter_ids] ||= []
|
||||
|
||||
if $2 == "none"
|
||||
if g2 == "none"
|
||||
q[:noter_ids] << "none"
|
||||
elsif $2 == "any"
|
||||
elsif g2 == "any"
|
||||
q[:noter_ids] << "any"
|
||||
else
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:noter_ids] << user_id unless user_id.blank?
|
||||
end
|
||||
|
||||
when "noteupdater"
|
||||
q[:note_updater_ids] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:note_updater_ids] << user_id unless user_id.blank?
|
||||
|
||||
when "artcomm"
|
||||
q[:artcomm_ids] ||= []
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:artcomm_ids] << user_id unless user_id.blank?
|
||||
|
||||
when "-pool"
|
||||
if $2.downcase == "none"
|
||||
if g2.downcase == "none"
|
||||
q[:pool] = "any"
|
||||
elsif $2.downcase == "any"
|
||||
elsif g2.downcase == "any"
|
||||
q[:pool] = "none"
|
||||
elsif $2.downcase == "series"
|
||||
elsif g2.downcase == "series"
|
||||
q[:tags][:exclude] << "pool:series"
|
||||
elsif $2.downcase == "collection"
|
||||
elsif g2.downcase == "collection"
|
||||
q[:tags][:exclude] << "pool:collection"
|
||||
else
|
||||
q[:tags][:exclude] << "pool:#{Pool.name_to_id($2)}"
|
||||
q[:tags][:exclude] << "pool:#{Pool.name_to_id(g2)}"
|
||||
end
|
||||
|
||||
when "pool"
|
||||
if $2.downcase == "none"
|
||||
if g2.downcase == "none"
|
||||
q[:pool] = "none"
|
||||
elsif $2.downcase == "any"
|
||||
elsif g2.downcase == "any"
|
||||
q[:pool] = "any"
|
||||
elsif $2.downcase == "series"
|
||||
elsif g2.downcase == "series"
|
||||
q[:tags][:related] << "pool:series"
|
||||
elsif $2.downcase == "collection"
|
||||
elsif g2.downcase == "collection"
|
||||
q[:tags][:related] << "pool:collection"
|
||||
elsif $2.include?("*")
|
||||
pools = Pool.name_matches($2).select("id").limit(Danbooru.config.tag_query_limit).order("post_count DESC")
|
||||
elsif g2.include?("*")
|
||||
pools = Pool.name_matches(g2).select("id").limit(Danbooru.config.tag_query_limit).order("post_count DESC")
|
||||
q[:tags][:include] += pools.map {|pool| "pool:#{pool.id}"}
|
||||
else
|
||||
q[:tags][:related] << "pool:#{Pool.name_to_id($2)}"
|
||||
q[:tags][:related] << "pool:#{Pool.name_to_id(g2)}"
|
||||
end
|
||||
|
||||
when "ordpool"
|
||||
pool_id = Pool.name_to_id($2)
|
||||
pool_id = Pool.name_to_id(g2)
|
||||
q[:tags][:related] << "pool:#{pool_id}"
|
||||
q[:ordpool] = pool_id
|
||||
|
||||
when "-favgroup"
|
||||
favgroup_id = FavoriteGroup.name_to_id($2)
|
||||
favgroup_id = FavoriteGroup.name_to_id(g2)
|
||||
q[:favgroups_neg] ||= []
|
||||
q[:favgroups_neg] << favgroup_id
|
||||
|
||||
when "favgroup"
|
||||
favgroup_id = FavoriteGroup.name_to_id($2)
|
||||
favgroup_id = FavoriteGroup.name_to_id(g2)
|
||||
q[:favgroups] ||= []
|
||||
q[:favgroups] << favgroup_id
|
||||
|
||||
when "-fav"
|
||||
q[:tags][:exclude] << "fav:#{User.name_to_id($2)}"
|
||||
q[:tags][:exclude] << "fav:#{User.name_to_id(g2)}"
|
||||
|
||||
when "fav"
|
||||
q[:tags][:related] << "fav:#{User.name_to_id($2)}"
|
||||
q[:tags][:related] << "fav:#{User.name_to_id(g2)}"
|
||||
|
||||
when "ordfav"
|
||||
user_id = User.name_to_id($2)
|
||||
user_id = User.name_to_id(g2)
|
||||
q[:tags][:related] << "fav:#{user_id}"
|
||||
q[:ordfav] = user_id
|
||||
|
||||
when "search"
|
||||
q[:saved_searches] ||= []
|
||||
q[:saved_searches] << $2
|
||||
q[:saved_searches] << g2
|
||||
|
||||
when "md5"
|
||||
q[:md5] = $2.downcase.split(/,/)
|
||||
q[:md5] = g2.downcase.split(/,/)
|
||||
|
||||
when "-rating"
|
||||
q[:rating_negated] = $2.downcase
|
||||
q[:rating_negated] = g2.downcase
|
||||
|
||||
when "rating"
|
||||
q[:rating] = $2.downcase
|
||||
q[:rating] = g2.downcase
|
||||
|
||||
when "-locked"
|
||||
q[:locked_negated] = $2.downcase
|
||||
q[:locked_negated] = g2.downcase
|
||||
|
||||
when "locked"
|
||||
q[:locked] = $2.downcase
|
||||
q[:locked] = g2.downcase
|
||||
|
||||
when "id"
|
||||
q[:post_id] = parse_helper($2)
|
||||
q[:post_id] = parse_helper(g2)
|
||||
|
||||
when "-id"
|
||||
q[:post_id_negated] = $2.to_i
|
||||
q[:post_id_negated] = g2.to_i
|
||||
|
||||
when "width"
|
||||
q[:width] = parse_helper($2)
|
||||
q[:width] = parse_helper(g2)
|
||||
|
||||
when "height"
|
||||
q[:height] = parse_helper($2)
|
||||
q[:height] = parse_helper(g2)
|
||||
|
||||
when "mpixels"
|
||||
q[:mpixels] = parse_helper_fudged($2, :float)
|
||||
q[:mpixels] = parse_helper_fudged(g2, :float)
|
||||
|
||||
when "ratio"
|
||||
q[:ratio] = parse_helper($2, :ratio)
|
||||
q[:ratio] = parse_helper(g2, :ratio)
|
||||
|
||||
when "score"
|
||||
q[:score] = parse_helper($2)
|
||||
q[:score] = parse_helper(g2)
|
||||
|
||||
when "favcount"
|
||||
q[:fav_count] = parse_helper($2)
|
||||
q[:fav_count] = parse_helper(g2)
|
||||
|
||||
when "filesize"
|
||||
q[:filesize] = parse_helper_fudged($2, :filesize)
|
||||
q[:filesize] = parse_helper_fudged(g2, :filesize)
|
||||
|
||||
when "source"
|
||||
src = $2.gsub(/\A"(.*)"\Z/, '\1')
|
||||
src = g2.gsub(/\A"(.*)"\Z/, '\1')
|
||||
q[:source] = (src.to_escaped_for_sql_like + "%").gsub(/%+/, '%')
|
||||
|
||||
when "-source"
|
||||
src = $2.gsub(/\A"(.*)"\Z/, '\1')
|
||||
src = g2.gsub(/\A"(.*)"\Z/, '\1')
|
||||
q[:source_neg] = (src.to_escaped_for_sql_like + "%").gsub(/%+/, '%')
|
||||
|
||||
when "date"
|
||||
q[:date] = parse_helper($2, :date)
|
||||
q[:date] = parse_helper(g2, :date)
|
||||
|
||||
when "age"
|
||||
q[:age] = reverse_parse_helper(parse_helper($2, :age))
|
||||
q[:age] = reverse_parse_helper(parse_helper(g2, :age))
|
||||
|
||||
when "tagcount"
|
||||
q[:post_tag_count] = parse_helper($2)
|
||||
q[:post_tag_count] = parse_helper(g2)
|
||||
|
||||
when "gentags"
|
||||
q[:general_tag_count] = parse_helper($2)
|
||||
|
||||
when "arttags"
|
||||
q[:artist_tag_count] = parse_helper($2)
|
||||
|
||||
when "chartags"
|
||||
q[:character_tag_count] = parse_helper($2)
|
||||
|
||||
when "copytags"
|
||||
q[:copyright_tag_count] = parse_helper($2)
|
||||
when /(#{TagCategory.short_name_regex})tags/
|
||||
q["#{TagCategory.short_name_mapping[$1]}_tag_count".to_sym] = parse_helper(g2)
|
||||
|
||||
when "parent"
|
||||
q[:parent] = $2.downcase
|
||||
q[:parent] = g2.downcase
|
||||
|
||||
when "-parent"
|
||||
if $2.downcase == "none"
|
||||
if g2.downcase == "none"
|
||||
q[:parent] = "any"
|
||||
elsif $2.downcase == "any"
|
||||
elsif g2.downcase == "any"
|
||||
q[:parent] = "none"
|
||||
else
|
||||
q[:parent_neg_ids] ||= []
|
||||
q[:parent_neg_ids] << $2.downcase
|
||||
q[:parent_neg_ids] << g2.downcase
|
||||
end
|
||||
|
||||
when "child"
|
||||
q[:child] = $2.downcase
|
||||
q[:child] = g2.downcase
|
||||
|
||||
when "order"
|
||||
q[:order] = $2.downcase
|
||||
q[:order] = g2.downcase
|
||||
|
||||
when "limit"
|
||||
# Do nothing. The controller takes care of it.
|
||||
|
||||
when "-status"
|
||||
q[:status_neg] = $2.downcase
|
||||
q[:status_neg] = g2.downcase
|
||||
|
||||
when "status"
|
||||
q[:status] = $2.downcase
|
||||
q[:status] = g2.downcase
|
||||
|
||||
when "filetype"
|
||||
q[:filetype] = $2.downcase
|
||||
q[:filetype] = g2.downcase
|
||||
|
||||
when "-filetype"
|
||||
q[:filetype_neg] = $2.downcase
|
||||
q[:filetype_neg] = g2.downcase
|
||||
|
||||
when "pixiv_id", "pixiv"
|
||||
q[:pixiv_id] = parse_helper($2)
|
||||
q[:pixiv_id] = parse_helper(g2)
|
||||
|
||||
when "upvote"
|
||||
if CurrentUser.user.is_moderator?
|
||||
q[:upvote] = User.name_to_id($2)
|
||||
q[:upvote] = User.name_to_id(g2)
|
||||
end
|
||||
|
||||
when "downvote"
|
||||
if CurrentUser.user.is_moderator?
|
||||
q[:downvote] = User.name_to_id($2)
|
||||
q[:downvote] = User.name_to_id(g2)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -129,48 +129,24 @@ class PostPresenter < Presenter
|
||||
@post.humanized_essential_tag_string
|
||||
end
|
||||
|
||||
def categorized_tag_string
|
||||
def categorized_tag_groups
|
||||
string = []
|
||||
|
||||
if @post.copyright_tags.any?
|
||||
string << @post.copyright_tags.join(" ")
|
||||
TagCategory.categorized_list.each do |category|
|
||||
if @post.typed_tags(category).any?
|
||||
string << @post.typed_tags(category).join(" ")
|
||||
end
|
||||
end
|
||||
|
||||
string
|
||||
end
|
||||
|
||||
if @post.character_tags.any?
|
||||
string << @post.character_tags.join(" ")
|
||||
end
|
||||
|
||||
if @post.artist_tags.any?
|
||||
string << @post.artist_tags.join(" ")
|
||||
end
|
||||
|
||||
if @post.general_tags.any?
|
||||
string << @post.general_tags.join(" ")
|
||||
end
|
||||
|
||||
string.join(" \n")
|
||||
def categorized_tag_string
|
||||
categorized_tag_groups.join(" \n")
|
||||
end
|
||||
|
||||
def humanized_categorized_tag_string
|
||||
string = []
|
||||
|
||||
if @post.copyright_tags.any?
|
||||
string << @post.copyright_tags
|
||||
end
|
||||
|
||||
if @post.character_tags.any?
|
||||
string << @post.character_tags
|
||||
end
|
||||
|
||||
if @post.artist_tags.any?
|
||||
string << @post.artist_tags
|
||||
end
|
||||
|
||||
if @post.general_tags.any?
|
||||
string << @post.general_tags
|
||||
end
|
||||
|
||||
string.flatten.slice(0, 25).join(", ").tr("_", " ")
|
||||
categorized_tag_groups.flatten.slice(0, 25).join(", ").tr("_", " ")
|
||||
end
|
||||
|
||||
def image_html(template)
|
||||
|
||||
@@ -25,40 +25,16 @@ class TagSetPresenter < Presenter
|
||||
def split_tag_list_html(template, options = {})
|
||||
html = ""
|
||||
|
||||
if copyright_tags.any?
|
||||
html << '<h2>Copyrights</h2>'
|
||||
html << "<ul>"
|
||||
copyright_tags.keys.each do |tag|
|
||||
html << build_list_item(tag, template, options)
|
||||
TagCategory.split_header_list.each do |category|
|
||||
typetags = typed_tags(category)
|
||||
if typetags.any?
|
||||
html << TagCategory.header_mapping[category]
|
||||
html << "<ul>"
|
||||
typetags.each do |tag|
|
||||
html << build_list_item(tag, template, options)
|
||||
end
|
||||
html << "</ul>"
|
||||
end
|
||||
html << "</ul>"
|
||||
end
|
||||
|
||||
if character_tags.any?
|
||||
html << '<h2>Characters</h2>'
|
||||
html << "<ul>"
|
||||
character_tags.keys.each do |tag|
|
||||
html << build_list_item(tag, template, options)
|
||||
end
|
||||
html << "</ul>"
|
||||
end
|
||||
|
||||
if artist_tags.any?
|
||||
html << '<h2>Artist</h2>'
|
||||
html << "<ul>"
|
||||
artist_tags.keys.each do |tag|
|
||||
html << build_list_item(tag, template, options)
|
||||
end
|
||||
html << "</ul>"
|
||||
end
|
||||
|
||||
if general_tags.any?
|
||||
html << '<h1>Tags</h1>'
|
||||
html << "<ul>"
|
||||
general_tags.keys.each do |tag|
|
||||
html << build_list_item(tag, template, options)
|
||||
end
|
||||
html << "</ul>"
|
||||
end
|
||||
|
||||
html.html_safe
|
||||
@@ -76,20 +52,13 @@ class TagSetPresenter < Presenter
|
||||
end
|
||||
|
||||
private
|
||||
def general_tags
|
||||
@general_tags ||= categories.select {|k, v| v == Tag.categories.general}
|
||||
end
|
||||
|
||||
def copyright_tags
|
||||
@copyright_tags ||= categories.select {|k, v| v == Tag.categories.copyright}
|
||||
end
|
||||
|
||||
def character_tags
|
||||
@character_tags ||= categories.select {|k, v| v == Tag.categories.character}
|
||||
end
|
||||
|
||||
def artist_tags
|
||||
@artist_tags ||= categories.select {|k, v| v == Tag.categories.artist}
|
||||
def typed_tags(name)
|
||||
@typed_tags ||= {}
|
||||
@typed_tags[name] ||= begin
|
||||
@tags.select do |tag|
|
||||
categories[tag] == TagCategory.mapping[name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def categories
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
<% unless cookies[:dm] %>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<% end %>
|
||||
<meta name="tag-category-names" content="<%= TagCategory.categories %>">
|
||||
<meta name="short-tag-category-names" content="<%= TagCategory.short_name_list %>">
|
||||
<meta name="current-user-name" content="<%= CurrentUser.name %>">
|
||||
<meta name="current-user-id" content="<%= CurrentUser.id %>">
|
||||
<meta name="current-user-can-approve-posts" content="<%= CurrentUser.can_approve_posts? %>">
|
||||
|
||||
@@ -77,10 +77,10 @@
|
||||
</div>
|
||||
|
||||
<%= button_tag "Related tags", :id => "related-tags-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
<%= button_tag "General", :id => "related-general-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
<%= button_tag "Artists", :id => "related-artists-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
<%= button_tag "Characters", :id => "related-characters-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
<%= button_tag "Copyrights", :id => "related-copyrights-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
|
||||
<% TagCategory.related_button_list.each do |category| %>
|
||||
<%= button_tag "#{TagCategory.related_button_mapping[category]}", :id => "related-#{category}-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="input">
|
||||
|
||||
@@ -155,6 +155,7 @@
|
||||
<% end %>
|
||||
|
||||
<% content_for(:html_header) do %>
|
||||
<meta name="related-tag-button-list" content="<%= TagCategory.related_button_list %>">
|
||||
<meta name="description" content="<%= @post.presenter.humanized_tag_string %>">
|
||||
<meta name="tags" content="<%= @post.tag_string %>">
|
||||
<meta name="favorites" content="<%= @post.fav_string %>">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<section>
|
||||
<%= form_tag(related_tag_path, :method => :get) do %>
|
||||
<%= text_field_tag "query", params[:query], :data => { :autocomplete => "tag" } %>
|
||||
<%= select_tag "category", options_for_select([""] + Danbooru.config.canonical_tag_category_mapping.map{|x| [x.first, x.first.downcase]}, params[:category]) %>
|
||||
<%= select_tag "category", options_for_select([""] + TagCategory.canonical_mapping.map{|x| [x.first, x.first.downcase]}, params[:category]) %>
|
||||
<%= submit_tag "Show"%>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<%= simple_form_for(:search, method: :get, url: tag_aliases_path, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
|
||||
<%= f.input :name_matches, label: "Name", input_html: { value: params[:search][:name_matches], data: { autocomplete: "tag" } } %>
|
||||
<%= f.input :status, label: "Status", collection: ["", "Approved", "Pending"], selected: params[:search][:status] %>
|
||||
<%= f.input :category, label: "Category", collection: Danbooru.config.canonical_tag_category_mapping.to_a, include_blank: true, selected: params[:search][:category] %>
|
||||
<%= f.input :category, label: "Category", collection: TagCategory.canonical_mapping.to_a, include_blank: true, selected: params[:search][:category] %>
|
||||
<%= f.input :order, label: "Order", collection: [%w[Status status], %w[Recently\ created created_at], %w[Recently\ updated updated_at], %w[Name name], %w[Tag\ count tag_count]], selected: params[:search][:order] %>
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<%= simple_form_for(:search, method: :get, url: tag_implications_path, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
|
||||
<%= f.input :name_matches, label: "Name", input_html: { value: params[:search][:name_matches], data: { autocomplete: "tag" } } %>
|
||||
<%= f.input :status, label: "Status", collection: ["", "Approved", "Pending"], selected: params[:search][:status] %>
|
||||
<%= f.input :category, label: "Category", collection: Danbooru.config.canonical_tag_category_mapping.to_a, include_blank: true, selected: params[:search][:category] %>
|
||||
<%= f.input :category, label: "Category", collection: TagCategory.canonical_mapping.to_a, include_blank: true, selected: params[:search][:category] %>
|
||||
<%= f.input :order, label: "Order", collection: [%w[Status status], %w[Recently\ created created_at], %w[Recently\ updated updated_at], %w[Name name], %w[Tag\ count tag_count]], selected: params[:search][:order] %>
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= simple_form_for(:search, url: tags_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
|
||||
<%= f.input :name_matches, label: "Name", hint: "Use * for wildcard", input_html: { value: params[:search][:name_matches], data: { autocomplete: "tag" } } %>
|
||||
<%= f.input :category, label: "Category", collection: Danbooru.config.canonical_tag_category_mapping.to_a, include_blank: true,selected: params[:search][:category] %>
|
||||
<%= f.input :category, label: "Category", collection: TagCategory.canonical_mapping.to_a, include_blank: true,selected: params[:search][:category] %>
|
||||
<%= f.input :order, collection: [%w[Newest date], %w[Count count], %w[Name name]], include_blank: false, selected: params[:search][:order] %>
|
||||
<%= f.input :hide_empty, label: "Hide empty?", collection: %w[yes no], selected: params[:search][:hide_empty] %>
|
||||
<%= f.input :has_wiki, label: "Has wiki?", collection: %w[yes no], include_blank: true, selected: params[:search][:has_wiki] %>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<% if @tag.is_locked? %>
|
||||
<p>This tag is category locked</p>
|
||||
<% else %>
|
||||
<%= f.input :category, :collection => Danbooru.config.canonical_tag_category_mapping.to_a, :include_blank => false %>
|
||||
<%= f.input :category, :collection => TagCategory.canonical_mapping.to_a, :include_blank => false %>
|
||||
<% end %>
|
||||
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
|
||||
@@ -109,10 +109,10 @@
|
||||
</div>
|
||||
|
||||
<%= button_tag "Related tags", :id => "related-tags-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
<%= button_tag "General", :id => "related-general-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
<%= button_tag "Artists", :id => "related-artists-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
<%= button_tag "Characters", :id => "related-characters-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
<%= button_tag "Copyrights", :id => "related-copyrights-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
|
||||
<% TagCategory.related_button_list.each do |category| %>
|
||||
<%= button_tag "#{TagCategory.related_button_mapping[category]}", :id => "related-#{category}-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="input">
|
||||
@@ -141,4 +141,8 @@
|
||||
Upload - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
|
||||
<% content_for(:html_header) do %>
|
||||
<meta name="related-tag-button-list" content="<%= Danbooru.config.related_tag_button_list %>">
|
||||
<% end %>
|
||||
|
||||
<%= render "posts/partials/common/secondary_links" %>
|
||||
|
||||
Reference in New Issue
Block a user