mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
Merge pull request #5782 from kevinansfield/search-no-results
Display "No results" message when no search results found
This commit is contained in:
commit
e448a53e16
@ -117,13 +117,36 @@ export default Ember.Component.extend({
|
||||
this.get('_selectize').focus();
|
||||
},
|
||||
|
||||
onInit: function () {
|
||||
var selectize = this.get('_selectize'),
|
||||
html = '<div class="dropdown-empty-message">No results...</div>';
|
||||
|
||||
selectize.$empty_results_container = $(html);
|
||||
selectize.$empty_results_container.hide();
|
||||
selectize.$dropdown.append(selectize.$empty_results_container);
|
||||
},
|
||||
|
||||
onFocus: function () {
|
||||
this._setKeymasterScope();
|
||||
this.refreshContent();
|
||||
},
|
||||
|
||||
onBlur: function () {
|
||||
var selectize = this.get('_selectize');
|
||||
|
||||
this._resetKeymasterScope();
|
||||
selectize.$empty_results_container.hide();
|
||||
},
|
||||
|
||||
onType: function () {
|
||||
var selectize = this.get('_selectize');
|
||||
|
||||
if (!selectize.hasOptions) {
|
||||
selectize.open();
|
||||
selectize.$empty_results_container.show();
|
||||
} else {
|
||||
selectize.$empty_results_container.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,8 @@
|
||||
border-radius: 1px;
|
||||
}
|
||||
.selectize-dropdown [data-selectable],
|
||||
.selectize-dropdown .optgroup-header {
|
||||
.selectize-dropdown .optgroup-header,
|
||||
.selectize-dropdown .dropdown-empty-message {
|
||||
padding: 5px 8px;
|
||||
}
|
||||
.selectize-dropdown .optgroup:first-child .optgroup-header {
|
||||
|
@ -8,7 +8,9 @@
|
||||
optionGroupPath="content.category"
|
||||
openOnFocus=false
|
||||
maxItems="1"
|
||||
on-init="onInit"
|
||||
on-focus="onFocus"
|
||||
on-blur="onBlur"
|
||||
update-filter="onType"
|
||||
select-item="openSelected"}}
|
||||
<button class="gh-nav-search-button" {{action "focusInput"}}><i class="icon-search"></i><span class="sr-only">Search</span></button>
|
||||
|
Loading…
Reference in New Issue
Block a user