add options for commentary_check #2623
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
class ArtistCommentary < ActiveRecord::Base
|
class ArtistCommentary < ActiveRecord::Base
|
||||||
attr_accessor :remove_commentary_tag, :remove_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
|
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
|
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
|
validates_uniqueness_of :post_id
|
||||||
belongs_to :post
|
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
|
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")
|
post.add_tag("commentary_request")
|
||||||
end
|
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?
|
post.save if post.tag_string_changed?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,25 +25,49 @@
|
|||||||
|
|
||||||
<% if @post.has_tag?("commentary") %>
|
<% if @post.has_tag?("commentary") %>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<label for="artist_commentary_remove_commentary_tag">Remove <em>commentary</em> tag</label>
|
<label>
|
||||||
<%= check_box :artist_commentary, :remove_commentary_tag %>
|
<%= check_box :artist_commentary, :remove_commentary_tag %>
|
||||||
|
Remove <em>commentary</em> tag
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<label for="artist_commentary_add_commentary_tag">Add <em>commentary</em> tag</label>
|
<label>
|
||||||
<%= check_box :artist_commentary, :add_commentary_tag %>
|
<%= check_box :artist_commentary, :add_commentary_tag %>
|
||||||
|
Add <em>commentary</em> tag
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @post.has_tag?("commentary_request") %>
|
<% if @post.has_tag?("commentary_request") %>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<label for="artist_commentary_remove_commentary_request_tag">Remove <em>commentary_request</em> tag</label>
|
<label>
|
||||||
<%= check_box :artist_commentary, :remove_commentary_request_tag %>
|
<%= check_box :artist_commentary, :remove_commentary_request_tag %>
|
||||||
|
Remove <em>commentary_request</em> tag
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<label for="artist_commentary_add_commentary_request_tag">Add <em>commentary_request</em> tag</label>
|
<label>
|
||||||
<%= check_box :artist_commentary, :add_commentary_request_tag %>
|
<%= 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>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user