Minor fixtures

This commit is contained in:
Tony Air 2018-12-21 09:56:42 +07:00
parent b376b94038
commit 6914a47f93
3 changed files with 63 additions and 99 deletions

View File

@ -8,44 +8,45 @@ img {
max-width: 100%; max-width: 100%;
} }
a, .a {
button, cursor: pointer;
.jqte_tool_icon { }
&:hover,
&:focus {
opacity: .8;
.fas, .a:hover,
.fab, .a:focus,
.far, a:hover,
&.fas, a:focus,
&.fab, [data-toggle]:hover,
&.far { [data-toggle]:focus {
transform: scale(-1, 1); opacity: .8;
}
.fas,
.fab,
&.fas,
&.fab {
transform: rotate(-180deg);
} }
} }
.jqte_tool_icon { [data-toggle="collapse"] {
&:hover, &[aria-expanded="true"] {
&:focus { .accordion-icon {
transform: scale(-1, 1); &:before {
content: "\f068";
}
}
} }
} }
// transactions // transactions
.transition, .transition,
a, a img, a, a *,
.jqte_tool_icon, .a, .a *,
a .fas, a .fab, a .far,
a.fas, a.fab, a.far,
button .fas, button .fab, button .far,
button.fas, button.fab, button.far,
button, input, optgroup, select, textarea, button, input, optgroup, select, textarea,
.btn, .btn,
.alert, .alert,
.dropdown, .dropdown,
[data-target], [data-toggle], [data-toggle] *,
.container, .container,
.container-fluid, .container-fluid,
.row, .row,
@ -53,73 +54,12 @@ button, input, optgroup, select, textarea,
transition: all 0.4s ease; transition: all 0.4s ease;
} }
.alert-fixed-top {
position: fixed;
top: 0;
z-index: 999;
left: 4rem;
right: 4rem;
}
.btn-toolbar { .btn-toolbar {
margin-top: $grid-gutter-height / 2; margin-top: $grid-gutter-height / 2;
} }
.field { .field {
position: relative;
margin: 2rem 0;
margin: ($grid-gutter-height / 4) 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 // stick navbar to top using mobile layout

View File

@ -16,6 +16,8 @@ use SilverStripe\Forms\TextField;
use SilverStripe\Forms\FormAction; use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\RequiredFields;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\ORM\ArrayList;
use DNADesign\Elemental\Models\ElementContent;
class PageController extends ContentController class PageController extends ContentController
{ {
@ -68,11 +70,33 @@ class PageController extends ContentController
return false; return false;
} }
$results = SiteTree::get()->filterAny([ $results = ArrayList::create();
// get pages by title and content
$pages = SiteTree::get()->filterAny([
'Title:PartialMatch' => $term, 'Title:PartialMatch' => $term,
'Content:PartialMatch' => $term, 'Content:PartialMatch' => $term,
])->sort('Created DESC'); ])->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([ return ArrayData::create([
'Title' => 'Search query "'.$term.'"', 'Title' => 'Search query "'.$term.'"',
'Results' => PaginatedList::create($results), 'Results' => PaginatedList::create($results),

View File

@ -9,16 +9,16 @@
<% loop $Results %> <% loop $Results %>
<div class="card"> <div class="card">
<div class="card-header" id="Heading{$ID}{$Up.ID}"> <div class="card-header" id="Heading{$ID}{$Up.ID}">
<h5 class="mb-0"> <h3
<strong class="mb-0 a"
data-toggle="collapse" data-toggle="collapse"
data-target="#Collapse{$ID}{$Up.ID}" data-target="#Collapse{$ID}{$Up.ID}"
aria-expanded="false" aria-expanded="false"
aria-controls="Collapse{$ID}{$Up.ID}" aria-controls="Collapse{$ID}{$Up.ID}"
> >
$Title $Title
</strong> <i class="fas fa-plus accordion-icon pull-right"></i>
</h5> </h3>
</div> </div>
<div <div
@ -28,7 +28,7 @@
data-parent="#SearchAccordion{$Up.ID}" data-parent="#SearchAccordion{$Up.ID}"
> >
<div class="card-body"> <div class="card-body">
<p>$Summary</p> <p>$Summary(100)</p>
<a href="{$Link}">Learn More</a> <a href="{$Link}">Learn More</a>
</div> </div>
</div> </div>
@ -42,4 +42,4 @@
</div> </div>
</div> </div>
<% end_with %> <% end_with %>