Skip to content

Commit

Permalink
English stripping + fixing JS
Browse files Browse the repository at this point in the history
  • Loading branch information
momijizukamori committed Jun 19, 2024
1 parent 1f5c0e7 commit 7e47aab
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
7 changes: 5 additions & 2 deletions resources/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@ $(() => {
doSearch: () => {
let form = document.getElementById('search-form');
let form_values = searchJs.getFormValues();
let page = document.getElementById('search-page').value;
let pageEl = document.getElementById('search-page');
searchJs.loader.css('display', 'block');
searchJs.results.css('display', 'none');
searchJs.error.css('display', 'none');
let form_data = new FormData(form);
form_data.set('page', page);
if (pageEl) {
let page = pageEl.value;
form_data.set('page', page);
}
window.history.pushState(null, null, '/search/?' + $.param(form_values));
fetch('/search', { method: "POST", headers: searchJs.headers, body: form_data})
.then((response) => {
Expand Down
8 changes: 7 additions & 1 deletion resources/lang/en/ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,22 @@

'search' => [
'title' => 'Search',
'filters' => 'Filters',
'clear_filters' => 'Clear Filters',
'no_results' => 'No Results!',
'try_again' => 'Try another search?',
'brands' => 'Brands',
'categories' => 'Categories',
'tags' => 'Tags',
'features' => 'Features',
'colors' => 'Colors',
'year' => 'Year',
'match_type' => 'Match',
'match_any' => 'Any',
'match_all' => 'All',
'match_none' => 'None',
'error' => 'Something went wrong, please try again later!'
'error' => 'Something went wrong, please try again later!',
'placeholder' => 'Type to search or filter'
],

'item' => [
Expand Down
6 changes: 3 additions & 3 deletions resources/views/components/filters.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="card">
<div class="card-header">
Filters
{{__('ui.search.filters')}}
</div>
<div class="card-body">
@foreach ($sections as $name => $items)
Expand All @@ -27,7 +27,7 @@
</div>
@endforeach
<div class="pb-2">
<label class="control-label" for="year-slider">Year</label>
<label class="control-label" for="year-slider">{{__('ui.search.year')}}</label>
<div id="slider-wrapper">
<input
type="text"
Expand Down Expand Up @@ -55,7 +55,7 @@
</div>

<div class="input-group pb-2">
<button class="btn btn-block btn-outline-primary" style="width: 100%" name="action:clear">Clear Filters</button>
<button class="btn btn-block btn-outline-primary" style="width: 100%" name="action:clear">{{__('ui.search.clear_filters')}}</button>
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions resources/views/components/search-bar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<div class="card-body pb-0 pt-3">
<div class="row">
<div class="col-md-8 col-lg-9 col-xl-10 mb-3">
<p class="sr-only">Type to search or filter</p>
<p class="sr-only">{{__('ui.search.placeholder')}}</p>
<input autocomplete="off" id="search" class="form-control input-lg" type="text" name="search" placeholder="Type to filter items by name" value="{{request('search')}}" role="search">
</div>
<div class="col-md-4 col-lg-3 col-xl-2 mb-3">
<button class="btn btn-block btn-outline-primary" name="action:search" id="search-btn">Search</button>
<button class="btn btn-block btn-outline-primary" name="action:search" id="search-btn">{{ __('ui.search.title') }}</button>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/search-results.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<div style="height: 14rem">
<img src="/categories/other.svg" class="mw-100 mh-100">
</div>
<p class="h4 text-center text-muted my-0">No Results!</p>
<p class="text-center">Try another search?</p>
<p class="h4 text-center text-muted my-0">{{__('ui.search.no_results')}}</p>
<p class="text-center">{{__('ui.search.try_again')}}</p>
</div>
@endforelse
</div>
Expand Down

0 comments on commit 7e47aab

Please sign in to comment.