Skip to content

Commit

Permalink
Open options page if Slackbot URL has not been setup
Browse files Browse the repository at this point in the history
  • Loading branch information
smilledge committed Dec 21, 2014
1 parent e8298e2 commit 34ade62
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ a, a:hover, a:active, a:visited {
color: #999;
}

.required {
color: #af1a11;
}

.button {
display: block;
width: 100%;
Expand Down
7 changes: 6 additions & 1 deletion js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
post: function(data) {
this.isSubmitting = false;

// TODO: validate channel, message and the web hook url
if (!this.options.get('slackbotUrl')) {
chrome.tabs.create({
url: chrome.extension.getURL('options.html')
});
return;
}

$.ajax({
url: this.options.get('slackbotUrl') + '&channel=' + encodeURIComponent('#' + data.channel),
Expand Down
2 changes: 1 addition & 1 deletion options.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div id="options">
<h1>Slackbot Says Options</h1>

<h2>Slackbot Url</h2>
<h2>Slackbot Url<span class="required">*</span></h2>

<form action="#" id="options-form" role="form"></form>

Expand Down

0 comments on commit 34ade62

Please sign in to comment.