1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Removed some UI info from views. Added UI Config

This commit is contained in:
Mark McDowall 2013-04-07 16:15:04 -07:00
parent 7c1e81a70e
commit 5d7f6fb03b
16 changed files with 211 additions and 73 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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'

View File

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

View File

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

41
UI/Config.js Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 = {};