announcement update with emtpy tag

This commit is contained in:
Harry Bomrah 2014-03-07 11:09:25 +08:00
parent 1dfa7e91ee
commit 758ceaf5e3
2 changed files with 1 additions and 2 deletions

View File

@ -122,7 +122,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
def update def update
@bulletin = Bulletin.find(params[:id]) @bulletin = Bulletin.find(params[:id])
params[:bulletin][:tag_ids] = (params[:bulletin][:tag_ids] ? params[:bulletin][:tag_ids] : [])
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])

View File

@ -100,7 +100,6 @@
<% @tags.each do |tag| %> <% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @bulletin.tag_ids.include?(tag.id) %>"> <label class="checkbox inline btn <%= 'active' if @bulletin.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id) %> <%= tag.name %> <%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id) %> <%= tag.name %>
<%= hidden_field_tag 'bulletin[tag_ids][]', '' %>
</label> </label>
<% end %> <% end %>
</div> </div>