@ -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' ) ;