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({
|
export default VisibleComponent.extend({
|
||||||
|
|
||||||
|
|
|
@ -80,16 +80,20 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</ul>
|
</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}}
|
{{/if}}
|
||||||
|
|
||||||
{{render "user-dropdown"}}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if showExtraInfo}}
|
{{#if showExtraInfo}}
|
||||||
|
|
|
@ -14,16 +14,26 @@ export default Discourse.View.extend({
|
||||||
classNames: ['d-header', 'clearfix'],
|
classNames: ['d-header', 'clearfix'],
|
||||||
classNameBindings: ['editingTopic'],
|
classNameBindings: ['editingTopic'],
|
||||||
templateName: 'header',
|
templateName: 'header',
|
||||||
|
renderDropdowns: false,
|
||||||
|
|
||||||
showDropdown: function($target) {
|
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'),
|
var elementId = $target.data('dropdown') || $target.data('notifications'),
|
||||||
$dropdown = $("#" + elementId),
|
$dropdown = $("#" + elementId),
|
||||||
$li = $target.closest('li'),
|
$li = $target.closest('li'),
|
||||||
$ul = $target.closest('ul'),
|
$ul = $target.closest('ul'),
|
||||||
$html = $('html'),
|
$html = $('html'),
|
||||||
$header = $('header'),
|
$header = $('header'),
|
||||||
replyZIndex = parseInt($('#reply-control').css('z-index'), 10),
|
replyZIndex = parseInt($('#reply-control').css('z-index'), 10);
|
||||||
self = this;
|
|
||||||
|
|
||||||
|
|
||||||
originalZIndex = originalZIndex || $('header').css('z-index');
|
originalZIndex = originalZIndex || $('header').css('z-index');
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
//= require ./discourse/routes/discourse_restricted_user_route
|
//= require ./discourse/routes/discourse_restricted_user_route
|
||||||
//= require ./discourse/components/top-title
|
//= require ./discourse/components/top-title
|
||||||
//= require ./discourse/components/text-field
|
//= require ./discourse/components/text-field
|
||||||
|
//= require ./discourse/components/visible
|
||||||
//= require ./discourse/helpers/user-avatar
|
//= require ./discourse/helpers/user-avatar
|
||||||
//= require ./discourse/helpers/cold-age-class
|
//= require ./discourse/helpers/cold-age-class
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue