[marinemap] 2 new revisions pushed by perrygeo...@gmail.com on 2011-09-21 00:26 GMT

0 views
Skip to first unread message

mari...@googlecode.com

unread,
Sep 20, 2011, 8:26:55 PM9/20/11
to marinema...@googlegroups.com
2 new revisions:

Revision: 293730a2e0b5
Author: Matthew Perry <mpe...@ecotrust.org>
Date: Tue Sep 20 17:24:50 2011
Log: When panel loading fails, turn off spinner to prevent stalling
the app
http://code.google.com/p/marinemap/source/detail?r=293730a2e0b5

Revision: 041ddd9b7f2a
Author: Matthew Perry <mpe...@ecotrust.org>
Date: Tue Sep 20 17:25:42 2011
Log: Use a getJSON call in the bookmarks attribute panel to avoid
parsing e...
http://code.google.com/p/marinemap/source/detail?r=041ddd9b7f2a

==============================================================================
Revision: 293730a2e0b5
Author: Matthew Perry <mpe...@ecotrust.org>
Date: Tue Sep 20 17:24:50 2011
Log: When panel loading fails, turn off spinner to prevent stalling
the app
http://code.google.com/p/marinemap/source/detail?r=293730a2e0b5

Modified:
/media/common/js/layout/panel.js

=======================================
--- /media/common/js/layout/panel.js Thu Sep 8 08:35:08 2011
+++ /media/common/js/layout/panel.js Tue Sep 20 17:24:50 2011
@@ -130,7 +130,10 @@
loader = lingcod.contentLoader($.extend({}, {
url: url,
activeTabs: options.syncTabs ? getActiveTabs(el) : false,
- error: options.error,
+ error: function(e){
+ alert('error loading content in panel');
+ that.stopSpinning();
+ },
behaviors: applyBehaviors,
target: el.find('.content'),
beforeCallbacks: function(){

==============================================================================
Revision: 041ddd9b7f2a
Author: Matthew Perry <mpe...@ecotrust.org>
Date: Tue Sep 20 17:25:42 2011
Log: Use a getJSON call in the bookmarks attribute panel to avoid
parsing errors with large strings
http://code.google.com/p/marinemap/source/detail?r=041ddd9b7f2a

Modified:
/lingcod/bookmarks/templates/bookmarks/show.html
/lingcod/bookmarks/urls.py
/lingcod/bookmarks/views.py

=======================================
--- /lingcod/bookmarks/templates/bookmarks/show.html Wed Sep 7 12:14:05
2011
+++ /lingcod/bookmarks/templates/bookmarks/show.html Tue Sep 20 17:25:42
2011
@@ -13,8 +13,12 @@
}
}
if (tree) {
- tree.previousState = JSON.parse('{{instance.publicstate|
safe}}');
- tree.refresh();
+ $('#bookmark_loading').show();
+ $.getJSON('{% url bookmark-state-json instance.pk %}',
function(data) {
+ tree.previousState = data;
+ tree.refresh();
+ $('#bookmark_loading').hide();
+ });
}
{% if request.user.is_staff %}
var tog = function() {
@@ -28,7 +32,9 @@
});
</script>

-<h1><strong>{{instance.name}}</strong> Bookmark</h1>
+<h1><strong>{{instance.name}}</strong> Bookmark
+<span id="bookmark_loading" style="display:none"><img
src="/media/kmltree/dist/images/ajax-loader.gif"/></span>
+</h1>

<h2>Description</h2>
{{instance.description}}</h2>
=======================================
--- /lingcod/bookmarks/urls.py Thu Sep 1 15:43:06 2011
+++ /lingcod/bookmarks/urls.py Tue Sep 20 17:25:42 2011
@@ -3,6 +3,7 @@

urlpatterns = patterns('lingcod.bookmarks.views',
url(r'^(?P<bookmark_id>\d+)/$', 'show_bookmark', name="bookmark"),
+ url(r'^statejson/(?P<bookmark_id>\d+)$', 'bookmark_state_json',
name="bookmark-state-json"),
url(r'^tool/$', 'save_tool_bookmark', name="bookmark-tool"),
)

=======================================
--- /lingcod/bookmarks/views.py Tue Sep 6 15:19:14 2011
+++ /lingcod/bookmarks/views.py Tue Sep 20 17:25:42 2011
@@ -29,6 +29,17 @@
request.GET = get;
return map(request)

+def bookmark_state_json(request, bookmark_id):
+ try:
+ b = Bookmark.objects.get(pk=bookmark_id)
+ except Bookmark.DoesNotExist:
+ return HttpResponse("<h3> Unable to find <em>bookmark %s</em>...
please check URL </h3>" % bookmark_id, status=404)
+
+ state = b.publicstate
+ response = HttpResponse(state, status=200)
+ response.ContentType = "application/json"
+ return response
+
def save_tool_bookmark(request):
u, created =
User.objects.get_or_create(username=settings.BOOKMARK_ANON_USERNAME)
p = request.POST

Reply all
Reply to author
Forward
0 new messages