Permalink
Browse files

fixed issue with not all pages being resfreshed with data upon ajax call

  • Loading branch information...
1 parent 221a2e3 commit 49479150d45065dbfc088e2d197fca99fa2cae18 @ahsteele ahsteele committed Apr 14, 2011
Showing with 16 additions and 14 deletions.
  1. +5 −4 geocamTalk/templates/geocamTalk/base.html
  2. +11 −10 geocamTalk/templates/geocamTalk/message_list.html
View
9 geocamTalk/templates/geocamTalk/base.html
@@ -11,17 +11,18 @@
<link rel="stylesheet" href="/resources/css/jquery.mobile.css" />
<link rel="stylesheet" href="/resources/css/site.css" />
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
- <script src="http://jquery.malsup.com/media/jquery.media.js?v.92"></script>
<script type="text/javascript">
$(document).bind("mobileinit", function () {
$.mobile.ajaxEnabled = true;
$.extend($.mobile, {
- ajaxFormsEnabled: false
+ ajaxFormsEnabled: false/*,
+ ajaxEnabled: false*/
});
});
</script>
+ <script src="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.js"></script>
+ <script src="http://jquery.malsup.com/media/jquery.media.js?v.92"></script>
{% block css %}{% endblock %}
</head>
<body>
@@ -31,7 +32,7 @@
<h1>{% block pagetitle %}GeoCam Talk{% endblock %}</h1>
<a href="/talk/messages" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
<div data-role="navbar">
- <ul>
+ <ul id="bigsigh">
<li><a id="my_messages_link" href="{% url geocamTalk.views.message_list user.username%}">My Messages (<span id="new_message_count">{{user.profile.getUnreadMessageCount}}</span>)</a></li>
<li><a href="{% url geocamTalk.views.message_list%}">All Messages</a></li>
</ul>
View
21 geocamTalk/templates/geocamTalk/message_list.html
@@ -103,25 +103,26 @@
html_str += '<p>'+content+'</p>';
html_str += '</dd>';
}
- $('#message_list').prepend(html_str);
+
+ $.mobile.activePage.page().find('#message_list').prepend(html_str);
running_timestamp = data['ts'];
new_message_count += data['msgCnt'];
- $('#new_message_count').html(new_message_count);
+ $.mobile.activePage.page().find('#new_message_count').html(new_message_count);
- if (new_message_count > 0 && $('#clear_link').length == 0)
+ if (new_message_count > 0
+ && $.mobile.activePage.page().find('#clear_link').length == 0)
{
- var span = '<span id="stupidfix">&nbsp;</span>';
- var link = $('<a id="clear_link" href="#">(Clear)</a>');
+ //var span = '<span id="stupidfix">&nbsp;</span>';
+ var link = $('<li><a id="clear_link" href="#">(Clear)</a></li>');
link.click(function() {
$.get('{% url geocamTalk.views.clear_messages %}', function() {
new_message_count = 0;
- $('#new_message_count').html(new_message_count);
- $('#clear_link').remove();
- $('#stupidfix').remove();
+ $.mobile.activePage.page().find('#new_message_count').html(new_message_count);
+ $.mobile.activePage.page().find('#clear_link').remove();
});
});
- $('#my_messages_link').after(link).after(span);
-
+ $.mobile.activePage.page().find('#my_messages_link').parent().after(link);//.after(span);
+ //alert($('#bigSigh'));//.listview('refresh');
}
});
};

0 comments on commit 4947915

Please sign in to comment.