[virtualcommons-svn] commit/vcweb: 2 new changesets
Status: Beta
Brought to you by:
alllee
From: <com...@bi...> - 2013-05-09 00:07:51
|
2 new commits in vcweb: https://bitbucket.org/virtualcommons/vcweb/commits/b0e9667b02ec/ Changeset: b0e9667b02ec User: RoleeSinha Date: 2013-05-09 02:06:19 Summary: fixing activity perform Affected #: 1 file diff -r 9c412a5a7bd601765617a3ec7a9084c55fb90e05 -r b0e9667b02ecb79148890658d21ee9f9de4a925d vcweb/lighterprints/templates/lighterprints/mobile/index.html --- a/vcweb/lighterprints/templates/lighterprints/mobile/index.html +++ b/vcweb/lighterprints/templates/lighterprints/mobile/index.html @@ -28,34 +28,20 @@ $("#submitChatMessage").click(function(event){ event.preventDefault(); - if ($('#chatText').val()) { - var formData = $('#chat-form').serialize(); - $.post('/lighterprints/api/message', formData, function(response){ - if (response.success) { - console.debug("successful post - updated view model: "); - ko.mapping.fromJS(response.viewModel, globalViewModel); - console.debug('refresh chatMessage List'); - $('#chatMessageList').listview('refresh'); - } - else { - console.debug("unable to post message to server"); - console.debug(response); - } - }); - $('#chatText').val(''); - } - else { - console.debug("No message found!"); - } }); - $("#dashboardPage").on('pageinit', function(event){ - console.debug('dashboardPage pageinit'); + $("#dashboardPage").on('pagebeforeshow', function(event){ + console.debug('dashboardPage pageshow'); $('#challengesList').listview('refresh'); $('#teamList').listview('refresh'); $('#teamActivityList').listview('refresh'); }); + $("#myTeamPage").on('pagebeforeshow', function(event){ + console.debug('chatMessageList pageshow'); + $('#chatMessageList').listview('refresh'); + }); + }); </script><!-- knockout templates --> @@ -163,6 +149,14 @@ </a></li></script> + <script type='text/html' id='leaderboard-template'> + <li> + <strong>#<span data-bind="text:$index() + 1"></span></strong> + <span data-bind='css: { "bold lighterprints-blue": groupName() == $root.groupName()}'> + <span data-bind="text: groupName"></span> + </span> + </li> + </script><script type='text/html' id='no-group-activity-template'> Your group has not had any activity yet. You can <a href='#dashboardPage'>perform challenges in your dashboard</a> or post messages in the <a href='#myTeamPage'>the group wall</a> @@ -252,13 +246,7 @@ </div></h2><h2><span class="icon-trophy text-gold "></span> Leaderboard <div class="ui-bar-d"> - <ul id="teamList" data-role="listview" data-bind="foreach: groupData" data-inset="true" data-theme="b"> - <li> - <strong>#<span data-bind="text:$index() + 1"></span></strong> - <span data-bind='css: { "bold lighterprints-blue": groupName() == $root.groupName()}'> - <span data-bind="text: groupName"></span> - </span> - </li> + <ul id="teamList" data-role="listview" data-bind="template: {name:'leaderboard-template', foreach: groupData}" data-inset="true" data-theme="b"></ul></div></h2><h2><span class="icon-user"></span> Team Activity @@ -320,7 +308,7 @@ <form id="chat-form"><div data-role="fieldcontain" class="innerblock"><input type="hidden" name="participant_group_id" value='{{participant_group_relationship.id}}'><input type="text" id="chatText" name="message" placeholder="Send a message to your group"> - </div><a href="#" data-role="button" id="submitChatMessage" type="submit">Send</a> + </div><a href="#" data-role="button" data-bind='click: $root.send'>Send</a></form></div></div> https://bitbucket.org/virtualcommons/vcweb/commits/df7023bb5d57/ Changeset: df7023bb5d57 User: RoleeSinha Date: 2013-05-09 02:06:27 Summary: fixing activity perform Affected #: 1 file diff -r b0e9667b02ecb79148890658d21ee9f9de4a925d -r df7023bb5d576a581141534fa1d26c963b964306 vcweb/lighterprints/static/js/lighterprints/mobile/controller.js --- a/vcweb/lighterprints/static/js/lighterprints/mobile/controller.js +++ b/vcweb/lighterprints/static/js/lighterprints/mobile/controller.js @@ -63,6 +63,26 @@ } }); }; + + model.send = function(){ + + if ($('#chatText').val()) { + var formData = {participant_group_id: model.participantGroupId(), message:$('#chatText').val()}; + $.post('/lighterprints/api/message', formData, function(response){ + if (response.success) { + console.debug("successful post - updated view model: "); + ko.mapping.fromJS(response.viewModel, model); + console.debug('refresh chatMessage List'); + $('#chatMessageList').listview('refresh'); + } + else { + console.debug("unable to post message to server"); + console.debug(response); + } + }); + $('#chatText').val(''); + } + }; return model; } \ No newline at end of file Repository URL: https://bitbucket.org/virtualcommons/vcweb/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |