closes #423, closes #424

This commit is contained in:
Baris Soner Usakli
2013-10-19 23:30:10 -04:00
parent 80aeb3677d
commit 7e8ddbadfb
2 changed files with 12 additions and 7 deletions

View File

@@ -6,9 +6,10 @@ define(function() {
function modified(el) {
var cid = $(el).parents('li').attr('data-cid');
modified_categories[cid] = modified_categories[cid] || {};
modified_categories[cid][$(el).attr('data-name')] = $(el).val();
if(cid) {
modified_categories[cid] = modified_categories[cid] || {};
modified_categories[cid][$(el).attr('data-name')] = $(el).val();
}
}
function save() {
@@ -28,6 +29,7 @@ define(function() {
var iconClass = jQuery('.bootbox .selected').children(':first').attr('class');
el.attr('class', iconClass + ' icon-2x');
el.val(iconClass);
el.attr('value', iconClass);
modified(el);
}
@@ -66,7 +68,6 @@ define(function() {
});
//DRY Failure. this needs to go into an ajaxify onready style fn. Currently is copy pasted into every single function so after ACP is off the ground fix asap
function showCreateCategoryModal() {
$('#new-category-modal').modal();
}
@@ -75,7 +76,7 @@ define(function() {
var category = {
name: $('#inputName').val(),
description: $('#inputDescription').val(),
icon: $('#new-category-modal i').attr('value'),
icon: $('#new-category-modal i').val(),
blockclass: $('#inputBlockclass').val()
};
@@ -120,6 +121,10 @@ define(function() {
select_icon($(this).find('i'));
});
jQuery('#new-category-modal').on('click', '.icon', function(ev) {
select_icon($(this).find('i'));
});
jQuery('.blockclass').on('change', function(ev) {
update_blockclass(ev.target);
});
@@ -137,7 +142,7 @@ define(function() {
});
jQuery('.entry-row button').on('click', function(ev) {
jQuery('#entry-container').on('click', '.disable-btn', function(ev) {
var btn = jQuery(this);
var categoryRow = btn.parents('li');
var cid = categoryRow.attr('data-cid');

View File

@@ -28,7 +28,7 @@
</select>
<input data-name="description" placeholder="Category Description" value="{categories.description}" class="form-control category_description description"></input>
<input type="hidden" data-name="order" data-value="{categories.order}"></input>
<button type="submit" class="btn btn-default" data-disabled="{categories.disabled}">Disable</button>
<button type="submit" class="btn btn-default disable-btn" data-disabled="{categories.disabled}">Disable</button>
</form>
</li>