From 6914a47f93162812679ce109774dd1691cc2325b Mon Sep 17 00:00:00 2001 From: Tony Air Date: Fri, 21 Dec 2018 09:56:42 +0700 Subject: [PATCH] Minor fixtures --- app/client/src/scss/_components/_ui.main.scss | 112 ++++-------------- app/src/Pages/PageController.php | 26 +++- app/templates/Layout/PageController_search.ss | 24 ++-- 3 files changed, 63 insertions(+), 99 deletions(-) diff --git a/app/client/src/scss/_components/_ui.main.scss b/app/client/src/scss/_components/_ui.main.scss index 244a640..3316993 100644 --- a/app/client/src/scss/_components/_ui.main.scss +++ b/app/client/src/scss/_components/_ui.main.scss @@ -8,44 +8,45 @@ img { max-width: 100%; } -a, -button, -.jqte_tool_icon { - &:hover, - &:focus { - opacity: .8; +.a { + cursor: pointer; +} - .fas, - .fab, - .far, - &.fas, - &.fab, - &.far { - transform: scale(-1, 1); - } +.a:hover, +.a:focus, +a:hover, +a:focus, +[data-toggle]:hover, +[data-toggle]:focus { + opacity: .8; + + .fas, + .fab, + &.fas, + &.fab { + transform: rotate(-180deg); } } -.jqte_tool_icon { - &:hover, - &:focus { - transform: scale(-1, 1); +[data-toggle="collapse"] { + &[aria-expanded="true"] { + .accordion-icon { + &:before { + content: "\f068"; + } + } } } // transactions .transition, -a, a img, -.jqte_tool_icon, -a .fas, a .fab, a .far, -a.fas, a.fab, a.far, -button .fas, button .fab, button .far, -button.fas, button.fab, button.far, +a, a *, +.a, .a *, button, input, optgroup, select, textarea, .btn, .alert, .dropdown, -[data-target], +[data-toggle], [data-toggle] *, .container, .container-fluid, .row, @@ -53,73 +54,12 @@ button, input, optgroup, select, textarea, transition: all 0.4s ease; } -.alert-fixed-top { - position: fixed; - top: 0; - z-index: 999; - left: 4rem; - right: 4rem; -} - .btn-toolbar { margin-top: $grid-gutter-height / 2; } .field { - position: relative; - margin: 2rem 0; margin: ($grid-gutter-height / 4) 0; - - &:first-child { - margin-top: 0; - } - - &.required { - &:after { - display: block; - position: absolute; - top: 2rem; - right: .5rem; - content: "*"; - color: $red; - z-index: 2; - } - } - - &.holder-error, - &.error { - input, select, textarea { - border-color: $red; - } - - label { - color: $red; - } - } - - label { - font-weight: bold; - } - - .bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) { - width: 100%; - } -} - -.message { - @extend .alert; - - @extend .alert-info; - - display: block; - margin: .5rem 0; -} - -.message.required, -.message.error { - @extend .alert; - - @extend .alert-danger; } // stick navbar to top using mobile layout diff --git a/app/src/Pages/PageController.php b/app/src/Pages/PageController.php index c89bd60..e3d7e52 100644 --- a/app/src/Pages/PageController.php +++ b/app/src/Pages/PageController.php @@ -16,6 +16,8 @@ use SilverStripe\Forms\TextField; use SilverStripe\Forms\FormAction; use SilverStripe\Forms\RequiredFields; use SilverStripe\Control\HTTPRequest; +use SilverStripe\ORM\ArrayList; +use DNADesign\Elemental\Models\ElementContent; class PageController extends ContentController { @@ -68,11 +70,33 @@ class PageController extends ContentController return false; } - $results = SiteTree::get()->filterAny([ + $results = ArrayList::create(); + + // get pages by title and content + $pages = SiteTree::get()->filterAny([ 'Title:PartialMatch' => $term, 'Content:PartialMatch' => $term, ])->sort('Created DESC'); + $results->merge($pages); + + // get pages by elements + $elements = ElementContent::get()->filterAny([ + 'Title:PartialMatch' => $term, + 'HTML:PartialMatch' => $term, + ])->sort('Created DESC'); + + foreach ($elements as $element) { + $page = Page::get()->filter('ElementalAreaID', $element->getField('ParentID'))->first(); + if(!$page) { + continue; + } + + $results->push($page); + } + + $results->removeDuplicates(); + return ArrayData::create([ 'Title' => 'Search query "'.$term.'"', 'Results' => PaginatedList::create($results), diff --git a/app/templates/Layout/PageController_search.ss b/app/templates/Layout/PageController_search.ss index 9a930d9..0e2d9c8 100644 --- a/app/templates/Layout/PageController_search.ss +++ b/app/templates/Layout/PageController_search.ss @@ -9,16 +9,16 @@ <% loop $Results %>
-
- -
+
-

$Summary

+

$Summary(100)

Learn More
@@ -42,4 +42,4 @@
-<% end_with %> \ No newline at end of file +<% end_with %>