add cid to widgets.render

init date pickers in widgets ACP
v1.18.x
barisusakli 8 years ago
parent 82d3b24cd3
commit e86708cb0c

@ -54,6 +54,7 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {
$('#widgets .widget-area').sortable({
update: function (event, ui) {
createDatePicker(ui.item);
appendToggle(ui.item);
},
connectWith: "div"
@ -154,6 +155,15 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {
});
}
function createDatePicker(el) {
var currentYear = new Date().getFullYear();
el.find('.date-selector').datepicker({
changeMonth: true,
changeYear: true,
yearRange: currentYear + ':' + (currentYear + 100)
});
}
function appendToggle(el) {
if (!el.hasClass('block')) {
el.addClass('block').css('width', '').css('height', '')
@ -209,6 +219,7 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {
widgetArea.append(populateWidget(widgetEl, widgetData.data));
appendToggle(widgetEl);
createDatePicker(widgetEl);
}
}

@ -33,6 +33,7 @@
locations: widgetLocations,
template: template + '.tpl',
url: url,
cid: ajaxify.data.cid,
isMobile: utils.isMobile()
}, function (renderedAreas) {
for (var x = 0; x < renderedAreas.length; ++x) {

@ -109,22 +109,17 @@ apiController.getConfig = function (req, res, next) {
apiController.renderWidgets = function (req, res, next) {
var areas = {
template: req.query.template,
locations: req.query.locations,
url: req.query.url
};
if (!areas.template || !areas.locations) {
if (!req.query.template || !req.query.locations) {
return res.status(200).json({});
}
widgets.render(req.uid,
{
template: areas.template,
url: areas.url,
locations: areas.locations,
isMobile: req.query.isMobile === 'true'
template: req.query.template,
url: req.query.url,
locations: req.query.locations,
isMobile: req.query.isMobile === 'true',
cid: req.query.cid
},
req,
res,

Loading…
Cancel
Save