diff --git a/public/language/en-GB/admin/menu.json b/public/language/en-GB/admin/menu.json index 5b22fbeb36..379e0b2687 100644 --- a/public/language/en-GB/admin/menu.json +++ b/public/language/en-GB/admin/menu.json @@ -76,7 +76,7 @@ "logout": "Log out", "view-forum": "View Forum", - "search.placeholder": "Press "/" to search for settings", + "search.placeholder": "Search settings", "search.no-results": "No results...", "search.search-forum": "Search the forum for ", "search.keep-typing": "Type more to see results...", diff --git a/public/less/admin/header.less b/public/less/admin/header.less index 1c50293113..63d8e8bcdb 100644 --- a/public/less/admin/header.less +++ b/public/less/admin/header.less @@ -86,6 +86,36 @@ } } + .dropdown:not(.open) { + &:before { + content: '/'; + border: 1px solid @gray; + border-radius: 5px; + padding: 0px 6px; + font-size: 12px; + font-weight: 600; + pointer-events: none; + + position: absolute; + top: 10px; + left: 1em; + } + + &:after { + content: attr(data-text); + position: absolute; + top: 10px; + left: 3em; + font-size: small; + font-weight: 600; + pointer-events: none; + } + + input { + color: transparent; + } + } + .search-match { font-weight: 700; color: black; diff --git a/public/src/admin/modules/search.js b/public/src/admin/modules/search.js index 20566ede27..f9c4050c1c 100644 --- a/public/src/admin/modules/search.js +++ b/public/src/admin/modules/search.js @@ -63,6 +63,7 @@ define('admin/modules/search', ['mousetrap', 'alerts'], function (mousetrap, ale const dropdown = $('#acp-search .dropdown'); const menu = $('#acp-search .dropdown-menu'); const input = $('#acp-search input'); + const placeholderText = dropdown.attr('data-text'); if (!config.searchEnabled) { menu.addClass('search-disabled'); @@ -73,17 +74,19 @@ define('admin/modules/search', ['mousetrap', 'alerts'], function (mousetrap, ale }); $('#acp-search').parents('form').on('submit', function (ev) { + const query = input.val(); let selected = menu.find('li.result > a.focus').attr('href'); if (!selected.length) { selected = menu.find('li.result > a').first().attr('href'); } - const href = selected || config.relative_path + '/search?in=titlesposts&term=' + escape(input.val()); + const href = selected || config.relative_path + '/search?in=titlesposts&term=' + escape(query); ajaxify.go(href.replace(/^\//, '')); setTimeout(function () { dropdown.removeClass('open'); input.blur(); + dropdown.attr('data-text', query || placeholderText); }, 150); ev.preventDefault(); diff --git a/src/views/admin/partials/menu.tpl b/src/views/admin/partials/menu.tpl index 343ba8445c..091c28ee9f 100644 --- a/src/views/admin/partials/menu.tpl +++ b/src/views/admin/partials/menu.tpl @@ -139,8 +139,8 @@ {{{ if user.privileges.admin:settings }}}