Disable channel settings on PWA
This commit is contained in:
parent
6ffdabd93b
commit
bac40290d6
2 changed files with 22 additions and 2 deletions
|
@ -25,9 +25,25 @@ $(function() {
|
|||
}
|
||||
});
|
||||
|
||||
$('.ui.dropdown').dropdown();
|
||||
$('.ui.dropdown.channel').dropdown();
|
||||
$('.ui.dropdown.locale').dropdown({
|
||||
sortSelect : 'natural',
|
||||
});
|
||||
$('.ui.progress').progress();
|
||||
|
||||
var isPWA = window.matchMedia('(display-mode: standalone)').matches;
|
||||
|
||||
if (isPWA) {
|
||||
$('.ui.dropdown.channel').dropdown('set selected', 'stable');
|
||||
$('.ui.dropdown.channel').addClass('disabled');
|
||||
$('.ui.dropdown.channel').find('select').removeAttr('name');
|
||||
|
||||
if ('undefined' !== typeof CHANNELS) {
|
||||
CHANNELS.forEach(channel => {
|
||||
if (channel.host === location.host) {
|
||||
$('.ui.dropdown.channel').dropdown('set selected', channel.branch);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -260,10 +260,14 @@ $page->navigation();
|
|||
</div>
|
||||
|
||||
<?php if (defined('CHANNELS') && is_array(CHANNELS)) { ?>
|
||||
<script type="text/javascript">
|
||||
var CHANNELS = <?= json_encode(CHANNELS) ?>;
|
||||
</script>
|
||||
|
||||
<div class="field">
|
||||
<label><?= __('Channel') ?></label>
|
||||
|
||||
<select class="ui search clearable dropdown" name="user-channel">
|
||||
<select class="ui search clearable dropdown channel" name="user-channel">
|
||||
<option value=""><?= __('Select channel') ?></option>
|
||||
|
||||
<?php foreach (CHANNELS as $channel) { ?>
|
||||
|
|
Loading…
Reference in a new issue