mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-10 15:32:37 -07:00
Finished #925
This commit is contained in:
parent
8e2b5bd167
commit
39d77cdb19
6 changed files with 141 additions and 82 deletions
|
@ -16,32 +16,44 @@ var base = $('#baseUrl').text();
|
|||
var tvLoaded = false;
|
||||
var albumLoaded = false;
|
||||
|
||||
var isAdmin = $('#isAdmin').text();
|
||||
var isAdmin = $('#isAdmin').text() === "True";
|
||||
|
||||
var adminFilter = $('#adminFilter').text();
|
||||
var adminFilterText = $('#adminFilterText').text();
|
||||
var adminSort = $('#adminSort').text();
|
||||
var adminSortText = $('#adminSortText').text();
|
||||
|
||||
var defaultFilterText = $('#defaultFilterText').text();
|
||||
var defaultSortText = $('#defaultSortText').text();
|
||||
|
||||
|
||||
var defaultFiler = isAdmin == 'True' ? '.approved-fase' : 'all';
|
||||
$("#filterText").text(isAdmin ? adminFilterText : defaultFilterText);
|
||||
$("#sortText").text(isAdmin ? adminSortText : defaultSortText);
|
||||
|
||||
var url = createBaseUrl(base, '/requests/UpdateFilters');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
// Loop through all the filters to set the correct one to checked
|
||||
selectCheckboxes('.filter', isAdmin ? adminFilterText : defaultFilterText);
|
||||
selectCheckboxes('.sort', isAdmin ? adminSortText : defaultSortText);
|
||||
|
||||
mixItUpDefault.load.filter = response.defaultFilter;
|
||||
mixItUpDefault.load.sort = response.defaultSort;
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong saving your filter!", "danger");
|
||||
}
|
||||
});
|
||||
|
||||
function selectCheckboxes(className, text) {
|
||||
$(className).each(function (i, obj) {
|
||||
|
||||
var $element = $(obj.children[0]);
|
||||
if (obj.text === " " + text) {
|
||||
$element.removeClass('fa-square-o').addClass('fa-check-square');
|
||||
} else {
|
||||
if ($element.hasClass('fa-check-square')) {
|
||||
$element.removeClass('fa-check-square').addClass('fa-square-o');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var mixItUpDefault = {
|
||||
animation: { enable: true },
|
||||
load: {
|
||||
filter: defaultFiler,
|
||||
sort: 'requestorder:desc'
|
||||
filter: isAdmin ? adminFilter : 'all',
|
||||
sort: isAdmin ? adminSort : 'requestorder:desc'
|
||||
},
|
||||
layout: {
|
||||
display: 'block'
|
||||
|
@ -293,6 +305,9 @@ $('.sort', '.dropdown-menu').click(function (e) {
|
|||
var $this = $(this);
|
||||
$('.fa-check-square', $this.parents('.dropdown-menu:first')).removeClass('fa-check-square').addClass('fa-square-o');
|
||||
$this.children('.fa').first().removeClass('fa-square-o').addClass('fa-check-square');
|
||||
$("#sortText").fadeOut(function () {
|
||||
$(this).text($this.text().trim());
|
||||
}).fadeIn();
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -37,13 +37,19 @@ namespace Ombi.UI.Models.Admin
|
|||
public class CustomizationViewModel
|
||||
{
|
||||
public CustomizationSettings Settings { get; set; }
|
||||
public List<Dropdown<Languages>> LanguageDropdown { get; set; } = new List<Dropdown<Languages>>();
|
||||
public List<Dropdown<FilterOptions>> FilterOptions { get; set; } = new List<Dropdown<FilterOptions>>();
|
||||
public List<Dropdown<Languages>> LanguageDropdown { get; } = new List<Dropdown<Languages>>();
|
||||
public List<Dropdown<FilterOptions>> FilterOptions { get; } = new List<Dropdown<FilterOptions>>();
|
||||
public List<Dropdown<SortOptions>> SortOptions { get; set; } = new List<Dropdown<SortOptions>>();
|
||||
}
|
||||
|
||||
public enum FilterOptions
|
||||
{
|
||||
[Display(Name = "all", Description = "All")]
|
||||
All,
|
||||
[Display(Name = ".approved-true", Description = "Approved")]
|
||||
Approved,
|
||||
[Display(Name = ".approved-false", Description = "Not Approved")]
|
||||
NotApproved,
|
||||
[Display(Name = ".available-true", Description = "Available")]
|
||||
Available,
|
||||
[Display(Name = ".available-false", Description = "Not Available")]
|
||||
|
|
37
Ombi.UI/Models/Requests/RequestsIndexViewModel.cs
Normal file
37
Ombi.UI/Models/Requests/RequestsIndexViewModel.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2017 Jamie Rees
|
||||
// File: RequestsIndexViewModel.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 Ombi.Core.SettingModels;
|
||||
|
||||
namespace Ombi.UI.Models.Requests
|
||||
{
|
||||
public class RequestsIndexViewModel
|
||||
{
|
||||
public PlexRequestSettings PlexRequestSettings { get; set; }
|
||||
public CustomizationSettings CustomizationSettings { get; set; }
|
||||
}
|
||||
}
|
|
@ -44,6 +44,7 @@ using Ombi.Services.Notification;
|
|||
using Ombi.Store;
|
||||
using Ombi.UI.Models;
|
||||
using Ombi.UI.Models.Admin;
|
||||
using Ombi.UI.Models.Requests;
|
||||
using Action = Ombi.Helpers.Analytics.Action;
|
||||
using ISecurityExtensions = Ombi.Core.ISecurityExtensions;
|
||||
|
||||
|
@ -117,7 +118,9 @@ namespace Ombi.UI.Modules
|
|||
private async Task<Negotiator> LoadRequests()
|
||||
{
|
||||
var settings = await PrSettings.GetSettingsAsync();
|
||||
return View["Index", settings];
|
||||
var custom = await CustomizationSettings.GetSettingsAsync();
|
||||
|
||||
return View["Index", new RequestsIndexViewModel { CustomizationSettings = custom, PlexRequestSettings = settings }];
|
||||
}
|
||||
|
||||
private async Task<Response> GetMovies()
|
||||
|
@ -227,7 +230,7 @@ namespace Ombi.UI.Modules
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Info(e);
|
||||
Log.Info(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -316,7 +319,7 @@ namespace Ombi.UI.Modules
|
|||
return Response.AsJson(new JsonResponseModel { Result = true });
|
||||
}
|
||||
|
||||
|
||||
|
||||
Analytics.TrackEventAsync(Category.Requests, Action.Delete, "Delete Request", Username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||
|
||||
var currentEntity = await Service.GetAsync(requestid);
|
||||
|
|
|
@ -245,6 +245,7 @@
|
|||
<Compile Include="Models\LandingPageViewModel.cs" />
|
||||
<Compile Include="Models\MovieSearchType.cs" />
|
||||
<Compile Include="Models\QualityModel.cs" />
|
||||
<Compile Include="Models\Requests\RequestsIndexViewModel.cs" />
|
||||
<Compile Include="Models\ScheduledJobsViewModel.cs" />
|
||||
<Compile Include="Models\SearchViewModel.cs" />
|
||||
<Compile Include="Models\SearchMusicViewModel.cs" />
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
@using Nancy.Security
|
||||
@using Nancy.Security
|
||||
@using Ombi.Helpers
|
||||
@using Ombi.Helpers.Permissions
|
||||
@using Ombi.UI.Helpers
|
||||
@using Ombi.UI.Models.Admin
|
||||
@using Ombi.UI.Resources
|
||||
|
||||
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<Ombi.UI.Models.Requests.RequestsIndexViewModel>
|
||||
@{
|
||||
var baseUrl = Html.GetBaseUrl();
|
||||
var formAction = string.Empty;
|
||||
|
@ -11,29 +15,42 @@
|
|||
{
|
||||
formAction = "/" + baseUrl.ToHtmlString();
|
||||
}
|
||||
|
||||
var sortText = EnumHelper<SortOptions>.GetDisplayDescription((SortOptions) Model.CustomizationSettings.DefaultSort);
|
||||
var filterText = EnumHelper<FilterOptions>.GetDisplayDescription((FilterOptions) Model.CustomizationSettings.DefaultFilter);
|
||||
var defaultFilter = EnumHelper<FilterOptions>.GetDisplayValue((FilterOptions) Model.CustomizationSettings.DefaultFilter);
|
||||
var defaultSort = EnumHelper<SortOptions>.GetDisplayValue((SortOptions) Model.CustomizationSettings.DefaultSort);
|
||||
|
||||
}
|
||||
<div>
|
||||
<div hidden="hidden" id="isAdmin" >@isAdmin</div>
|
||||
<div hidden="hidden" id="isAdmin">@isAdmin</div>
|
||||
<div hidden="hidden" id="adminFilter">@defaultFilter</div>
|
||||
<div hidden="hidden" id="adminFilterText">@filterText</div>
|
||||
<div hidden="hidden" id="adminSort">@defaultSort</div>
|
||||
<div hidden="hidden" id="adminSortText">@sortText</div>
|
||||
<div hidden="hidden" id="defaultSortText">@UI.Requests_Order_LatestRequests</div>
|
||||
<div hidden="hidden" id="defaultFilterText">@UI.Requests_Filter_All</div>
|
||||
|
||||
<h1>@UI.Requests_Title</h1>
|
||||
<h4>@UI.Requests_Paragraph</h4>
|
||||
<br/>
|
||||
<br />
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul id="nav-tabs" class="nav nav-tabs" role="tablist">
|
||||
@if (Model.SearchForMovies)
|
||||
@if (Model.PlexRequestSettings.SearchForMovies)
|
||||
{
|
||||
<li role="presentation" class="active"><a href="#MoviesTab" aria-controls="home" role="tab" data-toggle="tab"><i class="fa fa-film"></i> @UI.Requests_MoviesTabTitle</a></li>
|
||||
}
|
||||
@if (Model.SearchForTvShows)
|
||||
@if (Model.PlexRequestSettings.SearchForTvShows)
|
||||
{
|
||||
<li role="presentation"><a href="#TvShowTab" aria-controls="profile" role="tab" data-toggle="tab"><i class="fa fa-television"></i>@UI.Requests_TvShowTabTitle</a></li>
|
||||
}
|
||||
@if (Model.SearchForMusic)
|
||||
@if (Model.PlexRequestSettings.SearchForMusic)
|
||||
{
|
||||
<li role="presentation"><a href="#MusicTab" aria-controls="profile" role="tab" data-toggle="tab"><i class="fa fa-music"></i> @UI.Requests_AlbumsTabTitle</a></li>
|
||||
}
|
||||
</ul>
|
||||
<br/>
|
||||
<br />
|
||||
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content contentList">
|
||||
|
@ -43,53 +60,33 @@
|
|||
<div class="btn-group btn-group-separated">
|
||||
@if (isAdmin)
|
||||
{
|
||||
@if (Model.SearchForMovies)
|
||||
{
|
||||
<button id="deleteMovies" class="btn btn-warning-outline delete-category" type="submit"><i class="fa fa-trash"></i> @UI.Requests_DeleteMovies</button>
|
||||
<button id="approveMovies" class="btn btn-success-outline approve-category" type="submit"><i class="fa fa-plus"></i> @UI.Requests_ApproveMovies</button>
|
||||
}
|
||||
@if (Model.SearchForTvShows)
|
||||
{
|
||||
<button id="deleteTVShows" class="btn btn-warning-outline delete-category" type="submit" style="display: none;"><i class="fa fa-trash"></i> @UI.Requests_DeleteTVShows</button>
|
||||
<button id="approveTVShows" class="btn btn-success-outline approve-category" type="submit" style="display: none;"><i class="fa fa-plus"></i> @UI.Requests_ApproveTvShows</button>
|
||||
}
|
||||
@if (Model.SearchForMusic)
|
||||
{
|
||||
<button id="deleteMusic" class="btn btn-warning-outline delete-category" type="submit" style="display: none;"><i class="fa fa-trash"></i> @UI.Requests_DeleteMusic</button>
|
||||
<button id="approveMusic" class="btn btn-success-outline approve-category" type="submit" style="display: none;"><i class="fa fa-plus"></i> @UI.Requests_ApproveMusic</button>
|
||||
}
|
||||
@if (Model.PlexRequestSettings.SearchForMovies)
|
||||
{
|
||||
<button id="deleteMovies" class="btn btn-warning-outline delete-category" type="submit"><i class="fa fa-trash"></i> @UI.Requests_DeleteMovies</button>
|
||||
<button id="approveMovies" class="btn btn-success-outline approve-category" type="submit"><i class="fa fa-plus"></i> @UI.Requests_ApproveMovies</button>
|
||||
}
|
||||
@if (Model.PlexRequestSettings.SearchForTvShows)
|
||||
{
|
||||
<button id="deleteTVShows" class="btn btn-warning-outline delete-category" type="submit" style="display: none;"><i class="fa fa-trash"></i> @UI.Requests_DeleteTVShows</button>
|
||||
<button id="approveTVShows" class="btn btn-success-outline approve-category" type="submit" style="display: none;"><i class="fa fa-plus"></i> @UI.Requests_ApproveTvShows</button>
|
||||
}
|
||||
@if (Model.PlexRequestSettings.SearchForMusic)
|
||||
{
|
||||
<button id="deleteMusic" class="btn btn-warning-outline delete-category" type="submit" style="display: none;"><i class="fa fa-trash"></i> @UI.Requests_DeleteMusic</button>
|
||||
<button id="approveMusic" class="btn btn-success-outline approve-category" type="submit" style="display: none;"><i class="fa fa-plus"></i> @UI.Requests_ApproveMusic</button>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<a href="#" class="btn btn-primary-outline dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
@if (isAdmin)
|
||||
{
|
||||
<span id="filterText">@UI.Requests_Filter_NotApproved</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span id="filterText">@UI.Requests_Filter_All</span>
|
||||
}
|
||||
<span id="filterText">@UI.Requests_Filter_All</span>
|
||||
<i class="fa fa-filter"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
@if (!isAdmin)
|
||||
{
|
||||
<li><a href="#" class="filter" data-filter="all"><i class="fa fa-check-square"></i> @UI.Requests_Filter_All</a></li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li><a href="#" class="filter" data-filter="all"><i class="fa fa-square-o"></i> @UI.Requests_Filter_All</a></li>
|
||||
}
|
||||
|
||||
<li><a href="#" class="filter" data-filter="all"><i class="fa fa-check-square"></i> @UI.Requests_Filter_All</a></li>
|
||||
<li><a href="#" class="filter" data-filter=".approved-true"><i class="fa fa-square-o"></i> @UI.Requests_Filter_Approved</a></li>
|
||||
@if (isAdmin)
|
||||
{
|
||||
<li><a href="#" class="filter" data-filter=".approved-false"><i class="fa fa-check-square"></i> @UI.Requests_Filter_NotApproved</a></li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li><a href="#" class="filter" data-filter=".approved-false"><i class="fa fa-square-o"></i> @UI.Requests_Filter_NotApproved</a></li>
|
||||
}
|
||||
<li><a href="#" class="filter" data-filter=".approved-false"><i class="fa fa-square-o"></i> @UI.Requests_Filter_NotApproved</a></li>
|
||||
<li><a href="#" class="filter" data-filter=".available-true"><i class="fa fa-square-o"></i> @UI.Requests_Filter_Available</a></li>
|
||||
<li><a href="#" class="filter" data-filter=".available-false"><i class="fa fa-square-o"></i> @UI.Requests_Filter_NotAvailable</a></li>
|
||||
<li><a href="#" class="filter" data-filter=".released-true"><i class="fa fa-square-o"></i> @UI.Requests_Filter_Released</a></li>
|
||||
|
@ -98,7 +95,7 @@
|
|||
</div>
|
||||
<div class="btn-group">
|
||||
<a href="#" class="btn btn-primary-outline dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
@UI.Requests_Order
|
||||
<span id="sortText">@UI.Requests_Order</span>
|
||||
<i class="fa fa-sort"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
|
@ -111,40 +108,40 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (Model.SearchForMovies)
|
||||
@if (Model.PlexRequestSettings.SearchForMovies)
|
||||
{
|
||||
|
||||
<!-- Movie tab -->
|
||||
<div role="tabpanel" class="tab-pane active" id="MoviesTab">
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br />
|
||||
<br />
|
||||
<!-- Movie content -->
|
||||
<div id="movieList">
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Model.SearchForTvShows)
|
||||
@if (Model.PlexRequestSettings.SearchForTvShows)
|
||||
{
|
||||
<!-- TV tab -->
|
||||
<div role="tabpanel" class="tab-pane" id="TvShowTab">
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br />
|
||||
<br />
|
||||
<!-- TV content -->
|
||||
<div id="tvList">
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Model.SearchForMusic)
|
||||
@if (Model.PlexRequestSettings.SearchForMusic)
|
||||
{
|
||||
<!-- Music tab -->
|
||||
<div role="tabpanel" class="tab-pane" id="MusicTab">
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<br />
|
||||
<br />
|
||||
<!-- TV content -->
|
||||
<div id="musicList">
|
||||
</div>
|
||||
|
@ -202,12 +199,12 @@
|
|||
<span class="label label-success">{{status}}</span>
|
||||
{{#if denied}}
|
||||
<div>
|
||||
Denied: <i style="color:red;" class="fa fa-check"></i>
|
||||
Denied: <i style="color:red;" class="fa fa-check"></i>
|
||||
{{#if deniedReason}}
|
||||
<span class="customTooltip" title="{{deniedReason}}"><i class="fa fa-info-circle"></i></span>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
|
||||
{{/if}}
|
||||
{{#if_eq releaseDate "01/01/0001 00:00:00"}} <!--TheTVDB didn't provide any premier info-->
|
||||
<div>@UI.Requests_ReleaseDate: {{releaseDate}}</div>
|
||||
|
@ -234,7 +231,7 @@
|
|||
<i id="availableIcon{{requestId}}" class="fa fa-check"></i>
|
||||
{{/if_eq}}
|
||||
</div>
|
||||
|
||||
|
||||
{{#if_eq type "tv"}}
|
||||
{{#if episodes}}
|
||||
Episodes: <span class="customTooltip" data-tooltip-content="#{{requestId}}toolTipContent"><i class="fa fa-info-circle"></i></span>
|
||||
|
@ -284,7 +281,7 @@
|
|||
<input name="reason" type="text" hidden="hidden" />
|
||||
<div class="btn-group btn-split">
|
||||
<button type="button" class="btn btn-sm btn-danger-outline deny" id="{{requestId}}deny" custom-button="{{requestId}}"><i class="fa fa-times"></i> Deny</button>
|
||||
<button type="button" class="btn btn-danger-outline dropdown-toggle" id="{{requestId}}denyToggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<button type="button" class="btn btn-danger-outline dropdown-toggle" id="{{requestId}}denyToggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
<span class="sr-only">@UI.Requests_ToggleDropdown</span>
|
||||
</button>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue