mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
settings: Refactor image_upload_widget.hbs.
We can check for the `is_editable_by_current_user` condition once in the upper level instead of checking twice in middle for the same conditions and to match the implementation of style realm icon and realm logo since similar implementation between avatar, logo, the icon will help us to use `image_upload_widget.hbs` for logo and icon widgets also. This likely fixes a bug with the delete text being shown incorrectly for non-administrator users.
This commit is contained in:
@@ -664,11 +664,6 @@ input[type=checkbox] {
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
#user-settings-avatar {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.realm-icon-section .avatar-icon-logo-settings {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
@@ -1217,6 +1212,14 @@ input[type=checkbox] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#user-avatar-block {
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 0px 10px hsla(0, 0%, 0%, 0.1);
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
.settings-page-delete-button {
|
||||
cursor: pointer;
|
||||
color: hsl(0, 0%, 75%);
|
||||
@@ -1359,14 +1362,7 @@ input[type=checkbox] {
|
||||
}
|
||||
}
|
||||
|
||||
#user-avatar-block {
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 0px 10px hsla(0, 0%, 0%, 0.1);
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
top: 57px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
|
||||
#user-avatar-source {
|
||||
position: absolute;
|
||||
|
||||
@@ -158,6 +158,7 @@
|
||||
widget = "user-avatar"
|
||||
upload_text = "Upload new profile picture"
|
||||
delete_text = "Delete profile picture"
|
||||
is_editable_by_current_user = user_can_change_avatar
|
||||
image = page_params.avatar_url_medium}}
|
||||
<div id="user-avatar-source">
|
||||
<a href="https://en.gravatar.com/" target="_blank">{{t "Avatar from Gravatar" }}</a>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<div id ="{{widget}}-upload-widget" class="inline-block">
|
||||
<div id="user-settings-avatar" class="avatar-icon-logo-settings">
|
||||
<div id ="{{widget}}-upload-widget" class="inline-block avatar-icon-logo-settings">
|
||||
{{#if is_editable_by_current_user}}
|
||||
<div id="user-settings-avatar">
|
||||
<div class="settings-page-image-background"></div>
|
||||
<span id="user_avatar_delete_button" class="settings-page-delete-button" aria-label="{{t 'Delete profile picture'}}" role="button" tabindex="0"
|
||||
{{#unless user_can_change_avatar}}style="display:none"{{/unless}}>
|
||||
<span id="user_avatar_delete_button" class="settings-page-delete-button" aria-label="{{t 'Delete profile picture'}}" role="button" tabindex="0">
|
||||
×
|
||||
</span>
|
||||
<span id="user_avatar_delete" class="settings-page-delete-text" aria-label="{{t 'Delete profile picture'}}" tabindex="0">
|
||||
{{t delete_text }}
|
||||
</span>
|
||||
<span id="user_avatar_upload_button" class="settings-page-upload-text" aria-label="{{t 'Upload new profile picture'}}" role="button" tabindex="0"
|
||||
{{#if (and (not page_params.is_admin) page_params.realm_avatar_changes_disabled)}}style="display:none"{{/if}}>
|
||||
<span id="user_avatar_upload_button" class="settings-page-upload-text" aria-label="{{t 'Upload new profile picture'}}" role="button" tabindex="0">
|
||||
{{t upload_text }}
|
||||
</span>
|
||||
<span id="avatar-spinner-background" class="upload-spinner-background">
|
||||
<object id="user-avatar-spinner" type="image/svg+xml" data="/static/images/tail-spin.svg"></object>
|
||||
</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
<img id="user-avatar-block" src="{{ image }}"/>
|
||||
<input type="file" name="user_avatar_file_input" class="notvisible" id="user_avatar_file_input" value="{{t 'Upload profile picture' }}" />
|
||||
<div id="user_avatar_file_input_error" class="text-error"></div>
|
||||
|
||||
Reference in New Issue
Block a user