Ind.ie is now Small Technology Foundation.
Commit 03eebe61 authored by Aral Balkan's avatar Aral Balkan

Fixed the initial state messages on the timelines. Experimenting with...

Fixed the initial state messages on the timelines. Experimenting with callbacks on Set (not working).
parent c2b33c79
......@@ -156,4 +156,7 @@ module.exports = (app) ->
# TODO: Add the formatters to the messages themselves so we don’t have to duplicate them on the client.
response.render 'conversation', {personsAccountHandle: person, personsName: personsName, messages: messages, __set: { formatters: {messageBodyIDFormatter: messageBodyIDFormatter, messageStatusIDFormatter: messageStatusIDFormatter, profileImagePathFormatter: profileImagePathFormatter, personFormatter: personFormatter, postDateFormatter:postDateFormatter, timestampFormatter: timestampFormatter}}}
textWillChange = (node, newText) ->
console.log "About to modify: " + node + " text: " + newText
response.render 'conversation', {personsAccountHandle: person, personsName: personsName, messages: messages, __set: { textWillChange: textWillChange, formatters: {messageBodyIDFormatter: messageBodyIDFormatter, messageStatusIDFormatter: messageStatusIDFormatter, profileImagePathFormatter: profileImagePathFormatter, personFormatter: personFormatter, postDateFormatter:postDateFormatter, timestampFormatter: timestampFormatter}}}
......@@ -19,6 +19,12 @@ window.addEventListener('load', function(){
// console.log("Polling server for new public posts…")
//
// Get the ID of the last message loaded so we can use this
// to poll for new messages that have been received since the
// timeline initially loaded. Compensate for an empty timeline
// with no messages.
//
var messages = document.getElementById('messages');
var firstMessage = messages.firstElementChild;
......
......@@ -184,7 +184,9 @@ window.addEventListener('load', function(){
}
// Update the repeater node
set(repeaterNode, {messages: posts})
set(repeaterNode, {messages: posts}, function(){
console.log("Set is done!");
})
});
// Update all the message clocks
......
......@@ -11,8 +11,20 @@ window.addEventListener('load', function(){
// console.log("Polling server for new public posts…")
//
// Get the ID of the last message loaded so we can use this
// to poll for new messages that have been received since the
// timeline initially loaded. Compensate for an empty timeline
// with no messages.
//
var messages = document.getElementById('messages');
var newestPostID = messages.firstElementChild.getAttribute('id')
var firstMessage = messages.firstElementChild;
var newestPostID = 0;
if (firstMessage != null)
{
newestPostID = messages.firstElementChild.getAttribute('id');
}
// console.log('Getting post after ' + newestPostID)
......
......@@ -16,13 +16,14 @@
<h1>Private</h1>
<!-- Notice to display if there are no messages yet. -->
<div data-set-if='not messages' id='notice'>
<p>This timeline is for you alone.</p><p>It is only synchronised between your own devices.</p><p><em>This timeline is currently not very useful as we are only supporting one device per account during the pre-alpha.</em> Once we can lift this limit, this section will be expanded to make it easy for you to store files and folders and keep them synchronised between your devices.</p>
<div data-set-if='not:messages' id='notice'>
<p><strong>This timeline is for you alone.</strong></p>
<p>It is only synchronised between your own devices.</p><p><em>This timeline is currently not very useful as we are only supporting one device per account during the pre-alpha.</em> Once we can lift this limit, this section will be expanded to make it easy for you to store files and folders and keep them synchronised between your devices.</p>
</div>
<div id='messages' class='messages' data-set-if='messages'>
<!-- Repeater -->
<div class='message' data-set-repeat='message messages' data-set-attribute='id message.key' >
<div id='messageRepeater' class='message' data-set-repeat='message messages' data-set-attribute='id message.key' >
<div class='messageBody' data-set-attribute='id message.key messageBodyIDFormatter'>
<div class="image-and-body">
<img class="profileImage" src='http://localhost:42000/about/me.jpg'>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment