tags: move tag category definitions out of the config file.
Move all the code for defining tag categories from the config file to TagCategory. It didn't belong in the config because it's not possible to add new tag categories purely in the config without editing other things like the CSS. Also change it so that tag colors are hardcoded in the CSS instead of generated using ERB. Generating the CSS in ERB meant that the Docker build had to recompile the CSS on every commit, even when it didn't change, because it relied on Ruby code outside the CSS that we couldn't guarantee didn't change.
This commit is contained in:
@@ -215,83 +215,6 @@ module Danbooru
|
||||
# StorageManager::SFTP.new("www.example.com", base_dir: "/mnt/backup", ssh_options: {})
|
||||
end
|
||||
|
||||
# TAG CONFIGURATION
|
||||
|
||||
# Full tag configuration info for all tags
|
||||
def full_tag_config_info
|
||||
@full_tag_category_mapping ||= {
|
||||
"general" => {
|
||||
"category" => 0,
|
||||
"short" => "gen",
|
||||
"extra" => [],
|
||||
"relatedbutton" => "General",
|
||||
"css" => {
|
||||
"color" => "var(--general-tag-color)",
|
||||
"hover" => "var(--general-tag-hover-color)"
|
||||
}
|
||||
},
|
||||
"character" => {
|
||||
"category" => 4,
|
||||
"short" => "char",
|
||||
"extra" => ["ch"],
|
||||
"relatedbutton" => "Characters",
|
||||
"css" => {
|
||||
"color" => "var(--character-tag-color)",
|
||||
"hover" => "var(--character-tag-hover-color)"
|
||||
}
|
||||
},
|
||||
"copyright" => {
|
||||
"category" => 3,
|
||||
"short" => "copy",
|
||||
"extra" => ["co"],
|
||||
"relatedbutton" => "Copyrights",
|
||||
"css" => {
|
||||
"color" => "var(--copyright-tag-color)",
|
||||
"hover" => "var(--copyright-tag-hover-color)"
|
||||
}
|
||||
},
|
||||
"artist" => {
|
||||
"category" => 1,
|
||||
"short" => "art",
|
||||
"extra" => [],
|
||||
"relatedbutton" => "Artists",
|
||||
"css" => {
|
||||
"color" => "var(--artist-tag-color)",
|
||||
"hover" => "var(--artist-tag-hover-color)"
|
||||
}
|
||||
},
|
||||
"meta" => {
|
||||
"category" => 5,
|
||||
"short" => "meta",
|
||||
"extra" => [],
|
||||
"relatedbutton" => nil,
|
||||
"css" => {
|
||||
"color" => "var(--meta-tag-color)",
|
||||
"hover" => "var(--meta-tag-hover-color)"
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
# TAG ORDERS
|
||||
|
||||
# Sets the order of the split tag header list (presenters/tag_set_presenter.rb)
|
||||
def split_tag_header_list
|
||||
@split_tag_header_list ||= ["artist", "copyright", "character", "general", "meta"]
|
||||
end
|
||||
|
||||
# Sets the order of the categorized tag string (presenters/post_presenter.rb)
|
||||
def categorized_tag_list
|
||||
@categorized_tag_list ||= ["artist", "copyright", "character", "meta", "general"]
|
||||
end
|
||||
|
||||
# Sets the order of the related tag buttons (javascripts/related_tag.js)
|
||||
def related_tag_button_list
|
||||
@related_tag_button_list ||= ["general", "artist", "character", "copyright"]
|
||||
end
|
||||
|
||||
# END TAG
|
||||
|
||||
# Any custom code you want to insert into the default layout without
|
||||
# having to modify the templates.
|
||||
def custom_html_header_content
|
||||
|
||||
Reference in New Issue
Block a user