user avatar: Remove `user_avatar_file_input_error` id.

Now we can remove `user_avatar_file_input_error` id and added new class
`image_file_input_error`.we can access this class using
`#user-avatar-upload-widget .image_file_input` so that we can
have only one id at top-level and 'image_upload_widget.hbs`
can be more dynamic so we can use for other similar widgets also.
This commit is contained in:
jagansivam28 2020-06-15 11:58:41 +05:30 committed by Tim Abbott
parent c141daa624
commit 4576742b2f
3 changed files with 4 additions and 4 deletions

View File

@ -71,7 +71,7 @@ exports.build_user_avatar_widget = function (upload_function) {
if (settings_account.user_can_change_avatar()) {
return upload_widget.build_direct_upload_widget(
get_file_input,
$("#user_avatar_file_input_error").expectOne(),
$("#user-avatar-upload-widget .image_file_input_error").expectOne(),
$("#user-avatar-upload-widget .image_upload_button").expectOne(),
upload_function,
page_params.max_avatar_file_size_mib

View File

@ -590,7 +590,7 @@ exports.set_up = function () {
contentType: false,
success: function () {
display_avatar_upload_complete();
$("#user_avatar_file_input_error").hide();
$("#user-avatar-upload-widget .image_file_input_error").hide();
$("#user-avatar-source").hide();
// Rest of the work is done via the user_events -> avatar_url event we will get
},
@ -599,7 +599,7 @@ exports.set_up = function () {
if (page_params.avatar_source === 'G') {
$("#user-avatar-source").show();
}
const $error = $("#user_avatar_file_input_error");
const $error = $("#user-avatar-upload-widget .image_file_input_error");
$error.text(JSON.parse(xhr.responseText).msg);
$error.show();
},

View File

@ -18,5 +18,5 @@
{{/if}}
<img class="image-block" src="{{ image }}"/>
<input type="file" name="file_input" class="notvisible image_file_input" value="{{t upload_text }}" />
<div id="user_avatar_file_input_error" class="text-error"></div>
<div class="image_file_input_error text-error"></div>
</div>