spee.ch/views/partials/topBar.handlebars

35 lines
1.4 KiB
Handlebars
Raw Normal View History

2017-09-29 21:40:02 +02:00
<div class="row-wide nav-bar">
<div class="nav-bar-title-section">
2017-09-29 23:11:00 +02:00
<a href="/"><span class="nav-bar-title">spee&lt;h</span></a><span class="nav-bar-title nav-bar-title--superscript">(beta)</span>
2017-09-29 21:40:02 +02:00
<div class="nav-bar-link-section">
2017-09-29 23:11:00 +02:00
<a class="nav-bar-link" href="/popular">Popular</a>
<a class="nav-bar-link" href="/about">About</a>
<a class="nav-bar-link" href="https://github.com/lbryio/spee.ch" target="_blank">Source</a>
2017-09-29 21:40:02 +02:00
{{#if user}}
<select type="text" class="select nav-bar-link" onchange="toggleLogin(event)">
<option value="none">@{{user.userName}}</option>
2017-09-29 23:11:00 +02:00
<option value="view">View</option>
<option value="logout">Logout</option>
2017-09-29 21:40:02 +02:00
</select>
{{else}}
2017-09-29 23:11:00 +02:00
<a class="nav-bar-link" href="/login">Login</a>
2017-09-29 21:40:02 +02:00
{{/if}}
</div>
2017-09-29 20:59:53 +02:00
</div>
2017-09-29 21:40:02 +02:00
2017-09-27 00:12:47 +02:00
</div>
<script type="text/javascript">
function toggleLogin (event) {
console.log(event);
const selectedOption = event.target.selectedOptions[0].value;
if (selectedOption === 'logout') {
console.log('login');
window.location.href = '/logout';
} else if (selectedOption === 'view') {
console.log('view channel');
window.location.href = '/{{user.channelName}}:{{user.channelClaimId}}';
}
}
</script>