Skip to content

Commit

Permalink
Разделяй и властвуй3
Browse files Browse the repository at this point in the history
  • Loading branch information
lunianka committed Apr 14, 2024
1 parent 05f9a66 commit 11bbe38
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/presenter/trip-presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ export default class TripPresenter {
function pointEditClickHandler() {
replacePointToForm();
document.addEventListener('keydown', escKeyDownHandler);
};
}

function resetButtonClickHandler() {
replaceFormToPoint();
document.removeEventListener('keydown', escKeyDownHandler);
};
}

function pointSubmitHandler() {
replaceFormToPoint();
document.removeEventListener('keydown', escKeyDownHandler);
};
}

render(pointComponent, this.#pointListComponent.element);
}
};
}
16 changes: 8 additions & 8 deletions src/view/edit-point-view.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import AbstractView from '../framework/view/abstract-view.js';
import { POINT_EMPTY, TYPES, CITIES } from "../const.js";
import { POINT_EMPTY, TYPES, CITIES } from '../const.js';
import { formatStringToDateTime } from '../utils.js';

const createPointCitiesOptionsTemplate = () => {

Check failure on line 5 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`

Check failure on line 5 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`
Expand All @@ -8,7 +8,7 @@ const createPointCitiesOptionsTemplate = () => {
${CITIES.map((city) => `<option value="${city}"></option>`).join('')}
</div>`
);
}
};

const createPointPhotosTemplate = (pointDestination) => {

Check failure on line 13 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`

Check failure on line 13 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`
return (
Expand All @@ -17,15 +17,15 @@ const createPointPhotosTemplate = (pointDestination) => {
`<img class="event__photo" src="${picture.src}" alt="${picture.description}">`).join('')}
</div>`
);
}
};

const createPointTypesTemplate = (currentType) => {

Check failure on line 22 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`

Check failure on line 22 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`
return TYPES.map((type) =>
`<div class="event__type-item">
<input id="event-type-${type}-1" class="event__type-input visually-hidden" type="radio" name="event-type" value="${type}" ${currentType === type ? 'checked' : ''}>
<label class="event__type-label event__type-label--${type}" for="event-type-${type}-1">${type}</label>
</div>`).join('');
}
};

const createPointOffersTemplate = ({ pointOffers }) => {
const offerItems = pointOffers.map(offer => {

Check failure on line 31 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected parentheses around arrow function argument

Check failure on line 31 in src/view/edit-point-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected parentheses around arrow function argument
Expand All @@ -42,7 +42,7 @@ const createPointOffersTemplate = ({ pointOffers }) => {
}).join('');

return `<div class="event__available-offers">${offerItems}</div>`;
}
};

const createEditPointTemplate = ({ point, pointDestination, pointOffers }) => {
const { basePrice, dateFrom, dateTo, offers, type } = point;
Expand Down Expand Up @@ -107,7 +107,7 @@ const createEditPointTemplate = ({ point, pointDestination, pointOffers }) => {
</form>
</li>`
);
}
};

export default class EditPointView extends AbstractView {
#point = null;
Expand Down Expand Up @@ -140,10 +140,10 @@ export default class EditPointView extends AbstractView {
#formSubmitHandler = (evt) => {
evt.preventDefault();
this.#onSubmitClick();
}
};

#resetButtonClickHandler = (evt) => {
evt.preventDefault();
this.#onResetClick();
}
};
}
6 changes: 3 additions & 3 deletions src/view/point-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const createPointOffersTemplate = ({ pointOffers }) => {
}).join('');

return `<ul class="event__selected-offers">${offerItems}</ul>`;
}
};

const createPointTemplate = ({ point, pointDestination, pointOffers }) => {
const { basePrice, dateFrom, dateTo, offers, isFavorite, type } = point;
Expand Down Expand Up @@ -52,7 +52,7 @@ const createPointTemplate = ({ point, pointDestination, pointOffers }) => {
</div>
</li>`
);
}
};

export default class PointView extends AbstractView {
#point = null;
Expand Down Expand Up @@ -81,5 +81,5 @@ export default class PointView extends AbstractView {
#editClickHandler = (evt) => {
evt.preventDefault();
this.#onEditClick();
}
};
}
2 changes: 1 addition & 1 deletion src/view/sort-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const createSortTemplate = () => {
</div>
</form>`
);
}
};

export default class SortView extends AbstractView {
get template() {
Expand Down
2 changes: 1 addition & 1 deletion src/view/trip-info-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const createTripInfoTemplate = () => {
</p>
</section>`
);
}
};

export default class TripInfoView extends AbstractView {
get template() {
Expand Down

0 comments on commit 11bbe38

Please sign in to comment.