Removed some UI info from views. Added UI Config

pull/4/head
Mark McDowall 12 years ago
parent 7c1e81a70e
commit 5d7f6fb03b

@ -2,7 +2,6 @@
<FileVersion>1</FileVersion> <FileVersion>1</FileVersion>
<AutoEnableOnStartup>False</AutoEnableOnStartup> <AutoEnableOnStartup>False</AutoEnableOnStartup>
<AllowParallelTestExecution>true</AllowParallelTestExecution> <AllowParallelTestExecution>true</AllowParallelTestExecution>
<AllowTestsToRunInParallelWithThemselves>true</AllowTestsToRunInParallelWithThemselves>
<FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit> <FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit>
<FrameworkUtilisationTypeForGallio>Disabled</FrameworkUtilisationTypeForGallio> <FrameworkUtilisationTypeForGallio>Disabled</FrameworkUtilisationTypeForGallio>
<FrameworkUtilisationTypeForMSpec>Disabled</FrameworkUtilisationTypeForMSpec> <FrameworkUtilisationTypeForMSpec>Disabled</FrameworkUtilisationTypeForMSpec>

@ -4,10 +4,9 @@ define([
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({ NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
template: 'AddSeries/SearchResultTemplate', template: 'AddSeries/SearchResultTemplate',
className: 'search-item',
events: { events: {
'click .x-btn-add': 'addSeries' 'click .x-add': 'addSeries'
}, },
addSeries: function () { addSeries: function () {
@ -49,7 +48,6 @@ define([
template : 'AddSeries/Existing/UnmappedFolderCompositeViewTemplate', template : 'AddSeries/Existing/UnmappedFolderCompositeViewTemplate',
itemViewContainer: '.x-folder-name-match-results', itemViewContainer: '.x-folder-name-match-results',
className : 'unmapped-folder-view',
itemView : NzbDrone.AddSeries.Existing.FolderMatchResultView, itemView : NzbDrone.AddSeries.Existing.FolderMatchResultView,
events: { events: {
@ -116,7 +114,6 @@ define([
template : "AddSeries/Existing/RootFolderCompositeViewTemplate", template : "AddSeries/Existing/RootFolderCompositeViewTemplate",
itemViewContainer: ".x-existing-folder-container", itemViewContainer: ".x-existing-folder-container",
className : 'row',
itemView : NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView, itemView : NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView,
initialize: function () { initialize: function () {

@ -1,6 +1,7 @@
 <div class="row">
<div class="result-list span12 existing-root-folder-view"> <div class="result-list span12 existing-root-folder-view">
<h1>{{path}}</h1> <h1>{{path}}</h1>
<div class="x-existing-folder-container"/> <div class="x-existing-folder-container"/>
</div>
</div> </div>

@ -1,4 +1,5 @@
<div class="row"> <div class="unmapped-folder-view">
<div class="row">
<div class="folder-header span11"> <div class="folder-header span11">
<div class="input-prepend"> <div class="input-prepend">
<i class="add-on icon-search"></i> <i class="add-on icon-search"></i>
@ -9,7 +10,8 @@
<icon class="icon-search "></icon> <icon class="icon-search "></icon>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="x-folder-name-match-results folder-name-matches"/> <div class="x-folder-name-match-results folder-name-matches"/>
</div>
</div> </div>

@ -4,7 +4,6 @@ define(['app', 'Shared/NotificationCollection', 'AddSeries/SearchResultCollectio
NzbDrone.AddSeries.New.SearchItemView = Backbone.Marionette.ItemView.extend({ NzbDrone.AddSeries.New.SearchItemView = Backbone.Marionette.ItemView.extend({
template : "AddSeries/SearchResultTemplate", template : "AddSeries/SearchResultTemplate",
className: 'search-item',
ui: { ui: {
qualityProfile: '.x-quality-profile', qualityProfile: '.x-quality-profile',
@ -13,14 +12,14 @@ define(['app', 'Shared/NotificationCollection', 'AddSeries/SearchResultCollectio
}, },
events: { events: {
'click .x-add': 'add' 'click .x-add': 'addSeries'
}, },
onRender: function () { onRender: function () {
this.listenTo(this.model, 'change', this.render); this.listenTo(this.model, 'change', this.render);
}, },
add: function () { addSeries: function () {
var quality = this.ui.qualityProfile.val(); var quality = this.ui.qualityProfile.val();

@ -1,4 +1,5 @@
<div class="row"> <div class="search-item">
<div class="row">
<div class="span2"> <div class="span2">
<a href="{{traktUrl}}" target="_blank"> <a href="{{traktUrl}}" target="_blank">
<img class="series-poster img-polaroid" src="{{poster}}"> <img class="series-poster img-polaroid" src="{{poster}}">
@ -29,4 +30,5 @@
{{overview}} {{overview}}
</div> </div>
</div> </div>
</div>
</div> </div>

@ -1,6 +1,8 @@
<div id="events" class="span3"> <div class="row">
<div id="events" class="span3">
<h4>Upcoming</h4> <h4>Upcoming</h4>
</div> </div>
<div class=span9> <div class=span9>
<div id="calendar"></div> <div id="calendar"></div>
</div>
</div> </div>

@ -5,7 +5,6 @@ define(['app', 'Calendar/CalendarItemView'], function () {
itemView : NzbDrone.Calendar.CalendarItemView, itemView : NzbDrone.Calendar.CalendarItemView,
itemViewContainer: '#events', itemViewContainer: '#events',
template : 'Calendar/CalendarCollectionTemplate', template : 'Calendar/CalendarCollectionTemplate',
className : 'row',
ui: { ui: {
calendar: '#calendar' calendar: '#calendar'

@ -1,6 +1,8 @@
<div class="date {{statusLevel}}"> <div class="event">
<div class="date {{statusLevel}}">
<h1>{{day}}</h1> <h1>{{day}}</h1>
<h4>{{month}}</h4> <h4>{{month}}</h4>
</div>
<h4>{{seriesTitle}}</h4>
<p>{{startTime}} {{bestDateString}}<span class="pull-right">{{seasonNumber}}x{{paddedEpisodeNumber}}</span><br>{{episodeTitle}}</p>
</div> </div>
<h4>{{seriesTitle}}</h4>
<p>{{startTime}} {{bestDateString}}<span class="pull-right">{{seasonNumber}}x{{paddedEpisodeNumber}}</span><br>{{episodeTitle}}</p>

@ -8,7 +8,6 @@ define([
NzbDrone.Calendar.CalendarItemView = Backbone.Marionette.ItemView.extend({ NzbDrone.Calendar.CalendarItemView = Backbone.Marionette.ItemView.extend({
template : 'Calendar/CalendarItemTemplate', template : 'Calendar/CalendarItemTemplate',
tagName : 'div', tagName : 'div',
className: 'event',
onRender: function () { onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el); NzbDrone.ModelBinder.bind(this.model, this.el);

@ -0,0 +1,41 @@
"use strict";
define(['app'], function () {
$.cookie.json = true;
NzbDrone.Config.SeriesView = function (value) {
if (value) {
NzbDrone.Config.SetValue('seriesView', value);
}
else{
return NzbDrone.Config.GetValue('seriesView', 0);
}
};
NzbDrone.Config.GetValue = function (key, defaultValue) {
var cookie = NzbDrone.Config.GetCookie();
var value = cookie[key];
if (!value) {
return defaultValue;
}
else {
return value;
}
};
NzbDrone.Config.SetValue = function (key, value) {
var cookie = NzbDrone.Config.GetCookie();
cookie[key] = value;
};
NzbDrone.Config.GetCookie = function () {
return $.cookie('NzbDroneConfig');
};
NzbDrone.Config.SetCookie = function (cookie) {
$.cookie('NzbDroneConfig', cookie, { expires: 7, path: '/' });
};
});

@ -103,6 +103,7 @@
<script src="/JsLibraries/jquery.tablesorter.pager.js"></script> <script src="/JsLibraries/jquery.tablesorter.pager.js"></script>
<script src="/JsLibraries/sugar.js"></script> <script src="/JsLibraries/sugar.js"></script>
<script src="/JsLibraries/fullcalendar.js"></script> <script src="/JsLibraries/fullcalendar.js"></script>
<script src="/JsLibraries/jquery.cookie.js"></script>
<script src="/templates.js"></script> <script src="/templates.js"></script>

@ -0,0 +1,95 @@
/*!
* jQuery Cookie Plugin v1.3.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as anonymous module.
define(['jquery'], factory);
} else {
// Browser globals.
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function raw(s) {
return s;
}
function decoded(s) {
return decodeURIComponent(s.replace(pluses, ' '));
}
function converted(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
return config.json ? JSON.parse(s) : s;
} catch(er) {}
}
var config = $.cookie = function (key, value, options) {
// write
if (value !== undefined) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = config.json ? JSON.stringify(value) : String(value);
return (document.cookie = [
config.raw ? key : encodeURIComponent(key),
'=',
config.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// read
var decode = config.raw ? raw : decoded;
var cookies = document.cookie.split('; ');
var result = key ? undefined : {};
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = decode(parts.join('='));
if (key && key === name) {
result = converted(cookie);
break;
}
if (!key) {
result[name] = converted(cookie);
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
if ($.cookie(key) !== undefined) {
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return true;
}
return false;
};
}));

@ -40,7 +40,12 @@
<div class="controls"> <div class="controls">
<div class="switch" data-on-label="Yes" data-off-label="No"> <div class="switch" data-on-label="Yes" data-off-label="No">
<input type="checkbox" name="allowed"/> {{#if allowed}}
<input type="checkbox" checked="checked" />
{{else}}
<input type="checkbox" />
{{/if}}
</div> </div>
</div> </div>
</div> </div>

@ -11,8 +11,7 @@ define(['app', 'Quality/QualityProfileModel'], function () {
}, },
events: { events: {
'click .x-save': 'saveQualityProfile', 'click .x-save': 'saveQualityProfile'
//'click .x-remove': 'removeSeries'
}, },
onRender: function () { onRender: function () {
@ -20,19 +19,13 @@ define(['app', 'Quality/QualityProfileModel'], function () {
this.ui.switch.bootstrapSwitch(); this.ui.switch.bootstrapSwitch();
}, },
saveQualityProfile: function () { saveQualityProfile: function () {
//Todo: Make sure model is updated with Allowed, Cutoff, Name //Todo: Make sure model is updated with Allowed, Cutoff, Name
this.model.save(); this.model.save();
this.trigger('saved'); this.trigger('saved');
this.$el.parent().modal('hide'); this.$el.parent().modal('hide');
}, }
// removeSeries: function () {
// var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
// NzbDrone.modalRegion.show(view);
// }
}); });
}); });

@ -30,6 +30,7 @@ require.config({
define('app', function () { define('app', function () {
window.NzbDrone = new Backbone.Marionette.Application(); window.NzbDrone = new Backbone.Marionette.Application();
window.NzbDrone.Config = {};
window.NzbDrone.Series = {}; window.NzbDrone.Series = {};
window.NzbDrone.Series.Index = {}; window.NzbDrone.Series.Index = {};
window.NzbDrone.Series.Edit = {}; window.NzbDrone.Series.Edit = {};

Loading…
Cancel
Save