Merge pull request #2328 from dwendt/master

Made hiding widgets for guests/registered sensible.
v1.18.x
Barış Soner Uşaklı 10 years ago
commit b89b960f86

@ -270,7 +270,7 @@ adminController.extend.widgets = function(req, res, next) {
for (var w in widgetData.widgets) { for (var w in widgetData.widgets) {
if (widgetData.widgets.hasOwnProperty(w)) { if (widgetData.widgets.hasOwnProperty(w)) {
// if this gets anymore complicated, it needs to be a template // if this gets anymore complicated, it needs to be a template
widgetData.widgets[w].content += "<br /><label>Title:</label><input type=\"text\" class=\"form-control\" name=\"title\" placeholder=\"Title (only shown on some containers)\" /><br /><label>Container:</label><textarea rows=\"4\" class=\"form-control container-html\" name=\"container\" placeholder=\"Drag and drop a container or enter HTML here.\"></textarea><div class=\"checkbox\"><label><input name=\"registered-only\" type=\"checkbox\"> Hide from anonymous users?</label></div>"; widgetData.widgets[w].content += "<br /><label>Title:</label><input type=\"text\" class=\"form-control\" name=\"title\" placeholder=\"Title (only shown on some containers)\" /><br /><label>Container:</label><textarea rows=\"4\" class=\"form-control container-html\" name=\"container\" placeholder=\"Drag and drop a container or enter HTML here.\"></textarea><div class=\"checkbox\"><label><input name=\"hide-guests\" type=\"checkbox\"> Hide from anonymous users?</label></div><div class=\"checkbox\"><label><input name=\"hide-registered\" type=\"checkbox\"> Hide from registered users?</input></label></div>";
} }
} }

@ -30,7 +30,7 @@ var async = require('async'),
async.map(widgetsByLocation[location], function(widget, next) { async.map(widgetsByLocation[location], function(widget, next) {
if (!widget || !widget.data || (!!widget.data['registered-only'] && uid === 0)) { if (!widget || !widget.data || (!!widget.data['hide-registered'] && uid !== 0) || (!!widget.data['hide-guests'] && uid === 0)) {
return next(); return next();
} }

Loading…
Cancel
Save