Replace slack invite form on Community, fix surprise code example

The existing slack form on the community page doesn't function...
it's trying to post to the community-slack.chef.io site, but the actual
invite form doesn't actually live there but rather in a SlackIn app.
Also, we have some info we'd like new Slack users to receive, such as
etiquette tips and code-of-conduct information.

This change replaces the form with a link to the community-slack.chef.io
site. Also, I fixed a missing space in the surprise code example on
the main page.

Signed-off-by: Adam Leff <adam@leff.co>
This commit is contained in:
Adam Leff 2017-02-07 13:21:56 -05:00
parent 64ee82195d
commit 78a5241eae
4 changed files with 6 additions and 68 deletions

View file

@ -15,17 +15,13 @@ description: This is where you interact with the InSpec open source community -
h3.clear
| Join us on Slack and get answers fast
P
| Is something unclear or are you just feeling stuck? We're here to help keep you moving. Chat with us on Slack, so we can help you keep moving.
p
| <a href="https://slack.com/">Sign in</a> to slack or request an invite below:
| Is something unclear or are you just feeling stuck? We're here to help keep you moving. Chat with us on Slack so we can help you keep moving.
p
| <a href="https://slack.com/">Sign in</a> to Slack or visit the <a href="http://community-slack.chef.io/">Chef Community Slack</a> site to join!
p
| Once you're logged in, join us in the <strong>#inspec</strong> channel.
<form id="invite">
<input type="email" name="email" placeholder="you@yourdomain.com" class="form-item">
<button class="strict-r" href="https://community-slack.chef.io/"><i class="fa fa-slack"></i>Invite Me!</button>
</form>
.columns.large-6.medium-6.relative.mobile-hide
img.grid.strict-right src="/images/community/blue-web.svg" /
img.ball src="/images/community/glow-ball.png" /

View file

@ -28,7 +28,7 @@ header.blue-gradient.margin-top-offset
| do it
| { should be_inspec }
span.code-attribute
| end
| end
/! Second Content

View file

@ -5,4 +5,3 @@
//= require nav
//= require particles
//= require app
//= require slackform

View file

@ -1,57 +0,0 @@
/*global io,superagent*/
var body = document.body;
var request = superagent;
// elements
var form = body.querySelector('form#invite');
var channel = form.elements['channel'] || {};
var email = form.elements['email'];
var coc = form.elements['coc'];
var button = body.querySelector('button');
// remove loading state
button.className = '';
// capture submit
body.addEventListener('submit', function(ev){
ev.preventDefault();
button.disabled = true;
button.className = '';
button.innerHTML = 'Please Wait';
invite(channel ? channel.value : null, coc && coc.checked ? 1 : 0, email.value, function(err, msg){
if (err) {
button.removeAttribute('disabled');
button.className = 'error';
button.innerHTML = err.message;
} else {
button.className = 'success';
button.innerHTML = msg;
}
});
});
function invite(channel, coc, email, fn){
request
.post(data.path + 'invite')
.send({
coc: coc,
channel: channel,
email: email
})
.end(function(res){
if (res.body.redirectUrl) {
var err = new Error(res.body.msg || 'Server error');
window.setTimeout(function() {
topLevelRedirect(res.body.redirectUrl);
}, 1500);
}
if (res.error) {
var err = new Error(res.body.msg || 'Server error');
return fn(err);
} else {
fn(null, res.body.msg);
}
});
}