mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 01:23:53 -07:00
all links are automatically handled through backbone router.
no more page reload.
This commit is contained in:
parent
5ea794939c
commit
50918ae65f
6 changed files with 55 additions and 41 deletions
|
@ -21,29 +21,6 @@ Marionette.ItemView.prototype.self$ = function (selector) {
|
|||
return this.$(selector).not("[class*='iv-'] " + selector);
|
||||
};
|
||||
|
||||
|
||||
Marionette.ItemView.prototype._handleRelativeLink = function (event) {
|
||||
console.log('clikc');
|
||||
event.preventDefault();
|
||||
var $target = $(event.target);
|
||||
|
||||
var href = event.target.getAttribute('href');
|
||||
|
||||
if (!href && $target.parent('a') && $target.parent('a')[0]) {
|
||||
|
||||
var linkElement = $target.parent('a')[0];
|
||||
|
||||
href = linkElement.getAttribute('href');
|
||||
}
|
||||
|
||||
if (!href) {
|
||||
throw 'couldnt find route target';
|
||||
}
|
||||
|
||||
NzbDrone.Router.navigate(href, { trigger: true });
|
||||
};
|
||||
|
||||
|
||||
Marionette.ItemView.prototype.render = function () {
|
||||
|
||||
var result = oldMarionetteItemViewRender.apply(this, arguments);
|
||||
|
@ -64,7 +41,6 @@ Marionette.ItemView.prototype.render = function () {
|
|||
this._modelBinder.bind(this.model, this.el);
|
||||
}
|
||||
|
||||
this.$('a[href^="/"]').children().click(this._handleRelativeLink);
|
||||
this.$el.addClass('iv-' + this.viewName());
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue