PERF: don't render share dialog until we have a link.
This commit is contained in:
parent
46720b1017
commit
8b87f095c6
|
@ -1,3 +1,4 @@
|
||||||
|
{{#if controller.link}}
|
||||||
<h3>{{view.title}}</h3>
|
<h3>{{view.title}}</h3>
|
||||||
|
|
||||||
{{#if date}}
|
{{#if date}}
|
||||||
|
@ -14,3 +15,4 @@
|
||||||
<div class='link'>
|
<div class='link'>
|
||||||
<a href='#' {{action "close"}} title='{{i18n 'share.close'}}'><i class="fa fa-times-circle"></i></a>
|
<a href='#' {{action "close"}} title='{{i18n 'share.close'}}'><i class="fa fa-times-circle"></i></a>
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
|
@ -27,10 +27,12 @@ export default Discourse.View.extend({
|
||||||
}.property('controller.link'),
|
}.property('controller.link'),
|
||||||
|
|
||||||
linkChanged: function() {
|
linkChanged: function() {
|
||||||
|
var self=this;
|
||||||
if (this.present('controller.link')) {
|
if (this.present('controller.link')) {
|
||||||
if (!this.capabilities.touch) {
|
Em.run.next(function(){
|
||||||
|
if (!self.capabilities.touch) {
|
||||||
var $linkInput = $('#share-link input');
|
var $linkInput = $('#share-link input');
|
||||||
$linkInput.val(this.get('controller.link'));
|
$linkInput.val(self.get('controller.link'));
|
||||||
|
|
||||||
// Wait for the fade-in transition to finish before selecting the link:
|
// Wait for the fade-in transition to finish before selecting the link:
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
|
@ -38,9 +40,10 @@ export default Discourse.View.extend({
|
||||||
}, 160);
|
}, 160);
|
||||||
} else {
|
} else {
|
||||||
var $linkForTouch = $('#share-link .share-for-touch a');
|
var $linkForTouch = $('#share-link .share-for-touch a');
|
||||||
$linkForTouch.attr('href', this.get('controller.link'));
|
$linkForTouch.attr('href',self.get('controller.link'));
|
||||||
$linkForTouch.html(this.get('controller.link'));
|
$linkForTouch.html(self.get('controller.link'));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}.observes('controller.link'),
|
}.observes('controller.link'),
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue