fix problems with editing cards and columns that

were created in previous change
This commit is contained in:
ali asaria 2014-08-17 20:30:25 -04:00
parent de6a1b22b7
commit 7fdbeec800
4 changed files with 66 additions and 55 deletions

View file

@ -272,19 +272,20 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed)
sendAction( 'deleteCard' , { 'id': id });
}
);
card.children('.content').editable( "/edit-card/" + id,
{
style : 'inherit',
cssclass : 'card-edit-form',
type : 'textarea',
placeholder : 'Double Click to Edit.',
onblur: 'submit',
xindicator: '<img src="/images/ajax-loader.gif">',
event: 'dblclick', //event: 'mouseover'
callback: onCardChange
}
);
card.children('.content').editable(function(value, settings) {
onCardChange( id, value );
return(value);
}, {
type : 'textarea',
submit : 'OK',
style : 'inherit',
cssclass : 'card-edit-form',
type : 'textarea',
placeholder : 'Double Click to Edit.',
onblur: 'submit',
event: 'dblclick', //event: 'mouseover'
});
//add applicable sticker
if (sticker != null)
@ -292,15 +293,9 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed)
}
function onCardChange( text, result )
{
var path = result.target;
//e.g. /edit-card/card46156244
var id = path.slice(11);
function onCardChange( id, text )
{
sendAction('editCard', { id: id, value: text });
}
function moveCard(card, position) {
@ -395,7 +390,6 @@ function initCards( cardArray )
// cols
//----------------------------------
function drawNewColumn (columnName)
{
var cls = "col";
@ -404,42 +398,42 @@ function drawNewColumn (columnName)
cls = "col first";
}
$('#icon-col').before('<td class="' + cls + '" width="10%" style="display:none"><h2 id="col1" class="editable">' + columnName + '</h2></td>');
$('.editable').editable( "/edit-column",
{
style : 'inherit',
cssclass : 'card-edit-form',
type : 'textarea',
placeholder : 'New',
onblur: 'submit',
width: '',
height: '',
xindicator: '<img src="/images/ajax-loader.gif">',
event: 'dblclick', //event: 'mouseover'
callback: onColumnChange
}
);
console.log(totalcolumns);
$('#icon-col').before('<td class="' + cls + '" width="10%" style="display:none"><h2 id="col-' + (totalcolumns+1) + '" class="editable">' + columnName + '</h2></td>');
$('.editable').editable(function(value, settings) {
onColumnChange( this.id, value );
return(value);
}, {
style : 'inherit',
cssclass : 'card-edit-form',
type : 'textarea',
placeholder : 'New',
onblur: 'submit',
width: '',
height: '',
xindicator: '<img src="/images/ajax-loader.gif">',
event: 'dblclick', //event: 'mouseover'
});
$('.col:last').fadeIn(1500);
totalcolumns ++;
}
function onColumnChange( text, settings )
function onColumnChange( id, text )
{
var names = Array();
//Get the names of all the columns
//Get the names of all the columns right from the DOM (ignore what was sent in function)
$('.col').each(function() {
names.push(
$(this).text()
);
);
});
updateColumns(names);
}
function displayRemoveColumn()
@ -515,13 +509,9 @@ function initColumns( columnArray )
column
);
}
}
function changeThemeTo( theme )
{
currentTheme = theme;