Skip to content

Commit aac0afa

Browse files
authored
Merge pull request #18 from Flatte/develop
Develop
2 parents a949c91 + e066502 commit aac0afa

File tree

6 files changed

+52
-24
lines changed

6 files changed

+52
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Easy and free registration
2929
## How to use
3030
### Install
3131
##### CDN
32-
<script type="text/javascript" src="https://cdn.rawgit.com/Flatte/Flatte-Web/1.0.1-beta.87/dist/flatte.min.js"></script>
32+
<script type="text/javascript" src="https://cdn.rawgit.com/Flatte/Flatte-Web/1.0.1-beta.88/dist/flatte.min.js"></script>
3333
##### Bower
3434
$ bower install flatte
3535
If you don't want to use bower or cdn, you can manually download the latest version of [flatte.min.js](https://raw.githubusercontent.com/Flatte/Flatte-Web/master/dist/flatte.min.js).

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "flatte",
3-
"version": "1.0.1-beta.87",
3+
"version": "1.0.1-beta.88",
44
"main": "dist/flatte.js",
55
"description": "Client-Side NOSql Firebase Realtime Database modeling and management system. (only with angularjs for now...)",
66
"keywords": [

dist/flatte.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Client-Side nosql Firebase Realtime Database save management.
44
* @link https://flatte.github.io/Flatte-Web/
5-
* @version v.1.0.1-beta.87 - Tue Sep 05 2017 17:07:42 GMT+0300 (Türkiye Standart Saati)
5+
* @version v.1.0.1-beta.88 - Tue Sep 05 2017 21:11:41 GMT+0300 (Türkiye Standart Saati)
66
*
77
* Copyright (c) 2017 Flatte - Sezer Ekinci <sezer@maxabab.com>, Kaan Ekinci <kaan@maxabab.com>
88
* @license MIT License, https://opensource.org/licenses/MIT
@@ -252,22 +252,36 @@
252252

253253
promises.push($q(function (resolve, reject) {
254254
placeIDs(path,manifestPath,runRef.split('/'),"#").then(function(resRef){
255-
placeIDs(path,manifestPath,options.saveValue.split('/'),"#").then(function(resValue){
256-
commands.saveValue(ref, runData, resRef.join('/'), resValue.join('/'), action,manifestPath).then(function (res) {
255+
if (typeof saveValue === "string") {
256+
placeIDs(path,manifestPath,options.saveValue.split('/'),"#").then(function(resValue){
257+
commands.saveValue(ref, runData, resRef.join('/'), resValue.join('/'), action,manifestPath).then(function (res) {
258+
angular.extend(results,res);
259+
resolve();
260+
}).catch(function(err){ reject(err); return false; });
261+
});
262+
} else {
263+
commands.saveValue(ref, runData, resRef.join('/'), options.saveValue, action,manifestPath).then(function (res) {
257264
angular.extend(results,res);
258265
resolve();
259266
}).catch(function(err){ reject(err); return false; });
260-
});
267+
}
261268
});
262269
}));
263270
promises.push($q(function (resolve, reject) {
264271
placeIDs(path,manifestPath,runRef.split('/'),"#").then(function(resRef){
265-
placeIDs(path,manifestPath,options.deleteValue.split('/'),"#").then(function(resValue){
266-
commands.deleteValue(ref, runData, resRef.join('/'), resValue.join('/'), action,manifestPath).then(function (res) {
272+
if (typeof deleteValue === "string") {
273+
placeIDs(path,manifestPath,options.deleteValue.split('/'),"#").then(function(resValue){
274+
commands.deleteValue(ref, runData, resRef.join('/'), resValue.join('/'), action,manifestPath).then(function (res) {
275+
angular.extend(results,res);
276+
resolve();
277+
}).catch(function(err){ reject(err); return false; });
278+
});
279+
} else {
280+
commands.deleteValue(ref, runData, resRef.join('/'), options.deleteValue, action,manifestPath).then(function (res) {
267281
angular.extend(results,res);
268282
resolve();
269283
}).catch(function(err){ reject(err); return false; });
270-
});
284+
}
271285
});
272286
}));
273287

@@ -279,8 +293,8 @@
279293

280294
if (
281295
(
282-
((action === "save") && ((options.saveValue === null) || (options.saveValue === "$") || (options.saveValue.trim() === ""))) ||
283-
((action !== "save") && ((options.deleteValue === null) || (options.deleteValue === "$") || (options.deleteValue.trim() === "")))
296+
((action === "save") && ((options.saveValue === null) || (options.saveValue === "$") || (typeof options.saveValue === "string" && options.saveValue.trim() === ""))) ||
297+
((action !== "save") && ((options.deleteValue === null) || (options.deleteValue === "$") || (typeof options.deleteValue === "string" && options.deleteValue.trim() === "")))
284298
) && angular.isObject(loopData)
285299
) {
286300
angular.forEach(loopData,function(value,key){
@@ -361,7 +375,7 @@
361375
if (options.save.value !== ".doNothing") {
362376
if (action === "save") {
363377
promises.push($q(function (resolve, reject) {
364-
commands.saveValue(ref, "1", (path + "/" + options.save.key).split('/'), options.save.value, action,manifestPath).then(function (res) {
378+
commands.saveValue(ref, data, (path + "/" + options.save.key).split('/'), options.save.value, action,manifestPath).then(function (res) {
365379
if (!angular.equals(data,res)) angular.extend(results, res);
366380
resolve();
367381
}).catch(function (err) {

0 commit comments

Comments
 (0)