1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 22:57:14 +02:00

Javascript behaviour for draggable dashboard panels.

This commit is contained in:
Lóna Lore
2016-11-04 11:13:23 +01:00
parent 8a121f22ca
commit c8398db04b
3 changed files with 54 additions and 2 deletions

View File

@@ -261,7 +261,7 @@ $ADMIN_HEADER_DASHBOARD = $ADMIN_HEADER = $ADMIN_MODAL . '
$ADMIN_HEADER_DASHBOARD .= '
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="col-md-12 draggable-panels">
{SETSTYLE=admin_menu}
{ADMIN_MENU}
{ADMIN_PWORD}

View File

@@ -5,7 +5,7 @@ define("SEP"," <span class='fa fa-play e-breadcrumb'></span> ");
define("BOOTSTRAP", 3);
define('FONTAWESOME', 4);
e107::js("theme", "js/bootstrap3.js", 'jquery');
// e107::js("url", "https://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js",'jquery', 2);
// e107::css('url', 'http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css');

52
e107_themes/bootstrap3/js/bootstrap3.js vendored Normal file
View File

@@ -0,0 +1,52 @@
var e107 = e107 || {'settings': {}, 'behaviors': {}};
(function ($)
{
'use strict';
/**
* Initializes draggable panels on the dashboard.
*
* @type {{attach: e107.behaviors.adminDashboardDraggablePanels.attach}}
*/
e107.behaviors.adminDashboardDraggablePanels = {
attach: function (context, settings)
{
var selector = '.draggable-panels';
var onceKey = 'admin-dashboard-draggable-panels';
$(context).find(selector).once(onceKey).each(function ()
{
var $panel = $(this);
$panel.sortable({
connectWith: selector,
handle: '.panel-heading',
cursor: 'move',
placeholder: 'placeholder',
forcePlaceholderSize: true,
opacity: 0.4,
stop: function (event, ui)
{
var SortOrder = "SortOrder:\n";
var i = 0;
$(selector + " .panel-title").each(function ()
{
i++;
var $this = $(this);
var title = $this.text();
SortOrder += i + " - " + title + "\n";
});
console.log(SortOrder);
}
});
$panel.disableSelection();
});
}
};
})(jQuery);