Skip to content

Commit b6b983a

Browse files
committed
Don't render delete button unless channel metadata contains trueish destroyable flage.
1 parent 3de5e3a commit b6b983a

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

app/assets/javascripts/backbone/views/channel_tabs.js.coffee

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class Kandan.Views.ChannelTabs extends Backbone.View
3333
error: (model, response)->
3434
_.each(JSON.parse(response.responseText), alert);
3535
})
36-
console.log "create channel: #{channelName}"
3736
return false
3837

3938
deleteChannel: (event)->

app/assets/templates/channel_tabs.jst.eco

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<span class="tab_left"></span>
66
<span class="tab_content">
77
<cite><%= channel.get('name') %></cite>
8-
<% unless channel.get('id') == 1: %>
8+
<% if channel.get('destroyable'): %>
99
<cite class="close_channel" title="close channel">x</cite>
1010
<% end %>
1111
</span>

app/controllers/channels_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def index
1717
})
1818
end
1919

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

2323
respond_to do |format|

0 commit comments

Comments
 (0)