1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

using pre-compiled handlebar templates

re-did static content from nancy
This commit is contained in:
kay.one 2013-03-29 16:00:38 -07:00
parent 3720afd30d
commit 375f887539
21 changed files with 367 additions and 124 deletions

View File

@ -21,8 +21,7 @@ module.exports = function(grunt) {
handlebars: {
options: {
namespace: "NzbDrone.Templates",
wrapped: false,
namespace: "Templates",
processName: function(fileName){
return fileName
.replace('UI/','')
@ -52,10 +51,6 @@ module.exports = function(grunt) {
src: 'UI/**/*.png',
dest: '_output/'
},
templates:{
src: 'UI/**/*emplate.html',
dest: '_output/'
},
fonts:{
src: 'UI/**/Fonts/*.*',
dest: '_output/',
@ -87,10 +82,6 @@ module.exports = function(grunt) {
files: '<%= copy.images.src %>',
tasks: ['copy:images']
},
copyTemplates:{
files: '<%= copy.templates.src %>',
tasks: ['copy:templates']
},
copyFonts:{
files: '<%= copy.fonts.src %>',
tasks: ['copy:fonts']

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D18A5DEB-5102-4775-A1AF-B75DAAA8907B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NzbDrone.Api.Test</RootNamespace>
<AssemblyName>NzbDrone.Api.Test</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="StaticResourceMapperFixture.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Api\NzbDrone.Api.csproj">
<Project>{FD286DF8-2D3A-4394-8AD5-443FADE55FB2}</Project>
<Name>NzbDrone.Api</Name>
</ProjectReference>
<ProjectReference Include="..\NzbDrone.Common\NzbDrone.Common.csproj">
<Project>{f2be0fdf-6e47-4827-a420-dd4ef82407f8}</Project>
<Name>NzbDrone.Common</Name>
</ProjectReference>
<ProjectReference Include="..\NzbDrone.Test.Common\NzbDrone.Test.Common.csproj">
<Project>{CADDFCE0-7509-4430-8364-2074E1EEFCA2}</Project>
<Name>NzbDrone.Test.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NzbDrone.Api.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NzbDrone.Api.Test")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("260b2ff9-d3b7-4d8a-b720-a12c93d045e5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,21 @@
using System.IO;
using NUnit.Framework;
using NzbDrone.Api.Frontend;
using NzbDrone.Test.Common;
namespace NzbDrone.Api.Test
{
[TestFixture]
public class StaticResourceMapperFixture : TestBase<StaticResourceMapper>
{
[TestCase("/app.js", Result = "ui|app.js")]
[TestCase("/series/app.js", Result = "ui|series|app.js")]
[TestCase("series/app.js", Result = "ui|series|app.js")]
[TestCase("Series/App.js", Result = "ui|series|app.js")]
public string should_map_paths(string path)
{
return Subject.Map(path).Replace(Path.DirectorySeparatorChar, '|');
}
}
}

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.2" targetFramework="net40" />
</packages>

View File

@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Common;
using NzbDrone.Core.RootFolders;
namespace NzbDrone.Api.Directories
{

View File

@ -1,9 +1,7 @@
using System;
using System.Linq;
using System;
using Nancy;
using Nancy.Responses.Negotiation;
namespace NzbDrone.Api.FrontendModule
namespace NzbDrone.Api.Frontend
{
public class IndexModule : NancyModule
{

View File

@ -0,0 +1,21 @@
using System.IO;
namespace NzbDrone.Api.Frontend
{
public interface IMapHttpRequestsToDisk
{
string Map(string resourceUrl);
}
public class StaticResourceMapper : IMapHttpRequestsToDisk
{
public string Map(string resourceUrl)
{
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
path = path.Trim(Path.DirectorySeparatorChar).ToLower();
return Path.Combine("ui", path);
}
}
}

View File

@ -0,0 +1,60 @@
using System.Linq;
using NLog;
using Nancy;
using Nancy.Responses;
using NzbDrone.Common;
namespace NzbDrone.Api.Frontend
{
public interface IProcessStaticResource
{
Response ProcessStaticResourceRequest(NancyContext context, string workingFolder);
}
public class StaticResourceProvider : IProcessStaticResource
{
private readonly DiskProvider _diskProvider;
private readonly IMapHttpRequestsToDisk _requestMapper;
private readonly Logger _logger;
public StaticResourceProvider(DiskProvider diskProvider, IMapHttpRequestsToDisk requestMapper, Logger logger)
{
_diskProvider = diskProvider;
_requestMapper = requestMapper;
_logger = logger;
}
public Response ProcessStaticResourceRequest(NancyContext context, string workingFolder)
{
var path = context.Request.Url.Path.ToLower();
if (IsStaticResource(path))
{
var filePath = _requestMapper.Map(path);
if (_diskProvider.FileExists(filePath))
{
return new GenericFileResponse(filePath);
}
_logger.Warn("Couldn't find file [{0}] for [{1}]", filePath, path);
}
return null;
}
private static readonly string[] Extensions = new[] { ".css", ".js", ".html", ".htm", ".jpg", ".jpeg", ".icon", ".gif", ".png", ".woff", ".ttf" };
private bool IsStaticResource(string path)
{
if (string.IsNullOrWhiteSpace(path))
{
return false;
}
return Extensions.Any(path.EndsWith);
}
}
}

View File

@ -2,17 +2,20 @@
using System.Collections.Generic;
using Autofac;
using NLog;
using Nancy;
using Nancy.Bootstrapper;
using Nancy.Bootstrappers.Autofac;
using Nancy.Conventions;
using Nancy.Diagnostics;
using NzbDrone.Api.ErrorManagement;
using NzbDrone.Api.Extensions;
using NzbDrone.Api.Frontend;
using NzbDrone.Common;
using NzbDrone.Core;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Lifecycle;
using SignalR;
using ErrorPipeline = NzbDrone.Api.ErrorManagement.ErrorPipeline;
namespace NzbDrone.Api
{
@ -41,7 +44,7 @@ protected override void ApplicationStartup(ILifetimeScope container, IPipelines
SignalRBootstraper.InitializeAutomapper(container);
RegisterReporting(container);
KickoffInitilizables(container);
ApplicationPipelines.OnError.AddItemToEndOfPipeline(container.Resolve<ErrorPipeline>().HandleException);
}
@ -77,7 +80,7 @@ protected override ILifetimeScope GetApplicationContainer()
var builder = new ContainerBuilder();
builder.RegisterCoreServices();
builder.RegisterApiServices();
var container = builder.Build();
return container;
@ -104,8 +107,10 @@ protected override DiagnosticsConfiguration DiagnosticsConfiguration
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
base.ConfigureConventions(nancyConventions);
Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("static", @"UI", new[] { ".css", ".js", ".html", ".htm", ".jpg", ".jpeg", ".icon", ".gif", ".png", ".woff", ".ttf" }));
var processors = ApplicationContainer.Resolve<IProcessStaticResource>();
Conventions.StaticContentsConventions.Add(processors.ProcessStaticResourceRequest);
}
}
public static class SignalRBootstraper

View File

@ -102,7 +102,9 @@
<Compile Include="Episodes\EpisodeResource.cs" />
<Compile Include="Extensions\NancyJsonSerializer.cs" />
<Compile Include="Extensions\Serializer.cs" />
<Compile Include="FrontendModule\IndexModule.cs" />
<Compile Include="Frontend\IndexModule.cs" />
<Compile Include="Frontend\StaticResourceProvider.cs" />
<Compile Include="Frontend\StaticResourceMapper.cs" />
<Compile Include="Missing\MissingResource.cs" />
<Compile Include="Missing\MissingModule.cs" />
<Compile Include="Resolvers\EndTimeResolver.cs" />

View File

@ -16,12 +16,6 @@ protected static ProgressNotification MockNotification
}
}
protected static void ThrowException()
{
throw new ApplicationException("This is a message for test exception");
}
protected FileStream OpenRead(params string[] path)
{
return File.OpenRead(Path.Combine(path));

View File

@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.IO;
using Moq;
using NLog;
@ -10,6 +9,32 @@
namespace NzbDrone.Test.Common
{
public abstract class TestBase<TSubject> : TestBase where TSubject : class
{
private TSubject _subject;
[SetUp]
public void CoreTestSetup()
{
_subject = null;
}
protected TSubject Subject
{
get
{
if (_subject == null)
{
_subject = Mocker.Resolve<TSubject>();
}
return _subject;
}
}
}
public abstract class TestBase : LoggingTest
{
protected const string INTEGRATION_TEST = "Integration Test";

View File

@ -42,6 +42,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NzbDrone.Api", "NzbDrone.Ap
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NzbDrone.Console", "NzbDrone.Console\NzbDrone.Console.csproj", "{3DCA7B58-B8B3-49AC-9D9E-56F4A0460976}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NzbDrone.Api.Test", "NzbDrone.Api.Test\NzbDrone.Api.Test.csproj", "{D18A5DEB-5102-4775-A1AF-B75DAAA8907B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
@ -104,6 +106,10 @@ Global
{3DCA7B58-B8B3-49AC-9D9E-56F4A0460976}.Debug|x86.Build.0 = Debug|x86
{3DCA7B58-B8B3-49AC-9D9E-56F4A0460976}.Release|x86.ActiveCfg = Release|x86
{3DCA7B58-B8B3-49AC-9D9E-56F4A0460976}.Release|x86.Build.0 = Release|x86
{D18A5DEB-5102-4775-A1AF-B75DAAA8907B}.Debug|x86.ActiveCfg = Debug|Any CPU
{D18A5DEB-5102-4775-A1AF-B75DAAA8907B}.Debug|x86.Build.0 = Debug|Any CPU
{D18A5DEB-5102-4775-A1AF-B75DAAA8907B}.Release|x86.ActiveCfg = Release|x86
{D18A5DEB-5102-4775-A1AF-B75DAAA8907B}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -114,6 +120,7 @@ Global
{C0EA1A40-91AD-4EEB-BD16-2DDDEBD20AE5} = {57A04B72-8088-4F75-A582-1158CF8291F7}
{35388E8E-0CDB-4A84-AD16-E4B6EFDA5D97} = {57A04B72-8088-4F75-A582-1158CF8291F7}
{BEC74619-DDBB-4FBA-B517-D3E20AFC9997} = {57A04B72-8088-4F75-A582-1158CF8291F7}
{D18A5DEB-5102-4775-A1AF-B75DAAA8907B} = {57A04B72-8088-4F75-A582-1158CF8291F7}
{FAFB5948-A222-4CF6-AD14-026BE7564802} = {47697CDB-27B6-4B05-B4F8-0CBE6F6EDF97}
{CADDFCE0-7509-4430-8364-2074E1EEFCA2} = {47697CDB-27B6-4B05-B4F8-0CBE6F6EDF97}
{6BCE712F-846D-4846-9D1B-A66B858DA755} = {F9E67978-5CD6-4A5F-827B-4249711C0B02}

View File

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

View File

@ -9,32 +9,20 @@
<link rel="apple-touch-icon" sizes="144x144" href="Static/Content/Images/apple-touch-icon-144.png" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,600,300' rel='stylesheet' type='text/css'>
<link href="/static/content/bootstrap.css" rel='stylesheet' type='text/css' />
<link href="/static/content/bootstrap.slider.css" rel='stylesheet' type='text/css' />
<link href="/static/content/bootstrapSwitch.css" rel='stylesheet' type='text/css' />
<link href="/static/content/base.css" rel='stylesheet' type='text/css' />
<link href="/static/content/theme.css" rel='stylesheet' type='text/css'>
<link href="/static/content/toastr.css" rel='stylesheet' type='text/css'>
<link href="/static/content/fullcalendar.css" rel='stylesheet' type='text/css'>
<link href="/static/content/tablesorter.bootstrap.css" rel='stylesheet' type='text/css' />
<link href="/static/content/tablesorter.pager.css" rel='stylesheet' type='text/css' />
<link href="/static/AddSeries/addseries.css" rel='stylesheet' type='text/css' />
<link href="/static/content/menu.css" rel='stylesheet' type='text/css' />
<link href="/static/content/form.css" rel='stylesheet' type='text/css' />
<link href="/static/content/settings.quality.css" rel='stylesheet' type='text/css' />
<link href="/content/bootstrap.css" rel='stylesheet' type='text/css' />
<link href="/content/bootstrap.slider.css" rel='stylesheet' type='text/css' />
<link href="/content/bootstrapSwitch.css" rel='stylesheet' type='text/css' />
<link href="/content/base.css" rel='stylesheet' type='text/css' />
<link href="/content/theme.css" rel='stylesheet' type='text/css'>
<link href="/content/toastr.css" rel='stylesheet' type='text/css'>
<link href="/content/fullcalendar.css" rel='stylesheet' type='text/css'>
<link href="/content/tablesorter.bootstrap.css" rel='stylesheet' type='text/css' />
<link href="/content/tablesorter.pager.css" rel='stylesheet' type='text/css' />
<link href="/AddSeries/addseries.css" rel='stylesheet' type='text/css' />
<link href="/content/menu.css" rel='stylesheet' type='text/css' />
<link href="/content/form.css" rel='stylesheet' type='text/css' />
<link href="/content/settings.quality.css" rel='stylesheet' type='text/css' />
</head>
<script type="text/html" id="notification-template">
<div class="alert alert-{{level}}">
<button type="button" class="close x-close icon-remove-sign"></button>
<i class="{{iconClass}}" /><strong>{{title}}</strong>
{{#if isPreFormatted}}
<pre>{{{preFormattedMessage}}}</pre>
{{else}}
{{message}}
{{/if}}
</div>
</script>
<body>
<div id="in-nav">
<div class="container">
@ -100,27 +88,29 @@
</div>
</footer>
</body>
<script src="/static/JsLibraries/jquery.js"></script>
<script src="/static/JsLibraries/bootstrap.js"></script>
<script src="/static/JsLibraries/bootstrap.slider.js"></script>
<script src="/static/JsLibraries/bootstrapSwitch.js"></script>
<script src="/static/JsLibraries/underscore.js"></script>
<script src="/static/JsLibraries/handlebars.js"></script>
<script src="/static/JsLibraries/backbone.js"></script>
<script src="/static/JsLibraries/backbone.modelbinder.js"></script>
<script src="/static/JsLibraries/backbone.mutators.js"></script>
<script src="/static/JsLibraries/backbone.marionette.js"></script>
<script src="/static/JsLibraries/jquery.tablesorter.js"></script>
<script src="/static/JsLibraries/jquery.tablesorter.bootstrap.js"></script>
<script src="/static/JsLibraries/jquery.tablesorter.pager.js"></script>
<script src="/static/JsLibraries/sugar.js"></script>
<script src="/static/JsLibraries/fullcalendar.js"></script>
<script src="/JsLibraries/jquery.js"></script>
<script src="/JsLibraries/bootstrap.js"></script>
<script src="/JsLibraries/bootstrap.slider.js"></script>
<script src="/JsLibraries/bootstrapSwitch.js"></script>
<script src="/JsLibraries/underscore.js"></script>
<script src="/JsLibraries/handlebars.js"></script>
<script src="/JsLibraries/backbone.js"></script>
<script src="/JsLibraries/backbone.modelbinder.js"></script>
<script src="/JsLibraries/backbone.mutators.js"></script>
<script src="/JsLibraries/backbone.marionette.js"></script>
<script src="/JsLibraries/jquery.tablesorter.js"></script>
<script src="/JsLibraries/jquery.tablesorter.bootstrap.js"></script>
<script src="/JsLibraries/jquery.tablesorter.pager.js"></script>
<script src="/JsLibraries/sugar.js"></script>
<script src="/JsLibraries/fullcalendar.js"></script>
<script src="/static/Mixins/backbone.marionette.templates.js"></script>
<script src="/static/Mixins/backbone.ajax.js"></script>
<script src="/static/Mixins/tablesorter.extensions.js"></script>
<script src="/static/Mixins/spoon.js"></script>
<script src="/templates.js"></script>
<script data-main="/static/app" src="/static/JsLibraries/require.js"></script>
<script src="/static/Routing.js"></script>
<script src="/Mixins/backbone.marionette.templates.js"></script>
<script src="/Mixins/backbone.ajax.js"></script>
<script src="/Mixins/tablesorter.extensions.js"></script>
<script src="/Mixins/spoon.js"></script>
<script data-main="/app" src="/JsLibraries/require.js"></script>
<script src="/Routing.js"></script>
</html>

View File

@ -1,37 +1,23 @@
_.extend(Marionette.TemplateCache.prototype, {
"use strict";
loadTemplate:function (templateId) {
Marionette.TemplateCache.get = function (templateId) {
var templateFunction = window.Templates[templateId];
if (!templateFunction) {
console.error('couldn\'t find pre-compiled template ' + templateId);
}
var template;
var templateName = templateId;
console.log("Loading template '" + templateId + "'");
if (templateId.startsWith('#')) {
return $(templateId).html();
return function (data) {
try {
console.log('rendering template ' + templateName);
return templateFunction(data);
}
$.ajax({
url:'/static/' + templateId + '.html',
cache:false,
async:false
}).done(function (data) {
template = data;
}).fail(function (data) {
console.log("couldn't load template " + this.templateId + " Error: " + data.statusText);
template = "<div class='alert alert-error'>Couldn't load template '" + templateId + "'. Status: " + data.statusText + "</div>";
});
return template;
}
});
_.extend(Marionette.TemplateCache.prototype, {
compileTemplate:function (rawTemplate) {
return Handlebars.compile(rawTemplate);
}
});
catch (error) {
console.error('template render failed for ' + templateName + ' ' + error.message);
console.error(data);
}
};
};

View File

@ -1,22 +1,23 @@
require(['app','Controller'], function (app, controller) {
"use strict";
require(['app', 'Controller'], function (app, controller) {
NzbDrone.Router = Backbone.Marionette.AppRouter.extend({
controller: controller,
appRoutes: {
'': 'series',
'series': 'series',
'series/index': 'series',
'series/add': 'addSeries',
appRoutes : {
'' : 'series',
'series' : 'series',
'series/index' : 'series',
'series/add' : 'addSeries',
'series/add/:action(/:query)': 'addSeries',
'series/details/:query': 'seriesDetails',
'upcoming': 'upcoming',
'upcoming/index': 'upcoming',
'calendar': 'calendar',
'settings': 'settings',
'settings/:action(/:query)': 'settings',
'missing': 'missing',
':whatever': 'notFound'
'series/details/:query' : 'seriesDetails',
'upcoming' : 'upcoming',
'upcoming/index' : 'upcoming',
'calendar' : 'calendar',
'settings' : 'settings',
'settings/:action(/:query)' : 'settings',
'missing' : 'missing',
':whatever' : 'notFound'
}
});

View File

@ -1,6 +1,7 @@
define(['app'],function () {
"use strict";
define(['app'],function () {
NzbDrone.Shared.NotFoundView = Backbone.Marionette.ItemView.extend({
template: 'Shared/notfoundtemplate',
template: 'Shared/notfoundtemplate'
});
});

View File

@ -0,0 +1,10 @@
<div class="alert alert-{{level}}">
<button type="button" class="close x-close icon-remove-sign"></button>
<i class="{{iconClass}}" /><strong>{{title}}</strong>
{{#if isPreFormatted}}
<pre>{{{preFormattedMessage}}}</pre>
{{else}}
{{message}}
{{/if}}
</div>

View File

@ -1,7 +1,9 @@
define(['app', 'Shared/NotificationCollection'], function (app, notificationCollection) {
"use strict";
define(['app', 'Shared/NotificationCollection'], function (app, notificationCollection) {
var notificationItemView = Backbone.Marionette.ItemView.extend({
template: '#notification-template',
template: 'Shared/NotificationTemplate',
events: {
'click .x-close': 'kill'