Permalink
Browse files

Update accounts to pass username to tpl

  • Loading branch information...
mitechie committed Aug 18, 2011
1 parent 08556b5 commit 0380910146b198c51c56790db108ee814ed2b76d
View
@@ -21,5 +21,6 @@ def account(request):
user = UserMgr.get(username=request.user.username)
return {
- 'user': user
+ 'user': user,
+ 'username': user.username,
}
@@ -101,7 +101,7 @@ var bookie = (function (opts) {
*/
$b.api.recent = function (pager, callbacks) {
// we need to get the list of recent from the api
- var url = "/api/v1/bmarks/%s/recent?" + pager.generate_url(),
+ var url = "/api/v1/%s/bmarks?" + pager.generate_url(),
opts = {
url: url,
success: callbacks.success,
@@ -162,7 +162,7 @@ var bookie = (function (opts) {
* @param callbacks is an object of success, complete, error
*
*/
- $b.api.bookmark = function (hash_id, callbacks, get_last) {
+ $b.api.bookmark = function (hash_id, callbacks, get_last, with_content) {
// we need to get the list of recent from the api
var url = "/api/v1/%s/bmark/" + hash_id,
opts = {
@@ -175,6 +175,10 @@ var bookie = (function (opts) {
opts.data = {'last_bmark': true};
}
+ if (with_content !== undefined) {
+ opts.data = {'with_content': true};
+ }
+
$b.api._request(opts);
};
@@ -3,8 +3,10 @@
window.addEventListener("keydown", function(event) {
// Bind to both command (for Mac) and control (for Win/Linux)
var modifier = event.ctrlKey || event.metaKey;
+
+ // ctrl-alt-d since ctrl-d is bookmark in chrome
if (modifier && event.altKey && event.keyCode == 68) {
// fire to popup the extension
chrome.extension.sendRequest({'url' : true});
}
-}, false);
+}, false)j
@@ -83,7 +83,7 @@ var API_URL = 'http://dev.bmark.us',
// if we hit this the request failed in a bad way
console.log(data);
console.log(status_string);
-
+
ok(false, "Shouldn't have a bad api requests here");
start();
};
@@ -93,7 +93,7 @@ var API_URL = 'http://dev.bmark.us',
* Verify we can fetch real bookmark data from the live dev testing urls
*
*/
-test('bookie.api.live_bookmark', function () {
+test('live.bookmark', function () {
// we're going to test both with and without content so two calls
expect(2);
@@ -113,3 +113,57 @@ test('bookie.api.live_bookmark', function () {
'error': FAILED
});
});
+
+/**
+ * Test we get readable content
+ *
+ */
+test('live.bookmark_readable', function () {
+ // we're going to test both with and without content so two calls
+ expect(2);
+
+ stop();
+ bookie.api.init(API_URL, USERNAME, API_KEY);
+
+ bookie.api.bookmark(HASH_ID, {
+ 'success': function (data) {
+ var bmark = data.bmark
+ ok(bmark.hash_id == HASH_ID,
+ "The right bookmark came down by hash_id");
+ ok(bmark.readable,
+ "Should have readable content");
+ start();
+
+ },
+ 'error': FAILED
+ },
+ undefined, true);
+});
+
+
+/**
+ * Recent list
+ *
+ */
+test('live.recent', function () {
+ expect(3)
+
+ stop();
+ bookie.api.init(API_URL, USERNAME, API_KEY);
+
+ bookie.api.recent(bookie.api.pager(), {
+ 'success': function (data) {
+ ok(data.count == 10,
+ "We need to get 10 bookmarks");
+ ok(data.bmarks[0].hash_id !== undefined,
+ "Should have readable content");
+ ok(data.bmarks[0].readable === undefined,
+ "Should not have content by default");
+
+ start();
+
+ },
+ 'error': FAILED
+ });
+
+});

0 comments on commit 0380910

Please sign in to comment.