add content wip
This commit is contained in:
parent
4989f8a6c1
commit
d1c1808087
File diff suppressed because one or more lines are too long
@ -1,18 +1,4 @@
|
||||
jQuery(document).ready(function ($) {
|
||||
const getId = function ($el) {
|
||||
return $el.is('tr') ? $el.attr('data-level') : $el.parents('tr:eq(0)').attr('data-level');
|
||||
};
|
||||
|
||||
const updateTable = function () {
|
||||
$('table').each(function () {
|
||||
if ($(this).find('tbody tr.content-item:visible').length === 0) {
|
||||
$(this).find('tr.empty-tr').removeClass('hidden');
|
||||
} else {
|
||||
$(this).find('tr.empty-tr').addClass('hidden');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const inputTypeUpdate = function () {
|
||||
const $el = $('#content-add-type');
|
||||
const value = $el.val();
|
||||
@ -85,8 +71,13 @@ jQuery(document).ready(function ($) {
|
||||
};
|
||||
|
||||
$(document).on('change', '.modal input[type=file]', function() {
|
||||
const file = $(this).val().replace(/\\/g, '/').split('/').slice(-1);
|
||||
const file = $(this).val().replace(/\\/g, '/').split('/').slice(-1)[0];
|
||||
$(this).parents('label:eq(0)').find('input[type=text]').val(file);
|
||||
|
||||
if ($('#content-add-name').val().trim().length === 0) {
|
||||
const fileWithoutExt = file.split('.').slice(0, -1).join('.');
|
||||
$('#content-add-name').val(fileWithoutExt);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('change', '#content-add-type', inputTypeUpdate);
|
||||
@ -97,7 +88,6 @@ jQuery(document).ready(function ($) {
|
||||
$('.dirview input').focus();
|
||||
});
|
||||
|
||||
|
||||
$(document).on('click', '.content-add', function () {
|
||||
showModal('modal-content-add');
|
||||
inputTypeUpdate();
|
||||
@ -147,23 +137,16 @@ jQuery(document).ready(function ($) {
|
||||
$('#content-edit-id').val(content.id);
|
||||
});
|
||||
|
||||
$(document).on('click', '.content-delete', function () {
|
||||
if (confirm(l.js_slideshow_content_delete_confirmation)) {
|
||||
const $tr = $(this).parents('tr:eq(0)');
|
||||
$tr.remove();
|
||||
updateTable();
|
||||
$.ajax({
|
||||
method: 'DELETE',
|
||||
url: '/slideshow/content/delete',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
data: JSON.stringify({id: getId($(this))}),
|
||||
});
|
||||
}
|
||||
$(document).on('submit', '.modal-content-add form', function () {
|
||||
const $modal = $(this).parents('.modal:eq(0)');
|
||||
$modal.find('button[type=submit]').addClass('hidden');
|
||||
$modal.find('.btn-loading').removeClass('hidden');
|
||||
});
|
||||
|
||||
$(document).on('submit', '.modal-content-add form', function () {
|
||||
$(this).find('button[type=submit]').addClass('hidden');
|
||||
$(this).find('.btn-loading').removeClass('hidden');
|
||||
$(document).keyup(function (e) {
|
||||
if (e.key === "Escape") {
|
||||
$('.dirview .new-folder').addClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
main();
|
||||
|
||||
@ -38,6 +38,13 @@ button,
|
||||
&:focus { background: darken($info, 20%); }
|
||||
}
|
||||
|
||||
&.btn-naked {
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
&:hover { box-shadow: 0 $shadowOffset 0 1px #222 inset; background: darken($neutralGrey, 10%); }
|
||||
&:focus { background: darken($neutralGrey, 20%); }
|
||||
}
|
||||
|
||||
&.btn-info-alt {
|
||||
background: $bitterBlue;
|
||||
box-shadow: 0 $shadowOffset 0 0 darken($bitterBlue, 20%);
|
||||
|
||||
@ -70,15 +70,14 @@ ul.explr-dirview {
|
||||
}
|
||||
|
||||
&.highlight-drop {
|
||||
border: 1px dashed rgba($white, .2);
|
||||
background: rgba($white, .1);
|
||||
}
|
||||
|
||||
&.highlight-clicked {
|
||||
border: 1px dashed rgba($seaBlue, .4);
|
||||
background: rgba($seaBlue, .3);
|
||||
}
|
||||
|
||||
&.highlight-clicked {
|
||||
border: 1px dashed rgba($white, .2);
|
||||
background: rgba($white, .1);
|
||||
}
|
||||
|
||||
a {
|
||||
color: #BBB;
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
align-self: stretch;
|
||||
|
||||
form {
|
||||
max-width: 434px;
|
||||
max-width: 434px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ form {
|
||||
font-size: 14px;
|
||||
flex: 0;
|
||||
flex-basis: auto;
|
||||
margin-top: 5px;
|
||||
|
||||
input[type=file] {
|
||||
display: none;
|
||||
@ -137,7 +138,7 @@ form {
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
white-space: nowrap;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 200px;
|
||||
@ -151,4 +152,17 @@ form {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
align-self: stretch;
|
||||
margin: 20px 0 0 0;
|
||||
|
||||
button {
|
||||
margin-left: 25px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +63,8 @@
|
||||
"slideshow_content_form_label_type": "Type",
|
||||
"slideshow_content_form_label_object": "Object",
|
||||
"slideshow_content_form_button_cancel": "Cancel",
|
||||
"slideshow_content_form_button_upload": "Upload file",
|
||||
"slideshow_content_form_button_upload_choosen": "No file choosen yet",
|
||||
"js_slideshow_content_delete_confirmation": "Are you sure?",
|
||||
|
||||
"playlist_page_title": "Playlists",
|
||||
|
||||
@ -63,6 +63,8 @@
|
||||
"slideshow_content_form_label_type": "Tipo",
|
||||
"slideshow_content_form_label_object": "Objeto",
|
||||
"slideshow_content_form_button_cancel": "Cancelar",
|
||||
"slideshow_content_form_button_upload": "Subir un archivo",
|
||||
"slideshow_content_form_button_upload_choosen": "No hay archivos seleccionados",
|
||||
"js_slideshow_content_delete_confirmation": "¿Estás seguro?",
|
||||
|
||||
"playlist_page_title": "Listas de reproducción",
|
||||
|
||||
@ -63,6 +63,8 @@
|
||||
"slideshow_content_form_label_type": "Type",
|
||||
"slideshow_content_form_label_object": "Objet",
|
||||
"slideshow_content_form_button_cancel": "Annuler",
|
||||
"slideshow_content_form_button_upload": "Uploader un fichier",
|
||||
"slideshow_content_form_button_upload_choosen": "Aucun fichier sélectionné",
|
||||
"js_slideshow_content_delete_confirmation": "Êtes-vous sûr ?",
|
||||
|
||||
"playlist_page_title": "Listes de lecture",
|
||||
|
||||
@ -63,6 +63,8 @@
|
||||
"slideshow_content_form_label_type": "Tipo",
|
||||
"slideshow_content_form_label_object": "Oggetto",
|
||||
"slideshow_content_form_button_cancel": "Annulla",
|
||||
"slideshow_content_form_button_upload": "Carica un file",
|
||||
"slideshow_content_form_button_upload_choosen": "Nessun file selezionato",
|
||||
"js_slideshow_content_delete_confirmation": "Sei sicuro?",
|
||||
|
||||
"playlist_page_title": "Playlist",
|
||||
|
||||
@ -16,9 +16,9 @@ class ContentInputType(Enum):
|
||||
|
||||
class ContentType(Enum):
|
||||
|
||||
PICTURE = 'picture'
|
||||
URL = 'url'
|
||||
YOUTUBE = 'youtube'
|
||||
PICTURE = 'picture'
|
||||
VIDEO = 'video'
|
||||
|
||||
@staticmethod
|
||||
|
||||
@ -157,7 +157,7 @@
|
||||
Bibliothèque
|
||||
</a>
|
||||
</li>
|
||||
<li class="actfive">
|
||||
<li class="">
|
||||
<a href="">
|
||||
<span class="icon">
|
||||
<i class="fa fa-clock"></i>
|
||||
@ -165,14 +165,6 @@
|
||||
Planifier
|
||||
</a>
|
||||
</li>
|
||||
<li class="activfe">
|
||||
<a href="">
|
||||
<span class="icon">
|
||||
<i class="fa fa-list-alt"></i>
|
||||
</span>
|
||||
Playlist
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block add_css %}
|
||||
<link rel="stylesheet" href="{{ STATIC_PREFIX }}css/lib/flatpickr.min.css"/>
|
||||
<link rel="stylesheet" href="{{ STATIC_PREFIX }}css/lib/jquery-explr-1.4.css"/>
|
||||
{{ HOOK(H_SLIDESHOW_CONTENT_CSS) }}
|
||||
{% endblock %}
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group tab-select">
|
||||
<div class="widget">
|
||||
<i class="fa fa-get-pocket object-icon-add"></i>
|
||||
@ -36,20 +35,23 @@
|
||||
<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
|
||||
{{ l.slideshow_content_form_button_upload }}
|
||||
</span>
|
||||
<input type="text" value="No file choosen yet" disabled="disabled" />
|
||||
<input type="text" value="{{ l.slideshow_content_form_button_upload_choosen }}" disabled="disabled" />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# <div class="actions">#}
|
||||
{# <button type="button" class="btn-normal modal-close">#}
|
||||
{# {{ l.slideshow_content_form_button_cancel }}#}
|
||||
{# </button>#}
|
||||
{# <button type="submit" class="green">#}
|
||||
{# <i class="fa fa-save icon-left"></i>{{ l.slideshow_content_form_add_submit }}#}
|
||||
{# </button>#}
|
||||
{# </div>#}
|
||||
<div class="actions">
|
||||
<button type="button" class="btn btn-naked modal-close">
|
||||
{{ l.common_close }}
|
||||
</button>
|
||||
<button type="submit" class="btn btn-info">
|
||||
<i class="fa fa-save icon-left"></i>{{ l.common_save }}
|
||||
</button>
|
||||
<button type="button" disabled="disabled" class="btn btn-naked hidden btn-loading">
|
||||
{{ l.common_loading }}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user