Last active
November 9, 2015 23:48
-
-
Save gregtap/c3403e7f5a618ff3c18e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="message-wrap"> | |
| <div class="message"> | |
| <p>{{{message.content}}}</p> | |
| </div> | |
| <div class="meta"> | |
| {{#if message.isSent}} | |
| {{chat-message-time date=message.createdAt}} | |
| {{/if}} | |
| {{#if message.failedToUpload}} | |
| <div class="retry"> | |
| <span>Message delivery failed.</span> | |
| <button {{action "retryUpload"}}>Try again</button> | |
| </div> | |
| {{/if}} | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| const { run, Component } = Ember; | |
| export default Component.extend({ | |
| tagName: 'li', | |
| didRender: function() { | |
| if (this.get('message.failedToUpload')) { | |
| this.sendAction('messageStatusUpdate', this.get('message')); | |
| } | |
| }, | |
| actions: {} | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Ember from 'ember'; | |
| export default Ember.Component.extend({ | |
| tagName: 'ol', | |
| classNames: ['discussion'], | |
| didRender: function() { | |
| this.scrollToBottom(); | |
| }, | |
| scrollToBottom: function() { | |
| let componentScrollHeight = this.get('element').scrollHeight; | |
| this.$().parent().scrollTop(componentScrollHeight); | |
| }, | |
| actions: { | |
| /** | |
| * If message is last in collection we srcoll to bottom | |
| * to accomodate for the retry meta status bar height. | |
| */ | |
| onMessageStatusUpdate(message) { | |
| if (this.get('messages.lastObject') === message) { | |
| this.scrollToBottom(); | |
| } | |
| }, | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment