Skip to content

Commit

Permalink
Add link for setting up favorite channels
Browse files Browse the repository at this point in the history
  • Loading branch information
smilledge committed Dec 21, 2014
1 parent b13a43d commit e8298e2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
favoriteChannelTemplate: _.template($('#favoriteChannelsTemplate').html()),

events: {
'click .show-options': 'handleShowOptions',
'submit #post-form': 'handlePostFormSubmit',
'click .select-channel': 'handleSelectChannel',
'focus .input-channel': 'handleChannelFocus'
Expand Down Expand Up @@ -56,6 +57,14 @@
this.$('.favorite-channels').hide();
},

handleShowOptions: function(e) {
e.preventDefault();
e.stopPropagation();
chrome.tabs.create({
url: chrome.extension.getURL('options.html')
});
},

handlePostFormSubmit: function(e) {
e.preventDefault();
if (this.isSubmitting) {
Expand Down
1 change: 1 addition & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"default_popup": "popup.html"
},
"permissions": [
"tabs",
"http://*.slack.com/*",
"https://*.slack.com/*"
]
Expand Down
4 changes: 4 additions & 0 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@
</div>

<script id="favoriteChannelsTemplate" type="text/template">
<% if (channels.size() === 0) { %>
<li><a href="#" class="show-options">Setup your favorite channels</a></li>
<% } else { %>
<% channels.each(function(channel, i) { %>
<li><a href="#" class="select-channel" data-channel-name="<%= channel.get('name') %>">#<%= channel.get('name') %></a></li>
<% }) %>
<% } %>
</script>

<script src="js/vendor/jquery.js"></script>
Expand Down

0 comments on commit e8298e2

Please sign in to comment.