Outcome is a poor man's (wouldn't scale to lots of channels) ajax enabled
chat server in 23 lines of view code:
<extend tag="show-page" for="Conversation">
<old-show-page merge>
<append-content-body:>
<form with="&@message" update="mymessages">
<div> New Message: <input:content/> </div>
</form>
<form id="refresh-form" style="display:none;" action="refresh"
update="mymessages">
<input name="id" value="#{this.id}" type="hidden"/>
</form>
<script>
function update() {
$("form#refresh-form").submit(); setTimeout(update, 5000); };
$(document).ready(function() { setTimeout(update, 5000); });
</script>
<div class="form-horizontal">
<section param="collection-section" merge>
<h3 param="collection-heading"> <%= t("attributes.messages") %>
</h3>
<collection:messages part="mymessages" />
</section>
</div>
</append-content-body:>
</old-show-page>
</extend>
four lines of controller code:
> def refresh
> self.this = Conversation.find(params[:id])
> hobo_show
> end
and a route
> post 'conversations/refresh' => 'conversations#refresh'
Not too shabby ;-)
(Full app code at https://github.com/informatom/mercator)
<https://lh4.googleusercontent.com/-0l2sJ4gWEio/Ut11MRedIAI/AAAAAAAAATI/SPq9h_DYFmE/s1600/screenshot.png>
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.