artist commentary form: add partial_commentary checkbox.

Add a checkbox for adding/removing the partial_commentary tag in the
artist commentary form.

ref: https://danbooru.donmai.us/forum_topics/15101.
This commit is contained in:
evazion
2018-04-29 22:05:59 -05:00
parent 21431892e8
commit 7e99a1b38b
3 changed files with 28 additions and 4 deletions

View File

@@ -1,8 +1,8 @@
class ArtistCommentary < ApplicationRecord
class RevertError < Exception ; end
attr_accessor :remove_commentary_tag, :remove_commentary_request_tag, :remove_commentary_check_tag
attr_accessor :add_commentary_tag, :add_commentary_request_tag, :add_commentary_check_tag
attr_accessor :remove_commentary_tag, :remove_commentary_request_tag, :remove_commentary_check_tag, :remove_partial_commentary_tag
attr_accessor :add_commentary_tag, :add_commentary_request_tag, :add_commentary_check_tag, :add_partial_commentary_tag
before_validation :trim_whitespace
validates_uniqueness_of :post_id
belongs_to :post, required: true
@@ -108,6 +108,14 @@ class ArtistCommentary < ApplicationRecord
post.add_tag("check_commentary")
end
if remove_partial_commentary_tag == "1"
post.remove_tag("partial_commentary")
end
if add_partial_commentary_tag == "1"
post.add_tag("partial_commentary")
end
post.save if post.tag_string_changed?
end