nav - enable / disable

v1.18.x
psychobunny 10 years ago
parent 1ae0a8a1bf
commit a2e3179ea4

@ -14,6 +14,15 @@ define('admin/general/navigation', function() {
$(this).parents('li').remove();
});
$('.toggle').on('click', function() {
var btn = $(this),
disabled = btn.html() === 'Enable';
btn.toggleClass('btn-warning').toggleClass('btn-success').html(!disabled ? 'Enable' : 'Disable');
btn.parents('li').find('[name="enabled"]').val(disabled);
return false;
});
$('#save').on('click', saveNavigation);
};

@ -14,7 +14,12 @@
};
helpers.displayMenuItem = function(data, index) {
var properties = data.navigation[index].properties;
var item = data.navigation[index],
properites = item.properties;
if (!item.enabled) {
return false;
}
if (properties) {
if (properties.loggedIn && !data.loggedIn ||

@ -10,9 +10,6 @@ navigation.get = function(callback) {
db.getSortedSetRange('navigation:enabled', 0, -1, function(err, data) {
callback(err, data.map(function(item) {
return JSON.parse(item);
})
.filter(function(item) {
return item.enabled;
}));
});
};

@ -26,6 +26,7 @@ var async = require('async'),
groups: require('./admin/groups'),
tags: require('./admin/tags'),
rewards: require('./admin/rewards'),
navigation: require('./admin/navigation'),
themes: {},
plugins: {},
widgets: {},

@ -13,11 +13,11 @@
<label>Route: <small>ex. /unread</small>
<input class="form-control" type="text" name="route" value="{enabled.route}" />
</label>
<label>Title: <small>text shown upon mouseover</small>
<label>Title: <small>shown upon mouseover</small>
<input class="form-control" type="text" name="title" value="{enabled.title}" />
</label>
<label>Text:
<input class="form-control" type="text" name="textClass" value="{enabled.text}" />
<input class="form-control" type="text" name="text" value="{enabled.text}" />
</label>
<label>Icon Class: <small><a href="http://fortawesome.github.io/Font-Awesome/cheatsheet/" target="_blank">pick one</a></small>
<input class="form-control" type="text" name="iconClass" value="{enabled.iconClass}" />
@ -27,9 +27,12 @@
</label>
<hr />
<button class="btn btn-danger delete">Delete</button>
<label>Enabled
<input type="checkbox" name="enabled" <!-- IF enabled --> checked<!-- ENDIF enabled --> />
</label>
<!-- IF enabled.enabled -->
<button class="btn btn-warning toggle">Disable</button>
<!-- ELSE -->
<button class="btn btn-success toggle">Enable</button>
<!-- ENDIF enabled.enabled -->
<input type="hidden" name="enabled" value="{enabled.enabled}" />
</form>
</li>
<!-- END enabled -->

Loading…
Cancel
Save