Skip to content

Commit

Permalink
Don't render delete button unless channel metadata contains trueish d…
Browse files Browse the repository at this point in the history
…estroyable flage.
  • Loading branch information
mjtko committed Mar 15, 2013
1 parent 3de5e3a commit b6b983a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
Expand Up @@ -33,7 +33,6 @@ class Kandan.Views.ChannelTabs extends Backbone.View
error: (model, response)->
_.each(JSON.parse(response.responseText), alert);
})
console.log "create channel: #{channelName}"
return false

deleteChannel: (event)->
Expand Down
2 changes: 1 addition & 1 deletion app/assets/templates/channel_tabs.jst.eco
Expand Up @@ -5,7 +5,7 @@
<span class="tab_left"></span>
<span class="tab_content">
<cite><%= channel.get('name') %></cite>
<% unless channel.get('id') == 1: %>
<% if channel.get('destroyable'): %>
<cite class="close_channel" title="close channel">x</cite>
<% end %>
</span>
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/channels_controller.rb
Expand Up @@ -17,7 +17,7 @@ def index
})
end

nested_channel_data.push channel.attributes.merge({:activities => activities.reverse, :more_activities => more_activities})
nested_channel_data.push channel.attributes.merge({:activities => activities.reverse, :more_activities => more_activities, destroyable: can?(:destroy, channel)})
end

respond_to do |format|
Expand Down

0 comments on commit b6b983a

Please sign in to comment.