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) { function modified(el) {
var cid = $(el).parents('li').attr('data-cid'); var cid = $(el).parents('li').attr('data-cid');
if(cid) {
modified_categories[cid] = modified_categories[cid] || {}; modified_categories[cid] = modified_categories[cid] || {};
modified_categories[cid][$(el).attr('data-name')] = $(el).val(); modified_categories[cid][$(el).attr('data-name')] = $(el).val();
}
} }
function save() { function save() {
@@ -28,6 +29,7 @@ define(function() {
var iconClass = jQuery('.bootbox .selected').children(':first').attr('class'); var iconClass = jQuery('.bootbox .selected').children(':first').attr('class');
el.attr('class', iconClass + ' icon-2x'); el.attr('class', iconClass + ' icon-2x');
el.val(iconClass); el.val(iconClass);
el.attr('value', iconClass);
modified(el); 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() { function showCreateCategoryModal() {
$('#new-category-modal').modal(); $('#new-category-modal').modal();
} }
@@ -75,7 +76,7 @@ define(function() {
var category = { var category = {
name: $('#inputName').val(), name: $('#inputName').val(),
description: $('#inputDescription').val(), description: $('#inputDescription').val(),
icon: $('#new-category-modal i').attr('value'), icon: $('#new-category-modal i').val(),
blockclass: $('#inputBlockclass').val() blockclass: $('#inputBlockclass').val()
}; };
@@ -120,6 +121,10 @@ define(function() {
select_icon($(this).find('i')); 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) { jQuery('.blockclass').on('change', function(ev) {
update_blockclass(ev.target); 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 btn = jQuery(this);
var categoryRow = btn.parents('li'); var categoryRow = btn.parents('li');
var cid = categoryRow.attr('data-cid'); var cid = categoryRow.attr('data-cid');

View File

@@ -28,7 +28,7 @@
</select> </select>
<input data-name="description" placeholder="Category Description" value="{categories.description}" class="form-control category_description description"></input> <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> <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> </form>
</li> </li>