mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
PERF: don't render dropdowns till we need them
This commit is contained in:
parent
d7c4987ecb
commit
0621e87bcd
5 changed files with 24 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
import VisibleComponent from "discourse/components/visible-component";
|
||||
import VisibleComponent from "discourse/components/visible";
|
||||
|
||||
export default VisibleComponent.extend({
|
||||
|
||||
|
|
|
@ -80,16 +80,20 @@
|
|||
{{/if}}
|
||||
</ul>
|
||||
|
||||
{{render "search"}}
|
||||
{{#if view.renderDropdowns}}
|
||||
|
||||
{{render "notifications" notifications}}
|
||||
{{render "search"}}
|
||||
|
||||
{{render "notifications" notifications}}
|
||||
|
||||
{{#if view.renderSiteMap}}
|
||||
{{render "siteMap"}}
|
||||
{{/if}}
|
||||
|
||||
{{render "user-dropdown"}}
|
||||
|
||||
{{#if view.renderSiteMap}}
|
||||
{{render "siteMap"}}
|
||||
{{/if}}
|
||||
|
||||
{{render "user-dropdown"}}
|
||||
|
||||
</div>
|
||||
|
||||
{{#if showExtraInfo}}
|
||||
|
|
|
@ -14,16 +14,26 @@ export default Discourse.View.extend({
|
|||
classNames: ['d-header', 'clearfix'],
|
||||
classNameBindings: ['editingTopic'],
|
||||
templateName: 'header',
|
||||
renderDropdowns: false,
|
||||
|
||||
showDropdown: function($target) {
|
||||
var self = this;
|
||||
|
||||
if(!this.get("renderDropdowns")){
|
||||
this.set("renderDropdowns", true);
|
||||
Em.run.next(function(){
|
||||
self.showDropdown($target);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var elementId = $target.data('dropdown') || $target.data('notifications'),
|
||||
$dropdown = $("#" + elementId),
|
||||
$li = $target.closest('li'),
|
||||
$ul = $target.closest('ul'),
|
||||
$html = $('html'),
|
||||
$header = $('header'),
|
||||
replyZIndex = parseInt($('#reply-control').css('z-index'), 10),
|
||||
self = this;
|
||||
replyZIndex = parseInt($('#reply-control').css('z-index'), 10);
|
||||
|
||||
|
||||
originalZIndex = originalZIndex || $('header').css('z-index');
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
//= require ./discourse/routes/discourse_restricted_user_route
|
||||
//= require ./discourse/components/top-title
|
||||
//= require ./discourse/components/text-field
|
||||
//= require ./discourse/components/visible
|
||||
//= require ./discourse/helpers/user-avatar
|
||||
//= require ./discourse/helpers/cold-age-class
|
||||
|
||||
|
|
Loading…
Reference in a new issue