2017-09-27 00:12:47 +02:00
|
|
|
<div class="row">
|
|
|
|
<div class="column column--3">
|
|
|
|
<label class="label" for="channel-name-select">Channel:</label>
|
|
|
|
</div>
|
2017-09-27 01:05:45 +02:00
|
|
|
<div class="column column--9">
|
2017-09-21 01:04:58 +02:00
|
|
|
<div id="input-error-channel-select" class="info-message info-message--failure"></div>
|
2017-09-27 01:05:45 +02:00
|
|
|
<select type="text" id="channel-name-select" class="select select--primary" value="channel" onchange="toggleChannel(event)">
|
2017-09-27 00:12:47 +02:00
|
|
|
<optgroup>
|
2017-09-21 01:04:58 +02:00
|
|
|
{{#if user}}
|
2017-09-26 07:49:27 +02:00
|
|
|
<option value="@{{user.userName}}" >@{{user.userName}}</option>
|
2017-09-21 01:04:58 +02:00
|
|
|
{{/if}}
|
2017-09-22 01:03:45 +02:00
|
|
|
<option value="none" >None</option>
|
2017-09-27 00:12:47 +02:00
|
|
|
</optgroup>
|
|
|
|
<optgroup>
|
2017-09-21 01:04:58 +02:00
|
|
|
<option value="login">Login</option>
|
|
|
|
<option value="new" >New</option>
|
2017-09-27 00:12:47 +02:00
|
|
|
</optgroup>
|
2017-09-21 01:04:58 +02:00
|
|
|
</select>
|
|
|
|
</div>
|
2017-09-27 00:12:47 +02:00
|
|
|
</div>
|
2017-09-21 01:04:58 +02:00
|
|
|
|
2017-09-27 00:12:47 +02:00
|
|
|
<div id="channel-login-details" class="row" hidden="true">
|
|
|
|
{{> channelLoginForm}}
|
2017-09-21 01:04:58 +02:00
|
|
|
</div>
|
|
|
|
|
2017-09-27 00:12:47 +02:00
|
|
|
<div id="channel-create-details" class="row" hidden="true">
|
|
|
|
{{> channelCreationForm}}
|
|
|
|
</div>
|
|
|
|
|
2017-09-21 01:04:58 +02:00
|
|
|
<script src="/assets/js/authFunctions.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
function toggleChannel (event) {
|
|
|
|
const createChannelTool = document.getElementById('channel-create-details');
|
|
|
|
const loginToChannelTool = document.getElementById('channel-login-details');
|
|
|
|
const selectedOption = event.target.selectedOptions[0].value;
|
2017-09-27 01:05:45 +02:00
|
|
|
const urlChannel = document.getElementById('url-channel');
|
2017-09-21 01:04:58 +02:00
|
|
|
if (selectedOption === 'new') {
|
2017-09-27 01:05:45 +02:00
|
|
|
// show/hide the login and new channel forms
|
2017-09-21 01:04:58 +02:00
|
|
|
createChannelTool.hidden = false;
|
|
|
|
loginToChannelTool.hidden = true;
|
2017-09-27 01:05:45 +02:00
|
|
|
// update URL
|
|
|
|
urlChannel.innerText = '';
|
2017-09-21 01:04:58 +02:00
|
|
|
} else if (selectedOption === 'login') {
|
2017-09-27 01:05:45 +02:00
|
|
|
// show/hide the login and new channel forms
|
2017-09-21 01:04:58 +02:00
|
|
|
loginToChannelTool.hidden = false;
|
|
|
|
createChannelTool.hidden = true;
|
2017-09-27 01:05:45 +02:00
|
|
|
// update URL
|
|
|
|
urlChannel.innerText = '';
|
2017-09-21 01:04:58 +02:00
|
|
|
} else {
|
2017-09-27 01:05:45 +02:00
|
|
|
// hide the login and new channel forms
|
2017-09-21 01:04:58 +02:00
|
|
|
loginToChannelTool.hidden = true;
|
|
|
|
createChannelTool.hidden = true;
|
|
|
|
hideError(document.getElementById('input-error-channel-select'));
|
2017-09-27 01:05:45 +02:00
|
|
|
// update URL
|
|
|
|
if (selectedOption === 'none'){
|
|
|
|
urlChannel.innerText = '';
|
|
|
|
} else {
|
|
|
|
urlChannel.innerText = `${selectedOption}/`;
|
|
|
|
}
|
|
|
|
|
2017-09-21 01:04:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|