mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
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:
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user