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

no more # in the url.

This commit is contained in:
kay.one 2013-02-17 19:04:28 -08:00
parent 893795d029
commit eb0ffa83b6
7 changed files with 62 additions and 40 deletions

View File

@ -1,5 +1,7 @@
using System.Linq;
using System;
using System.Linq;
using Nancy;
using Nancy.Responses.Negotiation;
namespace NzbDrone.Api.FrontendModule
{
@ -7,7 +9,22 @@ public class IndexModule : NancyModule
{
public IndexModule()
{
Get[@"/"] = x => View["NzbDrone.Backbone/index.html"];
//Serve anything that doesn't have an extension
Get[@"/(.*)"] = x => Index();
}
private object Index()
{
if(
Request.Path.Contains(".")
|| Request.Path.StartsWith("/static", StringComparison.CurrentCultureIgnoreCase)
|| Request.Path.StartsWith("/api", StringComparison.CurrentCultureIgnoreCase))
{
return new NotFoundResponse();
}
return View["NzbDrone.Backbone/index.html"];
}
}
}

View File

@ -9,14 +9,25 @@
<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/bootstrap.less" rel='stylesheet' type='text/css' />
<link href="static/Content/base.css" rel='stylesheet' type='text/css' />
<link href="static/Content/menu.css" rel='stylesheet' type='text/css' />
<link href="static/Content/tablesorter.bootstrap.css" rel='stylesheet' type='text/css' />
<link href="/static/content/bootstrap/bootstrap.less" rel='stylesheet' type='text/css' />
<link href="/static/Content/base.css" rel='stylesheet' type='text/css' />
<link href="/static/Content/menu.css" rel='stylesheet' type='text/css' />
<link href="/static/Content/tablesorter.bootstrap.css" rel='stylesheet' type='text/css' />
<link href="static/AddSeries/addseries.css" rel='stylesheet' type='text/css' />
<link href="/static/AddSeries/addseries.css" rel='stylesheet' type='text/css' />
</head>
S
<script type="text/html" id="notification-template">
<div class="alert alert-{{level}}">
<button type="button" class="close x-close">×</button>
<i class="{{iconClass}}" /><strong>{{title}}</strong>
{{#if isPreFormatted}}
<pre>{{{preFormattedMessage}}}</pre>
{{else}}
{{message}}
{{/if}}
</div>
</script>
<body>
<div class="container">
<div id="menu" class="row">
@ -57,29 +68,29 @@ S
<div id="footer-region" class="span20"></div>
</div>
</div>
<script src="static/JsLibraries/jquery.js"></script>
<script src="static/JsLibraries/bootstrap.js"></script>
<script src="static/JsLibraries/jquery.dataTables.js"></script>
<script src="static/JsLibraries/jquery.dataTables.extensions.js"></script>
<script src="static/JsLibraries/jquery.dataTables.bootstrap.pagination.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.js"></script>
<script src="/static/JsLibraries/bootstrap.js"></script>
<script src="/static/JsLibraries/jquery.dataTables.js"></script>
<script src="/static/JsLibraries/jquery.dataTables.extensions.js"></script>
<script src="/static/JsLibraries/jquery.dataTables.bootstrap.pagination.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.bootstrap.js"></script>
*@
<script src="static/JsLibraries/sugar.js"></script>
<script src="/static/JsLibraries/sugar.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/backbone.marionette.templates.js"></script>
<script src="/static/Mixins/backbone.ajax.js"></script>
<script src="/static/Mixins/tablesorter.extensions.js"></script>
<script data-main="static/app" src="static/JsLibraries/require.js"></script>
<script src="static/Routing.js"></script>
<script data-main="/static/app" src="/static/JsLibraries/require.js"></script>
<script src="/static/Routing.js"></script>
</body>
</html>

View File

@ -6,9 +6,13 @@
var template;
console.log("Loading template '" + templateId + "'");
if (templateId.startsWith('#')) {
return $(templateId).html();
}
$.ajax({
url:'static//' + templateId + '.html',
url:'/static/' + templateId + '.html',
cache:false,
async:false

View File

@ -129,7 +129,6 @@
<Content Include="Shared\ModalRegion.js" />
<Content Include="Shared\NotificationCollection.js" />
<Content Include="Shared\NotificationModel.js" />
<Content Include="Shared\NotificationTemplate.html" />
<Content Include="Shared\NotificationView.js" />
<Content Include="Shared\SpinnerTemplate.html" />
<Content Include="Shared\SpinnerView.js" />

View File

@ -16,7 +16,7 @@
NzbDrone.addInitializer(function () {
NzbDrone.Router = new NzbDrone.Router();
Backbone.history.start();
Backbone.history.start({ pushState: true });
});
});

View File

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

View File

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