5 .col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3
6 .alert.alert-danger.messagebox.center
7 strong Authorization Required
8 p You must be <a href="/login">logged in</a> to view this page.
13 .alert.alert-danger.center.messagebox
14 strong Channel Deletion Failed
16 if channels.length == 0
18 strong You haven't registered any channels
20 table.table.table-bordered
28 form.form-inline.pull-right(action="/account/channels", method="post", onsubmit="return confirm('Are you sure you want to delete " +c.name+ "? This cannot be undone');")
29 input(type="hidden", name="_csrf", value=csrfToken)
30 input(type="hidden", name="action", value="delete_channel")
31 input(type="hidden", name="name", value=c.name)
32 button.btn.btn-xs.btn-danger(type="submit") Delete
33 span.glyphicon.glyphicon-trash
34 a(href=`/${channelPath}/${c.name}`, style="margin-left: 5px")= c.name
36 h3 Register a new channel
38 .alert.alert-danger.messagebox.center
39 strong Channel Registration Failed
41 form(action="/account/channels", method="post")
42 input(type="hidden", name="_csrf", value=csrfToken)
43 input(type="hidden", name="action", value="new_channel")
45 label.control-label(for="channelname") Channel URL
47 span.input-group-addon #{baseUrl}/#{channelPath}/
48 input#channelname.form-control(type="text", name="name", maxlength="30", onkeyup="checkChannel()")
49 p#validate_channel.text-danger.pull-right
50 button#register.btn.btn-primary.btn-block(type="submit") Register
53 script(type='text/javascript').
54 function checkChannel(){
55 function nameIsInvalid(id){
57 return 'Channel URL may not contain spaces';
60 return 'Channel URL must not be empty';
62 if(!/^[\w-]{1,30}$/.test(id)){
63 return 'Channel URL may only consist of a-z, A-Z, 0-9, - and _';
68 var box = $("#channelname");
69 var value = box.val();
70 var lastkey = Date.now();
71 box.data("lastkey", lastkey);
73 setTimeout(function () {
74 if (box.data("lastkey") !== lastkey || box.val() !== value) {
77 if(nameIsInvalid(value)){
78 $('#validate_channel').text(nameIsInvalid(value))
79 .parent().addClass('has-error').removeClass('has-success');
80 $('#register').addClass('disabled');
82 $('#validate_channel').text('')
83 .parent().addClass('has-success').removeClass('has-error');
84 $('#register').removeClass('disabled');