moved mixins to require.js

pull/2/head
kay.one 12 years ago
parent 72772bed5a
commit 467c88f711

@ -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;
});

@ -1,19 +1,19 @@
"use strict";
define([
'app',
'Missing/Collection',
'Missing/Row',
'Cells/AirDateCell',
'Series/Index/Table/SeriesStatusCell',
'Shared/Toolbar/ToolbarLayout',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell',
'Cells/AirDateCell',
'Shared/Grid/Pager',
'Shared/LoadingView'
],
function () {
define(
[
'app',
'Missing/Row',
'Missing/Collection',
'Cells/AirDateCell',
'Series/Index/Table/SeriesStatusCell',
'Shared/Toolbar/ToolbarLayout',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell',
'Cells/AirDateCell',
'Shared/Grid/Pager',
'Shared/LoadingView'
], function (App, MissingRow) {
NzbDrone.Missing.MissingLayout = Backbone.Marionette.Layout.extend({
template: 'Missing/MissingLayoutTemplate',
@ -23,36 +23,36 @@ define([
pager : '#x-pager'
},
columns: [
{
name : 'series',
label : 'Series Title',
sortable: false,
cell : NzbDrone.Cells.SeriesTitleCell
},
{
name : 'this',
label : 'Episode',
sortable: false,
cell : NzbDrone.Cells.EpisodeNumberCell
},
{
name : 'this',
label : 'Episode Title',
sortable: false,
cell : NzbDrone.Cells.EpisodeTitleCell
},
{
name : 'airDate',
label: 'Air Date',
cell : NzbDrone.Cells.AirDateCell
}
],
columns:
[
{
name : 'series',
label : 'Series Title',
sortable: false,
cell : NzbDrone.Cells.SeriesTitleCell
},
{
name : 'this',
label : 'Episode',
sortable: false,
cell : NzbDrone.Cells.EpisodeNumberCell
},
{
name : 'this',
label : 'Episode Title',
sortable: false,
cell : NzbDrone.Cells.EpisodeTitleCell
},
{
name : 'airDate',
label: 'Air Date',
cell : NzbDrone.Cells.AirDateCell
}
],
_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();
});
}

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

@ -1,23 +1,26 @@
//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];
var xhr = arguments[0];
//check if ajax call was made with data option
if (xhr && xhr.data && xhr.type === 'DELETE') {
if (xhr.url.indexOf('?') === -1) {
xhr.url = xhr.url + '?' + $.param(xhr.data);
//check if ajax call was made with data option
if (xhr && xhr.data && xhr.type === 'DELETE') {
if (xhr.url.indexOf('?') === -1) {
xhr.url = xhr.url + '?' + $.param(xhr.data);
}
else {
xhr.url = xhr.url + '&' + $.param(xhr.data);
}
}
else {
xhr.url = xhr.url + '&' + $.param(xhr.data);
}
}
return original.apply(this, arguments);
return original.apply(this, arguments);
};
};
});

@ -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({

Loading…
Cancel
Save