AddExisting clears check/hides rows once submitted. Bi-winning

AddNew, currently unable to submit. Bi-polar
This commit is contained in:
Mark McDowall
2011-03-11 01:04:56 -08:00
parent c3425f493f
commit 5a8842e3db
11 changed files with 169 additions and 36 deletions
+3 -8
View File
@@ -10,13 +10,8 @@
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
//Add New
//Add Existing
//Ask user for existing TV Root Folder...
//Get list of unmapped folders and allow the user to check off the ones they want to add...
//
<%: Html.ActionLink("Add New Series", "AddNew", "Series") %>
<br />
<%: Html.ActionLink("Add Existing Series", "AddExisting", "Series") %>
</asp:Content>
+8 -14
View File
@@ -4,7 +4,7 @@
<%@ Import Namespace="NzbDrone.Web.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Add Existing Series
Add Existing
</asp:Content>
<asp:Content ID="Menu" ContentPlaceHolderID="ActionMenu" runat="server">
<%
@@ -33,10 +33,6 @@
</script>
//Get AJAX listing of unmapped directories
//When getting unmapped, also do a quick lookup on TVDB to see which series we would map this to... Don't do the mapping though...
//ITvDbProvider.GetSeries(string title);
<%
Html.Telerik().Grid<AddExistingSeriesModel>().Name("Unmapped_Series_Folders")
.TableHtmlAttributes(new { id = "UnmappedSeriesGrid" })
@@ -85,7 +81,6 @@
else {
$('#mastercheckbox').attr('checked', false);
}
});
//Sync for selected series
@@ -100,15 +95,14 @@
$("#result").load('<%=Url.Action("SyncSelectedSeries", "Series") %>', {
checkedRecords: $checkedRecords.map(function () { return jQuery.param({ path: this.name, tvdbid: this.value }) })
}
//this.window.location = '<%= Url.Action("Index", "Series") %>';
});
);
var grid = $('#UnmappedSeriesGrid').data('tGrid');
//Hide the series that we just tried to sync up (uncheck them too, otherwise they will be re-sync'd if we sync again)
$checkedRecords.each(function () {
var id = "#row_" + this.value;
$(this).attr("checked", false);
$(id).hide();
});
}
</script>
</asp:Content>
+27 -5
View File
@@ -12,13 +12,12 @@
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
//Add a new series
<%= Html.Label("Enter a Series Name") %>
<%= Html.TextBox("new_series_name", new { id="new_series_id" }) %>
<%= Html.TextBox("new_series_name", String.Empty, new { id="new_series_id" }) %>
//Browse Button??
//Auto-Complete?
<p>
<button class="t.button" onclick="searchSeries ()">Search</button>
</p>
//Search Button - Perform AJAX search for this Series on TVDB
@@ -28,5 +27,28 @@
Add, ask user to choose where to save the show in (used when sorting) then add the show... Possibly ask user to choose Quality Profile
<div id="result"></div>
<script type="text/javascript" language="javascript">
function searchSeries() {
var seriesSearch = $('#new_series_id');
// if ($seriesSearch.length < 1) {
// alert("Enter a valid name to search for");
// return;
// }
//Setup a function to handle the results... Or return a partial...
$("#result").load('<%=Url.Action("SearchForSeries", "Series") %>', {
seriesName: seriesSearch.val()
}
//this.window.location = '<%= Url.Action("Index", "Series") %>';
);
}
</script>
</asp:Content>
@@ -0,0 +1,68 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<NzbDrone.Web.Models.SeriesSearchResultModel>>" %>
<%@ Import Namespace="NzbDrone.Core.Repository" %>
<div id="searchResults">
<fieldset>
<legend>Search Results</legend>
<% foreach (var result in Model)
{ %>
<%: Html.RadioButton("selectedSeries", result.TvDbId, new { @class="searchRadio examplePart", name = result.TvDbName }) %>
<%: Html.Label(result.TvDbName) %> (<%: Html.Label(result.FirstAired.ToString()) %>)
<br />
<% } %>
</fieldset>
</div>
<div id="RootDirectories" style="display:none">
<fieldset>
<legend>Root TV Folders</legend>
<% foreach (var dir in (List<RootDir>)ViewData["RootDirs"])
{ %>
<%: Html.RadioButton("selectedRootDir", dir.RootDirId, dir.Default, new { @class="dirList examplePart", name = dir.Path }) %>
<%: Html.Label(dir.Path) %>
<% if (dir.Default) { %>* <% } %>
<br />
<% } %>
</fieldset>
<div id="example"></div>
<button class="t.button" onclick="addSeries ()">Add New Series</button>
</div>
<div id="tester"></div>
<script type="text/javascript">
$(".searchRadio").live("change", function () {
var checked = $(this).attr('checked');
if (checked) {
$('#tester').text(this.value);
document.getElementById('RootDirectories').style.display = 'inline';
}
});
function addSeries() {
//Get the selected tvdbid + selected root folder
//jquery bit below doesn't want to work...
var checkedSeries = $('input:radio[name=selectedSeries]:checked').val();
//$('input:radio[name=selectedSeries]:checked').val();
$('#tester').text(checkedSeries.value);
//$('#tester').text("Hello_jhasdajsd");
}
// $(".examplePart").live("change", function() {
// var dir = $('.selectedRootDir:checked');
// var show = $('.selectedSeries:checked');
// var sep = "\\";
// var str = "Example: " + dir.name + sep + show.name;
// $('#example').text(str);
//
// });
</script>
+1 -2
View File
@@ -4,9 +4,8 @@
<% Html.Telerik().Menu().Name("telerikGrid").Items(items =>
{
items.Add().Text("View Unmapped Folders").Action("Unmapped", "Series");
items.Add().Text("Add Series").Action("Add", "Series");
items.Add().Text("Start RSS Sync").Action("RssSync", "Series");
items.Add().Text("Rename All").Action("RenameAll", "Series");
items.Add().Text("Add Series").Action("Add", "Series");
}).Render();
%>