Fix for tags
This commit is contained in:
parent
caef586691
commit
684f2c75be
|
@ -15,7 +15,7 @@ module OrbitTag
|
||||||
|
|
||||||
has_many :taggings, as: :taggable, autosave: true, dependent: :destroy
|
has_many :taggings, as: :taggable, autosave: true, dependent: :destroy
|
||||||
accepts_nested_attributes_for :taggings, allow_destroy: true
|
accepts_nested_attributes_for :taggings, allow_destroy: true
|
||||||
after_save :remove_taggings, unless: Proc.new{self.tags_to_destroy.blank?}
|
# after_save :remove_taggings, unless: Proc.new{self.tags_to_destroy.blank?}
|
||||||
end
|
end
|
||||||
send :include, InstanceMethods
|
send :include, InstanceMethods
|
||||||
end
|
end
|
||||||
|
|
|
@ -122,6 +122,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
def update
|
def update
|
||||||
|
|
||||||
@bulletin = Bulletin.find(params[:id])
|
@bulletin = Bulletin.find(params[:id])
|
||||||
|
|
||||||
# @bulletin.image.clear if params[:bulletin][:image_del] == '1'
|
# @bulletin.image.clear if params[:bulletin][:image_del] == '1'
|
||||||
# if params[:bulletin][:image_del] == '1'
|
# if params[:bulletin][:image_del] == '1'
|
||||||
# @bulletin.remove_image!
|
# @bulletin.remove_image!
|
||||||
|
@ -132,8 +133,12 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
delete_out_invalid_date_from_params
|
delete_out_invalid_date_from_params
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @bulletin.update_attributes(params[:bulletin])
|
if @bulletin.update_attributes(params[:bulletin])
|
||||||
@bulletin.tagged_ids = @bulletin.tag_ids if params[:bulletin][:tag_ids].nil?
|
tag = []
|
||||||
@bulletin.save
|
length = (@bulletin.tag_ids.length / 2)
|
||||||
|
@bulletin.tag_ids.each do |t|
|
||||||
|
tag << t.to_s
|
||||||
|
end
|
||||||
|
@bulletin.set(:tagged_ids, tag.take(length))
|
||||||
# if(is_manager? || is_admin?)
|
# if(is_manager? || is_admin?)
|
||||||
# @bulletin.is_checked = true
|
# @bulletin.is_checked = true
|
||||||
# @bulletin.is_rejected = false
|
# @bulletin.is_rejected = false
|
||||||
|
|
Reference in New Issue