Skip to content

Instantly share code, notes, and snippets.

@apeniche
Created February 10, 2015 16:52
Show Gist options
  • Save apeniche/0b70881bc9e62cc59a5a to your computer and use it in GitHub Desktop.
Save apeniche/0b70881bc9e62cc59a5a to your computer and use it in GitHub Desktop.
app/main/views/main/
<:Title>
Home
<:Body>
<h1>Home</h1>
{{ if Volt.user }}
<div class="row">
<div class="col-md-4">
{{ _users.each do |user| }}
{{ if user._id != Volt.user._id }}
<div class="contact {{ if params._user_id == user._id }} active {{ end }}" e-click="select_conversation(user)">
{{user._name}}
{{ if unread_notifications_from(user).count > 0 }}
<span class="badge">
{{ unread_notifications_from(user).count }}
</span>
{{ end }}
</div>
{{ end }}
{{ end }}
</div>
{{ if params._user_id }}
<div class="col-md-8 well conversation">
{{ current_conversation.each do |message| }}
<div class="message {{ if message._sender_id == Volt.user._id }} sent {{ end }}">
<p>{{ message._text }}</p>
</div>
{{ end }}
{{ if current_conversation.count == 0 }}
<p>You have no messages yet. Start chatting!</p>
{{ else }}
<div class="clearfix"></div>
{{ end }}
<form e-submit="send_message" role="form">
<div class="form-group">
<input class="form-control" type="text" placeholder="Write a message" value="{{ page._new_message }}" />
<button type="submit" class="btn btn-primary pull-right">Submit</button>
</div>
</form>
</div>
{{ end }}
</div>
{{ else }}
<p>This is a sample application built with Volt to demonstrate its real-time capabilities. Please log in to access it.</p>
{{ end }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment