Skip to content

Commit

Permalink
Integrate locations list into locations_page.
Browse files Browse the repository at this point in the history
For the easiness of reactive list update.
  • Loading branch information
Ruslan Kabalin authored and kabalin committed Feb 3, 2019
1 parent 0f44e3f commit 18ed27e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
7 changes: 0 additions & 7 deletions client/templates/locations/locations_list.html

This file was deleted.

17 changes: 0 additions & 17 deletions client/templates/locations/locations_list.js

This file was deleted.

6 changes: 5 additions & 1 deletion client/templates/locations/locations_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
<input class="form-control input-lg search-locations-input" type="text" placeholder="Search location...">
</div>
<div class="map-container"></div>
{{> locationsList}}
<div class="locations">
{{#each locations}}
{{> locationItem}}
{{/each}}
</div>
</template>
16 changes: 16 additions & 0 deletions client/templates/locations/locations_page.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Template.locationsPage.helpers({
locations: function() {
return Template.instance().locations();
}
});

Template.locationsPage.onRendered(function() {
var self = this;
this.autorun(function(c) {
Expand Down Expand Up @@ -37,4 +43,14 @@ Template.locationsPage.onCreated(function() {
GoogleMaps.load({
libraries: 'places'
});

var instance = this;
instance.autorun(function () {
// Subscribe to the locations publication.
var subscription = instance.subscribe('locations', Session.get('mapBounds'));
});
// Locations cursor.
instance.locations = function() {
return Locations.find({}, {sort: {submitted: -1}});
}
});

0 comments on commit 18ed27e

Please sign in to comment.