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") { if (seasons === "1") {
// Send over the first season // Send over the first season
data = data + "&seasons=first"; data = data + "&seasons=first";
} if (seasons === "0") {
// Send over the first season
data = data + "&seasons=all";
} }
var type = $form.prop('method'); var type = $form.prop('method');
@ -399,6 +402,7 @@ $(function () {
dataType: "json", dataType: "json",
success: function (results) { success: function (results) {
var $content = $("#seasonsBody"); var $content = $("#seasonsBody");
$content.html("");
$('#selectedSeasonsId').val(id); $('#selectedSeasonsId').val(id);
results.forEach(function(result) { results.forEach(function(result) {
var context = buildSeasonsContext(result); var context = buildSeasonsContext(result);
@ -436,11 +440,16 @@ $(function () {
var data = $form.serialize(); var data = $form.serialize();
var seasonsParam = "&seasons="; var seasonsParam = "&seasons=";
var testimonials = document.querySelectorAll('.selectedSeasons'); var $checkedSeasons = $('.selectedSeasons:checkbox:checked');
Array.prototype.forEach.call(testimonials, function (elements, index) { $checkedSeasons.each(function (index, element) {
seasonsParam = seasonsParam + elements.text() + ","; if (index < $checkedSeasons.length -1) {
seasonsParam = seasonsParam + element.id + ",";
} else {
seasonsParam = seasonsParam + element.id;
}
}); });
data = data + seasonsParam; data = data + seasonsParam;
var type = $form.prop('method'); 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/handlebars.min.js\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/bootstrap.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/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/pace.min.js\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/jquery.mixitup.js\"></script>"); sb.AppendLine($"<script src=\"{content}/Content/jquery.mixitup.js\"></script>");
sb.AppendLine($"<script src=\"{content}/Content/moment.min.js\"></script>"); sb.AppendLine($"<script src=\"{content}/Content/moment.min.js\"></script>");
@ -84,7 +84,7 @@ namespace PlexRequests.UI.Helpers
var content = GetContentUrl(assetLocation); 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()); return helper.Raw(sb.ToString());
} }
@ -96,7 +96,7 @@ namespace PlexRequests.UI.Helpers
var content = GetContentUrl(assetLocation); 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()); return helper.Raw(sb.ToString());
} }

View file

@ -47,6 +47,8 @@ using PlexRequests.Store;
using PlexRequests.UI.Helpers; using PlexRequests.UI.Helpers;
using PlexRequests.UI.Models; using PlexRequests.UI.Models;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms;
using PlexRequests.Api.Models.Tv; using PlexRequests.Api.Models.Tv;
using PlexRequests.Store.Models; using PlexRequests.Store.Models;
using PlexRequests.Store.Repository; using PlexRequests.Store.Repository;
@ -638,9 +640,20 @@ namespace PlexRequests.UI.Modules
seasonsList.Add(model.SeasonCount); seasonsList.Add(model.SeasonCount);
model.SeasonsRequested = "Latest"; model.SeasonsRequested = "Latest";
break; break;
default: case "all":
model.SeasonsRequested = "All"; model.SeasonsRequested = "All";
break; 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(); model.SeasonList = seasonsList.ToArray();

View file

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

View file

@ -280,7 +280,7 @@
<script id="seasons-template" type="text/x-handlebars-template"> <script id="seasons-template" type="text/x-handlebars-template">
<div class="form-group"> <div class="form-group">
<div class="checkbox"> <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>
</div> </div>