enable loading more
This commit is contained in:
parent
d7ee879590
commit
92658167b1
2 changed files with 20 additions and 0 deletions
|
@ -80,10 +80,25 @@ Metamaps.Views.init = function () {
|
||||||
that.el.appendChild(view.render().el)
|
that.el.appendChild(view.render().el)
|
||||||
})
|
})
|
||||||
this.$el.append('<div class="clearfloat"></div>')
|
this.$el.append('<div class="clearfloat"></div>')
|
||||||
|
|
||||||
|
if (this.collection.length >= 20 && this.collection.page != "loadedAll") {
|
||||||
|
this.$el.append('<button class="button loadMore">load more</button>')
|
||||||
|
this.$el.append('<div class="clearfloat"></div>')
|
||||||
|
}
|
||||||
|
|
||||||
$('#exploreMaps').empty().html(this.el)
|
$('#exploreMaps').empty().html(this.el)
|
||||||
|
this.$el.find('.loadMore').click(that.loadMore.bind(that))
|
||||||
if (cb) cb()
|
if (cb) cb()
|
||||||
Metamaps.Loading.hide()
|
Metamaps.Loading.hide()
|
||||||
},
|
},
|
||||||
|
loadMore: function () {
|
||||||
|
if (this.collection.page != "loadedAll") {
|
||||||
|
this.collection.getMaps();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.$el.find('.loadMore').hide()
|
||||||
|
}
|
||||||
|
},
|
||||||
handleSuccess: function (cb) {
|
handleSuccess: function (cb) {
|
||||||
if (this.collection && this.collection.id === 'mapper') {
|
if (this.collection && this.collection.id === 'mapper') {
|
||||||
this.fetchUserThenRender(cb)
|
this.fetchUserThenRender(cb)
|
||||||
|
|
|
@ -603,6 +603,11 @@
|
||||||
margin-top: 110px;
|
margin-top: 110px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button.loadMore {
|
||||||
|
margin: 10px auto 20px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.appsPage #exploreMapsHeader {
|
.appsPage #exploreMapsHeader {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue