Benjamin Renard
Add number of things feature
Benjamin Renard commited edd3957 at 2017-09-17 17:43:57
mysc_objects.js
function SCaseList() {
lastChange=0;
this.importExampleData=function() {
var exampleData={
'Vacances': {
'Papier': {
'color': '#f00',
'things': [
{'label': 'Papier blanc', 'nb': 1 },
{'label': 'Stylo', 'nb': 3 },
{'label': "Carte d'identité", 'nb': 1 },
]
},
'Multimédia' : {
'color': '#0f0',
'things': [
{'label': 'Montre', 'nb': 1 },
{'label': 'Chargeur montre', 'nb': 1 },
{'label': 'PC portable', 'nb': 1 },
]
}
}
};
for (scaseName in exampleData) {
var scase=this.newSCase(scaseName);
for (catName in exampleData[scaseName]) {
var cat=scase.cats.newCat(catName);
for (idx in exampleData[scaseName][catName].things) {
cat.newThing(exampleData[scaseName][catName].things[idx]['label'],exampleData[scaseName][catName].things[idx]['nb']);
}
}
}
}
this.loadFromLocalStorage=function() {
if (jQuery.type(localStorage.scases)!='undefined') {
try {
var data=JSON.parse(localStorage.scases);
this.lastChange=data.lastChange;
for (el in data.scases) {
this[el]=new SCase(false,false,data.scases[el]);
}
}
catch(e) {
for (el in this) {
if (this.isSCase(this[el])) {
delete this[el];
}
}
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX