better explr
This commit is contained in:
parent
cc16d59e15
commit
34cc7c3b8d
@ -112,13 +112,14 @@ jQuery(function ($) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('.draggable').each(function () {
|
$('.draggable').each(function () {
|
||||||
$(this).draggable({
|
$(this).multiDraggable({
|
||||||
revert: "invalid",
|
revert: "invalid",
|
||||||
revertDuration: 10,
|
revertDuration: 10,
|
||||||
start: function(event, ui) {
|
group: 'li.highlight-clicked',
|
||||||
|
startNative: function (event, ui) {
|
||||||
$('body').addClass('dragging');
|
$('body').addClass('dragging');
|
||||||
},
|
},
|
||||||
stop: function() {
|
stopNative: function () {
|
||||||
$('body').removeClass('dragging');
|
$('body').removeClass('dragging');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -136,19 +137,34 @@ jQuery(function ($) {
|
|||||||
drop: function (event, ui) {
|
drop: function (event, ui) {
|
||||||
$(this).removeClass("highlight-drop");
|
$(this).removeClass("highlight-drop");
|
||||||
const $form = $('#folder-move-form');
|
const $form = $('#folder-move-form');
|
||||||
const $moved = ui.draggable;
|
const $moved = $('.ui-draggable-dragging');
|
||||||
const $target = $(this);
|
const $target = $(this);
|
||||||
$form.find('[name=is_folder]').val($moved.attr('data-folder'))
|
const folder_ids = [], entity_ids = [];
|
||||||
$form.find('[name=entity_id]').val($moved.attr('data-id'))
|
|
||||||
$form.find('[name=new_folder_id]').val($target.attr('data-id'))
|
$moved.each(function () {
|
||||||
ui.draggable.position({
|
const $item = $(this);
|
||||||
|
const is_folder = $item.attr('data-folder') === '1';
|
||||||
|
const id = $item.attr('data-id');
|
||||||
|
|
||||||
|
if (is_folder) {
|
||||||
|
folder_ids.push(id);
|
||||||
|
} else {
|
||||||
|
entity_ids.push(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$item.position({
|
||||||
my: "center",
|
my: "center",
|
||||||
at: "center",
|
at: "center",
|
||||||
of: $(this),
|
of: $target,
|
||||||
using: function (pos) {
|
using: function (pos) {
|
||||||
$(this).animate(pos, 50);
|
$item.animate(pos, 50);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$form.find('[name=entity_ids]').val(entity_ids.join(','))
|
||||||
|
$form.find('[name=folder_ids]').val(folder_ids.join(','))
|
||||||
|
$form.find('[name=new_folder_id]').val($target.attr('data-id'))
|
||||||
$form.submit();
|
$form.submit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -189,10 +189,23 @@ class ContentController(ObController):
|
|||||||
|
|
||||||
def slideshow_content_folder_move(self):
|
def slideshow_content_folder_move(self):
|
||||||
working_folder_path, working_folder = self.get_working_folder()
|
working_folder_path, working_folder = self.get_working_folder()
|
||||||
|
entity_ids = request.form['entity_ids'].split(',')
|
||||||
|
folder_ids = request.form['folder_ids'].split(',')
|
||||||
|
|
||||||
|
for id in entity_ids:
|
||||||
self._model_store.folder().move_to_folder(
|
self._model_store.folder().move_to_folder(
|
||||||
entity_id=request.form['entity_id'],
|
entity_id=id,
|
||||||
folder_id=request.form['new_folder_id'],
|
folder_id=request.form['new_folder_id'],
|
||||||
entity_is_folder=True if 'is_folder' in request.form and request.form['is_folder'] == '1' else False,
|
entity_is_folder=False,
|
||||||
|
entity=FolderEntity.CONTENT
|
||||||
|
)
|
||||||
|
|
||||||
|
for id in folder_ids:
|
||||||
|
self._model_store.folder().move_to_folder(
|
||||||
|
entity_id=id,
|
||||||
|
folder_id=request.form['new_folder_id'],
|
||||||
|
entity_is_folder=True,
|
||||||
|
entity=FolderEntity.CONTENT
|
||||||
)
|
)
|
||||||
|
|
||||||
return redirect(url_for('slideshow_content_list', path=working_folder_path))
|
return redirect(url_for('slideshow_content_list', path=working_folder_path))
|
||||||
|
|||||||
@ -177,11 +177,23 @@ class FleetNodePlayerController(ObController):
|
|||||||
|
|
||||||
def fleet_node_player_folder_move(self):
|
def fleet_node_player_folder_move(self):
|
||||||
working_folder_path, working_folder = self.get_working_folder()
|
working_folder_path, working_folder = self.get_working_folder()
|
||||||
|
entity_ids = request.form['entity_ids'].split(',')
|
||||||
|
folder_ids = request.form['folder_ids'].split(',')
|
||||||
|
|
||||||
|
for id in entity_ids:
|
||||||
self._model_store.folder().move_to_folder(
|
self._model_store.folder().move_to_folder(
|
||||||
entity_id=request.form['entity_id'],
|
entity_id=id,
|
||||||
folder_id=request.form['new_folder_id'],
|
folder_id=request.form['new_folder_id'],
|
||||||
entity_is_folder=True if 'is_folder' in request.form and request.form['is_folder'] == '1' else False,
|
entity_is_folder=False,
|
||||||
|
entity=FolderEntity.NODE_PLAYER
|
||||||
|
)
|
||||||
|
|
||||||
|
for id in folder_ids:
|
||||||
|
self._model_store.folder().move_to_folder(
|
||||||
|
entity_id=id,
|
||||||
|
folder_id=request.form['new_folder_id'],
|
||||||
|
entity_is_folder=True,
|
||||||
|
entity=FolderEntity.NODE_PLAYER
|
||||||
)
|
)
|
||||||
|
|
||||||
return redirect(url_for('fleet_node_player_list', path=working_folder_path))
|
return redirect(url_for('fleet_node_player_list', path=working_folder_path))
|
||||||
|
|||||||
@ -143,10 +143,10 @@ class FolderManager(ModelManager):
|
|||||||
self._db.update_by_id(self.TABLE_NAME, id, self.pre_update({"name": name}))
|
self._db.update_by_id(self.TABLE_NAME, id, self.pre_update({"name": name}))
|
||||||
self.post_update(id)
|
self.post_update(id)
|
||||||
|
|
||||||
def move_to_folder(self, entity_id: int, folder_id: int, entity_is_folder=False) -> None:
|
def move_to_folder(self, entity_id: int, entity: FolderEntity, folder_id: Optional[int] = None, entity_is_folder=False) -> None:
|
||||||
folder = self.get(folder_id)
|
folder = self.get(folder_id) if folder_id else None
|
||||||
|
|
||||||
if not folder and not entity_is_folder:
|
if folder and folder.entity != entity:
|
||||||
return
|
return
|
||||||
|
|
||||||
if entity_is_folder:
|
if entity_is_folder:
|
||||||
@ -157,15 +157,15 @@ class FolderManager(ModelManager):
|
|||||||
|
|
||||||
table = None
|
table = None
|
||||||
|
|
||||||
if folder.entity == FolderEntity.CONTENT:
|
if entity == FolderEntity.CONTENT:
|
||||||
table = ContentManager.TABLE_NAME
|
table = ContentManager.TABLE_NAME
|
||||||
elif folder.entity == FolderEntity.NODE_PLAYER:
|
elif entity == FolderEntity.NODE_PLAYER:
|
||||||
table = NodePlayerManager.TABLE_NAME
|
table = NodePlayerManager.TABLE_NAME
|
||||||
|
|
||||||
if table:
|
if table:
|
||||||
return self._db.execute_write_query(
|
return self._db.execute_write_query(
|
||||||
query="UPDATE {} set folder_id = ? WHERE id = ?".format(table),
|
query="UPDATE {} set folder_id = ? WHERE id = ?".format(table),
|
||||||
params=(folder_id, entity_id)
|
params=(folder_id if folder else None, entity_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_working_folder(self, entity: FolderEntity) -> str:
|
def get_working_folder(self, entity: FolderEntity) -> str:
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
<script src="{{ STATIC_PREFIX }}js/explorer.js"></script>
|
<script src="{{ STATIC_PREFIX }}js/explorer.js"></script>
|
||||||
<script src="{{ STATIC_PREFIX }}js/fleet/node-players.js"></script>
|
<script src="{{ STATIC_PREFIX }}js/fleet/node-players.js"></script>
|
||||||
<script src="{{ STATIC_PREFIX }}js/lib/jquery-ui.min.js"></script>
|
<script src="{{ STATIC_PREFIX }}js/lib/jquery-ui.min.js"></script>
|
||||||
|
<script src="{{ STATIC_PREFIX }}js/lib/jquery-multidraggable.js"></script>
|
||||||
{{ HOOK(H_FLEET_NODE_PLAYER_JAVASCRIPT) }}
|
{{ HOOK(H_FLEET_NODE_PLAYER_JAVASCRIPT) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@ -83,11 +84,10 @@
|
|||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="folder-move-form" action="{{ url_for('fleet_node_player_folder_move') }}" class="hidden"
|
<form id="folder-move-form" action="{{ url_for('fleet_node_player_folder_move') }}?path={{ working_folder_path }}" class="hidden" method="POST">
|
||||||
method="POST">
|
<input type="hidden" name="entity_ids"/>
|
||||||
<input type="hidden" name="entity_id"/>
|
<input type="hidden" name="folder_ids"/>
|
||||||
<input type="hidden" name="new_folder_id"/>
|
<input type="hidden" name="new_folder_id"/>
|
||||||
<input type="hidden" name="is_folder"/>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
@ -132,7 +132,7 @@
|
|||||||
{% set parent_path = '/'.join(working_folder_path.rstrip('/').split('/')[:-1]) %}
|
{% set parent_path = '/'.join(working_folder_path.rstrip('/').split('/')[:-1]) %}
|
||||||
{% if parent_path %}
|
{% if parent_path %}
|
||||||
<li class="previous-folder droppable" data-path="{{ parent_path }}"
|
<li class="previous-folder droppable" data-path="{{ parent_path }}"
|
||||||
data-id="{{ working_folder.parent_id }}" data-folder="1">
|
data-id="{{ working_folder.parent_id if working_folder.parent_id else '' }}" data-folder="1">
|
||||||
<a href="{{ url_for('fleet_node_player_cd', path=parent_path) }}"
|
<a href="{{ url_for('fleet_node_player_cd', path=parent_path) }}"
|
||||||
class="explr-link explr-item-selectable explr-item-folder">
|
class="explr-link explr-item-selectable explr-item-folder">
|
||||||
<i class="fa fa-folder"></i>
|
<i class="fa fa-folder"></i>
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
<script src="{{ STATIC_PREFIX }}js/slideshow/contents.js"></script>
|
<script src="{{ STATIC_PREFIX }}js/slideshow/contents.js"></script>
|
||||||
<script src="{{ STATIC_PREFIX }}js/lib/jquery-ui.min.js"></script>
|
<script src="{{ STATIC_PREFIX }}js/lib/jquery-ui.min.js"></script>
|
||||||
<script src="{{ STATIC_PREFIX }}js/lib/jquery-fileupload.js"></script>
|
<script src="{{ STATIC_PREFIX }}js/lib/jquery-fileupload.js"></script>
|
||||||
|
<script src="{{ STATIC_PREFIX }}js/lib/jquery-multidraggable.js"></script>
|
||||||
<script src="{{ STATIC_PREFIX }}js/dragdrop.js"></script>
|
<script src="{{ STATIC_PREFIX }}js/dragdrop.js"></script>
|
||||||
|
|
||||||
{{ HOOK(H_SLIDESHOW_CONTENT_JAVASCRIPT) }}
|
{{ HOOK(H_SLIDESHOW_CONTENT_JAVASCRIPT) }}
|
||||||
@ -105,11 +106,10 @@
|
|||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="folder-move-form" action="{{ url_for('slideshow_content_folder_move') }}" class="hidden"
|
<form id="folder-move-form" action="{{ url_for('slideshow_content_folder_move') }}?path={{ working_folder_path }}" class="hidden" method="POST">
|
||||||
method="POST">
|
<input type="hidden" name="entity_ids"/>
|
||||||
<input type="hidden" name="entity_id"/>
|
<input type="hidden" name="folder_ids"/>
|
||||||
<input type="hidden" name="new_folder_id"/>
|
<input type="hidden" name="new_folder_id"/>
|
||||||
<input type="hidden" name="is_folder"/>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
@ -154,7 +154,7 @@
|
|||||||
{% set parent_path = '/'.join(working_folder_path.rstrip('/').split('/')[:-1]) %}
|
{% set parent_path = '/'.join(working_folder_path.rstrip('/').split('/')[:-1]) %}
|
||||||
{% if parent_path %}
|
{% if parent_path %}
|
||||||
<li class="previous-folder droppable" data-path="{{ parent_path }}"
|
<li class="previous-folder droppable" data-path="{{ parent_path }}"
|
||||||
data-id="{{ working_folder.parent_id }}" data-folder="1">
|
data-id="{{ working_folder.parent_id if working_folder.parent_id else '' }}" data-folder="1">
|
||||||
<a href="{{ url_for('slideshow_content_cd', path=parent_path) }}"
|
<a href="{{ url_for('slideshow_content_cd', path=parent_path) }}"
|
||||||
class="explr-link explr-item-selectable explr-item-folder">
|
class="explr-link explr-item-selectable explr-item-folder">
|
||||||
<i class="fa fa-folder"></i>
|
<i class="fa fa-folder"></i>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user