From 5f8c58adb9ec17cd7d2bc4b172ee085898181edf Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 6 Jun 2013 17:50:17 -0700 Subject: [PATCH] Added FileSizeCell --- UI/Episode/Search/Layout.js | 22 +++------------------- UI/Release/Collection.js | 4 ++++ UI/Shared/Cells/FileSizeCell.js | 14 ++++++++++++++ UI/app.js | 4 +++- 4 files changed, 24 insertions(+), 20 deletions(-) create mode 100644 UI/Shared/Cells/FileSizeCell.js diff --git a/UI/Episode/Search/Layout.js b/UI/Episode/Search/Layout.js index dae43d520..628105170 100644 --- a/UI/Episode/Search/Layout.js +++ b/UI/Episode/Search/Layout.js @@ -1,5 +1,5 @@ "use strict"; -define(['app'], function () { +define(['app', 'Shared/Cells/FileSizeCell'], function () { NzbDrone.Episode.Search.Layout = Backbone.Marionette.Layout.extend({ template: 'Episode/Search/LayoutTemplate', @@ -19,7 +19,7 @@ define(['app'], function () { name : 'size', label : 'Size', sortable: true, - cell : Backgrid.IntegerCell + cell : NzbDrone.Shared.Cells.FileSizeCell }, { name : 'title', @@ -27,16 +27,6 @@ define(['app'], function () { sortable: true, cell : Backgrid.StringCell }, - { - name : 'seasonNumber', - label: 'season', - cell : Backgrid.IntegerCell - }, - { - name : 'episodeNumber', - label: 'episode', - cell : Backgrid.StringCell - }, { name : 'approved', label: 'Approved', @@ -44,13 +34,7 @@ define(['app'], function () { } ], - - - initialize: function () { - - }, - - onShow :function(){ + onShow: function () { if (!this.isClosed) { this.grid.show(new Backgrid.Grid( { diff --git a/UI/Release/Collection.js b/UI/Release/Collection.js index 15daf00a8..ec094a0e8 100644 --- a/UI/Release/Collection.js +++ b/UI/Release/Collection.js @@ -6,6 +6,10 @@ define(['app', 'Release/Model'], function () { mode: 'client', + state: { + pageSize: 2000 + }, + fetchEpisodeReleases: function (episodeId) { return this.fetch({ data: { episodeId: episodeId }}); } diff --git a/UI/Shared/Cells/FileSizeCell.js b/UI/Shared/Cells/FileSizeCell.js new file mode 100644 index 000000000..e375bd0e2 --- /dev/null +++ b/UI/Shared/Cells/FileSizeCell.js @@ -0,0 +1,14 @@ +"use strict"; +NzbDrone.Shared.Cells.FileSizeCell = Backgrid.Cell.extend({ + + className: "file-size-cell", + + render: function () { + + var size = Number(this.model.get(this.column.get("name"))); + this.$el.html(size.bytes(1)); + this.delegateEvents(); + return this; + + } +}); diff --git a/UI/app.js b/UI/app.js index 3d2c36c8e..5da988f0f 100644 --- a/UI/app.js +++ b/UI/app.js @@ -63,7 +63,9 @@ define('app', ['shared/modal/region'], function (ModalRegion) { window.NzbDrone.Shared = { Toolbar : {}, - Messenger: {} + Messenger: {}, + Cells: {} + }; window.NzbDrone.Calendar = {};