1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-31 07:52:37 +01:00

moved mixins to require.js

This commit is contained in:
kay.one 2013-06-20 22:35:56 -07:00
parent 72772bed5a
commit 467c88f711
6 changed files with 81 additions and 89 deletions

View File

@ -1,14 +0,0 @@
"use strict";
define(['app','backgrid'], function () {
NzbDrone.Missing.Row = Backgrid.Row.extend({
events: {
'click .x-search': 'search'
},
search: function () {
window.alert('Episode Search');
}
});
return NzbDrone.Missing.Row;
});

View File

@ -1,8 +1,9 @@
"use strict";
define([
define(
[
'app',
'Missing/Collection',
'Missing/Row',
'Missing/Collection',
'Cells/AirDateCell',
'Series/Index/Table/SeriesStatusCell',
'Shared/Toolbar/ToolbarLayout',
@ -12,8 +13,7 @@ define([
'Cells/AirDateCell',
'Shared/Grid/Pager',
'Shared/LoadingView'
],
function () {
], function (App, MissingRow) {
NzbDrone.Missing.MissingLayout = Backbone.Marionette.Layout.extend({
template: 'Missing/MissingLayoutTemplate',
@ -23,7 +23,8 @@ define([
pager : '#x-pager'
},
columns: [
columns:
[
{
name : 'series',
label : 'Series Title',
@ -50,9 +51,8 @@ define([
],
_showTable: function () {
this.missing.show(new Backgrid.Grid(
{
row : NzbDrone.Missing.Row,
this.missing.show(new Backgrid.Grid({
row : MissingRow,
columns : this.columns,
collection: this.missingCollection,
className : 'table table-hover'
@ -70,8 +70,7 @@ define([
this.missing.show(new NzbDrone.Shared.LoadingView());
this.missingCollection = new NzbDrone.Missing.Collection();
this.missingCollection.fetch()
.done(function () {
this.missingCollection.fetch().done(function () {
self._showTable();
});
}

View File

@ -1,16 +1,16 @@
"use strict";
define(['app','backgrid'], function () {
define(
[
'backgrid'
], function (Backgrid) {
NzbDrone.Missing.Row = Backgrid.Row.extend({
return Backgrid.Row.extend({
events: {
'click .x-search': 'search'
},
search: function () {
window.alert('Episode Search');
}
});
return NzbDrone.Mixins.Row;
});

View File

@ -1,10 +1,11 @@
//try to add ajax data as query string to DELETE calls.
"use strict";
define(['jquery'], function () {
define(function () {
var original = Backbone.ajax;
return function () {
Backbone.ajax = function () {
var original = this.ajax;
this.ajax = function () {
var xhr = arguments[0];
@ -20,4 +21,6 @@ define(['jquery'], function () {
return original.apply(this, arguments);
};
};
});

View File

@ -68,10 +68,14 @@ require.config({
backbone: {
deps :
[
'mixins/backbone.ajax',
'underscore',
'$'
],
exports: 'Backbone'
exports: 'Backbone',
init : function (AjaxMixin) {
AjaxMixin.apply(Backbone);
}
},
@ -87,7 +91,7 @@ require.config({
[
'backbone',
'handlebars',
'mixins/backbone.marionette.templates',
'Handlebars/backbone.marionette.templates',
'mixins/AsNamedView',
'Handlebars/Helpers/DateTime'
@ -122,6 +126,9 @@ require.config({
[
'backbone'
],
exports: 'Backgrid',
init: function () {
Backgrid.Column.prototype.defaults = {
name : undefined,
@ -199,7 +206,6 @@ define(
window.NzbDrone.History = {};
window.NzbDrone.Logs = {};
window.NzbDrone.Release = {};
window.NzbDrone.Mixins = {};
window.NzbDrone.Events = {
SeriesAdded: 'seriesAdded'
@ -214,9 +220,7 @@ define(
};
window.NzbDrone.addInitializer(function () {
console.log('starting application');
});
NzbDrone.addRegions({