mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(edit) save file only if it was changed
This commit is contained in:
parent
5eafc73283
commit
306ed640b7
2 changed files with 21 additions and 15 deletions
|
|
@ -118,6 +118,8 @@ getJSONfromFileTable.
|
|||
|
||||
* feature(rest) add put patch
|
||||
|
||||
* feature(edit) save file only if it was changed
|
||||
|
||||
|
||||
2012.04.22, v0.2.0
|
||||
|
||||
|
|
|
|||
|
|
@ -77,22 +77,26 @@ var CloudCmd, Util, DOM, JsDiff, ace;
|
|||
lValue = Ace.getValue(),
|
||||
lLength = lValue.length;
|
||||
|
||||
DOM.setCurrentSize( lLength, lCurrent );
|
||||
|
||||
diff(lName, lValue, function(pDiff) {
|
||||
var lData,
|
||||
lPatch = '',
|
||||
lDiffLength = pDiff.length;
|
||||
if ( Util.strCmp(Value, lValue) )
|
||||
Util.log('edit: nothing to save');
|
||||
else {
|
||||
DOM.setCurrentSize( lLength, lCurrent );
|
||||
|
||||
if (lDiffLength >= lLength)
|
||||
lData = lValue;
|
||||
else {
|
||||
lData = pDiff;
|
||||
lPatch = '?patch';
|
||||
}
|
||||
|
||||
DOM.RESTfull.save( lPath, lData, null, lPatch);
|
||||
});
|
||||
diff(lName, lValue, function(pDiff) {
|
||||
var lData,
|
||||
lPatch = '',
|
||||
lDiffLength = pDiff.length;
|
||||
|
||||
if (lDiffLength >= lLength)
|
||||
lData = lValue;
|
||||
else {
|
||||
lData = pDiff;
|
||||
lPatch = '?patch';
|
||||
}
|
||||
|
||||
DOM.RESTfull.save( lPath, lData, null, lPatch);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue