q2a / question2answer

Question2Answer is a free and open source platform for Q&A sites, running on PHP/MySQL.
http://www.question2answer.org/
GNU General Public License v3.0
1.63k stars 627 forks source link

Inscreased HTML wrapper scope by 1, to better handle UI components/Styling #986

Closed rxchun closed 5 months ago

rxchun commented 11 months ago

Basically just moved qam-account-items-wrapper outside nav_user_search() , instead of inside. This gives plugins the ability to output stuff right next to the User Avatar on Modern themes such as SnowFlat. For example, the OnSiteNotification bell - https://i.ibb.co/9VMxz7z/z317.jpg

$this->output('<div class="qam-account-items-wrapper">');
    $this->nav_user_search();
$this->output('</div>');
svivian commented 6 months ago

I don't understand what this solves, as the div already wraps everything inside the nav_user_search() method.

rxchun commented 6 months ago

Because the header structure is like this:

public function header()
{
$this->output('<div class="qa-header">');

    $this->logo();
    $this->nav_user_search();
    $this->nav_main_sub();
    $this->header_clear();

    $this->output('</div> <!-- END qa-header -->', '');
}

So if you append/prepend something to the nav_user_search() like this:

function nav_user_search() {
    $this->output('<!-- Output something here -->');
    qa_html_theme_base::nav_user_search();
}

it will append outside the qam-account-items-wrapper , so it will be outputted as a sibling of the logo(), nav_user_search() and nav_main_sub() . But if you wrap it outside, you can properly append stuff as siblings of the User Avatar and prevent this: https://question2answer.org/qa/111662/notification-moved-to-left-please-help

rxchun commented 6 months ago

So that the content gets properly divided by sections like this