This commit is contained in:
tidusjar 2016-05-24 14:02:56 +01:00
commit b2144f3f69
7 changed files with 1122 additions and 1100 deletions

View file

@ -95,6 +95,9 @@ $(function () {
if (seasons === "1") {
// Send over the first season
data = data + "&seasons=first";
} if (seasons === "0") {
// Send over the first season
data = data + "&seasons=all";
}
var type = $form.prop('method');
@ -399,6 +402,7 @@ $(function () {
dataType: "json",
success: function (results) {
var $content = $("#seasonsBody");
$content.html("");
$('#selectedSeasonsId').val(id);
results.forEach(function(result) {
var context = buildSeasonsContext(result);
@ -436,11 +440,16 @@ $(function () {
var data = $form.serialize();
var seasonsParam = "&seasons=";
var testimonials = document.querySelectorAll('.selectedSeasons');
Array.prototype.forEach.call(testimonials, function (elements, index) {
seasonsParam = seasonsParam + elements.text() + ",";
var $checkedSeasons = $('.selectedSeasons:checkbox:checked');
$checkedSeasons.each(function (index, element) {
if (index < $checkedSeasons.length -1) {
seasonsParam = seasonsParam + element.id + ",";
} else {
seasonsParam = seasonsParam + element.id;
}
});
data = data + seasonsParam;
var type = $form.prop('method');

View file

@ -68,7 +68,7 @@ namespace PlexRequests.UI.Helpers
sb.AppendLine($"<script src=\"{content}/Content/handlebars.min.js\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/bootstrap.min.js\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/bootstrap-notify.min.js\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/site.js\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/site-1.7.js\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/pace.min.js\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/jquery.mixitup.js\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/moment.min.js\"></script>");
@ -84,7 +84,7 @@ namespace PlexRequests.UI.Helpers
var content = GetContentUrl(assetLocation);
sb.AppendLine($"<script src=\"{content}/Content/search.js\" type=\"text/javascript\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/search-1.7.js\" type=\"text/javascript\"></script>");
return helper.Raw(sb.ToString());
}
@ -96,7 +96,7 @@ namespace PlexRequests.UI.Helpers
var content = GetContentUrl(assetLocation);
sb.AppendLine($"<script src=\"{content}/Content/requests.js\" type=\"text/javascript\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/requests-1.7.js\" type=\"text/javascript\"></script>");
return helper.Raw(sb.ToString());
}

View file

@ -47,6 +47,8 @@ using PlexRequests.Store;
using PlexRequests.UI.Helpers;
using PlexRequests.UI.Models;
using System.Threading.Tasks;
using System.Windows.Forms;
using PlexRequests.Api.Models.Tv;
using PlexRequests.Store.Models;
using PlexRequests.Store.Repository;
@ -638,9 +640,20 @@ namespace PlexRequests.UI.Modules
seasonsList.Add(model.SeasonCount);
model.SeasonsRequested = "Latest";
break;
default:
case "all":
model.SeasonsRequested = "All";
break;
default:
var split = seasons.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
var seasonsCount = new int[split.Length];
for (var i = 0; i < split.Length; i++)
{
int tryInt;
int.TryParse(split[i], out tryInt);
seasonsCount[i] = tryInt;
}
seasonsList.AddRange(seasonsCount);
break;
}
model.SeasonList = seasonsList.ToArray();

View file

@ -370,10 +370,10 @@
<DependentUpon>pace.css</DependentUpon>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\requests.js">
<Content Include="Content\requests-1.7.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\site.js">
<Content Include="Content\site-1.7.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="app.config" />
@ -545,7 +545,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Content\search.js">
<Content Include="Content\search-1.7.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

View file

@ -280,7 +280,7 @@
<script id="seasons-template" type="text/x-handlebars-template">
<div class="form-group">
<div class="checkbox">
<input type="checkbox" class=".selectedSeasons" id="{{id}}" name="{{id}}"><label for="{{id}}">Season {{id}}</label>
<input type="checkbox" class="selectedSeasons" id="{{id}}" name="{{id}}"><label for="{{id}}">Season {{id}}</label>
</div>
</div>