Subreddit rules: Fix other_reason input in report dialog

The `other_reason` input needs to be enabled properly since
`.report-action-form` isn't being used in the report dialog anymore.
This commit is contained in:
MelissaCole
2015-11-13 12:34:09 -08:00
parent 0c7b0af668
commit 2ccf011943
3 changed files with 20 additions and 2 deletions

View File

@@ -5,6 +5,23 @@ $(function() {
return false
}
function toggleOther() {
var $reportForm = $(this).closest('.reportform');
var $submit = $reportForm.find('[type="submit"]');
var $reason = $reportForm.find('[name=reason]:checked');
var $other = $reportForm.find('[name="other_reason"]');
var isOther = $reason.val() === 'other';
$submit.removeAttr('disabled');
if (isOther) {
$other.removeAttr('disabled').focus();
} else {
$other.attr('disabled', 'disabled');
}
return false
}
function getReportAttrs($el) {
return {thing: $el.thing_id()}
}
@@ -39,4 +56,5 @@ $(function() {
$("div.content").on("click", ".tagline .reportbtn, .thing .reportbtn", openReportForm);
$("div.content").on("click", ".btn.report-cancel", toggleReportForm);
$("div.content").on("change", "input[name='reason']", toggleOther);
});

View File

@@ -61,7 +61,7 @@
<input name="other_reason" value="" maxlength="100" type="text" disabled>
</li>
</ol>
<button type="submit" class="btn submit-action-thing">
<button type="submit" class="btn submit-action-thing" disabled>
${_("submit")}
</button>
<button type="button" class="btn cancel-action-thing report-cancel">

View File

@@ -61,7 +61,7 @@
<input name="other_reason" value="" maxlength="100" type="text" disabled>
</li>
</ol>
<button type="submit" class="btn submit-action-thing">
<button type="submit" class="btn submit-action-thing" disabled>
${_("submit")}
</button>
<button type="button" class="btn report-cancel">