Removed some UI info from views. Added UI Config

pull/23/head
Mark McDowall 11 years ago
parent 7c1e81a70e
commit 5d7f6fb03b

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

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

@ -1,6 +1,7 @@

<div class="result-list span12 existing-root-folder-view">
<h1>{{path}}</h1>
<div class="row">
<div class="result-list span12 existing-root-folder-view">
<h1>{{path}}</h1>
<div class="x-existing-folder-container"/>
</div>
<div class="x-existing-folder-container"/>
</div>
</div>

@ -1,15 +1,17 @@
<div class="row">
<div class="folder-header span11">
<div class="input-prepend">
<i class="add-on icon-search"></i>
<input class="x-txt-search input-xlarge" type="text" value="{{folder.name}}" placeholder="{{folder.name}}">
</div>
<div class="unmapped-folder-view">
<div class="row">
<div class="folder-header span11">
<div class="input-prepend">
<i class="add-on icon-search"></i>
<input class="x-txt-search input-xlarge" type="text" value="{{folder.name}}" placeholder="{{folder.name}}">
</div>
<div class="btn btn-primary x-btn-search pull-right">
<icon class="icon-search "></icon>
<div class="btn btn-primary x-btn-search pull-right">
<icon class="icon-search "></icon>
</div>
</div>
</div>
</div>
<div class="row">
<div class="x-folder-name-match-results folder-name-matches"/>
<div class="row">
<div class="x-folder-name-match-results folder-name-matches"/>
</div>
</div>

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

@ -1,32 +1,34 @@
<div class="row">
<div class="span2">
<a href="{{traktUrl}}" target="_blank">
<img class="series-poster img-polaroid" src="{{poster}}">
</a>
</div>
<div class="span9">
<div class="search-item">
<div class="row">
<div class="span2">
<a href="{{traktUrl}}" target="_blank">
<img class="series-poster img-polaroid" src="{{poster}}">
</a>
</div>
<div class="span9">
<div class="row">
{{#unless isExisting}}
<select class="span6 x-root-folder">
{{#each rootFolders.models}}
<option value="{{id}}">{{attributes.path}}</option>
<div class="row">
{{#unless isExisting}}
<select class="span6 x-root-folder">
{{#each rootFolders.models}}
<option value="{{id}}">{{attributes.path}}</option>
{{/each}}
</select>
{{/unless}}
<select class="span2 x-quality-profile">
{{#each qualityProfiles.models}}
<option value="{{id}}">{{attributes.name}}</option>
{{/each}}
</select>
{{/unless}}
<select class="span2 x-quality-profile">
{{#each qualityProfiles.models}}
<option value="{{id}}">{{attributes.name}}</option>
{{/each}}
</select>
<div class="btn btn-success icon-plus x-add pull-right"/>
</div>
<div class="row">
<h2>{{title}}</h2>
</div>
<div class="row">
{{overview}}
<div class="btn btn-success icon-plus x-add pull-right"/>
</div>
<div class="row">
<h2>{{title}}</h2>
</div>
<div class="row">
{{overview}}
</div>
</div>
</div>
</div>
</div>

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

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

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

@ -8,7 +8,6 @@ define([
NzbDrone.Calendar.CalendarItemView = Backbone.Marionette.ItemView.extend({
template : 'Calendar/CalendarItemTemplate',
tagName : 'div',
className: 'event',
onRender: function () {
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/sugar.js"></script>
<script src="/JsLibraries/fullcalendar.js"></script>
<script src="/JsLibraries/jquery.cookie.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="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>

@ -11,8 +11,7 @@ define(['app', 'Quality/QualityProfileModel'], function () {
},
events: {
'click .x-save': 'saveQualityProfile',
//'click .x-remove': 'removeSeries'
'click .x-save': 'saveQualityProfile'
},
onRender: function () {
@ -20,19 +19,13 @@ define(['app', 'Quality/QualityProfileModel'], function () {
this.ui.switch.bootstrapSwitch();
},
saveQualityProfile: function () {
//Todo: Make sure model is updated with Allowed, Cutoff, Name
this.model.save();
this.trigger('saved');
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 () {
window.NzbDrone = new Backbone.Marionette.Application();
window.NzbDrone.Config = {};
window.NzbDrone.Series = {};
window.NzbDrone.Series.Index = {};
window.NzbDrone.Series.Edit = {};

Loading…
Cancel
Save