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

Fix issue processwire/processwire-issues#396 plus update ProcessCommentsManager to be compatible with AdminThemeUikit

This commit is contained in:
Ryan Cramer
2017-10-19 11:15:08 -04:00
parent a48f4038c8
commit b4f977c36a
5 changed files with 34 additions and 11 deletions

View File

@@ -22,13 +22,14 @@
.CommentItems {
clear: both;
border-bottom: 1px solid #000; }
.CommentItems + button {
border-bottom: 1px solid #777; }
.CommentItems + button.ui-button {
margin-top: 1em; }
.CommentItem {
clear: both;
border-top: 1px solid #000;
border-top: 1px solid #777;
padding: 0.75em 0;
margin: 0;
width: 100%;
/*
@@ -54,7 +55,7 @@
.CommentItem table th,
.CommentItem table td {
padding: 4px 10px 4px 0;
border-bottom: 1px dotted #ccc;
border-bottom: 1px solid #ddd;
vertical-align: top; }
.CommentItem table th {
font-weight: bold;
@@ -103,6 +104,7 @@
cursor: pointer;
padding-right: 1em; }
.CommentItem .CommentContent .CommentText textarea {
font-size: 1em;
width: 100%;
min-height: 15em;
margin-top: 1em;
@@ -181,5 +183,7 @@
.CommentItem .CommentContent .CommentTextOverflow {
overflow-y: auto;
max-height: inherit; } }
.WireTabs {
opacity: 0; }
/*# sourceMappingURL=ProcessCommentsManager.css.map */

View File

@@ -1,4 +1,14 @@
$(document).ready(function() {
var ready = false;
$(document).on('click', '.WireTabs a', function($event) {
if(ready) window.location.href = $(this).attr('href');
return false;
});
$('.WireTabs').css('opacity', 1.0);
$('.WireTabs a.on').click();
$("a.CommentTextEdit").click(function() {
var $textarea = $("<textarea></textarea>");
@@ -106,4 +116,6 @@ $(document).ready(function() {
// for AdminThemeReno
var color = $(".WireTabs a.on").css('border-top-color');
$("#CommentListHeader").css('border-top-color', color);
ready = true;
});

View File

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

View File

@@ -172,7 +172,8 @@ class ProcessCommentsManager extends Process {
if(empty($status) || ($status != 'all' && !in_array($status, $this->statuses))) {
$session->redirect($this->wire('page')->url . "list/$field->name/all/");
}
$headline = ucfirst($status);
$statusNum = array_search($status, $this->statuses);
$headline = $statusNum !== false ? $this->statusTranslations[$statusNum] : ucfirst($status);
$this->breadcrumb('../', $field->getLabel());
$limit = (int) $this->wire('input')->get('limit');
@@ -351,7 +352,7 @@ class ProcessCommentsManager extends Process {
$out =
"<table class='CommentItemInfo'>" .
"<table class='CommentItemInfo' cellspacing='0'>" .
"<tr class='CommentTitle'>" .
"<th>" .
"<label>" .

View File

@@ -34,16 +34,17 @@
.CommentItems {
clear: both;
border-bottom: 1px solid #000;
border-bottom: 1px solid #777;
& + button {
& + button.ui-button {
margin-top: 1em;
}
}
.CommentItem {
clear: both;
border-top: 1px solid #000;
border-top: 1px solid #777;
padding: 0.75em 0;
margin: 0;
width: 100%;
@@ -65,7 +66,7 @@
th,
td {
padding: 4px 10px 4px 0;
border-bottom: 1px dotted #ccc;
border-bottom: 1px solid #ddd;
vertical-align: top;
}
@@ -150,6 +151,7 @@
padding-right: 1em;
textarea {
font-size: 1em;
width: 100%;
min-height: 15em;
margin-top: 1em;
@@ -288,3 +290,7 @@
}
}
.WireTabs {
opacity: 0;
}