Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust avatar and its line height to comment message style #7514

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/comments/css/comments.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@

#commentsTabView .comment .avatar,
.atwho-view-ul * .avatar{
width: 32px;
height: 32px;
line-height: 32px;
width: 1.6em;
height: 1.6em;
line-height: 1.6em;
margin-right: 5px;
}

Expand Down
17 changes: 12 additions & 5 deletions apps/comments/js/commentstabview.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
'{{/if}}' +
'</li>';

var AVATAR_SIZE_TEXT = '16';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jan asked me to use 21px for avatars in activities.
Maybe we can use the same here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref #2012

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obsolete due to #7514 (comment) ff

var AVATAR_SIZE_HEADING = '32';

/**
* @memberof OCA.Comments
*/
Expand Down Expand Up @@ -169,7 +172,7 @@
this.$el.find('.comments').before(this.editCommentTemplate({}));
this.$el.find('.has-tooltip').tooltip();
this.$container = this.$el.find('ul.comments');
this.$el.find('.avatar').avatar(OC.getCurrentUser().uid, 32);
this.$el.find('.avatar').avatar(OC.getCurrentUser().uid, AVATAR_SIZE_HEADING);
this.delegateEvents();
this.$el.find('.message').on('keydown input change', this._onTypeComment);

Expand All @@ -191,7 +194,7 @@
// misuse the highlighter callback to instead of
// highlighting loads the avatars.
var $li = $(li);
$li.find('.avatar').avatar(undefined, 32);
$li.find('.avatar').avatar(undefined, AVATAR_SIZE_TEXT);
return $li;
},
sorter: function (q, items) { return items; }
Expand Down Expand Up @@ -374,7 +377,7 @@
$message
.html(self._formatMessage(model.get('message'), model.get('mentions')))
.find('.avatar')
.each(function () { $(this).avatar(); });
.each(function () { $(this).avatar(undefined, AVATAR_SIZE_HEADING); });
self._postRenderItem($message);
}
});
Expand All @@ -384,7 +387,11 @@
$el.find('.has-tooltip').tooltip();
$el.find('.avatar').each(function() {
var $this = $(this);
$this.avatar($this.attr('data-username'), 32);
var size = AVATAR_SIZE_TEXT;
if($this.parents('.authorRow').length) {
size = AVATAR_SIZE_HEADING;
}
$this.avatar($this.attr('data-username'), size);
});

var username = $el.find('.avatar').data('username');
Expand Down Expand Up @@ -497,7 +504,7 @@
$message
.html(this._formatMessage(commentToEdit.get('message'), commentToEdit.get('mentions')))
.find('.avatar')
.each(function () { $(this).avatar(); });
.each(function () { $(this).avatar(undefined, AVATAR_SIZE_TEXT); });
var editionMode = true;
this._postRenderItem($message, editionMode);

Expand Down