add content wip

This commit is contained in:
jr-k 2024-07-10 20:20:26 +02:00
parent 359bb002dc
commit 4989f8a6c1
4 changed files with 64 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@ -21,15 +21,19 @@ jQuery(document).ready(function ($) {
return $(el).val() === value;
}).data('input');
$('.content-add-object-input')
.addClass('hidden')
.prop('disabled', true)
.filter('#content-add-object-input-' + inputType)
.removeClass('hidden')
.prop('disabled', false)
;
$('.content-add-object-input').each(function() {
const active = $(this).attr('id') === 'content-add-object-input-' + inputType;
if ($(this).is('input[type=file]')) {
$(this).prop('disabled', !active);
$(this).parents('label:eq(0)').toggleClass('hidden', !active);
} else {
$(this).prop('disabled', !active).toggleClass('hidden', !active);
}
});
$('.object-label-add').html($selectedOption.get(0).attributes['data-object-label'].value);
$('.object-icon-add').attr('class', 'object-icon-add fa ' + $selectedOption.get(0).attributes['data-icon'].value)
};
const initExplr = function () {
@ -80,6 +84,11 @@ jQuery(document).ready(function ($) {
initDrags();
};
$(document).on('change', '.modal input[type=file]', function() {
const file = $(this).val().replace(/\\/g, '/').split('/').slice(-1);
$(this).parents('label:eq(0)').find('input[type=text]').val(file);
});
$(document).on('change', '#content-add-type', inputTypeUpdate);
$(document).on('click', '.folder-add', function () {

View File

@ -11,6 +11,7 @@
}
}
form {
display: flex;
flex-direction: column;
@ -38,6 +39,28 @@ form {
align-items: center;
align-self: stretch;
color: #666666;
&.btn-upload {
color: white;
font-size: 14px;
flex: 0;
flex-basis: auto;
input[type=file] {
display: none;
}
input[type=text] {
margin-bottom: 2px;
padding-left: 0;
margin-left: 10px;
}
i {
margin-left: 3px;
margin-right: 10px;
}
}
}
.widget {
@ -58,7 +81,18 @@ form {
box-shadow: 0 2px 1px #444, 0 4px 2px #333 inset;
color: #DDD;
font-size: 14px;
&[disabled] {
color: #555;
background: none;
box-shadow: none;
border: none;
border-bottom: 1px solid #333;
border-radius: 0;
}
}
}
@ -70,6 +104,7 @@ form {
height: 48px;
padding: 48px 0 0 0;
flex: 0;
flex-basis: auto;
.widget {
height: 49px;
@ -83,6 +118,7 @@ form {
left: 0;
background: rgba($seaBlue, .05);
border-bottom: 2px solid $seaBlue;
padding-right: 20px;
select {
border: none;
@ -108,7 +144,7 @@ form {
}
i {
margin-left: 10px;
margin-left: 25px;
margin-right: 10px;
color: $seaBlue;
}

View File

@ -15,6 +15,7 @@
<div class="form-group tab-select">
<div class="widget">
<i class="fa fa-get-pocket object-icon-add"></i>
<select name="type" id="content-add-type">
{% for type in enum_content_type %}
{% set input_type = enum_content_type.get_input(type) %}
@ -23,7 +24,6 @@
</option>
{% endfor %}
</select>
<i class="fa fa-get-pocket object-icon-add"></i>
</div>
</div>
@ -31,7 +31,15 @@
<label for="" class="object-label-add">{{ l.slideshow_content_form_label_object }}</label>
<div class="widget">
<input type="text" name="object" id="content-add-object-input-text" class="content-add-object-input"/>
<input type="file" name="object" id="content-add-object-input-upload" class="content-add-object-input hidden" disabled="disabled"/>
<label for="content-add-object-input-upload" class="btn-upload hidden">
<input type="file" name="object" id="content-add-object-input-upload" class="content-add-object-input" disabled="disabled"/>
<span class="btn btn-info">
<i class="fa fa-file-import"></i>
Upload file
</span>
<input type="text" value="No file choosen yet" disabled="disabled" />
</label>
</div>
</div>