1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-24 08:52:38 +00:00

Menus are now custom built, using AJAX loading of links where acceptable.

This commit is contained in:
Mark McDowall 2011-08-05 19:04:35 -07:00
parent 3d784b828d
commit aa82264774
16 changed files with 130 additions and 111 deletions

View file

@ -0,0 +1,20 @@
#sub-menu
{
padding-left: 5px;
}
#sub-menu li
{
display: inline;
list-style-type: none;
padding-left: 8px;
padding-right: 12px;
padding-top: 6px;
border-right: 1px solid #F0F0F0;
}
#sub-menu a
{
text-decoration: none;
color: #105CD6;
}

View file

@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NzbDrone.Core.Providers.Jobs;
namespace NzbDrone.Web.Controllers
{
public class CommandController : Controller
{
private readonly JobProvider _jobProvider;
public CommandController(JobProvider jobProvider)
{
_jobProvider = jobProvider;
}
public JsonResult RssSync()
{
_jobProvider.QueueJob(typeof(RssSyncJob));
return new JsonResult { Data = "ok" };
}
public JsonResult SyncEpisodesOnDisk(int seriesId)
{
//Syncs the episodes on disk for the specified series
_jobProvider.QueueJob(typeof(DiskScanJob), seriesId);
return new JsonResult { Data = "ok" };
}
public JsonResult UpdateInfo(int seriesId)
{
//Syncs the episodes on disk for the specified series
_jobProvider.QueueJob(typeof(UpdateInfoJob), seriesId);
return new JsonResult { Data = "ok" };
}
public JsonResult RenameSeries(int seriesId)
{
//Syncs the episodes on disk for the specified series
//_jobProvider.QueueJob(typeof(UpdateInfoJob), seriesId);
return new JsonResult { Data = "ok" };
}
}
}

View file

@ -26,16 +26,16 @@ public ActionResult Index()
return View();
}
public ActionResult Trim()
public JsonResult Trim()
{
_historyProvider.Trim();
return RedirectToAction("Index");
return new JsonResult { Data = "ok" };
}
public ActionResult Purge()
public JsonResult Purge()
{
_historyProvider.Purge();
return RedirectToAction("Index");
return new JsonResult { Data = "ok" };
}
[GridAction]

View file

@ -18,11 +18,11 @@ public ActionResult Index()
return View();
}
public ActionResult Clear()
public JsonResult Clear()
{
_logProvider.DeleteAll();
return RedirectToAction("Index");
return new JsonResult { Data = "ok" };
}
[GridAction]

View file

@ -47,12 +47,6 @@ public ActionResult Index()
return View();
}
public ActionResult RssSync()
{
_jobProvider.QueueJob(typeof(RssSyncJob));
return RedirectToAction("Index");
}
public ActionResult SeasonEditor(int seriesId)
{
var model = new List<SeasonEditModel>();
@ -185,21 +179,6 @@ public ActionResult Details(int seriesId)
return View(model);
}
public ActionResult SyncEpisodesOnDisk(int seriesId)
{
//Syncs the episodes on disk for the specified series
_jobProvider.QueueJob(typeof(DiskScanJob), seriesId);
return RedirectToAction("Details", new { seriesId });
}
public ActionResult UpdateInfo(int seriesId)
{
//Syncs the episodes on disk for the specified series
_jobProvider.QueueJob(typeof(UpdateInfoJob), seriesId);
return RedirectToAction("Details", new { seriesId });
}
private List<SeriesModel> GetSeriesModels(IList<Series> seriesInDb)
{
var series = seriesInDb.Select(s => new SeriesModel

View file

@ -135,6 +135,8 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="Content\Menu.css" />
<Compile Include="Controllers\CommandController.cs" />
<Compile Include="Controllers\DirectoryController.cs" />
<Compile Include="Controllers\EpisodeController.cs" />
<Compile Include="Controllers\HealthController.cs" />
@ -152,6 +154,7 @@
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Helpers\MenuExtension.cs" />
<Compile Include="Helpers\ValueExtension.cs" />
<Compile Include="Helpers\DescriptionExtension.cs" />
<Compile Include="Helpers\HtmlPrefixScopeExtensions.cs" />
@ -287,11 +290,10 @@
<Content Include="Views\Shared\Footer.cshtml" />
<Content Include="Views\_ViewStart.cshtml" />
<Content Include="Views\History\Index.cshtml" />
<Content Include="Views\Log\index.cshtml" />
<Content Include="Views\Log\Index.cshtml" />
<Content Include="Views\Upcoming\Index.cshtml" />
<Content Include="Views\Series\Details.cshtml" />
<Content Include="Views\Series\Index.cshtml" />
<Content Include="Views\Series\SubMenu.cshtml" />
<Content Include="Views\Series\SeriesSearchResults.cshtml" />
<Content Include="Views\Shared\Error.cshtml" />
<Content Include="Views\Settings\QualityProfileItem.cshtml" />

View file

@ -4,11 +4,10 @@
History
}
@section ActionMenu{
@{Html.Telerik().Menu().Name("historyMenu").Items(items =>
{
items.Add().Text("Trim History").Action("Trim", "History");
items.Add().Text("Purge History").Action("Purge", "History");
}).Render();}
<ul id="sub-menu">
<li>@Ajax.ActionLink("Trim History", "Trim", "History", new AjaxOptions{ OnSuccess = "reloadGrid" })</li>
<li>@Ajax.ActionLink("Purge History", "Purge", "History", new AjaxOptions{ OnSuccess = "reloadGrid" })</li>
</ul>
}
@section MainContent{
<div class="grid-container">
@ -42,3 +41,12 @@ History
.Render();}
</div>
}
<script type="text/javascript">
function reloadGrid() {
var grid = $('#history').data('tGrid');
grid.rebind();
}
</script>

View file

@ -22,10 +22,13 @@
@section TitleContent{
Logs
}
@section ActionMenu{
@{Html.Telerik().Menu().Name("logMenu").Items(items => items.Add().Text("Clear Logs").Action("Clear", "Log"))
.Render();}
<ul id="sub-menu">
<li>@Ajax.ActionLink("Clear Logs", "Clear", "Log", new AjaxOptions{ OnSuccess = "reloadGrid" })</li>
</ul>
}
@section MainContent{
@{Html.Telerik().Grid(Model).Name("logsGrid")
.TableHtmlAttributes(new { @class = "Grid" })
@ -47,3 +50,10 @@ Logs
.ClientEvents(c => c.OnRowDataBound("onRowDataBound"))
.Render();}
}
<script type="text/javascript">
function reloadGrid() {
var grid = $('#logsGrid').data('tGrid');
grid.rebind();
}
</script>

View file

@ -25,43 +25,16 @@
</style>
@section ActionMenu{
@{Html.Telerik().Menu().Name("SeriesMenu").Items(items =>
{
items.Add().Text("Back to Series List").Action("Index", "Series");
items.Add().Text("Scan For Episodes on Disk")
.Action("SyncEpisodesOnDisk", "Series", new { seriesId = Model.SeriesId });
items.Add().Text("Update Info").Action("UpdateInfo", "Series", new { seriesId = Model.SeriesId });
items.Add().Text("Rename Series").Action("RenameSeries", "Series", new { seriesId = Model.SeriesId });
}).Render();}
<ul id="sub-menu">
<li>@Html.ActionLink("Back to Series List", "Index", "Series")</li>
<li>@Ajax.ActionLink("Scan For Episodes on Disk", "SyncEpisodesOnDisk", "Command", new { seriesId = Model.SeriesId }, null)</li>
<li>@Ajax.ActionLink("Update Info", "UpdateInfo", "Command", new { seriesId = Model.SeriesId }, null)</li>
<li>@Ajax.ActionLink("Rename Series", "RenameSeries", "Command", new { seriesId = Model.SeriesId }, null)</li>
</ul>
}
@section MainContent{
<fieldset>
<div class="display-label">
ID</div>
<div class="display-field">
@Model.SeriesId</div>
<div class="display-label">
Overview</div>
<div class="display-field">
@Model.Overview</div>
<div class="display-label">
Status</div>
<div class="display-field">
@Model.Status</div>
<div class="display-label">
AirTimes</div>
<div class="display-field">
@Model.AirsDayOfWeek</div>
<div class="display-label">
Language</div>
<div class="display-label">
Location</div>
<div class="display-field">
@Model.Path</div>
</fieldset>
@foreach (var season in Model.Seasons.Where(s => s > 0).Reverse())
{
<br />
<h3>
Season @season</h3>
<div class="grid-container">

View file

@ -1,4 +1,5 @@
@using NzbDrone.Core.Repository;
@using NzbDrone.Web.Controllers
@using NzbDrone.Web.Models;
@model IEnumerable<NzbDrone.Core.Repository.Series>
@section TitleContent{
@ -49,7 +50,10 @@ NZBDrone
</style>
@section ActionMenu{
@{Html.RenderPartial("SubMenu");}
<ul id="sub-menu">
<li>@Html.ActionLink("Add Series", "Index", "AddSeries")</li>
<li>@Ajax.ActionLink("Start RSS Sync", "RssSync", "Command", null)</li>
</ul>
}
@section MainContent{
<div class="grid-container">
@ -119,8 +123,7 @@ NZBDrone
$("#progressbar_" + seriesId).episodeProgress(episodeFileCount, episodeCount);
}
</script>
<script type="text/javascript">
(function ($) {
$.fn.episodeProgress = function (episodes, totalEpisodes) {
return this.each(

View file

@ -1,7 +0,0 @@
@using NzbDrone.Web.Controllers
@{Html.Telerik().Menu().Name("telerikGrid").Items(items =>
{
items.Add().Text("Add Series").Action<AddSeriesController>(c => c.Index());
items.Add().Text("Start RSS Sync").Action<SeriesController>(c => c.RssSync());
}).Render();}

View file

@ -25,7 +25,7 @@
@using (Html.BeginForm("SaveIndexers", "Settings", FormMethod.Post, new { id = "form", name = "form", @class = "settingsForm" }))
{
<h1>Indexer</h1>
<h1>Indexers</h1>
<p></p>
@Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.")

View file

@ -1,13 +1,9 @@
@{Html.Telerik().Menu().Name("SubMenu").Items(items =>
{
items.Add().Text("Indexers").Action("Indexers", "Settings");
items.Add().Text("SABnzbd").Action("Sabnzbd", "Settings");
items.Add().Text("Quality").Action("Quality", "Settings");
items.Add().Text("Episode Sorting").Action("EpisodeSorting",
"Settings");
items.Add().Text("Notifications").Action("Notifications",
"Settings");
}).Render();
}
<ul id="sub-menu">
<li>@Html.ActionLink("Indexers", "Indexers", "Settings")</li>
<li>@Html.ActionLink("SABnzbd", "Sabnzbd", "Settings")</li>
<li>@Html.ActionLink("Quality", "Quality", "Settings")</li>
<li>@Html.ActionLink("Episode Sorting", "EpisodeSorting", "Settings")</li>
<li>@Html.ActionLink("Notifications", "Notifications", "Settings")</li>
</ul>
<div style="margin-bottom: 10px"></div>

View file

@ -1,17 +1 @@
<script type="text/javascript">
$(document).ready(function () {
//$('#save_button').attr('disabled', '');
});
</script>
<style>
#save_button[disabled="disabled"]
{
padding: 0px 6px 0px 6px;
border: 2px outset ButtonFace;
color: GrayText;
cursor: inherit;
}
</style>
<button type="submit" id="save_button" disabled="disabled">Save</button>


View file

@ -13,6 +13,7 @@
<link type="text/css" rel="stylesheet" href="/Content/Notibar.css" />
<link type="text/css" rel="stylesheet" href="/Content/ActionButton.css" />
<link type="text/css" rel="stylesheet" href="/Content/overrides.css" />
<link type="text/css" rel="stylesheet" href="/Content/Menu.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/3.3.0/build/yui/yui-min.js"></script>

View file

@ -4,8 +4,9 @@
Upcoming
}
@section ActionMenu{
@{Html.Telerik().Menu().Name("historyMenu").Items(
items => { items.Add().Text("Start RSS Sync").Action("RssSync", "Series"); }).Render();}
<ul id="sub-menu">
<li>@Ajax.ActionLink("Start RSS Sync", "RssSync", "Command", null, null)</li>
</ul>
}
@section MainContent{
<div id="yesterday">