Skip to content

Commit

Permalink
HAR-126: Внес правки в доску лайков
Browse files Browse the repository at this point in the history
  • Loading branch information
glebkos committed May 8, 2024
1 parent e6d3ed9 commit d75475b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
2 changes: 1 addition & 1 deletion source/entity/boardPin/ui/boardPin.handlebars
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="feed-item_100-size">
<img src="{{ pin.content_url }}" alt="" class="pin" id="pin-{{ pin.pin_id }}">
<img src="{{ pin.content_url }}" alt="" class="pin" id="pin-{{pin.pin_id}}">
{{#if owner}}
<button class="button primary-button board-pin__button" id="pin-del-{{pin.pin_id}}">Удалить</button>
{{/if}}
Expand Down
22 changes: 12 additions & 10 deletions source/entity/boardPin/ui/boardPin.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ export class BoardPinFeedView extends View {
this.onClick(pin.pin_id);
});

const delBtn = document.querySelector('#pin-del-' + pin.pin_id);
delBtn.addEventListener('click', async (event) => {
event.preventDefault();
const api = new API('/boards/' + board.board_id + '/pins/' + pin.pin_id);
const response = await api.delete();
if (response.code) {
return;
}
this.root.remove();
});
if (board.is_owner) {
const delBtn = document.querySelector('#pin-del-' + pin.pin_id);
delBtn.addEventListener('click', async (event) => {
event.preventDefault();
const api = new API('/boards/' + board.board_id + '/pins/' + pin.pin_id);
const response = await api.delete();
if (response.code) {
return;
}
this.root.remove();
});
}
}
}
6 changes: 3 additions & 3 deletions source/pages/board/ui/boardView.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
Удалить
</div>
{{else}}
<div class="primary-button button button_small">
Подписаться
</div>
<!-- <div class="primary-button button button_small">-->
<!-- Подписаться-->
<!-- </div>-->
{{/if}}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion source/pages/board/ui/boardView.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class BoardView extends View {
board = {
title: 'Понравившиеся',
description: 'Здесь появляются понравившиеся вам пины',
is_owner: true,
is_owner: false,
};
pins = response.body.pins;
} else {
Expand Down
18 changes: 13 additions & 5 deletions source/pages/profile/ui/profile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@
width: auto;
margin-top: 150px;
display: flex;
justify-content: space-between;
justify-content: center;
align-items: flex-end;
padding: 0 50px;
}

.add-block{
width: 40px;
display: flex;
flex-direction: column;
gap: 5px;
align-items: end;
//position: absolute;
inset: auto 20px auto auto;
position: absolute;
inset: auto 50px auto auto;
}

.profile-popup-button{
Expand All @@ -39,6 +38,8 @@
justify-content: center;
align-items: center;
transition: .3s all;
position: absolute;
inset: auto auto auto 50px;
}

.profile-image-button__likes{
Expand Down Expand Up @@ -96,7 +97,6 @@
@media screen and (max-width: 430px) {
.profile-switcher{
margin-top: 50px;
padding: 0 30px;
}

.profile-pop-menu{
Expand Down Expand Up @@ -126,4 +126,12 @@
.profile-popup-button{
background-color: variables.$primary-button-color;
}

.add-block{
inset: auto 30px auto auto;
}

.profile-like-button{
inset: auto auto auto 30px;
}
}

0 comments on commit d75475b

Please sign in to comment.