Skip to content

Commit

Permalink
[SSE DE PE] Add avatar in version history
Browse files Browse the repository at this point in the history
  • Loading branch information
Basher0303 committed Oct 11, 2023
1 parent 673b53e commit 9765935
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 9 deletions.
16 changes: 14 additions & 2 deletions apps/common/main/lib/view/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,20 @@ define([
'<div class="revision-expand ' + '<% if (isExpanded) { %>' + 'up' + '<% } %>' + '"></div>',
'<% } %>',
'<div class="user-name">',
'<div class="color" style="display: inline-block; background-color:' + '<%=usercolor%>;' + '" >',
'</div><%= Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)) %>',
'<div class="color"',
'<% if (avatar) { %>',
'style="<% if (usercolor !== null) { %> border-color:<%=usercolor%>; border-style:solid;<% }%>"',
'<% } else { %>',
'style="background-color: <% if (usercolor !== null) { %> <%=usercolor%> <% } else { %> #cfcfcf <% }%>;"',
'<% } %>',
'>',
'<% if (avatar) { %>',
'<img src="<%=avatar%>" />',
'<% } else { %>',
'<%=initials%>',
'<% } %>',
'</div>',
'<span><%= Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)) %></span>',
'</div>',
'<% if (canRestore && selected) { %>',
'<label class="revision-restore" role="presentation" tabindex="-1">' + this.textRestore + '</label>',
Expand Down
25 changes: 18 additions & 7 deletions apps/common/main/resources/less/history.less
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,26 @@
}

.color {
width: 12px;
height: 12px;
border: @scaled-one-px-value-ie solid @border-toolbar-ie;
border: @scaled-one-px-value solid @border-toolbar;
margin: 0 5px 3px 0;
position: relative;
width: 26px;
height: 26px;
border-radius: 20px;
border-width: @scaled-two-px-value;
display: inline-block;
vertical-align: middle;
overflow: hidden;
.margin-right-8();

.rtl & {
margin: 0 0 3px 5px;
color: #ffffff;
line-height: 26px;
text-align: center;

img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
}

Expand Down
4 changes: 4 additions & 0 deletions apps/documenteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,8 @@ define([
userid : version.user.id,
username : version.user.name || this.textAnonymous,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(version.user.name || this.textAnonymous)),
avatar : undefined,
created: version.created,
docId: version.key,
markedAsVersion: (group!==version.versionGroup),
Expand Down Expand Up @@ -771,6 +773,8 @@ define([
userid : change.user.id,
username : change.user.name || this.textAnonymous,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(change.user.name || this.textAnonymous)),
avatar : undefined,
created: change.created,
docId: version.key,
docIdPrev: docIdPrev,
Expand Down
4 changes: 4 additions & 0 deletions apps/presentationeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2637,6 +2637,8 @@ define([
userid : version.user.id,
username : version.user.name,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(version.user.name || this.textAnonymous)),
avatar : undefined,
created: version.created,
docId: version.key,
markedAsVersion: (group!==version.versionGroup),
Expand Down Expand Up @@ -2687,6 +2689,8 @@ define([
userid : change.user.id,
username : change.user.name,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(change.user.name || this.textAnonymous)),
avatar : undefined,
created: change.created,
docId: version.key,
docIdPrev: docIdPrev,
Expand Down
4 changes: 4 additions & 0 deletions apps/spreadsheeteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3252,6 +3252,8 @@ define([
userid : version.user.id,
username : version.user.name,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(version.user.name || this.textAnonymous)),
avatar : undefined,
created: version.created,
docId: version.key,
markedAsVersion: (group!==version.versionGroup),
Expand Down Expand Up @@ -3302,6 +3304,8 @@ define([
userid : change.user.id,
username : change.user.name,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(change.user.name || this.textAnonymous)),
avatar : undefined,
created: change.created,
docId: version.key,
docIdPrev: docIdPrev,
Expand Down

0 comments on commit 9765935

Please sign in to comment.