diff --git a/app/assets/javascripts/discourse/templates/share.hbs b/app/assets/javascripts/discourse/templates/share.hbs index 303ff6ef8e..a7c850f442 100644 --- a/app/assets/javascripts/discourse/templates/share.hbs +++ b/app/assets/javascripts/discourse/templates/share.hbs @@ -1,3 +1,4 @@ +{{#if controller.link}}

{{view.title}}

{{#if date}} @@ -14,3 +15,4 @@ +{{/if}} diff --git a/app/assets/javascripts/discourse/views/share.js.es6 b/app/assets/javascripts/discourse/views/share.js.es6 index c6a0b97159..566d5332e8 100644 --- a/app/assets/javascripts/discourse/views/share.js.es6 +++ b/app/assets/javascripts/discourse/views/share.js.es6 @@ -27,20 +27,23 @@ export default Discourse.View.extend({ }.property('controller.link'), linkChanged: function() { + var self=this; if (this.present('controller.link')) { - if (!this.capabilities.touch) { - var $linkInput = $('#share-link input'); - $linkInput.val(this.get('controller.link')); + Em.run.next(function(){ + if (!self.capabilities.touch) { + var $linkInput = $('#share-link input'); + $linkInput.val(self.get('controller.link')); - // Wait for the fade-in transition to finish before selecting the link: - window.setTimeout(function() { - $linkInput.select().focus(); - }, 160); - } else { - var $linkForTouch = $('#share-link .share-for-touch a'); - $linkForTouch.attr('href', this.get('controller.link')); - $linkForTouch.html(this.get('controller.link')); - } + // Wait for the fade-in transition to finish before selecting the link: + window.setTimeout(function() { + $linkInput.select().focus(); + }, 160); + } else { + var $linkForTouch = $('#share-link .share-for-touch a'); + $linkForTouch.attr('href',self.get('controller.link')); + $linkForTouch.html(self.get('controller.link')); + } + }); } }.observes('controller.link'),