Skip to content

Commit

Permalink
fixing some git inconsistency
Browse files Browse the repository at this point in the history
  • Loading branch information
rsaccon committed Nov 15, 2010
1 parent bb30e95 commit 6a99e4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 3 additions & 2 deletions demo/jquerymobile/index.html
Expand Up @@ -3,8 +3,9 @@
<head> <head>
<title>jQuery mobile / persistencejs integration</title> <title>jQuery mobile / persistencejs integration</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="http://jquerymobile.com/test/themes/default" /> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
<script src="http://jquerymobile.com/test/js/all"></script> <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
<script src="http://code.google.com/apis/gears/gears_init.js"></script> <script src="http://code.google.com/apis/gears/gears_init.js"></script>
<script src="../../lib/persistence.js"></script> <script src="../../lib/persistence.js"></script>
<script src="../../lib/persistence.store.sql.js"></script> <script src="../../lib/persistence.store.sql.js"></script>
Expand Down
14 changes: 9 additions & 5 deletions lib/jquery.persistence.js
Expand Up @@ -105,7 +105,7 @@ persistence.get = function(arg1, arg2) {
name = parts[0].charAt(0).toUpperCase() + parts[0].substring(1); name = parts[0].charAt(0).toUpperCase() + parts[0].substring(1);
if (persistence.isDefined(name)) { if (persistence.isDefined(name)) {
if ((settings.type == "post") || ((settings.type == "get") && (arr.length > 1))) { if ((settings.type == "post") || ((settings.type == "get") && (arr.length > 1))) {
// ajax form submission // form submission
var data = {}, qs = (settings.type == "post") ? settings.data : arr[1] ; var data = {}, qs = (settings.type == "post") ? settings.data : arr[1] ;
qs.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ( $0, $1, $2 ) { qs.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ( $0, $1, $2 ) {
if ($1) { if ($1) {
Expand All @@ -119,7 +119,7 @@ persistence.get = function(arg1, arg2) {
data: data data: data
}; };
} else { } else {
// ajax page // html page
return { return {
name: name, name: name,
templateKey: parts.slice(1).join('/') templateKey: parts.slice(1).join('/')
Expand Down Expand Up @@ -161,10 +161,11 @@ persistence.get = function(arg1, arg2) {
} else { } else {
persist(info.data); persist(info.data);
} }
} else { // ajax html page } else { // html page
Entity.findBy(persistence.jqmTemplateKeyField, info.templateKey, function(hit){ Entity.findBy(persistence.jqmTemplateKeyField, info.templateKey, function(hit){
if (hit) { if (hit) {
if (settings.success) if (settings.success)
// TODO: replace images src with data URl'
settings.success(hit[persistence.jqmDataField]()); settings.success(hit[persistence.jqmDataField]());
} else { } else {
originalAjaxMethod({ originalAjaxMethod({
Expand All @@ -174,8 +175,11 @@ persistence.get = function(arg1, arg2) {
var obj = {}; var obj = {};
obj[persistence.jqmTemplateKeyField] = info.templateKey; obj[persistence.jqmTemplateKeyField] = info.templateKey;
obj[persistence.jqmDataField] = data; obj[persistence.jqmDataField] = data;
var entity = new Entity(obj); var entity = new Entity(obj);
// TODO: start transaction
persistence.add(entity); persistence.add(entity);
// TODO: scan images
// TODO: add images as dataurlified
persistence.flush(); persistence.flush();
}, },
error: settings.error error: settings.error
Expand Down

0 comments on commit 6a99e4c

Please sign in to comment.