This commit is contained in:
Jamie Rees 2016-03-01 20:32:23 +00:00
commit 0e2f5bbf98
50 changed files with 1832 additions and 176 deletions

View file

@ -1,9 +1,16 @@
using Nancy;
using Mono.Data.Sqlite;
using Nancy;
using Nancy.Authentication.Forms;
using Nancy.Bootstrapper;
using Nancy.TinyIoc;
using RequestPlex.Core;
using RequestPlex.Core.SettingModels;
using RequestPlex.Helpers;
using RequestPlex.Store;
using RequestPlex.Store.Models;
using RequestPlex.Store.Repository.NZBDash.DataAccessLayer.Repository;
using FormsAuthentication = Nancy.Authentication.Forms.FormsAuthentication;
@ -17,8 +24,22 @@ namespace RequestPlex.UI
protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context)
{
base.ConfigureRequestContainer(container, context);
container.Register<IUserMapper, UserMapper>();
base.ConfigureRequestContainer(container, context);
container.Register<ISqliteConfiguration, DbConfiguration>(new DbConfiguration(new SqliteFactory()));
container.Register<ISettingsRepository, JsonRepository>();
container.Register<ICacheProvider, MemoryCacheProvider>();
container.Register<ISettingsService<RequestPlexSettings>, SettingsServiceV2<RequestPlexSettings>>();
container.Register<IRepository<RequestedModel>, GenericRepository<RequestedModel>>();
}
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)

View file

@ -0,0 +1,71 @@
Handlebars.registerHelper('if_eq', function (a, b, opts) {
if (a == b)
return opts.fn(this);
else
return opts.inverse(this);
});
var searchSource = $("#search-template").html();
var searchTemplate = Handlebars.compile(searchSource);
var movieTimer = 0;
var tvimer = 0;
movieLoad();
tvLoad();
function movieLoad() {
$("#movieList").html("");
$.ajax("/requests/movies/").success(function (results) {
results.forEach(function (result) {
var context = buildMovieRequestContext(result);
var html = searchTemplate(context);
$("#movieList").append(html);
});
});
};
function tvLoad() {
$("#tvList").html("");
$.ajax("/requests/tvshows/").success(function (results) {
results.forEach(function (result) {
var context = buildTvShowRequestContext(result);
var html = searchTemplate(context);
$("#tvList").append(html);
});
});
};
function buildMovieRequestContext(result) {
var date = new Date(result.releaseDate);
var year = date.getFullYear();
var context = {
posterPath: result.posterPath,
id: result.tmdbid,
title: result.title,
overview: result.overview,
year: year,
type: "movie",
status: result.status
};
return context;
}
function buildTvShowRequestContext(result) {
var date = new Date(result.releaseDate);
var year = date.getFullYear();
var context = {
posterPath: result.posterPath,
id: result.tmdbid,
title: result.name,
overview: result.overview,
year: year,
type: "tv",
status: result.status
};
return context;
}

View file

@ -1,26 +1,66 @@
var searchSource = $("#search-template").html();
Handlebars.registerHelper('if_eq', function (a, b, opts) {
if (a == b)
return opts.fn(this);
else
return opts.inverse(this);
});
var searchSource = $("#search-template").html();
var searchTemplate = Handlebars.compile(searchSource);
var movieTimer = 0;
var tvimer = 0;
$("#movieSearchContent").on("keyup", function (e) {
$("#movieSearchContent").keypress(function (e) {
if (movieTimer) {
clearTimeout(movieTimer);
}
movieTimer = setTimeout(movieSearch, 400);
});
$("#tvSearchContent").on("keyup", function (e) {
$("#tvSearchContent").keypress(function (e) {
if (tvimer) {
clearTimeout(tvimer);
}
tvimer = setTimeout(tvSearch(), 400);
});
$("#test").click(function (e) {
$(document).on("click", ".dropdownTv", function (e) {
e.preventDefault();
console.log(e.target.id);
var $form = $('#form'+e.target.id);
var data = $form.serialize();
var seasons = $(this).attr("season-select");
console.log(data);
if (seasons === "1") {
data = data + "&latest=true";
}
$.ajax({
type: $form.prop('method'),
url: $form.prop('action'),
data: data,
dataType: "json",
success: function (response) {
console.log(response);
if (response.result === true) {
generateNotify("Success!", "success");
} else {
generateNotify(response.message, "warning");
}
},
error: function (e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
}
});
});
$(document).on("click", ".requestMovie", function (e) {
e.preventDefault();
console.log(e.target.id);
var $form = $('#form' + e.target.id);
$.ajax({
type: $form.prop('method'),
@ -29,10 +69,10 @@ $("#test").click(function (e) {
dataType: "json",
success: function (response) {
console.log(response);
if (response.Result === true) {
if (response.result === true) {
generateNotify("Success!", "success");
} else {
generateNotify(response.Message, "warning");
generateNotify(response.message, "warning");
}
},
error: function (e) {
@ -71,35 +111,3 @@ function tvSearch() {
});
};
function buildMovieContext(result) {
var date = new Date(result.releaseDate);
var year = date.getFullYear();
var context = {
posterPath: result.posterPath,
id: result.id,
title: result.title,
overview: result.overview,
voteCount: result.voteCount,
voteAverage: result.voteAverage,
year: year,
type : "movie"
};
return context;
}
function buildTvShowContext(result) {
var date = new Date(result.firstAirDate);
var year = date.getFullYear();
var context = {
posterPath: result.posterPath,
id: result.id,
title: result.name,
overview: result.overview,
voteCount: result.voteCount,
voteAverage: result.voteAverage,
year: year,
type: "tv"
};
return context;
}

View file

@ -1,7 +1,4 @@

function generateNotify(message, type) {
function generateNotify(message, type) {
// type = danger, warning, info, successs
$.notify({
// options
@ -10,4 +7,37 @@ function generateNotify(message, type) {
// settings
type: type
});
}
}
function buildMovieContext(result) {
var date = new Date(result.releaseDate);
var year = date.getFullYear();
var context = {
posterPath: result.posterPath,
id: result.id,
title: result.title,
overview: result.overview,
voteCount: result.voteCount,
voteAverage: result.voteAverage,
year: year,
type: "movie"
};
return context;
}
function buildTvShowContext(result) {
var date = new Date(result.firstAirDate);
var year = date.getFullYear();
var context = {
posterPath: result.posterPath,
id: result.id,
title: result.name,
overview: result.overview,
voteCount: result.voteCount,
voteAverage: result.voteAverage,
year: year,
type: "tv"
};
return context;
}

View file

@ -1,7 +1,29 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: AdminModule.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Dynamic;
using System.Linq;
using System.Web.UI;
@ -9,18 +31,20 @@ using Nancy;
using Nancy.Extensions;
using Nancy.ModelBinding;
using Nancy.Security;
using Newtonsoft.Json;
using RequestPlex.Api;
using RequestPlex.Core;
using RequestPlex.Store;
using RequestPlex.Core.SettingModels;
using RequestPlex.UI.Models;
namespace RequestPlex.UI.Modules
{
public class AdminModule : NancyModule
{
public AdminModule()
private ISettingsService<RequestPlexSettings> Service { get; set; }
public AdminModule(ISettingsService<RequestPlexSettings> service)
{
Service = service;
#if !DEBUG
this.RequiresAuthentication();
#endif
@ -41,8 +65,8 @@ namespace RequestPlex.UI.Modules
dynamic model = new ExpandoObject();
model.Errored = Request.Query.error.HasValue;
model.Port = null;
var s = new SettingsService();
var settings = s.GetSettings();
var settings = Service.GetSettings();
if (settings != null)
{
model.Port = settings.Port;
@ -54,10 +78,9 @@ namespace RequestPlex.UI.Modules
private Response SaveAdmin()
{
var model = this.Bind<SettingsModel>();
var model = this.Bind<RequestPlexSettings>();
var s = new SettingsService();
s.SaveSettings(model);
Service.SaveSettings(model);
return Context.GetRedirect("~/admin");
@ -74,20 +97,19 @@ namespace RequestPlex.UI.Modules
var plex = new PlexApi();
var model = plex.GetToken(user.username, user.password);
var s = new SettingsService();
var oldSettings = s.GetSettings();
var oldSettings = Service.GetSettings();
if (oldSettings != null)
{
oldSettings.PlexAuthToken = model.user.authentication_token;
s.SaveSettings(oldSettings);
Service.SaveSettings(oldSettings);
}
else
{
var newModel = new SettingsModel
var newModel = new RequestPlexSettings
{
PlexAuthToken = model.user.authentication_token
};
s.SaveSettings(newModel);
Service.SaveSettings(newModel);
}
return Context.GetRedirect("~/admin");
@ -96,8 +118,7 @@ namespace RequestPlex.UI.Modules
private Response GetUsers()
{
var s = new SettingsService();
var token = s.GetSettings().PlexAuthToken;
var token = Service.GetSettings().PlexAuthToken;
var api = new PlexApi();
var users = api.GetUsers(token);
var usernames = users.User.Select(x => x.Username);

View file

@ -1,4 +1,6 @@
using Nancy;
using Nancy.Extensions;
using Nancy.Responses;
namespace RequestPlex.UI.Modules
{
@ -6,8 +8,8 @@ namespace RequestPlex.UI.Modules
{
public IndexModule()
{
Get["/"] = parameters => View["Index"];
Get["/Index"] = parameters => View["Index"];
Get["/"] = parameters => Context.GetRedirect("~/search");
Get["/Index"] = parameters => Context.GetRedirect("~/search");
}
}
}

View file

@ -1,12 +1,43 @@
using System.Linq;
using Nancy;
using Nancy.Responses.Negotiation;
using RequestPlex.Api;
using RequestPlex.Core;
using RequestPlex.Core.SettingModels;
using RequestPlex.Store;
namespace RequestPlex.UI.Modules
{
public class RequestsModule : NancyModule
{
public RequestsModule()
private IRepository<RequestedModel> Service { get; set; }
public RequestsModule(IRepository<RequestedModel> service)
{
Get["requests/"] = _ => "Hello!";
Service = service;
Get["requests/"] = _ => LoadRequests();
Get["requests/movies"] = _ => GetMovies();
Get["requests/tvshows"] = _ => GetTvShows();
}
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);
}
}
}

View file

@ -37,7 +37,7 @@ namespace RequestPlex.UI.Modules
Post["search/request/tv"] = parameters =>
{
var tvShowId = (int)Request.Form.tvId;
var latest = (bool)Request.Form.latestSeason;
var latest = (bool)Request.Form.latest;
return RequestTvShow(tvShowId, latest);
};
}
@ -49,7 +49,6 @@ namespace RequestPlex.UI.Modules
private Response SearchMovie(string searchTerm)
{
var s = new SettingsService();
var api = new TheMovieDbApi();
var movies = api.SearchMovie(searchTerm);
var result = movies.Result;
@ -87,14 +86,25 @@ namespace RequestPlex.UI.Modules
{
return Response.AsJson(new { Result = false, Message = "Movie has already been requested!" });
}
s.AddRequest(movieId, RequestType.Movie);
return Response.AsJson(new { Result = true });
}
/// <summary>
/// Requests the tv show.
/// </summary>
/// <param name="showId">The show identifier.</param>
/// <param name="latest">if set to <c>true</c> [latest].</param>
/// <returns></returns>
private Response RequestTvShow(int showId, bool latest)
{
// Latest send to Sonarr and no need to store in DB
var s = new SettingsService();
if (s.CheckRequest(showId))
{
return Response.AsJson(new { Result = false, Message = "TV Show has already been requested!" });
}
s.AddRequest(showId, RequestType.TvShow);
return Response.AsJson(new {Result = true });
}

View file

@ -2,9 +2,15 @@
using Microsoft.Owin.Hosting;
using Mono.Data.Sqlite;
using Nancy.Hosting.Self;
using RequestPlex.Core;
using RequestPlex.Core.SettingModels;
using RequestPlex.Helpers;
using RequestPlex.Store;
using RequestPlex.Store.Repository.NZBDash.DataAccessLayer.Repository;
namespace RequestPlex.UI
{
@ -16,10 +22,10 @@ namespace RequestPlex.UI
var s = new Setup();
s.SetupDb();
var service = new SettingsService();
var service = new SettingsServiceV2<RequestPlexSettings>(new JsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));
var settings = service.GetSettings();
if (settings != null)
if (settings.Port != 0)
{
uri = $"http://localhost:{settings.Port}";
}

View file

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RequestPlex.UI")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -8,11 +8,26 @@
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RequestPlex.UI</RootNamespace>
<AssemblyName>RequestPlex.UI</AssemblyName>
<AssemblyName>RequestPlex</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -23,6 +38,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -50,6 +66,10 @@
<HintPath>..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Data.Sqlite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Assemblies\Mono.Data.Sqlite.dll</HintPath>
</Reference>
<Reference Include="Nancy">
<HintPath>..\packages\Nancy.1.4.1\lib\net40\Nancy.dll</HintPath>
</Reference>
@ -71,10 +91,6 @@
<Reference Include="Nancy.ViewEngines.Razor">
<HintPath>..\packages\Nancy.Viewengines.Razor.1.4.1\lib\net40\Nancy.ViewEngines.Razor.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
<Private>True</Private>
@ -84,8 +100,11 @@
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll</HintPath>
@ -137,6 +156,9 @@
<Content Include="Content\jquery-2.2.1.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\requests.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\site.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -188,6 +210,9 @@
<Content Include="Views\Login\Register.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Views\Requests\Index.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="Web.Debug.config">
<DependentUpon>web.config</DependentUpon>
</None>
@ -197,7 +222,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Auth\" />
<Folder Include="Views\Requests\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RequestPlex.Api\RequestPlex.Api.csproj">
@ -208,6 +232,10 @@
<Project>{DD7DC444-D3BF-4027-8AB9-EFC71F5EC581}</Project>
<Name>RequestPlex.Core</Name>
</ProjectReference>
<ProjectReference Include="..\RequestPlex.Helpers\RequestPlex.Helpers.csproj">
<Project>{1252336D-42A3-482A-804C-836E60173DFA}</Project>
<Name>RequestPlex.Helpers</Name>
</ProjectReference>
<ProjectReference Include="..\RequestPlex.Store\RequestPlex.Store.csproj">
<Project>{92433867-2B7B-477B-A566-96C382427525}</Project>
<Name>RequestPlex.Store</Name>
@ -218,6 +246,18 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>

View file

@ -1,4 +1,6 @@
using Owin;
using System;
using Owin;
namespace RequestPlex.UI
{
@ -6,7 +8,16 @@ namespace RequestPlex.UI
{
public void Configuration(IAppBuilder app)
{
try
{
app.UseNancy();
}
catch (Exception exception)
{
Console.WriteLine(exception.Message);
throw;
}
}
}
}

View file

@ -2,7 +2,7 @@
@{
int port;
var authToken = string.Empty;
if (Model.Port == null)
if (Model.Port == 0)
{
port = 3579;
}
@ -44,7 +44,7 @@
<input type="text" class="form-control" id="username" name="Username" placeholder="Username">
</div>
<div class="col-lg-4 col-lg-push-1">
<input type="password" class="form-control" id="password" name="Username" placeholder="Password">
<input type="password" class="form-control" id="password" name="Password" placeholder="Password">
</div>
</div>
<div class="form-group">
@ -69,10 +69,10 @@
</div>
</div>
<br/>
<br/>
<br/>
<br/>
<br />
<br />
<br />
<br />
<div>
<small class="col-lg-10 col-lg-offset-2">Please note, you will have to restart after changing these settings.</small>
</div>
@ -98,9 +98,11 @@
<script>
$(function () {
if ($('#PlexAuthToken')) {
loadUserList();
}
$('#refreshUsers').click(function() {
$('#refreshUsers').click(function () {
loadUserList();
});

View file

@ -0,0 +1,63 @@
<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">
<span class="label label-success">{{status}}</span>
<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>

View file

@ -51,20 +51,37 @@
<img src="http://image.tmdb.org/t/p/w150/{{posterPath}}" alt="poster">
{{/if}}
</div>
<div class="col-sm-5">
<div class="col-sm-5 ">
<div>
<a href="https://www.themoviedb.org/{{type}}/{{id}}">
<h4>{{title}} ({{year}})</h4>
</a>
</div>
<p>{{overview}}.</p>
<p>{{overview}}</p>
</div>
<div class="col-sm-5">
<small>Vote Average: {{voteAverage}}</small>
<small>Vote Count: {{voteCount}}</small>
<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="test" style="text-align: right" class="btn btn-primary bottom-align-text requestClass" type="submit"><i class="fa fa-plus"></i>Request</button>
<input name="{{type}}Id" type="text" value="{{id}}" hidden="hidden" />
{{#if_eq type "movie"}}
<button id="{{id}}" style="text-align: right" class="btn btn-primary requestMovie" type="submit"><i class="fa fa-plus"></i> Request</button>
{{/if_eq}}
{{#if_eq type "tv"}}
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-plus"></i> Request
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><a id="{{id}}" season-select="0" class="dropdownTv " href="#">All Seasons</a></li>
<li><a id="{{id}}" season-select="1" class="dropdownTv" href="#">Latest Season</a></li>
</ul>
</div>
{{/if_eq}}
<br />
<br />
<br />
<small class="row">Vote Average: {{voteAverage}}</small>
<small class="row">Vote Count: {{voteCount}}</small>
</form>
</div>

View file

@ -1,19 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="webPages:Enabled" value="false" />
</appSettings>
<system.web.webPages.razor>
<pages pageBaseType="Nancy.ViewEngines.Razor.NancyRazorViewBase">
<namespaces>
<add namespace="Nancy.ViewEngines.Razor" />
</namespaces>
</pages>
</system.web.webPages.razor>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="webPages:Enabled" value="false" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<system.web.webPages.razor>
<pages pageBaseType="Nancy.ViewEngines.Razor.NancyRazorViewBase">
<namespaces>
<add namespace="Nancy.ViewEngines.Razor" />
</namespaces>
</pages>
</system.web.webPages.razor>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>

View file

@ -10,7 +10,6 @@
<package id="Nancy.Hosting.Self" version="1.4.1" requireReinstallation="true" />
<package id="Nancy.Owin" version="1.4.1" targetFramework="net452" />
<package id="Nancy.Viewengines.Razor" version="1.4.1" requireReinstallation="true" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
<package id="Owin" version="1.0" targetFramework="net452" />
<package id="RestSharp" version="105.2.3" targetFramework="net452" />
<package id="TMDbLib" version="0.9.0.0-alpha" targetFramework="net452" />