improved selection on upload

This commit is contained in:
Codenift 2020-01-26 21:48:22 -05:00
parent dbb95b7915
commit 339fddf652
2 changed files with 12 additions and 4 deletions

View File

@ -39,6 +39,7 @@
if ($showTracktypesDropdown != false) { ?>
<select id="select_type" class="form-control" <?php echo $hasTracktypes; ?>>
<?php
echo "<option value=''>Select Track Type</option>";
foreach ($tracktypes as $key => $tt) {
$selected = "";
if ($ttsaved == $tt['code']) {
@ -56,15 +57,16 @@
<?php
if ($showTracktypesDropdown) {
$ttTitle = "";
foreach ($tracktypes as $key => $tt) {
if ($ttsaved == $key) {
if ($ttsaved == $tt['code']) {
$ttTitle = $tt['type_name'];
}
}
}
?>
<H2><?php echo _("Upload")?> <span id="upload_type" <?php echo $showTracktypesDropdown ? 'style="color:#ff611f"' : "" ?>>
<?php echo $showTracktypesDropdown ? $ttTitle : "Tracks"; ?></span></H2>
<H2><?php echo _("Upload")?> <span id="upload_type" <?php echo ($showTracktypesDropdown && $ttTitle!="") ? 'style="color:#ff611f"' : "" ?>>
<?php echo ($showTracktypesDropdown && $ttTitle!="") ? $ttTitle : "Tracks"; ?></span></H2>
<form action="/rest/media" method="post" id="add-media-dropzone" class="dropzone dz-clickable">
<?php echo $this->form->getElement('csrf') ?>
<div class="dz-message">

View File

@ -207,7 +207,13 @@ $(document).ready(function () {
$("#select_type").on("change",function(){
var ttValue = $("#select_type").val();
var ttText = $('#select_type option[value="'+ttValue+'"]').text();
$("#upload_type").text(" " + ttText);
if (ttValue != ""){
$("#upload_type").text(" " + ttText);
$("#upload_type").css("color", "#ff611f");
} else {
$("#upload_type").text(" Tracks");
$("#upload_type").css("color", "#ffffff");
}
Cookies.set('tt_upload', ttValue);
});
});