Commit 14c59c64 authored by Ad Schellevis's avatar Ad Schellevis

(ui) pull in latest bootgrid version

parent 9bbca9c2
/*!
* jQuery Bootgrid v1.2.0 - 05/02/2015
/*!
* jQuery Bootgrid v1.3.1 - 09/11/2015
* Copyright (c) 2014-2015 Rafael Staib (http://www.jquery-bootgrid.com)
* Licensed under MIT http://www.opensource.org/licenses/MIT
*/
......
/*!
* jQuery Bootgrid v1.2.0 - 05/02/2015
/*!
* jQuery Bootgrid v1.3.1 - 09/11/2015
* Copyright (c) 2014-2015 Rafael Staib (http://www.jquery-bootgrid.com)
* Licensed under MIT http://www.opensource.org/licenses/MIT
*/
......@@ -126,7 +126,8 @@
searchable: !(data.searchable === false), // default: true
sortable: !(data.sortable === false), // default: true
visible: !(data.visible === false), // default: true
width: ($.isNumeric(data.width)) ? data.width + "px" :
visibleInSelection: !(data.visibleInSelection === false), // default: true
width: ($.isNumeric(data.width)) ? data.width + "px" :
(typeof(data.width) === "string") ? data.width : null
};
that.columns.push(column);
......@@ -382,27 +383,30 @@
$.each(this.columns, function (i, column)
{
var item = $(tpl.actionDropDownCheckboxItem.resolve(getParams.call(that,
{ name: column.id, label: column.text, checked: column.visible })))
.on("click" + namespace, selector, function (e)
{
e.stopPropagation();
var $this = $(this),
checkbox = $this.find(checkboxSelector);
if (!checkbox.prop("disabled"))
if (column.visibleInSelection)
{
var item = $(tpl.actionDropDownCheckboxItem.resolve(getParams.call(that,
{ name: column.id, label: column.text, checked: column.visible })))
.on("click" + namespace, selector, function (e)
{
column.visible = checkbox.prop("checked");
var enable = that.columns.where(isVisible).length > 1;
$this.parents(itemsSelector).find(selector + ":has(" + checkboxSelector + ":checked)")
._bgEnableAria(enable).find(checkboxSelector)._bgEnableField(enable);
that.element.find("tbody").empty(); // Fixes an column visualization bug
renderTableHeader.call(that);
loadData.call(that);
}
});
dropDown.find(getCssSelector(css.dropDownMenuItems)).append(item);
e.stopPropagation();
var $this = $(this),
checkbox = $this.find(checkboxSelector);
if (!checkbox.prop("disabled"))
{
column.visible = checkbox.prop("checked");
var enable = that.columns.where(isVisible).length > 1;
$this.parents(itemsSelector).find(selector + ":has(" + checkboxSelector + ":checked)")
._bgEnableAria(enable).find(checkboxSelector)._bgEnableField(enable);
that.element.find("tbody").empty(); // Fixes an column visualization bug
renderTableHeader.call(that);
loadData.call(that);
}
});
dropDown.find(getCssSelector(css.dropDownMenuItems)).append(item);
}
});
actions.append(dropDown);
}
......@@ -491,16 +495,17 @@
}
}
function renderPaginationItem(list, uri, text, markerCss)
function renderPaginationItem(list, page, text, markerCss)
{
var that = this,
tpl = this.options.templates,
css = this.options.css,
values = getParams.call(this, { css: markerCss, text: text, uri: "#" + uri }),
values = getParams.call(this, { css: markerCss, text: text, page: page }),
item = $(tpl.paginationItem.resolve(values))
.on("click" + namespace, getCssSelector(css.paginationButton), function (e)
{
e.stopPropagation();
e.preventDefault();
var $this = $(this),
parent = $this.parent();
......@@ -512,8 +517,8 @@
next: that.current + 1,
last: that.totalPages
};
var command = $this.attr("href").substr(1);
that.current = commandList[command] || +command; // + converts string to int
var command = $this.data("page");
that.current = commandList[command] || command;
loadData.call(that);
}
$this.trigger("blur");
......@@ -546,14 +551,14 @@
$.each(rowCountList, function (index, value)
{
var item = $(tpl.actionDropDownItem.resolve(getParams.call(that,
{ text: getText(value), uri: "#" + value })))
{ text: getText(value), action: value })))
._bgSelectAria(value === that.rowCount)
.on("click" + namespace, menuItemSelector, function (e)
{
e.preventDefault();
var $this = $(this),
newRowCount = +$this.attr("href").substr(1);
newRowCount = $this.data("action");
if (newRowCount !== that.rowCount)
{
// todo: sophisticated solution needed for calculating which page is selected
......@@ -562,7 +567,7 @@
$this.parents(menuItemsSelector).children().each(function ()
{
var $item = $(this),
currentRowCount = +$item.find(menuItemSelector).attr("href").substr(1);
currentRowCount = $item.find(menuItemSelector).data("action");
$item._bgSelectAria(currentRowCount === newRowCount);
});
$this.parents(menuSelector).find(menuTextSelector).text(getText(newRowCount));
......@@ -1082,7 +1087,7 @@
* @for searchSettings
**/
delay: 250,
/**
* The characters to type before the search gets executed.
*
......@@ -1330,7 +1335,7 @@
* @for statusMapping
**/
2: "warning",
/**
* Specifies a dangerous or potentially negative action.
*
......@@ -1351,7 +1356,7 @@
templates: {
actionButton: "<button class=\"btn btn-default\" type=\"button\" title=\"{{ctx.text}}\">{{ctx.content}}</button>",
actionDropDown: "<div class=\"{{css.dropDownMenu}}\"><button class=\"btn btn-default dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\"><span class=\"{{css.dropDownMenuText}}\">{{ctx.content}}</span> <span class=\"caret\"></span></button><ul class=\"{{css.dropDownMenuItems}}\" role=\"menu\"></ul></div>",
actionDropDownItem: "<li><a href=\"{{ctx.uri}}\" class=\"{{css.dropDownItem}} {{css.dropDownItemButton}}\">{{ctx.text}}</a></li>",
actionDropDownItem: "<li><a data-action=\"{{ctx.action}}\" class=\"{{css.dropDownItem}} {{css.dropDownItemButton}}\">{{ctx.text}}</a></li>",
actionDropDownCheckboxItem: "<li><label class=\"{{css.dropDownItem}}\"><input name=\"{{ctx.name}}\" type=\"checkbox\" value=\"1\" class=\"{{css.dropDownItemCheckbox}}\" {{ctx.checked}} /> {{ctx.label}}</label></li>",
actions: "<div class=\"{{css.actions}}\"></div>",
body: "<tbody></tbody>",
......@@ -1364,7 +1369,7 @@
loading: "<tr><td colspan=\"{{ctx.columns}}\" class=\"loading\">{{lbl.loading}}</td></tr>",
noResults: "<tr><td colspan=\"{{ctx.columns}}\" class=\"no-results\">{{lbl.noResults}}</td></tr>",
pagination: "<ul class=\"{{css.pagination}}\"></ul>",
paginationItem: "<li class=\"{{ctx.css}}\"><a href=\"{{ctx.uri}}\" class=\"{{css.paginationButton}}\">{{ctx.text}}</a></li>",
paginationItem: "<li class=\"{{ctx.css}}\"><a data-page=\"{{ctx.page}}\" class=\"{{css.paginationButton}}\">{{ctx.text}}</a></li>",
rawHeaderCell: "<th class=\"{{ctx.css}}\">{{ctx.content}}</th>", // Used for the multi select box
row: "<tr{{ctx.attr}}>{{ctx.cells}}</tr>",
search: "<div class=\"{{css.search}}\"><div class=\"input-group\"><span class=\"{{css.icon}} input-group-addon {{css.iconSearch}}\"></span> <input type=\"text\" class=\"{{css.searchField}}\" placeholder=\"{{lbl.search}}\" /></div></div>",
......@@ -1383,7 +1388,7 @@
{
if (this.options.ajax)
{
// todo: implement ajax DELETE
// todo: implement ajax PUT
}
else
{
......@@ -1466,19 +1471,6 @@
return this;
};
/**
* refresh grid (OPNsense addition)
*
* @method reload
* @chainable
**/
Grid.prototype.refresh = function()
{
loadData.call(this);
return this;
};
/**
* Removes rows by ids. Removes selected rows if no ids are provided.
*
......@@ -1527,7 +1519,7 @@
};
/**
* Searches in all rows for a specific phrase (but only in visible cells).
* Searches in all rows for a specific phrase (but only in visible cells).
* The search filter will be reseted, if no argument is provided.
*
* @method search
......@@ -1672,7 +1664,7 @@
};
/**
* Sorts the rows by a given sort descriptor dictionary.
* Sorts the rows by a given sort descriptor dictionary.
* The sort filter will be reseted, if no argument is provided.
*
* @method sort
......@@ -1833,8 +1825,8 @@
_bgBusyAria: function(busy)
{
return (busy == null || busy) ?
this._bgAria("busy", "true") :
return (busy == null || busy) ?
this._bgAria("busy", "true") :
this._bgAria("busy", "false");
},
......@@ -1845,29 +1837,29 @@
_bgEnableAria: function (enable)
{
return (enable == null || enable) ?
this.removeClass("disabled")._bgAria("disabled", "false") :
return (enable == null || enable) ?
this.removeClass("disabled")._bgAria("disabled", "false") :
this.addClass("disabled")._bgAria("disabled", "true");
},
_bgEnableField: function (enable)
{
return (enable == null || enable) ?
this.removeAttr("disabled") :
return (enable == null || enable) ?
this.removeAttr("disabled") :
this.attr("disabled", "disable");
},
_bgShowAria: function (show)
{
return (show == null || show) ?
return (show == null || show) ?
this.show()._bgAria("hidden", "false") :
this.hide()._bgAria("hidden", "true");
},
_bgSelectAria: function (select)
{
return (select == null || select) ?
this.addClass("active")._bgAria("selected", "true") :
return (select == null || select) ?
this.addClass("active")._bgAria("selected", "true") :
this.removeClass("active")._bgAria("selected", "false");
},
......@@ -1957,8 +1949,8 @@
{
var skip = (page - 1) * size,
end = skip + size;
return (this.length > skip) ?
(this.length > end) ? this.slice(skip, end) :
return (this.length > skip) ?
(this.length > end) ? this.slice(skip, end) :
this.slice(skip) : [];
};
}
......@@ -2047,4 +2039,4 @@
// ============
$("[data-toggle=\"bootgrid\"]").bootgrid();
})(jQuery, window);
})(jQuery, window);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment