1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-23 14:56:51 +02:00

Fix issue in ProcessCommentsManager where the tabs were not showing active state properly in AdminThemeUikit. Plus some minor CSS updates in InputfieldPage and ProcessPageLister.

This commit is contained in:
Ryan Cramer
2018-03-22 07:59:16 -04:00
parent a5e5ae7b47
commit bd85c025e2
7 changed files with 52 additions and 13 deletions

View File

@@ -151,6 +151,11 @@ class FieldtypeOptions extends FieldtypeMulti implements Module {
} else if(strpos($value, "\n") !== false) { } else if(strpos($value, "\n") !== false) {
$value = explode("\n", $value); $value = explode("\n", $value);
} }
if(is_array($value)) {
foreach($value as $k => $v) {
$value[$k] = trim($v);
}
}
} }
if(empty($value)) return $this->getBlankValue($page, $field); if(empty($value)) return $this->getBlankValue($page, $field);

View File

@@ -1,3 +1,7 @@
.InputfieldPageAdd {
margin-top: 1em;
}
.InputfieldPageAddButton { .InputfieldPageAddButton {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }

View File

@@ -8,7 +8,7 @@ $(document).ready(function() {
}); });
$('.WireTabs').css('opacity', 1.0); $('.WireTabs').css('opacity', 1.0);
$('.WireTabs a.on').click(); $('.WireTabs a.on').parent('li').click();
$("a.CommentTextEdit").click(function() { $("a.CommentTextEdit").click(function() {
var $textarea = $("<textarea></textarea>"); var $textarea = $("<textarea></textarea>");

View File

@@ -1 +1 @@
$(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}); $(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").parent("li").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

@@ -23,7 +23,7 @@ class ProcessCommentsManager extends Process {
return array( return array(
'title' => __('Comments', __FILE__), 'title' => __('Comments', __FILE__),
'summary' => __('Manage comments in your site outside of the page editor.', __FILE__), 'summary' => __('Manage comments in your site outside of the page editor.', __FILE__),
'version' => 7, 'version' => 8,
'author' => 'Ryan Cramer', 'author' => 'Ryan Cramer',
'icon' => 'comments', 'icon' => 'comments',
'requires' => 'FieldtypeComments', 'requires' => 'FieldtypeComments',
@@ -252,6 +252,8 @@ class ProcessCommentsManager extends Process {
$numDeleted = 0; $numDeleted = 0;
$numChanged = 0; $numChanged = 0;
/** @var FieldtypeComments $fieldtype */
$fieldtype = $field->type;
foreach($comments as $comment) { foreach($comments as $comment) {
@@ -287,7 +289,7 @@ class ProcessCommentsManager extends Process {
$_status = $this->input->post("CommentStatus{$comment->id}"); $_status = $this->input->post("CommentStatus{$comment->id}");
$status = (int) $_status; $status = (int) $_status;
if($status === Comment::statusDelete) { if($status === Comment::statusDelete) {
if($field->type->deleteComment($comment->getPage(), $field, $comment)) { if($fieldtype->deleteComment($comment->getPage(), $field, $comment)) {
$this->message(sprintf($this->_('Deleted comment #%d'), $comment->id)); $this->message(sprintf($this->_('Deleted comment #%d'), $comment->id));
$numDeleted++; $numDeleted++;
} }
@@ -300,7 +302,7 @@ class ProcessCommentsManager extends Process {
} }
if(count($properties)) { if(count($properties)) {
$field->type->updateComment($comment->getPage(), $field, $comment, $properties); $fieldtype->updateComment($comment->getPage(), $field, $comment, $properties);
$this->message(sprintf($this->_('Updated comment #%d'), $comment->id) . " (" . implode(', ', array_keys($properties)) . ")"); $this->message(sprintf($this->_('Updated comment #%d'), $comment->id) . " (" . implode(', ', array_keys($properties)) . ")");
} }
@@ -568,6 +570,7 @@ class ProcessCommentsManager extends Process {
if($cnt >= $limit) break; if($cnt >= $limit) break;
} }
/** @var MarkupPagerNav $pager */
$pager = $this->wire('modules')->get('MarkupPagerNav'); $pager = $this->wire('modules')->get('MarkupPagerNav');
$pagerOut = $pager->render($comments, array( $pagerOut = $pager->render($comments, array(
'queryString' => $queryString, 'queryString' => $queryString,
@@ -576,7 +579,7 @@ class ProcessCommentsManager extends Process {
/** @var JqueryWireTabs $wireTabs */ /** @var JqueryWireTabs $wireTabs */
$wireTabs = $this->modules->get('JqueryWireTabs'); $wireTabs = $this->modules->get('JqueryWireTabs');
$tabs = array(); $tabs = array();
$class = $this->input->urlSegment3 == 'all' ? 'on' : ''; $class = $this->input->urlSegment3 === 'all' ? 'on' : '';
$tabs["tabStatusAll"] = "<a class='$class' href='../all/'>" . $this->labelAll . "</a>"; $tabs["tabStatusAll"] = "<a class='$class' href='../all/'>" . $this->labelAll . "</a>";
foreach($this->statuses as $status => $name) { foreach($this->statuses as $status => $name) {
@@ -592,6 +595,7 @@ class ProcessCommentsManager extends Process {
$this->headline($this->headline); $this->headline($this->headline);
if($cnt) { if($cnt) {
/** @var InputfieldSubmit $button */
$button = $this->modules->get('InputfieldSubmit'); $button = $this->modules->get('InputfieldSubmit');
$button->attr('name', 'processComments'); $button->attr('name', 'processComments');
$button->showInHeader(); $button->showInHeader();

View File

@@ -4,12 +4,17 @@
#ProcessListerResultsTab { #ProcessListerResultsTab {
padding-top: 0.5em; } padding-top: 0.5em; }
#ProcessListerResults > form.InputfieldForm {
margin-bottom: 0; }
#ProcessListerResults #ProcessListerTable { #ProcessListerResults #ProcessListerTable {
clear: both; clear: both;
overflow-x: auto; } overflow-x: auto; }
#ProcessListerResults #ProcessListerTable > div {
margin-top: 0; }
#ProcessListerResults #ProcessListerTable table.ProcessListerTable { #ProcessListerResults #ProcessListerTable table.ProcessListerTable {
clear: both; clear: both;
position: relative; } position: relative;
margin-top: 0; }
#ProcessListerResults #ProcessListerTable table.ProcessListerTable td table { #ProcessListerResults #ProcessListerTable table.ProcessListerTable td table {
width: 100%; } width: 100%; }
#ProcessListerResults #ProcessListerTable table.ProcessListerTable > thead th { #ProcessListerResults #ProcessListerTable table.ProcessListerTable > thead th {
@@ -33,6 +38,7 @@
margin: 0; margin: 0;
padding-left: 0; } padding-left: 0; }
#ProcessListerResults #ProcessListerTable table.ProcessListerTable > tbody > tr > td ul.MarkupFieldtype > li { #ProcessListerResults #ProcessListerTable table.ProcessListerTable > tbody > tr > td ul.MarkupFieldtype > li {
list-style: none;
margin: 0; margin: 0;
padding-left: 0; } padding-left: 0; }
#ProcessListerResults #ProcessListerTable table.ProcessListerTable > tbody > tr > td ul.MarkupFieldtype > li + li { #ProcessListerResults #ProcessListerTable table.ProcessListerTable > tbody > tr > td ul.MarkupFieldtype > li + li {
@@ -100,7 +106,8 @@
.pw-content .lister_headline, .pw-content .lister_headline,
#content .lister_headline { #content .lister_headline {
float: left; } float: left;
margin-top: 1em; }
@media only screen and (max-width: 767px) { @media only screen and (max-width: 767px) {
.pw-content .lister_headline, .pw-content .lister_headline,
#content .lister_headline { #content .lister_headline {
@@ -117,9 +124,11 @@
#ProcessListerRefreshTab { #ProcessListerRefreshTab {
float: right; } float: right; }
#ProcessListerSelector {
display: inline-block; }
p.version { p.version {
clear: both; clear: both; }
padding-top: 1em; }
#ProcessListerScript { #ProcessListerScript {
display: none; } display: none; }
@@ -131,5 +140,5 @@ p.version {
padding: 0 !important; } padding: 0 !important; }
.AdminThemeReno a.lister-lightbox img { .AdminThemeReno a.lister-lightbox img {
margin: 0 !important; } margin: 0 !important; }
.AdminThemeReno #content .lister_headline {
/*# sourceMappingURL=ProcessPageLister.css.map */ margin-top: 0.5em; }

View File

@@ -10,15 +10,23 @@
#ProcessListerResults { #ProcessListerResults {
> form.InputfieldForm {
margin-bottom: 0;
}
#ProcessListerTable { #ProcessListerTable {
clear: both; clear: both;
overflow-x: auto; overflow-x: auto;
> div {
margin-top: 0;
}
} }
#ProcessListerTable table.ProcessListerTable { #ProcessListerTable table.ProcessListerTable {
clear: both; clear: both;
position: relative; position: relative;
margin-top: 0;
td table { td table {
width: 100%; width: 100%;
@@ -56,6 +64,7 @@
margin: 0; margin: 0;
padding-left: 0; padding-left: 0;
& > li { & > li {
list-style: none;
margin: 0; margin: 0;
padding-left: 0; padding-left: 0;
} }
@@ -169,6 +178,7 @@
.pw-content .lister_headline, .pw-content .lister_headline,
#content .lister_headline { #content .lister_headline {
float: left; float: left;
margin-top: 1em;
@media only screen and (max-width: 767px) { @media only screen and (max-width: 767px) {
float: none; float: none;
clear: both; clear: both;
@@ -188,9 +198,13 @@
float: right; float: right;
} }
#ProcessListerSelector {
display: inline-block;
}
p.version { p.version {
clear: both; clear: both;
padding-top: 1em; //padding-top: 1em;
} }
#ProcessListerScript { #ProcessListerScript {
@@ -208,5 +222,8 @@ p.version {
a.lister-lightbox img { a.lister-lightbox img {
margin: 0 !important; margin: 0 !important;
} }
#content .lister_headline {
margin-top: 0.5em;
}
} }