Topics index - Make the "new topic" button more visible

This commit is contained in:
Antoine Le Gonidec 2024-07-25 13:15:55 +02:00
parent 303dd63625
commit d34aea175a
Signed by: vv221
GPG key ID: 636B78F91CEB80D8
3 changed files with 60 additions and 40 deletions

View file

@ -120,12 +120,12 @@ function template_main()
{
echo '
<div class="pagesection">
', template_button_strip($context['normal_buttons'], ), '
', $context['menu_separator'], '
<div class="pagelinks">
<a href="#bot" class="button">', $txt['go_down'], '</a>
', $context['page_index'], '
</div>
', $context['menu_separator'], '
', template_button_strip($context['normal_buttons'], ), '
';
// Mobile action buttons (top)
@ -338,12 +338,12 @@ function template_main()
echo '
<div class="pagesection">
', template_button_strip($context['normal_buttons'], ), '
', $context['menu_separator'], '
<div class="pagelinks">
<a href="#main_content_section" class="button" id="bot">', $txt['go_up'], '</a>
', $context['page_index'], '
</div>';
</div>
', $context['menu_separator'], '
', template_button_strip($context['normal_buttons'], );
// Mobile action buttons (bottom)
if (!empty($context['normal_buttons']))

View file

@ -25,6 +25,8 @@ html {
--menu-background-hover: #555555;
--menu-background-active: black;
--menu-font: white;
--font-regular: "Cabin", sans-serif;
--font-emphasis: "Oswald", sans-serif;
}
/* Index */
@ -1133,13 +1135,16 @@ generic_menu .dropmenu .subsections ul li a {
border: 1px solid;
border-color: var(--bgcolor);
border-radius: 3px;
box-shadow: 1px 1px 1px rgba(221, 221, 221, 0.57) inset;
box-sizing: border-box;
vertical-align: middle;
background: var(--neutral-color);
outline: none;
padding: 0 0.4em;
}
.button_strip_new_topic {
font-weight: 700;
font-family: var(--font-emphasis);
}
a.button, a.button:hover, .button:focus {
border-bottom: none;

View file

@ -634,8 +634,6 @@ function template_menu()
*/
function template_button_strip($button_strip, $direction = '', $strip_options = array())
{
global $context, $txt;
if (!is_array($strip_options))
$strip_options = array();
@ -643,6 +641,32 @@ function template_button_strip($button_strip, $direction = '', $strip_options =
$buttons = array();
foreach ($button_strip as $key => $value)
{
// If a "new topic" button is provided, skip it in this first pass.
// It will be added at the end of the strip.
if ( $key == 'new_topic' ) continue;
$buttons = template_button_strip_single_button($key, $value, $buttons);
}
// If a "new topic" button is provided, add it at the end of the strip.
if ( array_key_exists('new_topic', $button_strip) ) {
$key = 'new_topic';
$value = $button_strip[$key];
$buttons = template_button_strip_single_button($key, $value, $buttons);
}
// No buttons? No button strip either.
if (empty($buttons))
return;
echo '
<div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"' : ''), '>
', implode('', $buttons), '
</div>';
}
function template_button_strip_single_button($key, $value, $buttons) {
global $context, $txt;
// As of 2.1, the 'test' for each button happens while the array is being generated. The extra 'test' check here is deprecated but kept for backward compatibility (update your mods, folks!)
if (!isset($value['test']) || !empty($context[$value['test']]))
{
@ -677,16 +701,7 @@ function template_button_strip($button_strip, $direction = '', $strip_options =
$buttons[] = $button;
}
}
// No buttons? No button strip either.
if (empty($buttons))
return;
echo '
<div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"' : ''), '>
', implode('', $buttons), '
</div>';
return $buttons;
}
/**