2017-10-04 23:03:19 +02:00
|
|
|
<!-- select whether to publish anonymously or in a channel -->
|
2017-10-24 22:39:06 +02:00
|
|
|
<div class="row row--padded row--short row--wide">
|
2017-10-04 23:03:19 +02:00
|
|
|
<div class="column column--10">
|
|
|
|
<form>
|
2017-10-25 22:08:29 +02:00
|
|
|
<div class="column column--3 column--med-10">
|
2017-11-03 21:37:23 +01:00
|
|
|
<input type="radio" name="anonymous-or-channel" id="anonymous-radio" class="input-radio" value="anonymous" {{#unless user}}checked {{/unless}} onchange="toggleChannel(event.target.value)"/>
|
|
|
|
<label class="label label--pointer" for="anonymous-radio">Anonymous</label>
|
2017-10-25 22:08:29 +02:00
|
|
|
</div><div class="column column--7 column--med-10">
|
2017-11-03 21:37:23 +01:00
|
|
|
<input type="radio" name="anonymous-or-channel" id="channel-radio" class="input-radio" value="in a channel" {{#if user}}checked {{/if}} onchange="toggleChannel(event.target.value)"/>
|
|
|
|
<label class="label label--pointer" for="channel-radio">In a channel</label>
|
2017-10-10 21:10:18 +02:00
|
|
|
</div>
|
2017-10-04 23:03:19 +02:00
|
|
|
</form>
|
2017-09-21 01:04:58 +02:00
|
|
|
</div>
|
2017-09-27 00:12:47 +02:00
|
|
|
</div>
|
2017-09-21 01:04:58 +02:00
|
|
|
|
2017-10-04 23:03:19 +02:00
|
|
|
<div id="channel-select-options" {{#unless user}}hidden="true"{{/unless}}>
|
2017-10-24 22:39:06 +02:00
|
|
|
<div class="row row--padded row--no-top row--no-bottom row--wide">
|
2017-10-24 18:30:47 +02:00
|
|
|
<!--error display-->
|
2017-10-28 00:15:05 +02:00
|
|
|
<p id="input-error-channel-select" class="info-message-placeholder info-message--failure"></p>
|
2017-10-24 18:30:47 +02:00
|
|
|
<!--channel login/create select-->
|
|
|
|
<div class="column column--3">
|
2017-10-04 23:03:19 +02:00
|
|
|
<label class="label" for="channel-name-select">Channel:</label>
|
2017-10-24 18:30:47 +02:00
|
|
|
</div><div class="column column--7">
|
2017-10-25 01:09:04 +02:00
|
|
|
<select type="text" id="channel-name-select" class="select select--arrow" onchange="toggleSelectedChannel(event.target.selectedOptions[0].value)">
|
2017-10-04 23:03:19 +02:00
|
|
|
{{#if user}}
|
2017-10-11 01:00:08 +02:00
|
|
|
<option value="{{user.channelName}}" id="publish-channel-select-channel-option">{{user.channelName}}</option>
|
2017-10-04 23:03:19 +02:00
|
|
|
{{/if}}
|
|
|
|
<option value="login">Existing</option>
|
|
|
|
<option value="new" >New</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- log into an existing channel -->
|
2017-10-24 22:39:06 +02:00
|
|
|
<div id="channel-login-details" class="row row--padded row--short row--wide" {{#if user}}hidden="true"{{/if}}>
|
2017-10-04 23:03:19 +02:00
|
|
|
{{> channelLoginForm}}
|
|
|
|
</div>
|
|
|
|
<!-- create a channel -->
|
2017-10-24 22:39:06 +02:00
|
|
|
<div id="channel-create-details" class="row row--padded row--short row--wide" hidden="true">
|
2017-10-04 23:03:19 +02:00
|
|
|
{{> channelCreationForm}}
|
|
|
|
</div>
|
2017-09-27 00:12:47 +02:00
|
|
|
</div>
|
|
|
|
|
2017-09-21 01:04:58 +02:00
|
|
|
<script type="text/javascript">
|
2017-10-04 23:03:19 +02:00
|
|
|
// show or hide the channel selection tools
|
|
|
|
function toggleChannel (selectedOption) {
|
|
|
|
const channelSelectOptions = document.getElementById('channel-select-options');
|
|
|
|
// show/hide the login and new channel forms
|
|
|
|
if (selectedOption === 'anonymous') {
|
|
|
|
channelSelectOptions.hidden = true;
|
|
|
|
channelSelectOptions.hidden = true;
|
2017-10-04 23:31:06 +02:00
|
|
|
// update url
|
|
|
|
updateUrl(selectedOption);
|
2017-10-04 23:03:19 +02:00
|
|
|
} else if (selectedOption === 'in a channel') {
|
|
|
|
channelSelectOptions.hidden = false;
|
2017-10-04 23:31:06 +02:00
|
|
|
// update url
|
2017-10-07 01:42:19 +02:00
|
|
|
let selectedChannel = document.getElementById('channel-name-select').selectedOptions[0].value
|
|
|
|
toggleSelectedChannel(selectedChannel);
|
2017-10-04 23:03:19 +02:00
|
|
|
} else {
|
|
|
|
console.log('selected option was not recognized');
|
|
|
|
}
|
2017-10-04 23:31:06 +02:00
|
|
|
|
2017-10-04 23:03:19 +02:00
|
|
|
}
|
|
|
|
// show or hide the channel create/login tool
|
2017-10-07 01:42:19 +02:00
|
|
|
function toggleSelectedChannel (selectedChannel) {
|
2017-09-29 00:47:55 +02:00
|
|
|
const createChannelTool = document.getElementById('channel-create-details');
|
|
|
|
const loginToChannelTool = document.getElementById('channel-login-details');
|
2017-10-04 23:03:19 +02:00
|
|
|
// show/hide the login and new channel forms
|
2017-10-04 23:31:06 +02:00
|
|
|
if (selectedChannel === 'new') {
|
2017-09-29 00:47:55 +02:00
|
|
|
createChannelTool.hidden = false;
|
|
|
|
loginToChannelTool.hidden = true;
|
2017-10-04 23:31:06 +02:00
|
|
|
} else if (selectedChannel === 'login') {
|
2017-09-29 00:47:55 +02:00
|
|
|
loginToChannelTool.hidden = false;
|
|
|
|
createChannelTool.hidden = true;
|
2017-09-27 01:05:45 +02:00
|
|
|
} else {
|
2017-09-29 00:47:55 +02:00
|
|
|
// hide the login and new channel forms
|
|
|
|
loginToChannelTool.hidden = true;
|
|
|
|
createChannelTool.hidden = true;
|
2017-11-10 02:46:50 +01:00
|
|
|
validationFunctions.hideError(document.getElementById('input-error-channel-select'));
|
2017-09-27 01:05:45 +02:00
|
|
|
}
|
2017-10-04 23:03:19 +02:00
|
|
|
// update url
|
2017-10-04 23:31:06 +02:00
|
|
|
updateUrl(selectedChannel);
|
2017-09-29 00:47:55 +02:00
|
|
|
}
|
2017-10-06 03:08:44 +02:00
|
|
|
function updateUrl (selectedOption) {
|
|
|
|
const urlChannel = document.getElementById('url-channel');
|
|
|
|
const urlNoChannelPlaceholder = document.getElementById('url-no-channel-placeholder');
|
|
|
|
const urlChannelPlaceholder = document.getElementById('url-channel-placeholder');
|
|
|
|
if (selectedOption === 'new' || selectedOption === 'login' || selectedOption === ''){
|
|
|
|
urlChannel.hidden = true;
|
|
|
|
urlNoChannelPlaceholder.hidden = true;
|
|
|
|
urlChannelPlaceholder.hidden = false;
|
|
|
|
} else if (selectedOption === 'anonymous'){
|
|
|
|
urlChannel.hidden = true;
|
|
|
|
urlNoChannelPlaceholder.hidden = false;
|
|
|
|
urlChannelPlaceholder.hidden = true;
|
|
|
|
} else {
|
|
|
|
urlChannel.hidden = false;
|
2017-10-07 01:42:19 +02:00
|
|
|
// show channel and short id
|
|
|
|
const selectedChannel = getCookie('channel_name');
|
|
|
|
const shortChannelId = getCookie('short_channel_id');
|
|
|
|
urlChannel.innerText = `${selectedChannel}:${shortChannelId}`;
|
2017-10-06 03:08:44 +02:00
|
|
|
urlNoChannelPlaceholder.hidden = true;
|
|
|
|
urlChannelPlaceholder.hidden = true;
|
|
|
|
}
|
|
|
|
}
|
2017-09-21 01:04:58 +02:00
|
|
|
</script>
|