From bd85c025e2bef375a8b2061ececdd01eab925241 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Thu, 22 Mar 2018 07:59:16 -0400 Subject: [PATCH] Fix issue in ProcessCommentsManager where the tabs were not showing active state properly in AdminThemeUikit. Plus some minor CSS updates in InputfieldPage and ProcessPageLister. --- .../FieldtypeOptions/FieldtypeOptions.module | 5 +++++ .../InputfieldPage/InputfieldPage.css | 4 ++++ .../ProcessCommentsManager.js | 2 +- .../ProcessCommentsManager.min.js | 2 +- .../ProcessCommentsManager.module | 12 +++++++---- .../ProcessPageLister/ProcessPageLister.css | 21 +++++++++++++------ .../ProcessPageLister/ProcessPageLister.scss | 19 ++++++++++++++++- 7 files changed, 52 insertions(+), 13 deletions(-) diff --git a/wire/modules/Fieldtype/FieldtypeOptions/FieldtypeOptions.module b/wire/modules/Fieldtype/FieldtypeOptions/FieldtypeOptions.module index b1c8e627..5d80adf6 100644 --- a/wire/modules/Fieldtype/FieldtypeOptions/FieldtypeOptions.module +++ b/wire/modules/Fieldtype/FieldtypeOptions/FieldtypeOptions.module @@ -151,6 +151,11 @@ class FieldtypeOptions extends FieldtypeMulti implements Module { } else if(strpos($value, "\n") !== false) { $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); diff --git a/wire/modules/Inputfield/InputfieldPage/InputfieldPage.css b/wire/modules/Inputfield/InputfieldPage/InputfieldPage.css index 8234345c..beafe3ab 100644 --- a/wire/modules/Inputfield/InputfieldPage/InputfieldPage.css +++ b/wire/modules/Inputfield/InputfieldPage/InputfieldPage.css @@ -1,3 +1,7 @@ +.InputfieldPageAdd { + margin-top: 1em; +} + .InputfieldPageAddButton { margin-bottom: 0 !important; } diff --git a/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.js b/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.js index 8600a08e..ab393d68 100644 --- a/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.js +++ b/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.js @@ -8,7 +8,7 @@ $(document).ready(function() { }); $('.WireTabs').css('opacity', 1.0); - $('.WireTabs a.on').click(); + $('.WireTabs a.on').parent('li').click(); $("a.CommentTextEdit").click(function() { var $textarea = $(""); diff --git a/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.min.js b/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.min.js index ddb5251a..f4cc51b0 100644 --- a/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.min.js +++ b/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.min.js @@ -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=$("");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}); \ No newline at end of file +$(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=$("");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}); \ No newline at end of file diff --git a/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.module b/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.module index 1229c86c..82c23fd7 100644 --- a/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.module +++ b/wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.module @@ -23,7 +23,7 @@ class ProcessCommentsManager extends Process { return array( 'title' => __('Comments', __FILE__), 'summary' => __('Manage comments in your site outside of the page editor.', __FILE__), - 'version' => 7, + 'version' => 8, 'author' => 'Ryan Cramer', 'icon' => 'comments', 'requires' => 'FieldtypeComments', @@ -252,6 +252,8 @@ class ProcessCommentsManager extends Process { $numDeleted = 0; $numChanged = 0; + /** @var FieldtypeComments $fieldtype */ + $fieldtype = $field->type; foreach($comments as $comment) { @@ -287,7 +289,7 @@ class ProcessCommentsManager extends Process { $_status = $this->input->post("CommentStatus{$comment->id}"); $status = (int) $_status; 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)); $numDeleted++; } @@ -300,7 +302,7 @@ class ProcessCommentsManager extends Process { } 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)) . ")"); } @@ -568,6 +570,7 @@ class ProcessCommentsManager extends Process { if($cnt >= $limit) break; } + /** @var MarkupPagerNav $pager */ $pager = $this->wire('modules')->get('MarkupPagerNav'); $pagerOut = $pager->render($comments, array( 'queryString' => $queryString, @@ -576,7 +579,7 @@ class ProcessCommentsManager extends Process { /** @var JqueryWireTabs $wireTabs */ $wireTabs = $this->modules->get('JqueryWireTabs'); $tabs = array(); - $class = $this->input->urlSegment3 == 'all' ? 'on' : ''; + $class = $this->input->urlSegment3 === 'all' ? 'on' : ''; $tabs["tabStatusAll"] = "" . $this->labelAll . ""; foreach($this->statuses as $status => $name) { @@ -592,6 +595,7 @@ class ProcessCommentsManager extends Process { $this->headline($this->headline); if($cnt) { + /** @var InputfieldSubmit $button */ $button = $this->modules->get('InputfieldSubmit'); $button->attr('name', 'processComments'); $button->showInHeader(); diff --git a/wire/modules/Process/ProcessPageLister/ProcessPageLister.css b/wire/modules/Process/ProcessPageLister/ProcessPageLister.css index 8f8eb776..c5ec67ee 100644 --- a/wire/modules/Process/ProcessPageLister/ProcessPageLister.css +++ b/wire/modules/Process/ProcessPageLister/ProcessPageLister.css @@ -4,12 +4,17 @@ #ProcessListerResultsTab { padding-top: 0.5em; } +#ProcessListerResults > form.InputfieldForm { + margin-bottom: 0; } #ProcessListerResults #ProcessListerTable { clear: both; overflow-x: auto; } + #ProcessListerResults #ProcessListerTable > div { + margin-top: 0; } #ProcessListerResults #ProcessListerTable table.ProcessListerTable { clear: both; - position: relative; } + position: relative; + margin-top: 0; } #ProcessListerResults #ProcessListerTable table.ProcessListerTable td table { width: 100%; } #ProcessListerResults #ProcessListerTable table.ProcessListerTable > thead th { @@ -33,6 +38,7 @@ margin: 0; padding-left: 0; } #ProcessListerResults #ProcessListerTable table.ProcessListerTable > tbody > tr > td ul.MarkupFieldtype > li { + list-style: none; margin: 0; padding-left: 0; } #ProcessListerResults #ProcessListerTable table.ProcessListerTable > tbody > tr > td ul.MarkupFieldtype > li + li { @@ -100,7 +106,8 @@ .pw-content .lister_headline, #content .lister_headline { - float: left; } + float: left; + margin-top: 1em; } @media only screen and (max-width: 767px) { .pw-content .lister_headline, #content .lister_headline { @@ -117,9 +124,11 @@ #ProcessListerRefreshTab { float: right; } +#ProcessListerSelector { + display: inline-block; } + p.version { - clear: both; - padding-top: 1em; } + clear: both; } #ProcessListerScript { display: none; } @@ -131,5 +140,5 @@ p.version { padding: 0 !important; } .AdminThemeReno a.lister-lightbox img { margin: 0 !important; } - -/*# sourceMappingURL=ProcessPageLister.css.map */ +.AdminThemeReno #content .lister_headline { + margin-top: 0.5em; } diff --git a/wire/modules/Process/ProcessPageLister/ProcessPageLister.scss b/wire/modules/Process/ProcessPageLister/ProcessPageLister.scss index 86b2d65e..4198b67d 100644 --- a/wire/modules/Process/ProcessPageLister/ProcessPageLister.scss +++ b/wire/modules/Process/ProcessPageLister/ProcessPageLister.scss @@ -10,15 +10,23 @@ #ProcessListerResults { + > form.InputfieldForm { + margin-bottom: 0; + } + #ProcessListerTable { clear: both; overflow-x: auto; + > div { + margin-top: 0; + } } #ProcessListerTable table.ProcessListerTable { clear: both; position: relative; + margin-top: 0; td table { width: 100%; @@ -56,6 +64,7 @@ margin: 0; padding-left: 0; & > li { + list-style: none; margin: 0; padding-left: 0; } @@ -169,6 +178,7 @@ .pw-content .lister_headline, #content .lister_headline { float: left; + margin-top: 1em; @media only screen and (max-width: 767px) { float: none; clear: both; @@ -188,9 +198,13 @@ float: right; } +#ProcessListerSelector { + display: inline-block; +} + p.version { clear: both; - padding-top: 1em; + //padding-top: 1em; } #ProcessListerScript { @@ -208,5 +222,8 @@ p.version { a.lister-lightbox img { margin: 0 !important; } + #content .lister_headline { + margin-top: 0.5em; + } }