Added fifth tag category meta

This commit is contained in:
BrokenEagle 2017-11-06 15:03:45 -08:00
parent 1de8fd2bd6
commit 7cb45fc8d3
5 changed files with 32 additions and 3 deletions

View File

@ -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;

View File

@ -265,6 +265,14 @@ module Danbooru
"formatstr" => "drawn by %s"
},
"relatedtag" => "Artists"
},
"meta" => {
"category" => 5,
"short" => "meta",
"extra" => [],
"header" => "<h2>Meta</h2>",
"humanized" => nil,
"relatedtag" => nil
}
}
end
@ -304,12 +312,12 @@ module Danbooru
#Sets the order of the split tag header list (presenters/tag_set_presenter.rb)
def split_tag_header_list
@split_tag_header_list ||= ["copyright","character","artist","general"]
@split_tag_header_list ||= ["copyright","character","artist","general","meta"]
end
#Sets the order of the categorized tag string (presenters/post_presenter.rb)
def categorized_tag_list
@categorized_tag_list ||= ["copyright","character","artist","general"]
@categorized_tag_list ||= ["copyright","character","artist","meta","general"]
end
#Sets the order of the related tag buttons (javascripts/related_tag.js)

View File

@ -0,0 +1,7 @@
class AddTagCountMetaToPosts < ActiveRecord::Migration
def change
Post.without_timeout do
add_column :posts, :tag_count_meta, :integer, default: 0, null: false
end
end
end

View File

@ -2776,7 +2776,8 @@ CREATE TABLE posts (
pixiv_id integer,
last_commented_at timestamp without time zone,
has_active_children boolean DEFAULT false,
bit_flags bigint DEFAULT 0 NOT NULL
bit_flags bigint DEFAULT 0 NOT NULL,
tag_count_meta integer DEFAULT 0 NOT NULL
);
@ -7518,3 +7519,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170709190409');
INSERT INTO schema_migrations (version) VALUES ('20170914200122');
INSERT INTO schema_migrations (version) VALUES ('20171106075030');

View File

@ -61,6 +61,7 @@ class TagTest < ActiveSupport::TestCase
assert_equal(1, Tag.categories.artist)
assert_equal(3, Tag.categories.copyright)
assert_equal(4, Tag.categories.character)
assert_equal(5, Tag.categories.meta)
end
should "have a regular expression for matching category names and shortcuts" do
@ -74,6 +75,7 @@ class TagTest < ActiveSupport::TestCase
assert_match(regexp, "character")
assert_match(regexp, "char")
assert_match(regexp, "ch")
assert_match(regexp, "meta")
assert_no_match(regexp, "c")
assert_no_match(regexp, "woodle")
end
@ -83,6 +85,7 @@ class TagTest < ActiveSupport::TestCase
assert_equal(0, Tag.categories.value_for("gen"))
assert_equal(1, Tag.categories.value_for("artist"))
assert_equal(1, Tag.categories.value_for("art"))
assert_equal(5, Tag.categories.value_for("meta"))
assert_equal(0, Tag.categories.value_for("unknown"))
end
end