Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add template for events lists with no results

  • Loading branch information...
commit 0d4b69ae18df9142e4906e41f7a7d72db79b0477 1 parent dde487e
Steven Surowiec steves authored
Showing with 19 additions and 7 deletions.
  1. +11 −7 public/javascripts/twalks.js
  2. +8 −0 views/backbone/_events.ejs
18 public/javascripts/twalks.js
View
@@ -211,15 +211,19 @@
this.collection.bind('reset', this.render);
}
, render: function() {
- var $list;
+ if (this.collection.length > 0) {
+ var $list;
- $(this.el).html(this.template({}));
- $list = this.$('.list');
+ $(this.el).html(this.template({}));
+ $list = this.$('.list');
- this.collection.each(function(event) {
- var view = new App.Views.EventsListEvent({ model: event });
- $list.append(view.render().el);
- });
+ this.collection.each(function(event) {
+ var view = new App.Views.EventsListEvent({ model: event });
+ $list.append(view.render().el);
+ });
+ } else {
+ $(this.el).html($('#events-list-empty-template').html());
+ }
return this;
}
8 views/backbone/_events.ejs
View
@@ -46,6 +46,14 @@
</div>
</script>
+<script type="text/template" id="events-list-empty-template">
+ <div id="events-list" class="row">
+ <section class="span16 columns list">
+ No Events Found
+ </section>
+ </div>
+</script>
+
<script type="text/template" id="events-list-event-template">
<header class="map">
<span class="time">
Please sign in to comment.
Something went wrong with that request. Please try again.