1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-29 03:05:49 +00:00
Sonarr/NzbDrone.Web/Scripts/backbone/controller.js

57 lines
1.8 KiB
JavaScript
Raw Normal View History

2012-11-07 00:41:34 +00:00
(function (nzbDrone) {
var appController = function () {
return {
home: function (id) {
// if (!this.homeView) {
// this.homeView = new HomeView();
// }
// $('#content').html(this.homeView.el);
nzbDrone.App.Layout.content.show(new nzbDrone.Views.HomeView());
this.menuItemSelected('home-menu');
},
list: function (page) {
var p = page ? parseInt(page, 10) : 1;
var profileList = new ProfileCollection();
profileList.fetch({
success: function () {
$('#content').html(new QualityProfilesView({ model: profileList, page: p }).el);
}
});
this.menuItemSelected('home-menu');
},
wineDetails: function (id) {
var profile = new Profile({ id: id });
profile.fetch({
success: function () {
$('#content').html(new QualityProfileView({ model: profile }).el);
}
});
this.menuItemSelected();
},
addWine: function () {
var wine = new Profile();
$('#content').html(new QualityProfileView({ model: wine }).el);
this.menuItemSelected('add-menu');
},
menuItemSelected: function (item) {
// Using the application vent object as our global event aggregator
nzbDrone.App.vent.trigger(
nzbDrone.Constants.Events.MenuItemSelected, // Event name
item); // Options
}
};
};
nzbDrone.AppController = appController;
})(window.NodeCellar);