1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Added Javascript to support shift-clicking ranges to disable/enable checkboxes.

This commit is contained in:
Mark McDowall 2011-05-16 16:57:02 -07:00
parent 8c372e938c
commit 0babb9474e
2 changed files with 26 additions and 2 deletions

View File

@ -44,4 +44,28 @@
<button type="button" class="t-button t-state-default" onclick="closeSeasonEditor()">Cancel</button> <button type="button" class="t-button t-state-default" onclick="closeSeasonEditor()">Cancel</button>
</div> </div>
} }
<div id="result"></div> <div id="result"></div>
<script type="text/javascript">
var lastChecked = null;
$(document).ready(function () {
$('.chkbox').click(function (event) {
if (!lastChecked) {
lastChecked = this;
return;
}
if (event.shiftKey) {
var start = $('.chkbox').index(this);
var end = $('.chkbox').index(lastChecked);
for (i = Math.min(start, end); i <= Math.max(start, end); i++) {
$('.chkbox')[i].checked = lastChecked.checked;
}
}
lastChecked = this;
});
});
</script>

View File

@ -6,7 +6,7 @@
{ {
<fieldset style="display: inline; border-color: lightgrey; width: 26%; margin-bottom: 2px; padding-bottom: 1px; padding-top: 1px;"> <fieldset style="display: inline; border-color: lightgrey; width: 26%; margin-bottom: 2px; padding-bottom: 1px; padding-top: 1px;">
@Html.DisplayFor(m => m.SeasonString) @Html.DisplayFor(m => m.SeasonString)
<span style="float: right;">@Html.CheckBoxFor(m => m.Monitored)</span> <span style="float: right;">@Html.CheckBoxFor(m => m.Monitored, new { @class = "chkbox" })</span>
@Html.HiddenFor(m => m.SeasonId) @Html.HiddenFor(m => m.SeasonId)
@Html.HiddenFor(m => m.SeasonNumber) @Html.HiddenFor(m => m.SeasonNumber)