mirror of https://github.com/calzoneman/sync.git
Round 2.
This commit is contained in:
parent
668477d711
commit
d42de93d74
|
@ -202,6 +202,7 @@ function handleAccountChannelPage(req, res) {
|
|||
|
||||
db.channels.listUserChannels(req.user.name, function (err, channels) {
|
||||
sendPug(res, "account-channels", {
|
||||
domain: req.host,
|
||||
channels: channels
|
||||
});
|
||||
});
|
||||
|
|
|
@ -56,10 +56,10 @@ html(lang="en")
|
|||
input(type="hidden", name="action", value="new_channel")
|
||||
.form-group
|
||||
label.control-label(for="channelname") Channel URL
|
||||
span#validation.pull-right
|
||||
span#validation.text-danger.pull-right
|
||||
.input-group
|
||||
span.input-group-addon #{baseUrl}/r/
|
||||
input#channelname.form-control(type="text", name="name")
|
||||
span.input-group-addon #{domain}/r/
|
||||
input#channelname.form-control(type="text", name="name", maxlength="30", onkeyup="checkChannel()")
|
||||
button#register.btn.btn-primary.btn-block(type="submit") Register
|
||||
|
||||
include footer
|
||||
|
@ -69,11 +69,8 @@ html(lang="en")
|
|||
if(/\s/.test(id)){
|
||||
return 'Channel URLs may not contain spaces';
|
||||
}
|
||||
if(id.length > 30){
|
||||
return 'Channel URLs may not be longer than 30 characters';
|
||||
}
|
||||
if(id.length < 1){
|
||||
return 'Channel URLs must be at least one character';
|
||||
if(id === ''){
|
||||
return 'Channel URLs must not be empty';
|
||||
}
|
||||
if(!/^[\w-]{1,30}$/.test(id)){
|
||||
return 'Channel URLs may only consist of a-z, A-Z, 0-9, - and _';
|
||||
|
@ -81,8 +78,8 @@ html(lang="en")
|
|||
return false;
|
||||
}
|
||||
|
||||
$("#channelname").keyup(function () {
|
||||
var box = $(this);
|
||||
function checkChannel(){
|
||||
var box = $("#channelname");
|
||||
var value = box.val();
|
||||
var lastkey = Date.now();
|
||||
box.data("lastkey", lastkey);
|
||||
|
@ -92,12 +89,15 @@ html(lang="en")
|
|||
return;
|
||||
}
|
||||
if(nameIsInvalid(value)){
|
||||
$('#validation').text(nameIsInvalid(value));
|
||||
$('#validation').text(nameIsInvalid(value))
|
||||
.parent().addClass('has-error').removeClass('has-success');
|
||||
$('#register').addClass('disabled');
|
||||
} else {
|
||||
$('#validation').text('');
|
||||
$('#validation').text('')
|
||||
.parent().addClass('has-success').removeClass('has-error');
|
||||
$('#register').removeClass('disabled');
|
||||
}
|
||||
}, 200);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue