You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by ds...@apache.org on 2013/11/18 21:00:16 UTC
svn commit: r1543132 - in
/incubator/streams/branches/webservice/streams-web/src/main/webapp/demo:
activityDemo.html js/activityDemo.js
Author: dsullivan
Date: Mon Nov 18 20:00:16 2013
New Revision: 1543132
URL: http://svn.apache.org/r1543132
Log:
formatting the activity
Modified:
incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/activityDemo.html
incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/js/activityDemo.js
Modified: incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/activityDemo.html
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/activityDemo.html?rev=1543132&r1=1543131&r2=1543132&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/activityDemo.html (original)
+++ incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/activityDemo.html Mon Nov 18 20:00:16 2013
@@ -30,7 +30,7 @@
<!--Iterates through each activity in the array that was returned from Streams-->
{{#each this}}
<div class='activity'>
- <div class='actor'>{{actor.id}} {{verb}} {{published}}</div>
+ <img src={{actor.url}} height=25 width=25> {{verb}} <a href = {{target.url}}>{{target.displayName}}</a> on {{formatDate published}}
</div>
{{/each}}
</script>
Modified: incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/js/activityDemo.js
URL: http://svn.apache.org/viewvc/incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/js/activityDemo.js?rev=1543132&r1=1543131&r2=1543132&view=diff
==============================================================================
--- incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/js/activityDemo.js (original)
+++ incubator/streams/branches/webservice/streams-web/src/main/webapp/demo/js/activityDemo.js Mon Nov 18 20:00:16 2013
@@ -1,4 +1,16 @@
var activityDemo = activityDemo || (function(){
+ Handlebars.registerHelper("formatDate", function(timestamp) {
+ var d = new Date(timestamp);
+
+ var curr_date = d.getDate();
+
+ var curr_month = d.getMonth();
+
+ var curr_year = d.getFullYear();
+
+ return (curr_month + 1 )+ "-" + curr_date + "-" + curr_year;
+ });
+
var subscriberURL = "";
var registerUrl = "/streams-web/app/subscriberRegister";
var activityStream = "";
@@ -38,18 +50,17 @@ var activityDemo = activityDemo || (func
setInterval(function(){
// Gets activities streams array
// var getActivitiesStream = function(){
- if(!subscriberURL){
- alert("Please enter a subscriber url first");
- }else(
- $.ajax({
- type:"GET",
- url: subscriberURL,
- success:function(data){
- setTemplate(data);
- }
- }));
- //};
- },3000);
+ if(subscriberURL){
+ $.ajax({
+ type:"GET",
+ url: subscriberURL,
+ success:function(data){
+ setTemplate(data);
+ }
+ })
+ };
+ }
+ ,3000);
// Applies the array returned from Streams to the html template to be displayed