mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Fix couple of issues when there are no posts
Fixes #877 - Updated the blog/content view to check `collection.length` before attempting to pull another record. - In the event an item is removed and the collection now has zero items, still redraw the preview pane, just with no data.
This commit is contained in:
parent
598915a125
commit
c5438c5fff
@ -35,6 +35,11 @@
|
||||
|
||||
showNext: function () {
|
||||
if (this.isLoading) { return; }
|
||||
|
||||
if (!this.collection.length) {
|
||||
return Backbone.trigger('blog:activeItem', null);
|
||||
}
|
||||
|
||||
var id = this.collection.at(0).id;
|
||||
if (id) {
|
||||
Backbone.trigger('blog:activeItem', id);
|
||||
@ -192,10 +197,9 @@
|
||||
templateName: "preview",
|
||||
|
||||
render: function () {
|
||||
if (this.activeId) {
|
||||
this.model = this.collection.get(this.activeId);
|
||||
this.$el.html(this.template(this.templateData()));
|
||||
}
|
||||
this.model = this.collection.get(this.activeId);
|
||||
this.$el.html(this.template(this.templateData()));
|
||||
|
||||
this.$('.content-preview-content').scrollClass({target: '.content-preview', offset: 10});
|
||||
this.$('.wrapper').on('click', 'a', function (e) {
|
||||
$(e.currentTarget).attr('target', '_blank');
|
||||
|
Loading…
Reference in New Issue
Block a user