Skip to content

Commit

Permalink
1.8. Время разбивать камни2
Browse files Browse the repository at this point in the history
  • Loading branch information
lunianka committed Feb 29, 2024
1 parent d28b945 commit ff392bb
Show file tree
Hide file tree
Showing 7 changed files with 343 additions and 338 deletions.
22 changes: 11 additions & 11 deletions src/presenter/trip-presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import TripView from '../view/point-list-view.js';
import { render } from '../render.js';

export default class TripPresenter {
constructor(tripContainer) {
this.tripContainer = tripContainer;
this.pointList = new TripView();
}
constructor(tripContainer) {
this.tripContainer = tripContainer;
this.pointList = new TripView();
}

init() {
render(new SortView(), this.tripContainer);
render(this.pointList, this.tripContainer);
render(new EditPointView(), this.pointList.getElement());
init() {
render(new SortView(), this.tripContainer);
render(this.pointList, this.tripContainer);
render(new EditPointView(), this.pointList.getElement());

for (let i = 0; i < 3; i++) {
render(new PointView(), this.pointList.getElement());
}
for (let i = 0; i < 3; i++) {
render(new PointView(), this.pointList.getElement());
}
}
}

Check failure on line 22 in src/presenter/trip-presenter.js

View workflow job for this annotation

GitHub Actions / Check

Newline required at end of file but not found

Check failure on line 22 in src/presenter/trip-presenter.js

View workflow job for this annotation

GitHub Actions / Check

Newline required at end of file but not found
342 changes: 171 additions & 171 deletions src/view/edit-point-view.js

Large diffs are not rendered by default.

70 changes: 37 additions & 33 deletions src/view/filter-view.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
import { createElement } from '../render.js';

const createFilterTemplate = () => {
return (
`<form class="trip-filters" action="#" method="get">
<div class="trip-filters__filter">
<input id="filter-everything" class="trip-filters__filter-input visually-hidden" type="radio" name="trip-filter" value="everything">
<label class="trip-filters__filter-label" for="filter-everything">Everything</label>
</div>
<div class="trip-filters__filter">
<input id="filter-future" class="trip-filters__filter-input visually-hidden" type="radio" name="trip-filter" value="future">
<label class="trip-filters__filter-label" for="filter-future">Future</label>
</div>
<div class="trip-filters__filter">
<input id="filter-present" class="trip-filters__filter-input visually-hidden" type="radio" name="trip-filter" value="present">
<label class="trip-filters__filter-label" for="filter-present">Present</label>
</div>
<div class="trip-filters__filter">
<input id="filter-past" class="trip-filters__filter-input visually-hidden" type="radio" name="trip-filter" value="past" checked>
<label class="trip-filters__filter-label" for="filter-past">Past</label>
</div>
<button class="visually-hidden" type="submit">Accept filter</button>
</form>`
);
function createFilterTemplate () {
return (`
<form class="trip-filters" action="#" method="get">
<div class="trip-filters__filter">
<input id="filter-everything" class="trip-filters__filter-input visually-hidden" type="radio" name="trip-filter" value="everything">
<label class="trip-filters__filter-label" for="filter-everything">Everything</label>
</div>
<div class="trip-filters__filter">
<input id="filter-future" class="trip-filters__filter-input visually-hidden" type="radio" name="trip-filter" value="future">
<label class="trip-filters__filter-label" for="filter-future">Future</label>
</div>
<div class="trip-filters__filter">
<input id="filter-present" class="trip-filters__filter-input visually-hidden" type="radio" name="trip-filter" value="present">
<label class="trip-filters__filter-label" for="filter-present">Present</label>
</div>
<div class="trip-filters__filter">
<input id="filter-past" class="trip-filters__filter-input visually-hidden" type="radio" name="trip-filter" value="past" checked>
<label class="trip-filters__filter-label" for="filter-past">Past</label>
</div>
<button class="visually-hidden" type="submit">Accept filter</button>
</form>
`);
}

export default class FilterView {
getTemplate() {
return createFilterTemplate();
}

getElement() {
if (!this.element) {
this.element = createElement(this.getTemplate());
}

return this.element;
getTemplate() {
return createFilterTemplate();
}

getElement() {
if (!this.element) {
this.element = createElement(this.getTemplate());
}


return this.element;
}

removeElement() {

Check failure on line 44 in src/view/filter-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected indentation of 2 spaces but found 4

Check failure on line 44 in src/view/filter-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected indentation of 2 spaces but found 4
this.element = null;

Check failure on line 45 in src/view/filter-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected indentation of 4 spaces but found 8

Check failure on line 45 in src/view/filter-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected indentation of 4 spaces but found 8
}

Check failure on line 46 in src/view/filter-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected indentation of 2 spaces but found 4

Check failure on line 46 in src/view/filter-view.js

View workflow job for this annotation

GitHub Actions / Check

Expected indentation of 2 spaces but found 4
Expand Down
34 changes: 16 additions & 18 deletions src/view/point-list-view.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
import { createElement } from '../render.js';

const createPointListTemplate = () => {
return (
`<ul class="trip-events__list"><ul>`
);
function createPointListTemplate () {
return '<ul class="trip-events__list"></ul>';
}

export default class PointListView {
getTemplate() {
return createPointListTemplate();
}

getElement() {
if (!this.element) {
this.element = createElement(this.getTemplate());
}

return this.element;
}

removeElement() {
this.element = null;
getTemplate() {
return createPointListTemplate();
}

getElement() {
if (!this.element) {
this.element = createElement(this.getTemplate());
}

return this.element;
}

removeElement() {
this.element = null;
}
}

Check failure on line 23 in src/view/point-list-view.js

View workflow job for this annotation

GitHub Actions / Check

Newline required at end of file but not found

Check failure on line 23 in src/view/point-list-view.js

View workflow job for this annotation

GitHub Actions / Check

Newline required at end of file but not found
108 changes: 54 additions & 54 deletions src/view/point-view.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
import { createElement } from '../render.js';

const createPointTemplate = () => {
return (
`<li class="trip-events__item">
<div class="event">
<time class="event__date" datetime="2019-03-18">MAR 18</time>
<div class="event__type">
<img class="event__type-icon" width="42" height="42" src="img/icons/taxi.png" alt="Event type icon">
</div>
<h3 class="event__title">Taxi Amsterdam</h3>
<div class="event__schedule">
<p class="event__time">
<time class="event__start-time" datetime="2019-03-18T10:30">10:30</time>
&mdash;
<time class="event__end-time" datetime="2019-03-18T11:00">11:00</time>
</p>
<p class="event__duration">30M</p>
</div>
<p class="event__price">
&euro;&nbsp;<span class="event__price-value">20</span>
</p>
<h4 class="visually-hidden">Offers:</h4>
<ul class="event__selected-offers">
<li class="event__offer">
<span class="event__offer-title">Order Uber</span>
&plus;&euro;&nbsp;
<span class="event__offer-price">20</span>
</li>
</ul>
<button class="event__favorite-btn event__favorite-btn--active" type="button">
<span class="visually-hidden">Add to favorite</span>
<svg class="event__favorite-icon" width="28" height="28" viewBox="0 0 28 28">
<path d="M14 21l-8.22899 4.3262 1.57159-9.1631L.685209 9.67376 9.8855 8.33688 14 0l4.1145 8.33688 9.2003 1.33688-6.6574 6.48934 1.5716 9.1631L14 21z"/>
</svg>
</button>
<button class="event__rollup-btn" type="button">
<span class="visually-hidden">Open event</span>
</button>
</div>
</li>`
);
function createPointTemplate () {
return (`
<li class="trip-events__item">
<div class="event">
<time class="event__date" datetime="2019-03-18">MAR 18</time>
<div class="event__type">
<img class="event__type-icon" width="42" height="42" src="img/icons/taxi.png" alt="Event type icon">
</div>
<h3 class="event__title">Taxi Amsterdam</h3>
<div class="event__schedule">
<p class="event__time">
<time class="event__start-time" datetime="2019-03-18T10:30">10:30</time>
&mdash;
<time class="event__end-time" datetime="2019-03-18T11:00">11:00</time>
</p>
<p class="event__duration">30M</p>
</div>
<p class="event__price">
&euro;&nbsp;<span class="event__price-value">20</span>
</p>
<h4 class="visually-hidden">Offers:</h4>
<ul class="event__selected-offers">
<li class="event__offer">
<span class="event__offer-title">Order Uber</span>
&plus;&euro;&nbsp;
<span class="event__offer-price">20</span>
</li>
</ul>
<button class="event__favorite-btn event__favorite-btn--active" type="button">
<span class="visually-hidden">Add to favorite</span>
<svg class="event__favorite-icon" width="28" height="28" viewBox="0 0 28 28">
<path d="M14 21l-8.22899 4.3262 1.57159-9.1631L.685209 9.67376 9.8855 8.33688 14 0l4.1145 8.33688 9.2003 1.33688-6.6574 6.48934 1.5716 9.1631L14 21z"/>
</svg>
</button>
<button class="event__rollup-btn" type="button">
<span class="visually-hidden">Open event</span>
</button>
</div>
</li>
`);
}

export default class PointView {
getTemplate() {
return createPointTemplate();
}

getElement() {
if (!this.element) {
this.element = createElement(this.getTemplate());
}

return this.element;
}

removeElement() {
this.element = null;
getTemplate() {
return createPointTemplate();
}

getElement() {
if (!this.element) {
this.element = createElement(this.getTemplate());
}

return this.element;
}

removeElement() {
this.element = null;
}
}

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

View workflow job for this annotation

GitHub Actions / Check

Newline required at end of file but not found

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

View workflow job for this annotation

GitHub Actions / Check

Newline required at end of file but not found
61 changes: 32 additions & 29 deletions src/view/sort-view.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
import { createElement } from '../render.js';

const createSortTemplate = () => {
return (
`<form class="trip-events__trip-sort trip-sort" action="#" method="get">
function createSortTemplate () {
return (`
<form class="trip-events__trip-sort trip-sort" action="#" method="get">
<div class="trip-sort__item trip-sort__item--day">
<input id="sort-day" class="trip-sort__input visually-hidden" type="radio" name="trip-sort" value="sort-day">
<label class="trip-sort__btn" for="sort-day">Day</label>
<input id="sort-day" class="trip-sort__input visually-hidden" type="radio" name="trip-sort" value="sort-day">
<label class="trip-sort__btn" for="sort-day">Day</label>
</div>
<div class="trip-sort__item trip-sort__item--event">
<input id="sort-event" class="trip-sort__input visually-hidden" type="radio" name="trip-sort" value="sort-event" disabled>
<label class="trip-sort__btn" for="sort-event">Event</label>
<input id="sort-event" class="trip-sort__input visually-hidden" type="radio" name="trip-sort" value="sort-event" disabled>
<label class="trip-sort__btn" for="sort-event">Event</label>
</div>
<div class="trip-sort__item trip-sort__item--time">
<input id="sort-time" class="trip-sort__input visually-hidden" type="radio" name="trip-sort" value="sort-time">
<label class="trip-sort__btn" for="sort-time">Time</label>
<input id="sort-time" class="trip-sort__input visually-hidden" type="radio" name="trip-sort" value="sort-time">
<label class="trip-sort__btn" for="sort-time">Time</label>
</div>
<div class="trip-sort__item trip-sort__item--price">
<input id="sort-price" class="trip-sort__input visually-hidden" type="radio" name="trip-sort" value="sort-price" checked>
<label class="trip-sort__btn" for="sort-price">Price</label>
<input id="sort-price" class="trip-sort__input visually-hidden" type="radio" name="trip-sort" value="sort-price" checked>
<label class="trip-sort__btn" for="sort-price">Price</label>
</div>
<div class="trip-sort__item trip-sort__item--offer">
<input id="sort-offer" class="trip-sort__input visually-hidden" type="radio" name="trip-sort" value="sort-offer" disabled>
<label class="trip-sort__btn" for="sort-offer">Offers</label>
<input id="sort-offer" class="trip-sort__input visually-hidden" type="radio" name="trip-sort" value="sort-offer" disabled>
<label class="trip-sort__btn" for="sort-offer">Offers</label>
</div>
</form>`
);
</form>
`);
}

export default class SortView {
getTemplate() {
return createSortTemplate();
}

getElement() {
if (!this.element) {
this.element = createElement(this.getTemplate());
}

return this.element;
}

removeElement() {
this.element = null;
getTemplate() {
return createSortTemplate();
}

getElement() {
if (!this.element) {
this.element = createElement(this.getTemplate());
}

return this.element;
}

removeElement() {
this.element = null;
}
}

Check failure on line 50 in src/view/sort-view.js

View workflow job for this annotation

GitHub Actions / Check

Newline required at end of file but not found

Check failure on line 50 in src/view/sort-view.js

View workflow job for this annotation

GitHub Actions / Check

Newline required at end of file but not found
Loading

0 comments on commit ff392bb

Please sign in to comment.