small fix for deleted tags

This commit is contained in:
Harry Bomrah 2015-09-16 14:03:33 +08:00
parent e21bbac441
commit dc4496fedd
1 changed files with 22 additions and 11 deletions

View File

@ -14,8 +14,10 @@
<div class="tags"> <div class="tags">
<div id="tags-list"> <div id="tags-list">
<ul class="tags-groups checkbox-card module-tags"> <ul class="tags-groups checkbox-card module-tags">
<% tags_to_remove = [] %>
<% feed.tag_ids.each do |t| %> <% feed.tag_ids.each do |t| %>
<% tag = Tag.find(t) %> <% tag = Tag.find(t) rescue nil %>
<% if !tag.nil? %>
<li class="filter-item module"> <li class="filter-item module">
<a href="#" onclick="return false;"> <a href="#" onclick="return false;">
<% @site_in_use_locales.each_with_index do |locale,index| %> <% @site_in_use_locales.each_with_index do |locale,index| %>
@ -26,7 +28,16 @@
<% end %> <% end %>
</a> </a>
</li> </li>
<% else %>
<% tags_to_remove << t %>
<% end %> <% end %>
<% end %>
<% if !tags_to_remove.blank?
tags_to_remove.each do |t|
feed.tag_ids.delete(t)
end
feed.save
end %>
</ul> </ul>
</div> </div>
</div> </div>