removed default root property

tweaked the ui on add new show
This commit is contained in:
Keivan 2011-03-28 16:38:05 -07:00
parent 613a49c3ea
commit c45729a986
5 changed files with 72 additions and 102 deletions

View File

@ -8,11 +8,8 @@ namespace NzbDrone.Core.Repository
{ {
public class RootDir public class RootDir
{ {
[SubSonicPrimaryKey(true)] public int Id { get; set; }
public int RootDirId { get; set; }
public string Path { get; set; } public string Path { get; set; }
public bool Default { get; set; }
} }
} }

View File

@ -191,7 +191,7 @@ namespace NzbDrone.Web.Controllers
public ViewResult AddRootDir() public ViewResult AddRootDir()
{ {
return View("RootDir", new RootDir { Default = false }); return View("RootDir", new RootDir());
} }
public ActionResult SubMenu() public ActionResult SubMenu()
@ -225,13 +225,13 @@ namespace NzbDrone.Web.Controllers
foreach (var currentRootDir in currentRootDirs) foreach (var currentRootDir in currentRootDirs)
{ {
var closureRootDir = currentRootDir; var closureRootDir = currentRootDir;
if (!data.Directories.Exists(d => d.RootDirId == closureRootDir.RootDirId)) if (!data.Directories.Exists(d => d.Id == closureRootDir.Id))
_rootDirProvider.Remove(closureRootDir.RootDirId); _rootDirProvider.Remove(closureRootDir.Id);
} }
foreach (var dir in data.Directories) foreach (var dir in data.Directories)
{ {
if (dir.RootDirId == 0) if (dir.Id == 0)
_rootDirProvider.Add(dir); _rootDirProvider.Add(dir);
else else

View File

@ -1,17 +1,15 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<AddNewSeriesModel>" %> <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<AddNewSeriesModel>" %>
<%@ Import Namespace="NzbDrone.Web.Models" %> <%@ Import Namespace="NzbDrone.Web.Models" %>
<%@ Import Namespace="Telerik.Web.Mvc.UI" %> <%@ Import Namespace="Telerik.Web.Mvc.UI" %>
<%@ Import Namespace="NzbDrone.Core.Repository" %> <%@ Import Namespace="NzbDrone.Core.Repository" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Add New Series Add New Series
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function () { jQuery(document).ready(function () {
$('#searchButton').attr('disabled', ''); $('#searchButton').attr('disabled', '');
}); });
</script> </script>
</asp:Content> </asp:Content>
<asp:Content ID="Menu" ContentPlaceHolderID="ActionMenu" runat="server"> <asp:Content ID="Menu" ContentPlaceHolderID="ActionMenu" runat="server">
<% <%
@ -19,47 +17,37 @@
%> %>
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div style="width: 60%"> <div style="width: 60%">
<div style="display:inline"> <div style="display: inline">
<%= Html.Label("Enter a Series Name") %> <%= Html.Label("Enter a Series Name") %>
<%= Html.TextBox("new_series_name", String.Empty, new { id="new_series_id" }) %> <%= Html.TextBox("new_series_name", String.Empty, new { id="new_series_id" }) %>
<button class="t.button" id="searchButton" disabled="disabled" onclick="searchSeries ()">
Search</button>
</div> </div>
<div style="display: inline; float: right;">
<div style="display:inline; float:right;">
<%= Html.LabelFor(m => m.QualityProfileId)%> <%= Html.LabelFor(m => m.QualityProfileId)%>
<%: Html.DropDownListFor(m => m.QualityProfileId, Model.QualitySelectList)%> <%: Html.DropDownListFor(m => m.QualityProfileId, Model.QualitySelectList)%>
</div> </div>
</div> </div>
<div id="result">
<p> </div>
<button class="t.button" id="searchButton" disabled="disabled" onclick="searchSeries ()">Search</button> <div id="RootDirectories" class="rootDirectories" style="display: none">
</p>
<div id="result"></div>
<div id="RootDirectories" class="rootDirectories" style="display:none">
<fieldset> <fieldset>
<legend>Root TV Folders</legend> <legend>Root TV Folders</legend>
<% int d = 0; %> <% int d = 0; %>
<% foreach (var dir in Model.RootDirectories) <% foreach (var dir in Model.RootDirectories)
{ %> { %>
<%: Html.RadioButton("selectedRootDir", dir.Path, dir.Default, new { @class="dirList examplePart", id="dirRadio_" + d }) %> <%: Html.RadioButton("selectedRootDir", dir.Path, d ==0 , new { @class="dirList examplePart", id="dirRadio_" + d }) %>
<%: Html.Label(dir.Path) %> <%: Html.Label(dir.Path) %>
<% if (dir.Default) { %> * <% } %>
<% d++;%>
<br />
<% } %> <% } %>
</fieldset> </fieldset>
<div id="example">
<div id="example"></div> </div>
<button class="t.button" onclick="addSeries ()">
<button class="t.button" onclick="addSeries ()">Add New Series</button> Add New Series</button>
</div> </div>
<div id="addResult">
<div id="addResult"></div> </div>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
$('#new_series_id').bind('keydown', function (e) { $('#new_series_id').bind('keydown', function (e) {
@ -72,20 +60,12 @@
var seriesSearch = $('#new_series_id'); var seriesSearch = $('#new_series_id');
$("#result").text("Searching..."); $("#result").text("Searching...");
document.getElementById('RootDirectories').style.display = 'none'; document.getElementById('RootDirectories').style.display = 'inline';
$("#result").load('<%=Url.Action("SearchForSeries", "Series") %>', { $("#result").load('<%=Url.Action("SearchForSeries", "Series") %>', {
seriesName: seriesSearch.val() seriesName: seriesSearch.val()
}); });
} }
$(".searchRadio").live("change", function () {
var checked = $(this).attr('checked');
if (checked) {
document.getElementById('RootDirectories').style.display = 'inline';
}
});
function addSeries() { function addSeries() {
//Get the selected tvdbid + selected root folder //Get the selected tvdbid + selected root folder
//jquery bit below doesn't want to work... //jquery bit below doesn't want to work...
@ -119,12 +99,12 @@
var sep = "\\"; var sep = "\\";
var str = "Example: " + dir + sep + seriesName; var str = "Target: " + dir + sep + seriesName;
$('#example').text(str); $('#example').text(str);
}); });
</script> </script>
<div id="tester"></div> <div id="tester">
</div>
</asp:Content> </asp:Content>

View File

@ -1,25 +1,23 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<NzbDrone.Web.Models.SeriesSearchResultModel>>" %> <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<NzbDrone.Web.Models.SeriesSearchResultModel>>" %>
<%@ Import Namespace="NzbDrone.Core.Repository" %> <%@ Import Namespace="NzbDrone.Core.Repository" %>
<div id="searchResults"> <div id="searchResults">
<fieldset class="tvDbSearchResults"> <fieldset>
<legend>Search Results</legend> <legend>Search Results</legend>
<% if (Model.Count == 0) <% if (Model.Count == 0)
{ %> { %>
<b>No results found for the series name</b> <b>No results found for the series name</b>
<% } <% }
%> %>
<% int r = 0; %> <% int r = 0; %>
<% foreach (var result in Model) <% foreach (var result in Model)
{ %> { %>
<%: Html.RadioButton("selectedSeries", result.TvDbId, new { @class="searchRadio examplePart", id="searchRadio_" + r }) %> <%: Html.RadioButton("selectedSeries", result.TvDbId, r ==0, new { @class="searchRadio examplePart", id="searchRadio_" + r }) %>
<b><%: Html.Label(result.TvDbName) %></b> (<%: Html.Label(result.FirstAired.ToString("MM/dd/yyyy"))%>) <b>
<%:result.TvDbName + " (" + result.FirstAired.ToShortDateString()%>)
<%: Html.TextBox(result.TvDbName + "_text", result.TvDbName, new { id = result.TvDbId + "_text", style="display:none" }) %> <%: Html.TextBox(result.TvDbName + "_text", result.TvDbName, new { id = result.TvDbId + "_text", style="display:none" }) %>
<% r++;%> <%
r++;%>
<br /> <br />
<% <%
} %> } %>

View File

@ -1,36 +1,31 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Core.Repository.RootDir>" %> <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<NzbDrone.Core.Repository.RootDir>" %>
<%@ Import Namespace="NzbDrone.Web.Helpers" %> <%@ Import Namespace="NzbDrone.Web.Helpers" %>
<% using (Html.BeginCollectionItem("Directories")) <% using (Html.BeginCollectionItem("Directories"))
{ %> { %>
<%
<%
var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_'); var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_');
//string sortable1 = String.Format("{0}_sortable1", idClean); //string sortable1 = String.Format("{0}_sortable1", idClean);
%> %>
<style type="text/css">
<style type="text/css"> .root_dir_text
.root_dir_text { width:300px; } {
</style> width: 300px;
}
<div class="rootDirSection"> </style>
<div class="rootDirSection">
<fieldset style="width:350px; height:16px; margin:0px; margin-top: 0px; border-color:#CCCCCD; -khtml-border-radius:8px; border-radius:8px; -moz-border-radius:8px; -webkit-border-radius:8px;"> <fieldset style="width: 350px; height: 16px; margin: 0px; margin-top: 0px; border-color: #CCCCCD;
-khtml-border-radius: 8px; border-radius: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px;">
<div> <div>
<%: Html.CheckBoxFor(m => m.Default, new { @class = "defaultCheckbox" }) %>
<%: Html.TextBoxFor(m => m.Path, new { @class="root_dir_text" }) %> <%: Html.TextBoxFor(m => m.Path, new { @class="root_dir_text" }) %>
<a href="#" class="deleteRow"><img src="../../Content/Images/X.png" alt="Delete"/></a> <a href="#" class="deleteRow">
<img src="../../Content/Images/X.png" alt="Delete" /></a>
</div> </div>
<div> <div>
<%: Html.ValidationMessageFor(m => m.Path) %> <%: Html.ValidationMessageFor(m => m.Path) %>
</div> </div>
<div class="hiddenProfileDetails"> <div class="hiddenProfileDetails">
<%= Html.TextBoxFor(x => x.RootDirId, new { @style = "display:none" })%> <%= Html.TextBoxFor(x => x.Id, new { @style = "display:none" })%>
</div> </div>
</fieldset> </fieldset>
</div> </div>
<% } %> <% } %>