diff --git a/public/src/widgets.js b/public/src/widgets.js index 2a8b052bba..ffa539c6ff 100644 --- a/public/src/widgets.js +++ b/public/src/widgets.js @@ -40,7 +40,8 @@ $.get(RELATIVE_PATH + '/api/widgets/render' + (config['cache-buster'] ? '?v=' + config['cache-buster'] : ''), { locations: locations, template: template + '.tpl', - url: url + url: url, + isMobile: utils.isMobile() }, function(renderedAreas) { for (var x=0; x + +
+ + + + +
+ +
+ +
+ +
+ +
+ +
diff --git a/src/widgets/admin.js b/src/widgets/admin.js index 110f523e21..03f16f3a0a 100644 --- a/src/widgets/admin.js +++ b/src/widgets/admin.js @@ -1,8 +1,9 @@ "use strict"; - -var async = require('async'), - plugins = require('../plugins'); +var fs = require('fs'); +var path = require('path'); +var async = require('async'); +var plugins = require('../plugins'); var admin = {}; @@ -22,6 +23,9 @@ admin.get = function(callback) { }, widgets: function(next) { plugins.fireHook('filter:widgets.getWidgets', [], next); + }, + adminTemplate: function(next) { + fs.readFile(path.resolve(__dirname, '../../public/templates/admin/partials/widget-settings.tpl'), 'utf8', next); } }, function(err, widgetData) { if (err) { @@ -34,17 +38,14 @@ admin.get = function(callback) { area.data = areaData; next(err); }); - }, function(err) { if (err) { return callback(err); } - for (var w in widgetData.widgets) { - if (widgetData.widgets.hasOwnProperty(w)) { - // if this gets anymore complicated, it needs to be a template - widgetData.widgets[w].content += "

"; - } - } + + widgetData.widgets.forEach(function(w) { + w.content += widgetData.adminTemplate; + }); var templates = [], list = {}, index = 0; diff --git a/src/widgets/index.js b/src/widgets/index.js index c1421b44b6..d220f73740 100644 --- a/src/widgets/index.js +++ b/src/widgets/index.js @@ -1,12 +1,12 @@ "use strict"; -var async = require('async'), - winston = require('winston'), - templates = require('templates.js'), +var async = require('async'); +var winston = require('winston'); +var templates = require('templates.js'); - plugins = require('../plugins'), - translator = require('../../public/src/modules/translator'), - db = require('../database'); +var plugins = require('../plugins'); +var translator = require('../../public/src/modules/translator'); +var db = require('../database'); var widgets = {}; @@ -30,7 +30,10 @@ widgets.render = function(uid, area, req, res, callback) { } async.map(widgetsByLocation[location], function(widget, next) { - if (!widget || !widget.data || (!!widget.data['hide-registered'] && uid !== 0) || (!!widget.data['hide-guests'] && uid === 0)) { + if (!widget || !widget.data || + (!!widget.data['hide-registered'] && uid !== 0) || + (!!widget.data['hide-guests'] && uid === 0) || + (!!widget.data['hide-mobile'] && area.isMobile)) { return next(); }