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 @@ namespace NzbDrone.Web.Controllers
return View(); return View();
} }
public ActionResult Trim() public JsonResult Trim()
{ {
_historyProvider.Trim(); _historyProvider.Trim();
return RedirectToAction("Index"); return new JsonResult { Data = "ok" };
} }
public ActionResult Purge() public JsonResult Purge()
{ {
_historyProvider.Purge(); _historyProvider.Purge();
return RedirectToAction("Index"); return new JsonResult { Data = "ok" };
} }
[GridAction] [GridAction]

View File

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

View File

@ -47,12 +47,6 @@ namespace NzbDrone.Web.Controllers
return View(); return View();
} }
public ActionResult RssSync()
{
_jobProvider.QueueJob(typeof(RssSyncJob));
return RedirectToAction("Index");
}
public ActionResult SeasonEditor(int seriesId) public ActionResult SeasonEditor(int seriesId)
{ {
var model = new List<SeasonEditModel>(); var model = new List<SeasonEditModel>();
@ -185,21 +179,6 @@ namespace NzbDrone.Web.Controllers
return View(model); 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) private List<SeriesModel> GetSeriesModels(IList<Series> seriesInDb)
{ {
var series = seriesInDb.Select(s => new SeriesModel var series = seriesInDb.Select(s => new SeriesModel

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
@using NzbDrone.Core.Repository; @using NzbDrone.Core.Repository;
@using NzbDrone.Web.Controllers
@using NzbDrone.Web.Models; @using NzbDrone.Web.Models;
@model IEnumerable<NzbDrone.Core.Repository.Series> @model IEnumerable<NzbDrone.Core.Repository.Series>
@section TitleContent{ @section TitleContent{
@ -49,7 +50,10 @@ NZBDrone
</style> </style>
@section ActionMenu{ @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{ @section MainContent{
<div class="grid-container"> <div class="grid-container">
@ -119,8 +123,7 @@ NZBDrone
$("#progressbar_" + seriesId).episodeProgress(episodeFileCount, episodeCount); $("#progressbar_" + seriesId).episodeProgress(episodeFileCount, episodeCount);
} }
</script>
<script type="text/javascript">
(function ($) { (function ($) {
$.fn.episodeProgress = function (episodes, totalEpisodes) { $.fn.episodeProgress = function (episodes, totalEpisodes) {
return this.each( 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" })) @using (Html.BeginForm("SaveIndexers", "Settings", FormMethod.Post, new { id = "form", name = "form", @class = "settingsForm" }))
{ {
<h1>Indexer</h1> <h1>Indexers</h1>
<p></p> <p></p>
@Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") @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 => <ul id="sub-menu">
{ <li>@Html.ActionLink("Indexers", "Indexers", "Settings")</li>
items.Add().Text("Indexers").Action("Indexers", "Settings"); <li>@Html.ActionLink("SABnzbd", "Sabnzbd", "Settings")</li>
items.Add().Text("SABnzbd").Action("Sabnzbd", "Settings"); <li>@Html.ActionLink("Quality", "Quality", "Settings")</li>
items.Add().Text("Quality").Action("Quality", "Settings"); <li>@Html.ActionLink("Episode Sorting", "EpisodeSorting", "Settings")</li>
items.Add().Text("Episode Sorting").Action("EpisodeSorting", <li>@Html.ActionLink("Notifications", "Notifications", "Settings")</li>
"Settings"); </ul>
items.Add().Text("Notifications").Action("Notifications",
"Settings");
}).Render();
}
<div style="margin-bottom: 10px"></div> <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/Notibar.css" />
<link type="text/css" rel="stylesheet" href="/Content/ActionButton.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/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/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/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> <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 Upcoming
} }
@section ActionMenu{ @section ActionMenu{
@{Html.Telerik().Menu().Name("historyMenu").Items( <ul id="sub-menu">
items => { items.Add().Text("Start RSS Sync").Action("RssSync", "Series"); }).Render();} <li>@Ajax.ActionLink("Start RSS Sync", "RssSync", "Command", null, null)</li>
</ul>
} }
@section MainContent{ @section MainContent{
<div id="yesterday"> <div id="yesterday">