Skip to content

Commit

Permalink
new jquery ui and sending updates for sorted items
Browse files Browse the repository at this point in the history
  • Loading branch information
caprazzo committed Oct 11, 2011
1 parent bd5da06 commit 65bbdb1
Show file tree
Hide file tree
Showing 30 changed files with 876 additions and 541 deletions.
15 changes: 14 additions & 1 deletion curl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@
curl -i localhost:8989/data/stories

# create new story
curl -X POST -d'{"stories":[{"desc":"desc", "list":"todo"}]}' http://localhost:8989/data/stories
curl -X POST -d'{"stories":[{"desc":"first todo", "list":"todo", "pos":65536}]}' http://localhost:8989/data/stories
curl -X POST -d'{"stories":[{"desc":"second todo", "list":"todo", "pos":131072}]}' http://localhost:8989/data/stories
curl -X POST -d'{"stories":[{"desc":"third todo", "list":"todo", "pos":196608}]}' http://localhost:8989/data/stories
curl -X POST -d'{"stories":[{"desc":"fourth todo", "list":"todo", "pos":262144}]}' http://localhost:8989/data/stories

curl -X POST -d'{"stories":[{"desc":"first doing", "list":"doing", "pos":65536}]}' http://localhost:8989/data/stories
curl -X POST -d'{"stories":[{"desc":"second doing", "list":"doing", "pos":131072}]}' http://localhost:8989/data/stories
curl -X POST -d'{"stories":[{"desc":"third doing", "list":"doing", "pos":196608}]}' http://localhost:8989/data/stories
curl -X POST -d'{"stories":[{"desc":"fourth doing", "list":"doing", "pos":262144}]}' http://localhost:8989/data/stories

curl -X POST -d'{"stories":[{"desc":"first done", "list":"done", "pos":65536}]}' http://localhost:8989/data/stories
curl -X POST -d'{"stories":[{"desc":"second done", "list":"done", "pos":131072}]}' http://localhost:8989/data/stories
curl -X POST -d'{"stories":[{"desc":"third done", "list":"done", "pos":196608}]}' http://localhost:8989/data/stories
curl -X POST -d'{"stories":[{"desc":"fourth done", "list":"done", "pos":262144}]}' http://localhost:8989/data/stories

#update a story
curl -X PUT -d'{"desc":"newdesc", "list":"done"}' http://localhost:8989/data/stories/2p1tg4n/1
1 change: 1 addition & 0 deletions db/minimav0-121471q.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"121471q","desc":"fourth doing","list":"doing","pos":262144}
1 change: 1 addition & 0 deletions db/minimav0-154k6gt.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"154k6gt","desc":"third done","list":"done","pos":196608}
1 change: 1 addition & 0 deletions db/minimav0-161uttv.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"161uttv","desc":"fourth todo","list":"todo","pos":262144}
1 change: 1 addition & 0 deletions db/minimav0-1aukpco.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"1aukpco","desc":"third todo","list":"todo","pos":196608}
1 change: 1 addition & 0 deletions db/minimav0-1pen765.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"1pen765","desc":"first doing","list":"doing","pos":65536}
1 change: 1 addition & 0 deletions db/minimav0-1ttevds.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"1ttevds","desc":"second todo","list":"todo","pos":131072}
1 change: 1 addition & 0 deletions db/minimav0-2kgidlo.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"2kgidlo","desc":"second done","list":"done","pos":131072}
1 change: 1 addition & 0 deletions db/minimav0-2t6sjh5.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"2t6sjh5","desc":"third doing","list":"doing","pos":196608}
1 change: 1 addition & 0 deletions db/minimav0-38i7vja.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"38i7vja","desc":"first done","list":"done","pos":65536}
1 change: 1 addition & 0 deletions db/minimav0-3t1039a.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"3t1039a","desc":"first todo","list":"todo","pos":65536}
1 change: 1 addition & 0 deletions db/minimav0-3t1039a.2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":2,"id":"3t1039a","desc":"first todo","list":"todo","pos":32768}
1 change: 1 addition & 0 deletions db/minimav0-8kel1.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"8kel1","desc":"second doing","list":"doing","pos":131072}
1 change: 1 addition & 0 deletions db/minimav0-g33acf.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"revision":1,"id":"g33acf","desc":"fourth done","list":"done","pos":262144}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void updateStory(String id, final int revision, final byte[] storyData, f
if (!validateStoryData(storyData, cb))
return;

Story story = fromPostStoryJson(storyData);
Story story = fromJson(storyData);
story.setId(id);
story.setRevision(revision+1);
final byte[] writeData = asJson(story);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
writer.write(IO.toString(in).replaceAll("\\{\\{ JS_SRC_URL \\}\\}", "all.js?rl=" + new Date().getTime()));

writer.close();
in.close();
}

}
4 changes: 2 additions & 2 deletions src/main/java/net/caprazzi/minima/servlet/MinimaServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ protected void doPut(HttpServletRequest req, final HttpServletResponse resp)
return;
}

String key = parts[2];
int revision = Integer.parseInt(parts[3]);
String key = parts[3];
int revision = Integer.parseInt(parts[4]);
byte[] story = IO.readBytes(req.getInputStream());
minimaService.updateStory(key, revision, story, new UpdateStory() {

Expand Down
Loading

0 comments on commit 65bbdb1

Please sign in to comment.