1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 16:26:59 +02:00

Fix issue processwire/processwire-issues#1632 with suggestion by @Notanotherdotcom

This commit is contained in:
Ryan Cramer
2022-11-04 15:42:27 -04:00
parent d9bfba5c74
commit c2eaa0a8da
3 changed files with 9 additions and 4 deletions

View File

@@ -103,7 +103,8 @@ $(document).ready(function() {
$(this).find(".CommentDownvotes > input").val(0).change(); $(this).find(".CommentDownvotes > input").val(0).change();
} else { } else {
// status // status
$(this).find(".CommentStatus > input[value='" + val + "']").click(); // $(this).find(".CommentStatus > input[value='" + val + "']").click(); // radios
$(this).find("select.CommentStatus").val(val); // select
} }
}); });
$checkedItems.effect('highlight', 500); $checkedItems.effect('highlight', 500);

View File

@@ -1 +1 @@
$(document).ready(function(){var ready=false;$(document).on("click",".WireTabs a",function($event){if(ready)window.location.href=$(this).attr("href");return false});var $tabs=$(".WireTabs");$tabs.css("opacity",1);$tabs.find(".uk-active").removeClass("uk-active");$tabs.find("a.on").parent("li").click().addClass("uk-active");$("a.CommentTextEdit").click(function(){var $textarea=$("<textarea></textarea>");var $parent=$(this).closest(".CommentTextEditable");$parent.parent(".CommentText").removeClass("CommentTextOverflow");$textarea.attr("name",$parent.attr("id"));$textarea.addClass($parent.attr("data-textarea-class"));$(this).remove();$textarea.val($parent.text());$parent.after($textarea);$parent.remove();return false});$(".CommentText").click(function(){$(this).find("a.CommentTextEdit").click();return false});$(".CommentItem").each(function(){var $item=$(this);var $table=$item.find(".CommentItemInfo");var height=$table.height()+30;var $text=$item.find(".CommentText");if($text.height()>height){$text.addClass("CommentTextOverflow")}});$("#CommentLimitSelect").change(function(){window.location="./?limit="+parseInt($(this).val())});$("#CommentListSort").change(function(){window.location="./?sort="+$(this).val()});function commentCheckboxClicked($checkbox){var $item=$checkbox.closest(".CommentItem");if($checkbox.is(":checked")){$item.addClass("CommentChecked")}else{$item.removeClass("CommentChecked")}}$(".CommentCheckbox").click(function(){commentCheckboxClicked($(this))});$("#CommentCheckAll").click(function(){var $items=$(".CommentCheckbox");if($(this).is(":checked")){$items.prop("checked",true)}else{$items.prop("checked",false)}$items.each(function(){commentCheckboxClicked($(this))})});$("#CommentActions").change(function(){var val=$(this).val();if(!val.length)return;var $checkedItems=$(".CommentChecked");if($checkedItems.length){$checkedItems.each(function(){if(val=="reset-upvotes"){$(this).find(".CommentUpvotes > input").val(0).change()}else if(val=="reset-downvotes"){$(this).find(".CommentDownvotes > input").val(0).change()}else{$(this).find(".CommentStatus > input[value='"+val+"']").click()}});$checkedItems.effect("highlight",500)}else{ProcessWire.alert($(this).attr("data-nochecked"))}$(this).val("")});$(document).on("change",".CommentItem :input",function(){var $this=$(this);if($this.is("[type='checkbox']"))return;$(this).closest(".CommentItem").addClass("CommentItemChanged")});$("#CommentListForm").submit(function(){$(this).addClass("CommentListFormSubmitted")});window.addEventListener("beforeunload",function(e){if($(".CommentListFormSubmitted").length)return;var $changes=$(".CommentItemChanged");if($changes.length==0)return;var msg=$("#CommentListForm").attr("data-unsaved");(e||window.event).returnValue=msg;return msg});var color=$(".WireTabs a.on").css("border-top-color");$("#CommentListHeader").css("border-top-color",color);ready=true}); $(document).ready(function(){var ready=false;$(document).on("click",".WireTabs a",function($event){if(ready)window.location.href=$(this).attr("href");return false});var $tabs=$(".WireTabs");$tabs.css("opacity",1);$tabs.find(".uk-active").removeClass("uk-active");$tabs.find("a.on").parent("li").click().addClass("uk-active");$("a.CommentTextEdit").click(function(){var $textarea=$("<textarea></textarea>");var $parent=$(this).closest(".CommentTextEditable");$parent.parent(".CommentText").removeClass("CommentTextOverflow");$textarea.attr("name",$parent.attr("id"));$textarea.addClass($parent.attr("data-textarea-class"));$(this).remove();$textarea.val($parent.text());$parent.after($textarea);$parent.remove();return false});$(".CommentText").click(function(){$(this).find("a.CommentTextEdit").click();return false});$(".CommentItem").each(function(){var $item=$(this);var $table=$item.find(".CommentItemInfo");var height=$table.height()+30;var $text=$item.find(".CommentText");if($text.height()>height){$text.addClass("CommentTextOverflow")}});$("#CommentLimitSelect").change(function(){window.location="./?limit="+parseInt($(this).val())});$("#CommentListSort").change(function(){window.location="./?sort="+$(this).val()});function commentCheckboxClicked($checkbox){var $item=$checkbox.closest(".CommentItem");if($checkbox.is(":checked")){$item.addClass("CommentChecked")}else{$item.removeClass("CommentChecked")}}$(".CommentCheckbox").click(function(){commentCheckboxClicked($(this))});$("#CommentCheckAll").click(function(){var $items=$(".CommentCheckbox");if($(this).is(":checked")){$items.prop("checked",true)}else{$items.prop("checked",false)}$items.each(function(){commentCheckboxClicked($(this))})});$("#CommentActions").change(function(){var val=$(this).val();if(!val.length)return;var $checkedItems=$(".CommentChecked");if($checkedItems.length){$checkedItems.each(function(){if(val=="reset-upvotes"){$(this).find(".CommentUpvotes > input").val(0).change()}else if(val=="reset-downvotes"){$(this).find(".CommentDownvotes > input").val(0).change()}else{$(this).find("select.CommentStatus").val(val)}});$checkedItems.effect("highlight",500)}else{ProcessWire.alert($(this).attr("data-nochecked"))}$(this).val("")});$(document).on("change",".CommentItem :input",function(){var $this=$(this);if($this.is("[type='checkbox']"))return;$(this).closest(".CommentItem").addClass("CommentItemChanged")});$("#CommentListForm").submit(function(){$(this).addClass("CommentListFormSubmitted")});window.addEventListener("beforeunload",function(e){if($(".CommentListFormSubmitted").length)return;var $changes=$(".CommentItemChanged");if($changes.length==0)return;var msg=$("#CommentListForm").attr("data-unsaved");(e||window.event).returnValue=msg;return msg});var color=$(".WireTabs a.on").css("border-top-color");$("#CommentListHeader").css("border-top-color",color);ready=true});

View File

@@ -1352,7 +1352,7 @@ class ProcessCommentsManager extends Process {
$checkAllLabel = $this->_('Check/uncheck all'); $checkAllLabel = $this->_('Check/uncheck all');
$checkAll = $checkAll =
"<label title='$checkAllLabel'><input class='$checkboxClass' type='checkbox' id='CommentCheckAll' /> " . "<label class='pw-tooltip' title='$checkAllLabel'><input class='$checkboxClass' type='checkbox' id='CommentCheckAll' /> " .
"<span class='detail'></span></label>"; "<span class='detail'></span></label>";
$noCheckedLabel = $this->_('There are no checked items'); $noCheckedLabel = $this->_('There are no checked items');
@@ -1455,7 +1455,11 @@ class ProcessCommentsManager extends Process {
} }
$tabsOut = $wireTabs->renderTabList($tabs); $tabsOut = $wireTabs->renderTabList($tabs);
$this->headline .= ' (' . ($start+1) . "" . ($start + $cnt) . " " . sprintf($this->_('of %d'), $total) . ')'; if($total) {
$this->headline .= ' (' . ($start + 1) . "" . ($start + $cnt) . " " . sprintf($this->_('of %d'), $total) . ')';
} else {
$this->headline .= ' (0)';
}
$this->headline($this->headline); $this->headline($this->headline);
if($cnt) { if($cnt) {