diff --git a/app/models/asset.rb b/app/models/asset.rb
index b591ab9c..f8751d57 100644
--- a/app/models/asset.rb
+++ b/app/models/asset.rb
@@ -18,8 +18,16 @@ class Asset
belongs_to :assetable, polymorphic: true
has_and_belongs_to_many :tags, :class_name => "AssetTag"
+ before_save :clean_tags
+
def sorted_tags
tags.order_by(I18n.locale, :asc)
end
+
+ protected
+
+ def clean_tags
+ self.tag_ids.delete('')
+ end
end
diff --git a/app/views/admin/assets/_form.html.erb b/app/views/admin/assets/_form.html.erb
index dddfa9e6..75655604 100644
--- a/app/views/admin/assets/_form.html.erb
+++ b/app/views/admin/assets/_form.html.erb
@@ -26,6 +26,7 @@
<%= content_tag :label, :class => "checkbox inline" do -%>
<%= check_box_tag 'asset[tag_ids][]', tag.id, @asset.tag_ids.include?(tag.id) %>
<%= tag[I18n.locale] %>
+ <%= hidden_field_tag 'asset[tag_ids][]', '' %>
<% end %>
<% end %>
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb
index 8ca11aa1..5500835b 100644
--- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb
@@ -307,7 +307,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
params[:bulletin].delete("deadline(3i)")
params[:bulletin].delete("deadline(4i)")
params[:bulletin].delete("deadline(5i)")
- end
+ end rescue nil
end
# def get_categories_for_index(id = nil)
diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb
index 44ae58ee..e8716b32 100644
--- a/vendor/built_in_modules/announcement/app/models/bulletin.rb
+++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb
@@ -62,7 +62,7 @@ class Bulletin
validates :title, :at_least_one => true
- before_save :check_deadline, :update_avliable_language
+ before_save :check_deadline, :update_avliable_language, :clean_tags
before_save :fetch_dept
after_save :save_bulletin_links
@@ -224,4 +224,8 @@ class Bulletin
self.cache_dept = (User.find(self.create_user_id).cache_dept rescue nil) if self.new_record?
end
+ def clean_tags
+ self.tag_ids.delete('')
+ end
+
end
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb
index aecf1b6d..23e8b82e 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb
@@ -70,8 +70,9 @@
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
- <%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id)%>
+ <%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id) %>
<%= tag[I18n.locale] %>
+ <%= hidden_field_tag 'bulletin[tag_ids][]', '' %>
<% end %>
<% end %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_basic.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_basic.html.erb
index b019aa85..1d4c4f71 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_basic.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_basic.html.erb
@@ -25,13 +25,13 @@
- <%= f.date_select :postdate, {}, :class => 'input-small' %>
+ <%= f.datetime_select :postdate, {}, :class => 'input-small' %>
- <%= f.date_select :deadline, {}, :class => 'input-small' %>
+ <%= f.datetime_select :deadline, {}, :class => 'input-small' %>
@@ -47,7 +47,7 @@
<% end -%>
-
+
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_tags.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_tags.html.erb
index 3887a671..c3bf4b34 100644
--- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_tags.html.erb
+++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_tags.html.erb
@@ -4,9 +4,10 @@
<% @tags.each do |tag| %>
+ <%= hidden_field_tag 'bulletin[tag_ids][]', '' %>
<% end %>
diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb
index b16534cb..d31790d5 100644
--- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb
+++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb
@@ -341,7 +341,7 @@ protected
params[:news_bulletin].delete("deadline(1i)")
params[:news_bulletin].delete("deadline(2i)")
params[:news_bulletin].delete("deadline(3i)")
- end
+ end rescue nil
end
# def get_categories_for_index(id = nil)
diff --git a/vendor/built_in_modules/news/app/models/news_bulletin.rb b/vendor/built_in_modules/news/app/models/news_bulletin.rb
index 3838d930..7dac0869 100644
--- a/vendor/built_in_modules/news/app/models/news_bulletin.rb
+++ b/vendor/built_in_modules/news/app/models/news_bulletin.rb
@@ -62,7 +62,7 @@ class NewsBulletin
validates :title, :at_least_one => true
before_save :check_deadline
- before_save :update_avliable_language
+ before_save :update_avliable_language, :clean_tags
after_save :save_news_bulletin_links
after_save :save_news_bulletin_files
@@ -239,6 +239,7 @@ class NewsBulletin
end
protected
+
def update_avliable_language
VALID_LOCALES.each do |locale|
if (title_translations[locale].blank? rescue true)
@@ -249,11 +250,14 @@ class NewsBulletin
end
end
- def check_deadline
+ def check_deadline
if(!self.deadline.nil? and (self.deadline < self.postdate ))
self.deadline = nil
end
end
-
+
+ def clean_tags
+ self.tag_ids.delete('')
+ end
end
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb
index 71de8413..3460f8d8 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb
@@ -96,6 +96,7 @@
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'news_bulletin[tag_ids][]', tag.id, @news_bulletin.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
+ <%= hidden_field_tag 'news_bulletin[tag_ids][]', '' %>
<% end %>
<% end %>
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_basic.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_basic.html.erb
index df04b3c9..182a4d81 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_basic.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_basic.html.erb
@@ -48,7 +48,7 @@
<% end -%>
-
+
diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_picture.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_picture.html.erb
index b29dd276..663ef647 100644
--- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_picture.html.erb
+++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_picture.html.erb
@@ -4,7 +4,7 @@
-
+ <%= image_tag(@news_bulletin.image.url , :class => "pull-left") if @news_bulletin.image? %>
diff --git a/vendor/built_in_modules/web_resource/app/models/web_link.rb b/vendor/built_in_modules/web_resource/app/models/web_link.rb
index 52b1c6a7..e2eea02b 100644
--- a/vendor/built_in_modules/web_resource/app/models/web_link.rb
+++ b/vendor/built_in_modules/web_resource/app/models/web_link.rb
@@ -22,7 +22,7 @@ class WebLink
belongs_to :web_link_category
- before_save :update_avliable_language
+ before_save :update_avliable_language, :clean_tags
validates :title, :at_least_one => true
@@ -75,5 +75,9 @@ class WebLink
self.url = 'http://' + self.url
end
end
+
+ def clean_tags
+ self.tag_ids.delete('')
+ end
end
\ No newline at end of file
diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb
index ccb7c9bb..97f21a8c 100644
--- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb
+++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb
@@ -39,6 +39,7 @@
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
+ <%= hidden_field_tag 'web_link[tag_ids][]', '' %>
<% end %>
<% end %>