stuff we did :D

This commit is contained in:
Keivan Beigi 2013-04-24 21:27:49 -07:00
commit 4cd75cd8aa
29 changed files with 648 additions and 479 deletions

View file

@ -61,7 +61,7 @@
<option passfail="false" />
<option white="false" />
<option maxerr="50" />
<option predef="NzbDrone, define, Backbone, _, window,Handlebars, console,require,$,Marionette, Backgrid" />
<option predef="NzbDrone, define, Backbone, _, window,Handlebars, console,require,$,Marionette, Backgrid, jQuery" />
</component>
</project>

View file

@ -0,0 +1,59 @@
'use strict';
var oldItemViewRender = Marionette.ItemView.prototype.render;
var oldItemCollectionViewRender = Marionette.CollectionView.prototype.render;
Marionette.View.prototype.viewName = function () {
if (this.template) {
var regex = new RegExp('\/', 'g');
return this.template
.toLocaleLowerCase()
.replace('template', '')
.replace(regex, '-');
}
return undefined;
};
Marionette.ItemView.prototype.self$ = function (selector) {
return this.$(selector).not("[class*='iv-'] " + selector);
};
Marionette.ItemView.prototype.render = function () {
var result = oldItemViewRender.apply(this, arguments);
//check to see if el has bindings (name attribute)
// any element that has a name attribute and isn't child of another view.
if (this.self$('[name]').length > 0) {
if (!this.model) {
throw 'view ' + this.viewName() + ' has binding attributes but model is not defined';
}
if (!this._modelBinder) {
this._modelBinder = new Backbone.ModelBinder();
}
window.console.log('binding ' + this.viewName());
this._modelBinder.bind(this.model, this.el);
}
this.self$('.switch').bootstrapSwitch();
this.$el.addClass('iv-' + this.viewName());
return result;
};
Marionette.CollectionView.prototype.render = function () {
if (this.model) {
NzbDrone.ModelBinder.bind(this.model, this.el);
}
return oldItemCollectionViewRender.apply(this, arguments);
};

View file

@ -25,8 +25,8 @@ define(['app'], function () {
name : 'airDate',
label : 'Air Date',
editable : false,
cell : 'datetime',
formatter: new Backgrid.AirDateFormatter()
cell : 'datetime'
//formatter: new Backgrid.AirDateFormatter()
}
],

View file

@ -2,17 +2,12 @@
define([
'app',
'Series/Index/List/CollectionView',
<<<<<<< HEAD
'Config'
'Series/Index/Posters/CollectionView',
'Series/Index/EmptyView',
'Config',
'Series/Index/Table/AirDateCell',
'Series/Index/Table/SeriesStatusCell'
'Series/Index/Table/SeriesStatusCell',
'Shared/Toolbar/ToolbarView',
=======
'Shared/Toolbar/ToolbarLayout',
>>>>>>> added support for multi-button groups to toolbar
'Config'
],
function () {
@ -34,128 +29,74 @@ define([
showTable: function () {
var columns =
[
{
name : 'status',
label : '',
editable: false,
cell : 'seriesStatus'
},
{
name : 'title',
label : 'Title',
editable: false,
cell : 'string'
},
{
name : 'seasonCount',
label : 'Seasons',
editable: false,
cell : 'integer'
},
{
name : 'quality',
label : 'Quality',
editable: false,
cell : 'integer'
},
{
name : 'network',
label : 'Network',
editable: false,
cell : 'string'
},
{
name : 'nextAiring',
label : 'Next Airing',
editable : false,
cell : 'datetime',
formatter: new Backgrid.AirDateFormatter()
},
{
name : 'episodes',
label : 'Episodes',
editable: false,
sortable: false,
cell : 'string'
},
{
name : 'edit',
label : '',
editable: false,
sortable: false,
cell : 'string'
}
];
var grid = new Backgrid.Grid(
var columns = [
{
name: 'status',
label: '',
editable: false,
cell: 'seriesStatus',
name : 'status',
label : '',
editable : false,
cell : 'seriesStatus',
headerCell: 'nzbDrone'
},
{
name: 'title',
label: 'Title',
editable: false,
cell: Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/SeriesTitleTemplate' }),
name : 'title',
label : 'Title',
editable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/SeriesTitleTemplate' }),
headerCell: 'nzbDrone'
},
{
name: 'seasonCount',
label: 'Seasons',
editable: false,
cell: 'integer',
name : 'seasonCount',
label : 'Seasons',
editable : false,
cell : 'integer',
headerCell: 'nzbDrone'
},
{
name: 'quality',
label: 'Quality',
editable: false,
cell: 'integer',
name : 'quality',
label : 'Quality',
editable : false,
cell : 'integer',
headerCell: 'nzbDrone'
},
{
name: 'network',
label: 'Network',
editable: false,
cell: 'string',
name : 'network',
label : 'Network',
editable : false,
cell : 'string',
headerCell: 'nzbDrone'
},
{
name: 'nextAiring',
label: 'Next Airing',
editable: false,
cell: 'airDate',
name : 'nextAiring',
label : 'Next Airing',
editable : false,
cell : 'airDate',
headerCell: 'nzbDrone'
},
{
name: 'episodes',
label: 'Episodes',
editable: false,
sortable: false,
cell: Backgrid.TemplateBackedCell.extend({ template: 'Series/EpisodeProgressTemplate' }),
name : 'episodes',
label : 'Episodes',
editable : false,
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/EpisodeProgressTemplate' }),
headerCell: 'nzbDrone'
},
{
name: 'edit',
label: '',
editable: false,
sortable: false,
cell: Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/ControlsColumnTemplate' }),
name : 'edit',
label : '',
editable : false,
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/ControlsColumnTemplate' }),
headerCell: 'nzbDrone'
}
];
this.series.show(new Backgrid.Grid(
{
row: Backgrid.SeriesIndexTableRow,
columns : columns,
collection : this.seriesCollection,
className: 'table table-hover'
row : Backgrid.SeriesIndexTableRow,
columns : columns,
collection: this.seriesCollection,
className : 'table table-hover'
}));
},
@ -196,7 +137,7 @@ define([
menuRight.add(new NzbDrone.Shared.Toolbar.CommandModel({title: "RSS Sync", icon: "icon-rss"}));
menuRight.add(new NzbDrone.Shared.Toolbar.CommandModel({title: "Sync Database", icon: "icon-refresh"}));
this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({left: [ menuLeft], right: [menuRight]}));
this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({left: [ menuLeft, menuLeft], right: [menuRight]}));
switch (this.viewStyle) {
case 1:

View file

@ -9,7 +9,7 @@
margin-top: 0px;
}
a{
a {
color: #000000;
}
}
@ -21,70 +21,71 @@
display: inline-block;
vertical-align: top;
}
.series-page-header {
padding-bottom: 50px;
}
.series-posters-item {
margin-bottom: 20px;
.center {
display: block;
margin-left:auto;
margin-right:auto;
text-align: center;
.series-page-header {
padding-bottom: 50px;
}
.progress {
left: 22px;
margin-top: 5px;
}
.series-posters-item {
margin-bottom: 20px;
.title {
font-size: 17px;
text-rendering: optimizelegibility;
}
.labels {
display: inline-block;
opacity: 0.75;
width: 138px;
:hover {
cursor: default;
}
.label {
margin-top: 3px;
.center {
display: block;
margin-left: auto;
margin-right: auto;
text-align: center;
}
.tooltip {
opacity: 1;
.progress {
left: 22px;
margin-top: 5px;
}
.title {
font-size: 17px;
text-rendering: optimizelegibility;
}
.labels {
display: inline-block;
opacity: 0.75;
width: 138px;
:hover {
cursor: default;
}
.label {
margin-top: 3px;
display: block;
}
.tooltip {
opacity: 1;
}
}
.series-season {
padding-bottom: 20px;
}
}
.series-season {
padding-bottom: 20px;
}
}
.series-poster-container {
position: relative;
overflow: hidden;
display: inline-block;
.series-poster-container {
position: relative;
overflow: hidden;
display: inline-block;
.ended-banner {
color: #EEEEEE;
background-color: #B94A48;
-moz-box-shadow: 2px 2px 20px #888;
-moz-transform: rotate(45deg);
-moz-transform-origin: 50% 50%;
-webkit-transform: rotate(45deg);
-webkit-transform-origin: 50% 50%;
position: absolute;
width: 300px;
top: 175px;
left: -122px;
text-align: center;
.ended-banner {
color: #eeeeee;
background-color: #b94a48;
-moz-box-shadow: 2px 2px 20px #888888;
-moz-transform: rotate(45deg);
-moz-transform-origin: 50% 50%;
-webkit-transform: rotate(45deg);
-webkit-transform-origin: 50% 50%;
position: absolute;
width: 300px;
top: 175px;
left: -122px;
text-align: center;
}
}
}

View file

@ -0,0 +1,6 @@
"use strict";
define(['app'], function () {
NzbDrone.Settings.Naming.NamingModel = Backbone.Model.extend({
url: NzbDrone.Constants.ApiRoot + '/config/naming'
});
});

View file

@ -5,9 +5,7 @@
<label class="control-label">Use Scene Name</label>
<div class="controls">
<div class="switch">
<input type="checkbox" name="sortingUseSceneName"/>
</div>
<input type="checkbox" name="useSceneName"/>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Use the scene name, ignoring all other naming settings"></i>
</span>
@ -15,12 +13,10 @@
</div>
<div class="control-group">
<label class="control-label">Series Name</label>
<label class="control-label">Include Series Title</label>
<div class="controls">
<div class="switch">
<input type="checkbox" name="sortingIncludeSeriesName"/>
</div>
<input type="checkbox" name="includeSeriesTitle"/>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Should filenames contain the series name when renamed?"></i>
</span>
@ -28,12 +24,10 @@
</div>
<div class="control-group">
<label class="control-label">Episode Name</label>
<label class="control-label">Include Episode Title</label>
<div class="controls">
<div class="switch">
<input type="checkbox" name="sortingIncludeEpisodeTitle"/>
</div>
<input type="checkbox" name="includeEpisodeTitle"/>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Should filenames contain the episode name when renamed?"></i>
</span>
@ -45,7 +39,7 @@
<div class="controls">
<div class="switch">
<input type="checkbox" name="sortingReplaceSpaces"/>
<input type="checkbox" name="replaceSpaces"/>
</div>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Do you want to replace spaces in the filename with periods?"></i>
@ -54,11 +48,11 @@
</div>
<div class="control-group">
<label class="control-label">Append Quality</label>
<label class="control-label">Include Quality</label>
<div class="controls">
<div class="switch">
<input type="checkbox" name="sortingAppendQuality"/>
<input type="checkbox" name="includeQuality"/>
</div>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Should filenames have the quality appended to the end?"></i>
@ -67,25 +61,11 @@
</div>
</div>
<div class="control-group">
<label class="control-label">Use Season Folders</label>
<div class="controls">
<div class="switch">
<input type="checkbox" name="useSeasonFolder"/>
</div>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Should files be stored in season folders by default? (Applied only when a series is added)"></i>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Season Folder Format</label>
<div class="controls">
<input type="text" placeholder="Season %s" name="sortingSeasonFolderFormat"/>
<input type="text" placeholder="Season %s" name="seasonFolderFormat"/>
<span class="help-inline">
<i class="icon-question-sign" title="How should season folders be named? (Use %0s to pad to two digits)"></i>
</span>
@ -93,13 +73,13 @@
</div>
<div class="control-group">
<label class="control-label">Separator Style</label>
<label class="control-label">Separator</label>
<div class="controls">
<select class="inputClass x-backlog-setting" name="sortingSeparatorStyle">
<option value="0">Dash</option>
<option value="1">Space</option>
<option value="2">Period</option>
<select class="inputClass x-backlog-setting" name="separator">
<option value=" - ">Dash</option>
<option value=" ">Space</option>
<option value=".">Period</option>
</select>
<span class="help-inline">
<i class="icon-question-sign" title="How should NzbDrone separate sections of the filename?"></i>
@ -111,7 +91,7 @@
<label class="control-label">Numbering Style</label>
<div class="controls">
<select class="inputClass x-backlog-setting" name="sortingNumberStyle">
<select class="inputClass x-backlog-setting" name="numberStyle">
<option value="0">1x05</option>
<option value="1">01x05</option>
<option value="2">S01E05</option>
@ -127,7 +107,7 @@
<label class="control-label">Multi-Episode Style</label>
<div class="controls">
<select class="inputClass x-backlog-setting" name="sortingMultiEpisodeStyle">
<select class="inputClass x-backlog-setting" name="multiEpisodeStyle">
<option value="0">Extend</option>
<option value="1">Duplicate</option>
<option value="2">Repeat</option>
@ -168,4 +148,4 @@
</span>
</div>
</div>
</fieldset>
</fieldset>

View file

@ -1,9 +1,5 @@
'use strict';
define([
'app', 'Settings/SettingsModel'
], function () {
define(['app', 'Settings/Naming/NamingModel'], function () {
NzbDrone.Settings.Naming.NamingView = Backbone.Marionette.ItemView.extend({
template : 'Settings/Naming/NamingTemplate',
@ -14,11 +10,32 @@ define([
},
initialize: function () {
//Listen to save event
this.model = new NzbDrone.Settings.Naming.NamingModel();
this.model.fetch();
NzbDrone.vent.on(NzbDrone.Commands.SaveSettings, this.saveSettings, this);
},
onRender: function () {
this.ui.tooltip.tooltip({ placement: 'right' });
},
saveSettings: function () {
this.model.save(undefined, this.syncNotification("Naming Settings Saved", "Couldn't Save Naming Settings"));
},
syncNotification: function (success, error) {
return {
success: function () {
window.alert(success);
},
error: function () {
window.alert(error);
}
};
}
});
});
})
;

View file

@ -150,8 +150,22 @@ define([
},
save: function () {
this.settings.save();
}
});
});
NzbDrone.vent.trigger(NzbDrone.Commands.SaveSettings);
this.settings.save(undefined,
{
success: function () {
window.alert('Saved');
},
error : function () {
window.alert("couldn't save settings");
}
});
}
})
;
})
;

View file

@ -60,11 +60,16 @@ define('app', function () {
window.NzbDrone.Missing = {};
window.NzbDrone.Events = {
//TODO: Move to commands
OpenModalDialog : 'openModal',
CloseModalDialog: 'closeModal',
SeriesAdded: 'seriesAdded'
};
window.NzbDrone.Commands = {
SaveSettings : 'saveSettings'
};
window.NzbDrone.Constants = {
ApiRoot: '/api'
};