diff --git a/addons/mail/static/src/components/composer_suggestion/composer_suggestion.js b/addons/mail/static/src/components/composer_suggestion/composer_suggestion.js index caa324f1583..ea2ae737393 100644 --- a/addons/mail/static/src/components/composer_suggestion/composer_suggestion.js +++ b/addons/mail/static/src/components/composer_suggestion/composer_suggestion.js @@ -55,6 +55,31 @@ class ComposerSuggestion extends Component { return this.env.models[this.props.modelName].get(this.props.recordLocalId); } + /** + * Returns a descriptive title for this suggestion. Useful to be able to + * read both parts when they are overflowing the UI. + * + * @returns {string} + */ + title() { + if (this.isCannedResponse) { + return _.str.sprintf("%s: %s", this.record.source, this.record.substitution); + } + if (this.isChannel) { + return this.record.name; + } + if (this.isCommand) { + return _.str.sprintf("%s: %s", this.record.name, this.record.help); + } + if (this.isPartner) { + if (this.record.email) { + return _.str.sprintf("%s (%s)", this.record.nameOrDisplayName, this.record.email); + } + return this.record.nameOrDisplayName; + } + return ""; + } + //-------------------------------------------------------------------------- // Handlers //-------------------------------------------------------------------------- diff --git a/addons/mail/static/src/components/composer_suggestion/composer_suggestion.scss b/addons/mail/static/src/components/composer_suggestion/composer_suggestion.scss index 6516672f38f..4083c149001 100644 --- a/addons/mail/static/src/components/composer_suggestion/composer_suggestion.scss +++ b/addons/mail/static/src/components/composer_suggestion/composer_suggestion.scss @@ -9,7 +9,24 @@ } .o_ComposerSuggestion_part1 { + // avoid shrinking part 1 because it is more important than part 2 + // because no shrink, ensure it cannot overflow with a max-width + flex: 0 0 auto; + max-width: 100%; + overflow: hidden; padding-inline-end: map-get($spacers, 2); + text-overflow: ellipsis; +} + +.o_ComposerSuggestion_part2 { + // shrink part 2 to properly ensure it cannot overflow + flex: 0 1 auto; + overflow: hidden; + text-overflow: ellipsis; +} + +.o_ComposerSuggestion_partnerImStatusIcon { + flex: 0 0 auto; } // ------------------------------------------------------------------ diff --git a/addons/mail/static/src/components/composer_suggestion/composer_suggestion.xml b/addons/mail/static/src/components/composer_suggestion/composer_suggestion.xml index 3397095e415..44917ca12c2 100644 --- a/addons/mail/static/src/components/composer_suggestion/composer_suggestion.xml +++ b/addons/mail/static/src/components/composer_suggestion/composer_suggestion.xml @@ -2,7 +2,7 @@ - + @@ -17,6 +17,7 @@ diff --git a/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.scss b/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.scss index 9cb509c2380..2b2cec239ec 100644 --- a/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.scss +++ b/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.scss @@ -4,8 +4,20 @@ .o_ComposerSuggestionList { position: absolute; + // prevent suggestion items from overflowing + width: 100%; &.o-lowPosition { bottom: 0; } } + +.o_ComposerSuggestionList_drop { + // prevent suggestion items from overflowing + width: 100%; +} + +.o_ComposerSuggestionList_list { + // prevent suggestion items from overflowing + width: 100%; +} diff --git a/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.xml b/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.xml index e38f9cca8c7..8bcd87c2d07 100644 --- a/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.xml +++ b/addons/mail/static/src/components/composer_suggestion_list/composer_suggestion_list.xml @@ -3,7 +3,7 @@
-
+