mirror of https://github.com/Ombi-app/Ombi
parent
70362b908f
commit
98d143c9b2
@ -1,28 +1,43 @@
|
|||||||
|
using System.Linq;
|
||||||
|
|
||||||
using Nancy;
|
using Nancy;
|
||||||
|
using Nancy.Responses.Negotiation;
|
||||||
|
|
||||||
|
using RequestPlex.Api;
|
||||||
using RequestPlex.Core;
|
using RequestPlex.Core;
|
||||||
using RequestPlex.Core.SettingModels;
|
using RequestPlex.Core.SettingModels;
|
||||||
|
using RequestPlex.Store;
|
||||||
|
|
||||||
namespace RequestPlex.UI.Modules
|
namespace RequestPlex.UI.Modules
|
||||||
{
|
{
|
||||||
public class RequestsModule : NancyModule
|
public class RequestsModule : NancyModule
|
||||||
{
|
{
|
||||||
public RequestsModule(ISettingsService<RequestPlexSettings> s)
|
private IRepository<RequestedModel> Service { get; set; }
|
||||||
|
public RequestsModule(IRepository<RequestedModel> service)
|
||||||
{
|
{
|
||||||
Get["requests/"] = _ => "Hello!";
|
Service = service;
|
||||||
Get["requests/test"] = _ =>
|
|
||||||
{
|
Get["requests/"] = _ => LoadRequests();
|
||||||
var se = new RequestPlexSettings
|
Get["requests/movies"] = _ => GetMovies();
|
||||||
{
|
Get["requests/tvshows"] = _ => GetTvShows();
|
||||||
PlexAuthToken = "abc",
|
}
|
||||||
Port = 2344,
|
|
||||||
UserAuthentication = false
|
|
||||||
};
|
|
||||||
s.SaveSettings(se);
|
|
||||||
var a = s.GetSettings();
|
|
||||||
return "Hi!";
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
private Negotiator LoadRequests()
|
||||||
|
{
|
||||||
|
return View["Requests/Index"];
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response GetMovies()
|
||||||
|
{
|
||||||
|
var dbMovies = Service.GetAll().Where(x => x.Type == RequestType.Movie);
|
||||||
|
return Response.AsJson(dbMovies);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Response GetTvShows()
|
||||||
|
{
|
||||||
|
var dbTv = Service.GetAll().Where(x => x.Type == RequestType.TvShow);
|
||||||
|
return Response.AsJson(dbTv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
<div>
|
||||||
|
<h2>Requests</h2>
|
||||||
|
<!-- Nav tabs -->
|
||||||
|
<ul id="nav-tabs" class="nav nav-tabs" role="tablist">
|
||||||
|
<li role="presentation" class="active"><a href="#MoviesTab" aria-controls="home" role="tab" data-toggle="tab">Movies</a></li>
|
||||||
|
<li role="presentation"><a href="#TvShowTab" aria-controls="profile" role="tab" data-toggle="tab">TV Shows</a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- Tab panes -->
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<!-- Movie tab -->
|
||||||
|
<div role="tabpanel" class="tab-pane active" id="MoviesTab">
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<!-- Movie content -->
|
||||||
|
<div id="movieList">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TV tab -->
|
||||||
|
<div role="tabpanel" class="tab-pane" id="TvShowTab">
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<!-- TV content -->
|
||||||
|
<div id="tvList">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script id="search-template" type="text/x-handlebars-template">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2">
|
||||||
|
{{#if posterPath}}
|
||||||
|
<img src="http://image.tmdb.org/t/p/w150/{{posterPath}}" alt="poster">
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-5 ">
|
||||||
|
<div>
|
||||||
|
<a href="https://www.themoviedb.org/{{type}}/{{id}}">
|
||||||
|
<h4>{{title}} ({{year}})</h4>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<p>{{overview}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2 col-sm-push-3">
|
||||||
|
<form method="POST" action="/search/request/{{type}}" id="form{{id}}">
|
||||||
|
<input name="{{type}}Id" type="text" value="{{id}}" hidden="hidden" />
|
||||||
|
<button id="{{id}}" style="text-align: right" class="btn btn-primary requestMovie" type="submit"><i class="fa fa-plus"></i> TestBtn</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="/Content/requests.js" type="text/javascript"></script>
|
Loading…
Reference in new issue