Skip to content

Instantly share code, notes, and snippets.

@DmitriyKashin
Last active December 17, 2015 13:59
Show Gist options
  • Save DmitriyKashin/5620755 to your computer and use it in GitHub Desktop.
Save DmitriyKashin/5620755 to your computer and use it in GitHub Desktop.
Partner Guide

1. Правила разрабатываемого кода

  • Конечный код не должен содержать тэгов <html> , <script>, <meta>, <head> ,<title> , <link>.
  • Ваш CSS, обязательно заключенный в тэг <style>, должен содержать описание только ваших классов или переопределять классы iknow.travel внутри ваших классов.
  • Если используется JavaScript, он не должен затрагивать какие-либо элементы сайта, кроме добавленных вами.
  • Картинки в процессе разработки могут хоститься где угодно, но при передаче нам HTML'a необходимо передать папку с ними. Названия картинок в HTML'e и в папке должны совпадать.
  • Список используемых библиотек необходимо утвердить до начала процесса разработки
  • Ваш JavaScript должен учитывать следующий фактор : открытие нового плана не удаляет старый из DOM, а всего лишь архивирует его, поэтому $.parents и схожие с ним селекторы могут работать не так , как ожидается при открытии &gt;2 ваших планов за 1 сессию. ($.closest может стать хорошей альтернативой)
  • Перед отправкой кода проверьте все возможные граничные случаи (предыдущий пункт - один из них)

2. Использование имеющихся библиотек

Вот список библиотек, которые есть в iknow.travel :

  • CSS+JS
    • Bootstrap
    • fotorama
  • JS
    • jQuery
    • jQuery - autogeocoder
    • jQuery - waypoints
    • backbone
    • backbone - queryparams
    • google maps - infobox
    • google plusone
    • google maps - markerclusterer
    • underscore

3. Добавление новых библиотек

Если возникла необходимость в добавлении новой библиотеки — напишите нам. Это очень важно сделать перед началом разработки.

4. Разработка и проверка HTML/CSS

Варианты :

  • Разработка и проверка в браузере

    Для этого необходимо открыть страницу с планом и найти блок с классом .b-plan__container, если необходимо добавить шапку плана, или с классом .b-profile__filler, если необходимо добавить шапку профиля, во вкладке Elements. Внутри него можно добавлять весь необходимый код. Именно в .b-plan__container или .b-profile__filler в дальнейшем будет помещен ваш HTML.

    Также у нас есть редактор HTML'a, который позволяет заменить содержимое .b-plan__container(.b-profile__filler) на введенный в поле HTML и обновляет шапку страницы. Если вы не используете JavaScript, то оптимальным выбором будет редактор iknow.travel. Для доступа к редактору необходимо связаться с нами и получить права модератора на тестовой версии сайта. В случае с профилем, редактор находится в пользовательских настройках. В случае с планом, редактор вызывается нажатием на специальный элемент текущей шапки, видимый лишь для партнеров.

Example

  • Разработка локально

    HTML файл вы создаете локально и затем проверяете в браузере аналогично с первым вариантом. Советуем проверять все в браузере после наиболее значительных изменений.

Дополнение:

Если необходимо использовать элементы стандартного плана (карта, автор), то их без изменений можно скопировать с уже существующих планов из .b-plan__container. Добавление карты в шапку профиля невозможно. Элементы стандартной шапки профиля можно скопировать аналогичным образом из .b-profile__filler

Пример

https://gist.github.com/DmitriyKashin/5620755#file-gistfile2-html

5. Разработка и проверка JavaScript

Когда необходимые библиотеки определены, можно приступать к JS. Если мы решили добавить вашу библиотеку, но на ресурсе она пока отсутствует, можно подключить её как bookmarklet\расширение в chrome. Самый оптимальный вариант разработки — локально. Для того, чтобы проверить работу JS'a в реальных условиях, первым делом вставьте весь HTML/CSS (подробно в пункте 4), затем откройте вкладку Console и вставьте ваш JS.

Example

Возможные проблемы

Если JS по каким-то причинам работает локально, а в браузере нет — свяжитесь с нами. Версии используемых библиотек всегда можно посмотреть в Sources. Конфликт версий может быть одной из проблем.

Example

<div class="b-plan__container" data-partner="ibiza">
<div class="b-ibiza-main">
<style type="text/css">
.b-ibiza-main .b-plan__container .btn.active{ color: blue; }
.b-ibiza-main .b-plan__container .btn {
text-transform:none;
background-color: rgb(0, 0, 0);
/* RGBa with 0.6 opacity */
background-color: rgba(0, 0, 0, 0.6);
/* For IE 5.5 - 7*/
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);
/* For IE 8*/
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";
transition: none;
-moz-transition: none;
-webkit-transition: none;
-o-transition: none;
}
.b-ibiza-main .b-plan__caption-author {
}
.b-ibiza-main .b-plan__caption-author-portrait {
display: inline-block;
height: 47px;
vertical-align: middle;
}
.b-ibiza-main .b-plan__caption-author-name {
display: inline-block;
height: 18px;
margin-top: 12px;
vertical-align: top;
*display: inline;
zoom: 1;
}
.b-ibiza-main .b-plan__caption-title {
box-shadow: none;
color: #5A5A5A;
font-family: PFDinTextCompPro-Medium,sans-serif;
font-size: 2.6em;
font-weight: normal;
letter-spacing: -0.02em;
margin: 0 auto;
padding-top: 9px;
text-align: center;
text-shadow: none;
width: 500px;
}
.b-ibiza-main .b-plan__caption-details {
width: 1084px;
}
.b-ibiza-container {
background-image: url("https://s3-eu-west-1.amazonaws.com/pst0.iknow.travel/ibiza/b-ibiza-bg.jpg");
background-size: cover;
background-color: #92ceff;
background-position: 0 center;
background-repeat: no-repeat;
display: block;
height: 233px;
margin: 0 auto;
overflow: hidden;
max-width: 2000px;
position: relative;
}
.__b-ibiza-footer {
background-image: url("https://s3-eu-west-1.amazonaws.com/pst0.iknow.travel/ibiza/b-ibiza-bottom-image.png");
background-position: center bottom;
background-repeat: repeat-x;
bottom: 0;
display: block;
height: 15px;
left: 0;
margin: 0 auto;
max-width: 2000px;
margin-top: -15px;
position: relative;
}
.b-ibiza-column {
width: 1084px;
margin: 0 auto;
position: relative;
}
.b-ibiza-logo {
background-image: url("https://s3-eu-west-1.amazonaws.com/pst0.iknow.travel/ibiza/b-ibiza-logo.png");
background-repeat: no-repeat;
height: 118px;
left: 85px;
position: absolute;
top: 60px;
width: 426px;
}
.b-button-wrapper{
width: 424px;
height: 28px;
overflow: hidden;
border: 1px solid rgba(0,0,0,0.5);
border-radius: 8px;
white-space: nowrap;
font-size: 0;
}
.b-ibiza-button {
font-size: 14px;
font-family: "PT Sans", Arial, Verdana, sans-serif;
font-weight: bold;
cursor: pointer;
padding: 5px 32px;
position: relative;
top: 4px;
background-image: url("https://s3-eu-west-1.amazonaws.com/pst0.iknow.travel/ibiza/b-ibiza-buttons.png");
background-position: 0 -28px;
border-right: 1px solid rgba(0,0,0,0.5);
text-shadow: 0 1px 0px rgba(255,255,255,0.7);
}
.b-ibiza-button-last {
border-right: none;
}
.b-ibiza-button.active {
color: #0074cb;
background-position: 0 0;
}
.b-ibiza-button.active:hover {
background-position: 0 0;
}
.b-ibiza-button:hover {
background-position: 0 -56px;
}
.b-ibiza-form {
margin-top: 15px;
}
.b-ibiza-form__from-to {
position: relative;
}
.b-ibiza-form__from-to-inp-wrapper {
display: inline-block;
zoom: 1;
margin-right: 9px;
*display: inline;
zoom: 1;
}
.b-ibiza-form__from-to-title {
font-family: "PT Sans", Arial, Verdana, sans-serif;
text-shadow: none;
font-size: 14px;
}
.b-ibiza-form__from-to-inp-w {
position: relative;
}
.b-ibiza-form__from-to-inp-w-inp {}
.b-ibiza-form__from-to-inp-w-date {
background-image: url("https://s3-eu-west-1.amazonaws.com/pst0.iknow.travel/ibiza/b-ibiza-date.png");
cursor: pointer;
height: 14px;
width: 15px;
position: absolute;
right: 9px;
top: 9px;
}
.b-ibiza-form__from-to-inp-field {
width: 174px;
box-shadow: 2px 2px 0 rgba(255,255,255,0.7);
padding: 4px 20px 4px 12px !important;
}
.b-ibiza-ammount-wrapper {
margin-top: 12px;
}
.b-ibiza-ammount-block {
display: inline-block;
vertical-align: top;
position: relative;
*display: inline;
zoom: 1;
}
.b-ibiza-ammount-block-input-wrapper {
width: 150px;
}
.b-ibiza-ammount-block-input-field {
width: 30px;
padding-right: 10px !important;
}
.b-ibiza-ammount-block-input-controlls {
position: absolute;
left: 31px;
top: 6px;
}
.b-ibiza-ammount-block-input-title {
font-family: "PT Sans", Arial, Verdana, sans-serif;
white-space: normal;
position: absolute;
right: 0;
top: 0;
width: 90px;
text-shadow: none;
line-height: 1em;
}
.b-ibiza-ammount-block-input-controlls-arrow {
position: absolute;
width: 10px;
height: 10px;
background-image: url("https://s3-eu-west-1.amazonaws.com/pst0.iknow.travel/ibiza/b-ibiza-number-arrows.png");
cursor: pointer
}
.b-ibiza-ammount-block-input-controlls-arrow-up {
}
.b-ibiza-ammount-block-input-controlls-arrow-down {
background-position: 0 -10px;
top: 10px;
}
.b-show-price-block {
display: inline-block;
vertical-align: top;
}
.b-show-price-button {
background-color: transparent;
border: none;
background-image: url("https://s3-eu-west-1.amazonaws.com/pst0.iknow.travel/ibiza/b-ibiza-show-price.png");
width: 154px;
height: 33px;
margin-left: 27px;
background-repeat: no-repeat;
cursor: pointer;
}
.b-ibiza-createdby {
position: absolute;
right: 112px;
top: 190px;
}
.b-ibiza-createdby-text {
display: inline-block;
font-family: "PT Sans",Arial,Verdana,sans-serif;
font-size: 12px;
margin-right: 5px;
}
.b-ibiza-createdby-logo {
background-image: url("https://s3-eu-west-1.amazonaws.com/pst0.iknow.travel/ibiza/ibiza-logo.png");
background-repeat: no-repeat;
display: inline-block;
height: 37px;
vertical-align: middle;
width: 71px;
}
.b-ibiza-planes-wrapper {
font-size: 0;
left: 300px;
position: absolute;
top: 20px;
white-space: nowrap;
*display: inline;
zoom: 1;
}
.b-ibiza-planes-wrapper-button {
background-image: url("https://s3-eu-west-1.amazonaws.com/pst0.iknow.travel/ibiza/b-ibiza-planes.png");
background-repeat: no-repeat;
display: inline-block;
white-space: nowrap;
cursor: pointer;
*display: inline;
zoom: 1;
}
.b-ibiza-planes-wrapper-button-one {
width: 40px;
height: 32px;
}
.b-ibiza-planes-wrapper-button-one-back {
width: 36px;
height: 32px;
background-position: -85px 0;
}
.b-ibiza-planes-wrapper-button-one.active {
background-position: 0 -32px;
}
.b-ibiza-planes-wrapper-button-one-back.active {
background-position: -85px -32px;
}
.b-ibiza-planes-wrapper-button-two {
width: 45px;
height: 32px;
background-position: -40px 0;
}
.b-ibiza-planes-wrapper-button-two.active {
background-position: -40px -32px;
}
</style>
<div class="b-plan__caption-details" style="margin-top: 9px;">
<div class="b-plan__caption-label pull-right"><i class="avo-icon-em-label"></i><span class="b-plan__caption-label-text">Путеводитель</span></div>
<div class="b-plan__caption-author pull-left">
<div class="b-plan__caption-author-portrait pull-left">
<a href="#" title="Anna Mitrokhova" class="b-portrait-holder47">
<div class="portrait-shadow"></div>
<img src="http://static.iknow.travel.s3-eu-west-1.amazonaws.com/img/avatars/small/hx7m2.jpg" alt="Anna Mitrokhova" title="Anna Mitrokhova" class="portrait">
</a>
</div>
<div class="b-plan__caption-author-name"><a href="/id1097328375/plans" class="b-plan__caption-author-name-link">Anna Mitrokhova</a></div>
</div>
<h1 class="b-plan__caption-title b-caption__title" style="">Правильный путеводитель по Ибице</h1>
<div class="clear"></div>
</div>
<div class="b-ibiza-container">
<div class="b-ibiza-column">
<div class="b-ibiza-logo"></div>
<div style="width: 600px; height: 150px; padding-top: 30px; margin-left: 570px;">
<form action="http://booking.ibiza.ru/order/process/" method="post" target="_blank">
<input type="hidden" name="rmrevin" value="REYtkVSm7APbiVn3PwVgPFrRdiM=">
<input type="hidden" name="type" value="tour">
<input type="hidden" name="direction" value="DME-IBZ-DME">
<div data-toggle="buttons-radio">
<div class="b-button-wrapper">
<span class="b-ibiza-button active" data-panel="1" data-tourtype="tour">Отель + перелет</span>
<span class="b-ibiza-button" data-panel="2" data-tourtype="flight">Авиабилет</span>
<span class="b-ibiza-button b-ibiza-button-last" data-panel="3" data-tourtype="hotel">Отель</span>
</div>
</div>
<div class="b-ibiza-form">
<div class="b-ibiza-form__from-to">
<div class="b-ibiza-form__from-to-inp-wrapper b-ibiza-form__from-to-inp-wrapper-date-from">
<div class="b-ibiza-form__from-to-title b-ibiza-form__from-to-title-to">Туда (Москва)</div>
<div class="b-ibiza-form__from-to-inp-w">
<div class="b-ibiza-form__from-to-inp-w-inp">
<input type="text" placeholder="Дата отправления" class="b-ibiza-form__from-to-inp-field datepicker" id="date_from" name="date_from">
</div>
<div class="b-ibiza-form__from-to-inp-w-date"></div>
</div>
</div>
<div class="b-ibiza-form__from-to-inp-wrapper b-ibiza-form__from-to-inp-wrapper-date-to">
<div class="b-ibiza-form__from-to-title b-ibiza-form__from-to-title-back">Обратно (Ибица)</div>
<div class="b-ibiza-form__from-to-inp-w">
<div class="b-ibiza-form__from-to-inp-w-inp">
<input type="text" placeholder="Дата прибытия" class="b-ibiza-form__from-to-inp-field datepicker" id="date_to" name="date_to">
</div>
<div class="b-ibiza-form__from-to-inp-w-date"></div>
</div>
</div>
<div class="b-ibiza-planes-wrapper" style="display: none;">
<div class="b-ibiza-planes-wrapper-button b-ibiza-planes-wrapper-button-one"></div>
<div class="b-ibiza-planes-wrapper-button b-ibiza-planes-wrapper-button-one-back"></div>
<div class="b-ibiza-planes-wrapper-button b-ibiza-planes-wrapper-button-two active"></div>
</div>
</div>
<div class="b-form-type">
<div class="b-ibiza-ammount-wrapper">
<div class="b-ibiza-ammount-block">
<div class="b-ibiza-ammount-block-input-wrapper">
<div class="b-ibiza-ammount-block-input-input">
<input type="text" class="b-ibiza-ammount-block-input-field" value="2" name="num_adults"/>
</div>
<div class="b-ibiza-ammount-block-input-controlls">
<div class="b-ibiza-ammount-block-input-controlls-arrow b-ibiza-ammount-block-input-controlls-arrow-up"></div>
<div class="b-ibiza-ammount-block-input-controlls-arrow b-ibiza-ammount-block-input-controlls-arrow-down"></div>
</div>
<div class="b-ibiza-ammount-block-input-title">Количество человек (18+)</div>
</div>
</div>
<div class="b-ibiza-ammount-block" style="width: 90px;">
<div class="b-ibiza-ammount-block-input-wrapper">
<div class="b-ibiza-ammount-block-input-input">
<input type="text" class="b-ibiza-ammount-block-input-field" value="0" name="num_children"/>
</div>
<div class="b-ibiza-ammount-block-input-controlls">
<div class="b-ibiza-ammount-block-input-controlls-arrow b-ibiza-ammount-block-input-controlls-arrow-up"></div>
<div class="b-ibiza-ammount-block-input-controlls-arrow b-ibiza-ammount-block-input-controlls-arrow-down"></div>
</div>
<div class="b-ibiza-ammount-block-input-title" style="width: 35px;">Дети <br/> (0-2)</div>
</div>
</div>
<div class="b-show-price-block">
<button class="b-show-price-button"></button>
</div>
</div>
</div>
<div class="b-ibiza-createdby">
<span class="b-ibiza-createdby-text">by</span>
<a href="http://www.ibiza.ru" target="_blank"><div class="b-ibiza-createdby-logo"></div></a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="__b-ibiza-footer"></div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment