Skip to content

Commit

Permalink
Merge pull request #11547 from nanaya/forum-search-form-update
Browse files Browse the repository at this point in the history
Update forum search form style
  • Loading branch information
notbakaneko authored Oct 21, 2024
2 parents 18625db + 3be6947 commit 02fd2a3
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 89 deletions.
6 changes: 0 additions & 6 deletions resources/css/bem/btn-osu-big.less
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,6 @@
border-radius: 100000px;
}

&--search-advanced {
flex: 1 0 auto;
text-transform: lowercase;
margin: 0 5px;
}

&--store-action {
display: block;
width: max-content;
Expand Down
58 changes: 15 additions & 43 deletions resources/css/bem/search-forum-options.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,25 @@
// See the LICENCE file in the repository root for full licence text.

.search-forum-options {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;

&__input-group {
display: block;
margin: 10px auto;
width: 100%;
padding: 0 10px;

// reset global label style
text-transform: initial;
font-weight: initial;
display: grid;
width: 100%;
max-width: 400px;
margin: 0 auto;
gap: 10px;
margin-bottom: 10px;

&__buttons {
display: grid;
gap: inherit;
grid-template-columns: 1fr 1fr;

@media @desktop {
width: 300px;
position: relative;
}

&--buttons {
display: flex;
padding-left: 5px; // remaining 5px is provided by the buttons themselves
padding-right: $padding-left;

@media @desktop {
padding-left: 40px;
padding-right: 40px;
}
padding: 0 40px;
}
}

&__label {
display: block;
margin-bottom: 5px;
font-weight: bold;
white-space: nowrap;

@media @desktop {
position: absolute;
display: flex;
align-items: center;
margin-right: 10px;
margin-bottom: 0;
top: 0;
right: 100%;
height: 100%;
}
&__checkbox {
margin: 0;
font-weight: normal;
}
}
78 changes: 38 additions & 40 deletions resources/views/objects/search/_forum_options.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@

<div id="search-forum-options" class="search-forum-options">
@if ($fields['user'] !== null)
<label class="search-forum-options__input-group">
<div class="search-forum-options__label">
<label class="input-container">
<div class="input-container__label">
{{ osu_trans('home.search.forum_post.label.username') }}
</div>

<input
name="{{ $fields['user'] }}"
value="{{ $params[$fields['user']] ?? null }}"
class="form-text"
class="input-text"
>
</label>
@endif
Expand All @@ -45,54 +45,52 @@ class="form-text"

{{-- FIXME: remove querystring check? --}}
@if ($fields['topicId'] !== null && present($params[$fields['topicId']] ?? null))
<label class="search-forum-options__input-group">
<div class="search-forum-options__label">
<label class="input-container">
<div class="input-container__label">
{{ osu_trans('home.search.forum_post.label.topic_id') }}
</div>

<input
name="{{ $fields['topicId'] }}"
value="{{ $params[$fields['topicId']] }}"
class="form-text"
class="input-text"
>
</label>
@elseif ($fields['forumId'] !== null)
<label class="search-forum-options__input-group">
<div class="search-forum-options__label">
<label class="input-container input-container--select">
<div class="input-container__label">
{{ osu_trans('home.search.forum_post.label.forum') }}
</div>

<div class="form-select">
<select
name="{{ $fields['forumId'] }}"
class="form-select__input"
>
<option value="">
{{ osu_trans('home.search.forum_post.all') }}
</option>

@foreach (App\Models\Forum\Forum::searchable()->displayList()->get() as $forum)
@if (priv_check('ForumView', $forum)->can())
@php
$currentDepth = $forum->currentDepth();
@endphp
@if ($currentDepth === 0)
<hr>
@endif
<option
value="{{ $forum->getKey() }}"
{{ $forum->getKey() === get_int($params[$fields['forumId']] ?? null) ? 'selected' : '' }}
>
{{ str_repeat('', $currentDepth) }}
{{ $forum->forum_name }}
</option>
<select
name="{{ $fields['forumId'] }}"
class="input-text"
>
<option value="">
{{ osu_trans('home.search.forum_post.all') }}
</option>

@foreach (App\Models\Forum\Forum::searchable()->displayList()->get() as $forum)
@if (priv_check('ForumView', $forum)->can())
@php
$currentDepth = $forum->currentDepth();
@endphp
@if ($currentDepth === 0)
<hr>
@endif
@endforeach
</select>
</div>
<option
value="{{ $forum->getKey() }}"
{{ $forum->getKey() === get_int($params[$fields['forumId']] ?? null) ? 'selected' : '' }}
>
{{ str_repeat('', $currentDepth) }}
{{ $forum->forum_name }}
</option>
@endif
@endforeach
</select>
</label>

<label class="search-forum-options__input-group">
<label class="search-forum-options__checkbox">
@include('objects._switch', ['locals' => [
'checked' => $params[$fields['includeSubforums']] ?? null,
'name' => $fields['includeSubforums'],
Expand All @@ -103,7 +101,7 @@ class="form-select__input"
@endif

@if ($fields['includeDeleted'] !== null)
<label class="search-forum-options__input-group">
<label class="search-forum-options__checkbox">
@include('objects._switch', ['locals' => [
'checked' => $params[$fields['includeDeleted']] ?? null,
'name' => $fields['includeDeleted'],
Expand All @@ -113,8 +111,8 @@ class="form-select__input"
</label>
@endif

<div class="search-forum-options__input-group search-forum-options__input-group--buttons">
<button class="btn-osu-big btn-osu-big--search-advanced">
<div class="search-forum-options__buttons">
<button class="btn-osu-big btn-osu-big--rounded-thin">
<div class="btn-osu-big__content">
<div class="btn-osu-big__left">
{{ osu_trans('home.search.button') }}
Expand All @@ -126,7 +124,7 @@ class="form-select__input"
</div>
</button>

<button type="button" class="btn-osu-big btn-osu-big--search-advanced js-search--forum-options-reset">
<button type="button" class="btn-osu-big btn-osu-big--rounded-thin js-search--forum-options-reset">
<div class="btn-osu-big__content">
<div class="btn-osu-big__left">
{{ osu_trans('common.buttons.reset') }}
Expand Down

0 comments on commit 02fd2a3

Please sign in to comment.