Skip to content

Commit

Permalink
LDBR-3.20: Правки после РК2 (#36)
Browse files Browse the repository at this point in the history
* LDBR-3.20: Исправить МиБ, исправить ошибку несовпадающих паролей, исправить автофокус в попапах.

* LDBR-3.20: разрешить все виды картинок.
  • Loading branch information
DPeshkoff authored Nov 25, 2021
1 parent 90d0594 commit adce9ea
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 11 deletions.
5 changes: 4 additions & 1 deletion src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const ConstantMessages = {
NoSpecialSymbolsPassword: 'Введите пароль, не содержащий специальных символов',
UseOnlyLatinLettersPassword: 'Введите пароль, содержащий только латинские буквы',

AvatarTooBig: 'Аватар не должен превышать 500 МиБ',
AvatarTooBig: 'Аватар не должен превышать 500 КБ',

BoardTitleTooLong: 'Название доски превышает 60 символов',
BoardTitleTooShort: 'Название доски слишком короткое',
Expand All @@ -87,6 +87,9 @@ export const ConstantMessages = {
CardListTitleTooLong: 'Название списка карточек слишком длинное',
CardListErrorOnServer: 'Не удалось создать список, попробуйте позднее',

CardTitleTooShort: 'Название карточки слишком короткое',
CardTitleTooLong: 'Название карточки слишком длинное',
CardErrorOnServer: 'Не удалось создать карточку, попробуйте позднее',
UnsuccessfulRequest: 'Неудачный запрос, попробуйте позднее :]',
};

Expand Down
4 changes: 2 additions & 2 deletions src/modules/Validator/Validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ export default class Validator {
*/
validateCardTitle(title) {
if (title.length < 1) {
return ConstantMessages.CardListTitleTooShort;
return ConstantMessages.CardTitleTooShort;
}
if (title.length > 40) {
return ConstantMessages.CardListTitleTooLong;
return ConstantMessages.CardTitleTooLong;
}
return null;
}
Expand Down
1 change: 1 addition & 0 deletions src/popups/BoardSetting/BoardSettingPopUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default class BoardSettingPopUp extends BaseComponent {
this._elements.confirmBtn?.addEventListener('click', this._onDeleteConfirm);
this._elements.rejectBtn?.addEventListener('click', this._onRejectConfirm);
this._elements.saveBtn?.addEventListener('click', this._onSave);
this._elements.title?.focus();
};

/**
Expand Down
1 change: 1 addition & 0 deletions src/popups/Card/CardPopUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default class CardPopUp extends BaseComponent {
this._elements.closeBtn?.addEventListener('click', this._onPopUpClose);
this._elements.createBtn?.addEventListener('click', this._onCreate);
this._elements.saveBtn?.addEventListener('click', this._onSave);
this._elements.card_name?.focus();
this._elements.comments?.editBtns?.forEach((editCommentBtn)=>{
editCommentBtn.addEventListener('click', this._onEditComment);
});
Expand Down
1 change: 1 addition & 0 deletions src/popups/CardList/CardListPopUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default class CardListPopUp extends BaseComponent {
this._elements.closeBtn?.addEventListener('click', this._onPopUpClose);
this._elements.createBtn?.addEventListener('click', this._onCreate);
this._elements.saveBtn?.addEventListener('click', this._onSave);
this._elements.title?.focus();
};

/**
Expand Down
1 change: 1 addition & 0 deletions src/popups/CreateBoard/CreateBoardPopUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default class CreateBoardPopUp extends BaseComponent {
this._elements.closeBtn?.addEventListener('click', this._onPopUpClose);
this._elements.submitBtn?.addEventListener('click', this._onSaveBtnClick);
document.addEventListener('click', this._onPopUpClose);
this._elements.name?.focus();
};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/popups/DeleteCard/DeleteCardPopUp.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<div class="horizontal-line"></div>
<div class="popup-form__elements-wrapper">
<div class="confirm-delete-wrapper">
<button class="button button_red button_full-space" id="deleteCardPopUpConfirmBtnId">Удалить</button>
<button class="button button_full-space" id="deleteCardPopUpRejectBtnId">Не удалять</button>
<button class="button button_red button_full-space" id="deleteCardPopUpConfirmBtnId">Да, удалить</button>
<button class="button button_full-space" id="deleteCardPopUpRejectBtnId">Нет, отменить</button>
</div>
</div>
</form>
Expand Down
4 changes: 2 additions & 2 deletions src/popups/DeleteCardList/DeleteCardListPopUp.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<div class="horizontal-line"></div>
<div class="popup-form__elements-wrapper">
<div class="confirm-delete-wrapper">
<button class="button button_red button_full-space" id="deleteCLPopUpConfirmBtnId">Удалить</button>
<button class="button button_full-space" id="deleteCLPopUpRejectBtnId">Не удалять</button>
<button class="button button_red button_full-space" id="deleteCLPopUpConfirmBtnId">Да, удалить</button>
<button class="button button_full-space" id="deleteCLPopUpRejectBtnId">Нет, отменить</button>
</div>
</div>
</form>
Expand Down
10 changes: 7 additions & 3 deletions src/stores/UserStore/UserStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,13 @@ class UserStore extends BaseStore {
}
}

if (data.hasOwnProperty('passwordRepeat') && (data.password !== data.passwordRepeat)) {
validation.passwordRepeat = ConstantMessages.NonMatchingPasswords;
this._storage.get(form).passwordRepeat = '';
if (data.hasOwnProperty('passwordRepeat')) {
if (data.password !== data.passwordRepeat) {
validation.passwordRepeat = ConstantMessages.NonMatchingPasswords;
this._storage.get(form).passwordRepeat = '';
} else {
validation.passwordRepeat = '';
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/views/ProfileView/ProfileView.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="profile-box__column-left">
<div class="profile-container">
<img class="profile-box__user-picture" src="{{avatar}}" alt="User Picture" id="avatar-img">
<input type="file" name="avatar" id="avatar" class="profile-box__user-avatar" accept="image/png" value="{{avatar}}">
<input type="file" name="avatar" id="avatar" class="profile-box__user-avatar" accept="image/*" value="{{avatar}}">
<label for="avatar" class="profile-box__upload-button">
<span class="profile-box__upload-icon-wrapper"><img class="profile-box__upload-icon" src="assets/icons/upload.webp" alt="Выбрать файл" width="25"></span>
<span class="profile-box__upload-button-text">Выберите файл</span>
Expand Down

0 comments on commit adce9ea

Please sign in to comment.