mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 00:25:06 +02:00
Merge remote-tracking branch 'rebugger/gridster.js.git/resize-widget-dimensions'
* rebugger/gridster.js.git/resize-widget-dimensions: fix min-width and min-height after resize add resize_widget_dimension() resize widgets after initialization fix min-width and min-height after resize add resize_widget_dimension() resize widgets after initialization
This commit is contained in:
Vendored
+46
-3
@@ -1647,6 +1647,46 @@
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Change the dimensions of widgets.
|
||||
*
|
||||
* @method resize_widget_dimensions
|
||||
* @param {Object} [options] An Object with all options you want to
|
||||
* overwrite:
|
||||
* @param {Array} [options.widget_margins] Margin between widgets.
|
||||
* The first index for the horizontal margin (left, right) and
|
||||
* the second for the vertical margin (top, bottom).
|
||||
* @param {Array} [options.widget_base_dimensions] Base widget dimensions
|
||||
* in pixels. The first index for the width and the second for the
|
||||
* height.
|
||||
* @return {Class} Returns the instance of the Gridster Class.
|
||||
*/
|
||||
fn.resize_widget_dimensions = function(options) {
|
||||
if (options.widget_margins) {
|
||||
this.options.widget_margins = options.widget_margins;
|
||||
}
|
||||
|
||||
if (options.widget_base_dimensions) {
|
||||
this.options.widget_base_dimensions = options.widget_base_dimensions;
|
||||
}
|
||||
|
||||
this.min_widget_width = (this.options.widget_margins[0] * 2) + this.options.widget_base_dimensions[0];
|
||||
this.min_widget_height = (this.options.widget_margins[1] * 2) + this.options.widget_base_dimensions[1];
|
||||
|
||||
var serializedGrid = this.serialize();
|
||||
this.$widgets.each($.proxy(function(i, widget) {
|
||||
var $widget = $(widget);
|
||||
this.resize_widget($widget);
|
||||
}, this));
|
||||
|
||||
this.generate_grid_and_stylesheet();
|
||||
this.get_widgets_from_DOM();
|
||||
this.set_dom_grid_height();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Mutate widget dimensions and position in the grid map.
|
||||
*
|
||||
@@ -2483,7 +2523,9 @@
|
||||
.removeClass('resizing')
|
||||
.css({
|
||||
'width': '',
|
||||
'height': ''
|
||||
'height': '',
|
||||
'min-width': '',
|
||||
'min-height': ''
|
||||
});
|
||||
|
||||
delay($.proxy(function() {
|
||||
@@ -4169,11 +4211,12 @@
|
||||
tag.setAttribute('type', 'text/css');
|
||||
|
||||
if (tag.styleSheet) {
|
||||
tag.styleSheet.cssText = css;
|
||||
tag.styleSheet.cssText = css;
|
||||
}else{
|
||||
tag.appendChild(document.createTextNode(css));
|
||||
tag.appendChild(document.createTextNode(css));
|
||||
}
|
||||
|
||||
this.remove_style_tags();
|
||||
this.$style_tags = this.$style_tags.add(tag);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-3
File diff suppressed because one or more lines are too long
Vendored
+46
-3
@@ -1647,6 +1647,46 @@
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Change the dimensions of widgets.
|
||||
*
|
||||
* @method resize_widget_dimensions
|
||||
* @param {Object} [options] An Object with all options you want to
|
||||
* overwrite:
|
||||
* @param {Array} [options.widget_margins] Margin between widgets.
|
||||
* The first index for the horizontal margin (left, right) and
|
||||
* the second for the vertical margin (top, bottom).
|
||||
* @param {Array} [options.widget_base_dimensions] Base widget dimensions
|
||||
* in pixels. The first index for the width and the second for the
|
||||
* height.
|
||||
* @return {Class} Returns the instance of the Gridster Class.
|
||||
*/
|
||||
fn.resize_widget_dimensions = function(options) {
|
||||
if (options.widget_margins) {
|
||||
this.options.widget_margins = options.widget_margins;
|
||||
}
|
||||
|
||||
if (options.widget_base_dimensions) {
|
||||
this.options.widget_base_dimensions = options.widget_base_dimensions;
|
||||
}
|
||||
|
||||
this.min_widget_width = (this.options.widget_margins[0] * 2) + this.options.widget_base_dimensions[0];
|
||||
this.min_widget_height = (this.options.widget_margins[1] * 2) + this.options.widget_base_dimensions[1];
|
||||
|
||||
var serializedGrid = this.serialize();
|
||||
this.$widgets.each($.proxy(function(i, widget) {
|
||||
var $widget = $(widget);
|
||||
this.resize_widget($widget);
|
||||
}, this));
|
||||
|
||||
this.generate_grid_and_stylesheet();
|
||||
this.get_widgets_from_DOM();
|
||||
this.set_dom_grid_height();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Mutate widget dimensions and position in the grid map.
|
||||
*
|
||||
@@ -2483,7 +2523,9 @@
|
||||
.removeClass('resizing')
|
||||
.css({
|
||||
'width': '',
|
||||
'height': ''
|
||||
'height': '',
|
||||
'min-width': '',
|
||||
'min-height': ''
|
||||
});
|
||||
|
||||
delay($.proxy(function() {
|
||||
@@ -4169,11 +4211,12 @@
|
||||
tag.setAttribute('type', 'text/css');
|
||||
|
||||
if (tag.styleSheet) {
|
||||
tag.styleSheet.cssText = css;
|
||||
tag.styleSheet.cssText = css;
|
||||
}else{
|
||||
tag.appendChild(document.createTextNode(css));
|
||||
tag.appendChild(document.createTextNode(css));
|
||||
}
|
||||
|
||||
this.remove_style_tags();
|
||||
this.$style_tags = this.$style_tags.add(tag);
|
||||
}
|
||||
|
||||
|
||||
+2
-3
File diff suppressed because one or more lines are too long
+46
-3
@@ -770,6 +770,46 @@
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Change the dimensions of widgets.
|
||||
*
|
||||
* @method resize_widget_dimensions
|
||||
* @param {Object} [options] An Object with all options you want to
|
||||
* overwrite:
|
||||
* @param {Array} [options.widget_margins] Margin between widgets.
|
||||
* The first index for the horizontal margin (left, right) and
|
||||
* the second for the vertical margin (top, bottom).
|
||||
* @param {Array} [options.widget_base_dimensions] Base widget dimensions
|
||||
* in pixels. The first index for the width and the second for the
|
||||
* height.
|
||||
* @return {Class} Returns the instance of the Gridster Class.
|
||||
*/
|
||||
fn.resize_widget_dimensions = function(options) {
|
||||
if (options.widget_margins) {
|
||||
this.options.widget_margins = options.widget_margins;
|
||||
}
|
||||
|
||||
if (options.widget_base_dimensions) {
|
||||
this.options.widget_base_dimensions = options.widget_base_dimensions;
|
||||
}
|
||||
|
||||
this.min_widget_width = (this.options.widget_margins[0] * 2) + this.options.widget_base_dimensions[0];
|
||||
this.min_widget_height = (this.options.widget_margins[1] * 2) + this.options.widget_base_dimensions[1];
|
||||
|
||||
var serializedGrid = this.serialize();
|
||||
this.$widgets.each($.proxy(function(i, widget) {
|
||||
var $widget = $(widget);
|
||||
this.resize_widget($widget);
|
||||
}, this));
|
||||
|
||||
this.generate_grid_and_stylesheet();
|
||||
this.get_widgets_from_DOM();
|
||||
this.set_dom_grid_height();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Mutate widget dimensions and position in the grid map.
|
||||
*
|
||||
@@ -1606,7 +1646,9 @@
|
||||
.removeClass('resizing')
|
||||
.css({
|
||||
'width': '',
|
||||
'height': ''
|
||||
'height': '',
|
||||
'min-width': '',
|
||||
'min-height': ''
|
||||
});
|
||||
|
||||
delay($.proxy(function() {
|
||||
@@ -3292,11 +3334,12 @@
|
||||
tag.setAttribute('type', 'text/css');
|
||||
|
||||
if (tag.styleSheet) {
|
||||
tag.styleSheet.cssText = css;
|
||||
tag.styleSheet.cssText = css;
|
||||
}else{
|
||||
tag.appendChild(document.createTextNode(css));
|
||||
tag.appendChild(document.createTextNode(css));
|
||||
}
|
||||
|
||||
this.remove_style_tags();
|
||||
this.$style_tags = this.$style_tags.add(tag);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user