add options for commentary_check #2623
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class ArtistCommentary < ActiveRecord::Base
|
||||
attr_accessor :remove_commentary_tag, :remove_commentary_request_tag
|
||||
attr_accessor :add_commentary_tag, :add_commentary_request_tag
|
||||
attr_accessible :post_id, :original_description, :original_title, :translated_description, :translated_title, :remove_commentary_tag, :remove_commentary_request_tag, :add_commentary_tag, :add_commentary_request_tag
|
||||
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_accessible :post_id, :original_description, :original_title, :translated_description, :translated_title, :remove_commentary_tag, :remove_commentary_request_tag, :add_commentary_tag, :add_commentary_request_tag, :add_commentary_check_tag, :remove_commentary_check_tag
|
||||
validates_uniqueness_of :post_id
|
||||
belongs_to :post
|
||||
has_many :versions, lambda {order("artist_commentary_versions.id ASC")}, :class_name => "ArtistCommentaryVersion", :dependent => :destroy, :foreign_key => :post_id, :primary_key => :post_id
|
||||
@@ -104,6 +104,14 @@ class ArtistCommentary < ActiveRecord::Base
|
||||
post.add_tag("commentary_request")
|
||||
end
|
||||
|
||||
if remove_commentary_check_tag == "1"
|
||||
post.remove_tag("commentary_check")
|
||||
end
|
||||
|
||||
if add_commentary_check_tag == "1"
|
||||
post.add_tag("commentary_check")
|
||||
end
|
||||
|
||||
post.save if post.tag_string_changed?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,25 +25,49 @@
|
||||
|
||||
<% if @post.has_tag?("commentary") %>
|
||||
<div class="input">
|
||||
<label for="artist_commentary_remove_commentary_tag">Remove <em>commentary</em> tag</label>
|
||||
<%= check_box :artist_commentary, :remove_commentary_tag %>
|
||||
<label>
|
||||
<%= check_box :artist_commentary, :remove_commentary_tag %>
|
||||
Remove <em>commentary</em> tag
|
||||
</label>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="input">
|
||||
<label for="artist_commentary_add_commentary_tag">Add <em>commentary</em> tag</label>
|
||||
<%= check_box :artist_commentary, :add_commentary_tag %>
|
||||
<label>
|
||||
<%= check_box :artist_commentary, :add_commentary_tag %>
|
||||
Add <em>commentary</em> tag
|
||||
</label>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @post.has_tag?("commentary_request") %>
|
||||
<div class="input">
|
||||
<label for="artist_commentary_remove_commentary_request_tag">Remove <em>commentary_request</em> tag</label>
|
||||
<%= check_box :artist_commentary, :remove_commentary_request_tag %>
|
||||
<label>
|
||||
<%= check_box :artist_commentary, :remove_commentary_request_tag %>
|
||||
Remove <em>commentary_request</em> tag
|
||||
</label>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="input">
|
||||
<label for="artist_commentary_add_commentary_request_tag">Add <em>commentary_request</em> tag</label>
|
||||
<%= check_box :artist_commentary, :add_commentary_request_tag %>
|
||||
<label>
|
||||
<%= check_box :artist_commentary, :add_commentary_request_tag %>
|
||||
Add <em>commentary_request</em> tag
|
||||
</label>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @post.has_tag?("commentary_check") %>
|
||||
<div class="input">
|
||||
<label>
|
||||
<%= check_box :artist_commentary, :remove_commentary_check_tag %>
|
||||
Remove <em>commentary_check</em> tag
|
||||
</label>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="input">
|
||||
<label>
|
||||
<%= check_box :artist_commentary, :add_commentary_check_tag %>
|
||||
Add <em>commentary_check</em> tag
|
||||
</label>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user