Skip to content

Conversation

@luka-nextcloud
Copy link
Contributor

Signed-off-by: Luka Trovic [email protected]
Change-Id: I39f567c67a727a23fdef3d98a147fa30a13b36a4

  • Resolves: #
  • Target version: master

Summary

TODO

  • ...

Checklist

  • Code is properly formatted
  • All commits have Change-Id
  • I have run tests with make check
  • I have issued make run and manually verified that everything looks okay
  • Documentation (manuals or wiki) has been updated or is not required

@juliusknorr
Copy link
Member

@luka-nextcloud Avatar display should work again after #3531 is merged

<input id="selectbackground" type="file" accept="image/*" style="position: fixed; top: -100em">

<div id="closebuttonwrapper">
<div class="userInfo">
Copy link
Member

Choose a reason for hiding this comment

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

This should rather be moved out of the closebuttonwrapper

$('#listActiveUser').append('<div class="user-item-wrapper" id="user-wrapper-' + viewId + '"><p class="user-item" id="user-' + viewId
+ '" style="background-image:url(\'' + extraInfo.avatar + '\');border-color:' + color + '"></p><span> '+ userName +'</span></div>');

$('.userInfo').append('<p class="user-top ' + ownerClass + '" id="user-top-' + viewId + '" style="background-image:url(\'' + extraInfo.avatar + '\');border-color:' + color + ';"></p>');
Copy link
Member

Choose a reason for hiding this comment

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

Would be great if we could move the rendering of the header avatars to a separate method, ideally also just making use of plain javascript for the dom manipulation instead of jquery, so this doesn't have the external dependency on the library.

Copy link
Member

@juliusknorr juliusknorr Nov 2, 2021

Choose a reason for hiding this comment

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

A few other points to consider:

  • The avatar might not be available
    if (extraInfo !== undefined && extraInfo.avatar !== undefined) {
  • For uniquely identifying the element you could use a data-view-id="" attribute
  • Maintain the option to follow the current editor or a user

}

.guess {
opacity: 0.5;
Copy link
Member

Choose a reason for hiding this comment

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

I'd say we don't need a separation between the display of the current user or guest like that. Also opacity may look a bit odd when other avatars are shining through

var content = L.DomUtil.create('tr', 'useritem');
content.id = 'user-' + viewId;
$(document).on('click', '#' + content.id, this.onUseritemClicked.bind(this));
var ownerClass = userName == 'You' ? 'onwer' : 'guess';
Copy link
Member

Choose a reason for hiding this comment

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

@pedropintosilva Maybe something for you to decide if we should actually show the avatar of the current user view or just hide it.

@luka-nextcloud luka-nextcloud force-pushed the update-avatar-list branch 2 times, most recently from 06232e8 to eefc4a8 Compare November 5, 2021 14:32
@luka-nextcloud
Copy link
Contributor Author

Here's a screenshot:
image


updateUserListCount: function() {
renderUserAvatars: function(viewId, userName, extraInfo, color) {
if (extraInfo !== undefined && extraInfo.avatar !== undefined) {
Copy link
Member

Choose a reason for hiding this comment

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

renderUserAvatars: function(viewId, userName, extraInfo, color) {
if (extraInfo !== undefined && extraInfo.avatar !== undefined) {
var avatarElement = '<div class="user-item-wrapper" id="user-wrapper-' + viewId + '"><p class="user-item" id="user-' + viewId
+ '" style="background-image:url(\'' + extraInfo.avatar + '\');border-color:' + color + '"></p><span> '+ userName +'</span></div>';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
+ '" style="background-image:url(\'' + extraInfo.avatar + '\');border-color:' + color + '"></p><span> '+ userName +'</span></div>';
+ '" style="background-image:url(\'' + extraInfo.avatar + '\');border-color:' + color + '"></p><span> '+ this.escapeHtml(userName) +'</span></div>';

align-items: center;
}

.user-item {
Copy link
Member

Choose a reason for hiding this comment

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

Please add somea dditional styling to make the spacing fit the existing popover entries and the font also match the default font-family: var(--loleaflet-font);

See screenshot for comparison:
image

Comment on lines 205 to 208
<div class="userInfo">
<div class="userInfo-content" id="listActiveUser">
</div>
</div>

This comment was marked as resolved.

var avatarElement = '<div class="user-item-wrapper" id="user-wrapper-' + viewId + '"><p class="user-item" id="user-' + viewId
+ '" style="background-image:url(\'' + extraInfo.avatar + '\');border-color:' + color + '"></p><span> '+ userName +'</span></div>';
if ($('#follow-editor').length == 0) {
$('#listActiveUser').append(avatarElement);

This comment was marked as resolved.

@juliusknorr
Copy link
Member

juliusknorr commented Nov 11, 2021

@luka-nextcloud This would be the open points I can think of right now, most likely best tackled in the order mentioned 😉

  • Use the viewId as unique identifier as there might be users with the same
  • Clicking the avatar should trigger the following of the user cursor (see current implementation)
  • The checkbox to follow the current editor should be working (see current implementation)
  • Do not show on mobile (there the current implementation works fine with just showing the number of users)
  • Hide the existing avatar list in the status bar if the new one is shown
  • Ideally do not remove all elements to rerender but check if an element is present already in the DOM and remove it if the view gets removed or add a new element if needed
  • In the end it would be good to replace jQuery usage with plain javascript methods

@pedropintosilva
Copy link
Contributor

@luka-nextcloud it seems there are some problems in the following lines:

browser/src/control/Control.UserList.js
  88:1  error  Expected indentation of 2 tabs but found 4 spaces  indent
  90:1  error  Expected indentation of 2 tabs but found 4 spaces  indent

Could you please fix that?

Note: make sure your text editor/IDE is using the proper JS linter with the appropriated configuration within online project:

  • browser/.eslintrc

@luka-nextcloud
Copy link
Contributor Author

Sure, let me check!

@pedropintosilva
Copy link
Contributor

pedropintosilva commented Nov 18, 2021

This is still not passing the tests because

  • #userListSummary is now obstructing the view from other elements
    • So when a user tries to click an icon in the toolbar it triggers instead that element
    • That's why in the tests when trying to click #tb_editbar_item_linespacing it fails

Maybe removing the default margin top and bottom from the child (p#user-top-x) that is inside of #userListSummary would suffice in order to fix this

@pedropintosilva
Copy link
Contributor

Probably the parent's position should also be tweaked after that, so maybe something like this :

+ #userListSummary p {
+   margin-top: 0;
+   margin-bottom: 0;
+ }

#userListHeader {
-  top: 5px;
+ top: 2px;
}

Signed-off-by: Luka Trovic <[email protected]>
Change-Id: I058de8da8e4f3fbd0994c3e50efa7c1deb5be8ac
@juliusknorr
Copy link
Member

@luka-nextcloud Lets continue over at #3677 as discussed 😉

@pedropintosilva
Copy link
Contributor

this has been moved to #3677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants