all content section

This commit is contained in:
Ivan Smolin 2017-11-13 12:36:08 +03:00
parent f8d805e4e8
commit 6a3945bbe9
11 changed files with 324 additions and 181 deletions

View File

@ -0,0 +1,80 @@
{%- include 'blocks/head.html.twig' with { title: pageTitle, cssFolderPath: cssFolderPath } %}
<body class="main-page">
<div class="aside aside-left">
<div class="header">
<div class="title">{{ pageTitle }}</div>
</div>
<div class="content">
{%- include 'blocks/main-menu.html.twig' with { mainMenu: mainMenu } %}
</div>
</div>
<div class="aside aside-right">
{%- include 'blocks/header.html.twig' with {
imagesFolderPath: imagesFolderPath,
methodsPath: methodsPath,
relativeToRootPath: relativeToRootPath
} %}
<div class="content">
<h1>
Оглавление
</h1>
<div class="page-data">
{%- include 'blocks/table-of-contents-body.html.twig' with {
methods: tableOfContents.methods,
classes: tableOfContents.classes,
enums: tableOfContents.enums
} %}
</div>
{% if methods is not null %}
<h1>
Методы
</h1>
{% for method in methods %}
<div class="page-data">
{%- include 'blocks/method-body.html.twig' with {
method: method,
objectsLinks: objectsLinks,
showSandbox: false
} %}
</div>
{% endfor %}
{% endif %}
{% if classes is not null %}
<h1>
Классы
</h1>
{% for class in classes %}
<div class="page-data">
{%- include 'blocks/class-body.html.twig' with {
structure: class,
objectsLinks: objectsLinks
} %}
</div>
{% endfor %}
{% endif %}
{% if enums is not null %}
<h1>
Перечисления
</h1>
{% for enum in enums %}
<div class="page-data">
{%- include 'blocks/enum-body.html.twig' with {
structure: enum,
objectsLinks: objectsLinks
} %}
</div>
{% endfor %}
{% endif %}
</div>
</div>
{%- include 'blocks/scripts.html.twig' with { jsFolderPath: jsFolderPath } %}
</body>
</html>

View File

@ -0,0 +1,22 @@
<h2>Описание</h2>
<p class="sub-header">{{ structure.type.baseTypeName }} - {{ structure.description }}</p>
{%- include 'comment.html.twig' with { comment: structure.comment } %}
<h2>Структура данных</h2>
<div class="table">
<div class="part-table">
<div class="row-header">
<div>Название поля</div>
<div>Тип поля</div>
<div class="text-centered">Описание</div>
<div>Обязательность</div>
</div>
{% for field in structure.allFieldsOrdered -%}
{%- include 'field-row.html.twig' with {
field: field,
objectsLinks: objectsLinks
} %}
{%- endfor %}
</div>
</div>

View File

@ -0,0 +1,20 @@
<h2>Описание</h2>
<p class="sub-header">{{ structure.name }} - {{ structure.description }}</p>
{%- include 'comment.html.twig' with { comment: structure.comment } %}
<h2>Возможные значения</h2>
<div class="table table--small">
<div class="part-table">
<div class="row-header">
<div>Значения</div>
<div>Описание</div>
</div>
{% for value in structure.values %}
<div class="row-body">
<div>{{ value.value }}</div>
<div>{{ value.description }}</div>
</div>
{% endfor %}
</div>
</div>

View File

@ -28,4 +28,8 @@
<li {%- if mainMenu.tableOfContents.active %} class="active" {%- endif -%}><a href="{{ mainMenu.tableOfContents.path }}">Оглавление</a></li>
{% endif %}
{%- if mainMenu.allContents is not null %}
<li {%- if mainMenu.allContents.active %} class="active" {%- endif -%}><a href="{{ mainMenu.allContents.path }}">Версия для печати</a></li>
{% endif %}
</menu>

View File

@ -0,0 +1,96 @@
<h2>Метод</h2>
<p class="sub-header">POST {{ method.url }}</p>
<h2>Описание</h2>
<p class="sub-header">{{ method.description }}</p>
{%- include 'comment.html.twig' with { comment: method.comment } %}
<h2>Параметры</h2>
{% if method.requestFields is not empty %}
<div class="table example-response-expanded">
<div class="part-table">
<div class="row-header">
<div>Название параметра</div>
<div>Тип параметра</div>
<div class="text-centered">Описание</div>
<div>Обязательность</div>
</div>
{% for field in method.requestFields -%}
{%- include 'field-row.html.twig' with {
field: field,
objectsLinks: objectsLinks
} %}
{%- endfor %}
</div>
{% if default(showSandbox, true) %}
<div class="part-block">
<a class="show-example-response">Пример запроса</a>
</div>
<div class="part-example-response">
<div class="inputs">
{% for field in method.requestFields -%}
<label>
{{ field.jsonName }}<br>
{% if field.type.values is not empty -%}
<div class="styled-select">
<select data-name="{{ field.jsonName }}">
{% for value in field.type.values %}
<option>{{ value.value }}</option>
{% endfor %}
</select>
{%- if field.optional or field.nullable -%}
{% include 'sandbox-optional-nullable.html.twig' with { field: field } %}
{% endif %}
</div>
{%- else %}
{%- if field.optional or field.nullable -%}
<div class="styled-input">
<input type="text" data-name="{{ field.jsonName }}">
{% include 'sandbox-optional-nullable.html.twig' with { field: field } %}
</div>
{%- else %}
<input type="text" data-name="{{ field.jsonName }}">
{% endif %}
{%- endif %}
</label>
{% endfor %}
<button class="btn run-btn" data-server-method-path="{{ serverMethodPath }}">
Выполнить
</button>
</div>
<div class="text-response"></div>
</div>
{% endif %}
</div>
{% else %}
<p class="sub-header">Параметры отсутствуют</p>
{% endif %}
<h2>Возможные ошибки</h2>
{% for value in method.errorsEnumeration.values -%}
{%- if value.value in method.errorsEnumeration.allowedValues %}
<p class="sub-header">#Код {{ value.value }}{{ value.description }}</p>
{%- endif -%}
{%- endfor %}
<h2>Результат</h2>
<p>Объект следующей структуры:</p>
<div class="table example-response-expanded">
<div class="part-table">
<div class="row-header">
<div>Название поля</div>
<div>Тип поля</div>
<div class="text-centered">Описание</div>
<div>Обязательность</div>
</div>
{% for field in method.responseFields -%}
{%- include 'field-row.html.twig' with {
field: field,
objectsLinks: objectsLinks
} %}
{%- endfor %}
</div>
</div>

View File

@ -0,0 +1,32 @@
{%- if methods is not null %}
<h2>
<a href="{{ methods.path }}">Методы</a>
</h2>
{% for methodsGroup in methods.items %}
<h3>
<a href="{{ methodsGroup.path }}">{{ methodsGroup.title }}</a>
</h3>
{% for method in methodsGroup.items -%}
<li><a href="{{ method.path }}">{{ method.title }}</a></li>
{% endfor -%}
{% endfor %}
{%- endif %}
{%- if classes is not null %}
<h2>
<a href="{{ classes.path }}">Классы</a>
</h2>
{% for class in classes.items -%}
<li><a href="{{ class.path }}">{{ class.title }}</a></li>
{% endfor %}
{% endif %}
{%- if enums is not null %}
<h2>
<a href="{{ enums.path }}">Перечисления</a>
</h2>
{% for enum in enums.items -%}
<li><a href="{{ enum.path }}">{{ enum.title }}</a></li>
{% endfor %}
{%- endif %}

View File

@ -1,10 +1,50 @@
$(function () {
$(document).ready(function () {
let sizes = [30, 70];
window.Split(['.aside-left', '.aside-right'], {
sizes: [30, 70],
minSize: [200, 769]
})
const splitSizesKey = 'split-sizes';
try {
const localStorageSizes = localStorage.getItem(splitSizesKey);
sizes = JSON.parse(localStorageSizes);
} catch (e) {
console.info("Unable to read split size from localStorage. Using defaults.");
}
let split = window.Split(['.aside-left', '.aside-right'], {
sizes: sizes,
minSize: [200, 769],
onDragEnd: function () {
try {
sizes = split.getSizes();
localStorage.setItem(splitSizesKey, JSON.stringify(sizes));
} catch (e) {
// SecurityError (DOM Exception 18): The operation is insecure.
}
}
});
window.split1 = split;
const beforePrint = function() {
split.collapse(0);
console.log('Functionality to run before printing.');
};
const afterPrint = function() {
split.setSizes(sizes);
console.log('Functionality to run after printing.');
};
if (window.matchMedia) {
const mediaQueryList = window.matchMedia('print');
mediaQueryList.addListener(function(mql) {
if (mql.matches) {
beforePrint();
} else {
afterPrint();
}
});
}
$('.part-example-response .text-response').css('height', $('.inputs').height() - 21);

View File

@ -10,11 +10,11 @@
<menu class="secondary">
{% for menu in menus %}
{% include 'blocks/secondary-menu.html.twig' with {
menu: menu,
menuTitle: menu.title,
activeItemTypeName: name
} %}
{% include 'blocks/secondary-menu.html.twig' with {
menu: menu,
menuTitle: menu.title,
activeItemTypeName: name
} %}
{% endfor %}
</menu>
@ -30,97 +30,10 @@
<div class="content">
<div class="page-data">
<h2>Метод</h2>
<p class="sub-header">POST {{ url }}</p>
<h2>Описание</h2>
<p class="sub-header">{{ description }}</p>
{%- include 'blocks/comment.html.twig' with { comment: comment } %}
<h2>Параметры</h2>
<div class="table example-response-expanded">
<div class="part-table">
<div class="row-header">
<div>Название параметра</div>
<div>Тип параметра</div>
<div class="text-centered">Описание</div>
<div>Обязательность</div>
</div>
{% for field in requestFields -%}
{%- include 'blocks/field-row.html.twig' with {
field: field,
objectsLinks: objectsLinks
} %}
{%- endfor %}
</div>
<div class="part-block">
<a class="show-example-response">Пример запроса</a>
</div>
<div class="part-example-response">
<div class="inputs">
{% for field in requestFields -%}
<label>
{{ field.jsonName }}<br>
{% if field.type.values is not empty -%}
<div class="styled-select">
<select data-name="{{ field.jsonName }}">
{% for value in field.type.values %}
<option>{{ value.value }}</option>
{% endfor %}
</select>
{%- if field.optional or field.nullable -%}
{% include 'blocks/sandbox-optional-nullable.html.twig' with { field: field } %}
{% endif %}
</div>
{%- else %}
{%- if field.optional or field.nullable -%}
<div class="styled-input">
<input type="text" data-name="{{ field.jsonName }}">
{% include 'blocks/sandbox-optional-nullable.html.twig' with { field: field } %}
</div>
{%- else %}
<input type="text" data-name="{{ field.jsonName }}">
{% endif %}
{%- endif %}
</label>
{% endfor %}
<button class="btn run-btn" data-server-method-path="{{ serverMethodPath }}">
Выполнить
</button>
</div>
<div class="text-response"></div>
</div>
</div>
<h2>Возможные ошибки</h2>
{% for value in errorsEnumeration.values -%}
{%- if value.value in errorsEnumeration.allowedValues %}
<p class="sub-header">#Код {{ value.value }}{{ value.description }}</p>
{%- endif -%}
{%- endfor %}
<h2>Результат</h2>
<p>Объект следующей структуры:</p>
<div class="table example-response-expanded">
<div class="part-table">
<div class="row-header">
<div>Название поля</div>
<div>Тип поля</div>
<div class="text-centered">Описание</div>
<div>Обязательность</div>
</div>
{% for field in responseFields -%}
{%- include 'blocks/field-row.html.twig' with {
field: field,
objectsLinks: objectsLinks
} %}
{%- endfor %}
</div>
</div>
{%- include 'blocks/method-body.html.twig' with {
method: method,
objectsLinks: objectsLinks
} %}
</div>
</div>
</div>

View File

@ -6,7 +6,7 @@
<div class="title">{{ pageTitle }}</div>
</div>
<div class="content">
{%- include 'blocks/main-menu.html.twig' %}
{%- include 'blocks/main-menu.html.twig' with { mainMenu: mainMenu } %}
<menu class="secondary">
{% include 'blocks/secondary-menu.html.twig' with {
@ -24,30 +24,14 @@
</div>
<div class="aside aside-right">
{%- include 'blocks/header.html.twig' with { imagesFolderPath: imagesFolderPath } %}
{%- include 'blocks/header.html.twig' with {
imagesFolderPath: imagesFolderPath,
relativeToRootPath: relativeToRootPath
} %}
<div class="content">
<div class="page-data">
<h2>Описание</h2>
<p class="sub-header">{{ name }} - {{ description }}</p>
{%- include 'blocks/comment.html.twig' with { comment: comment } %}
<h2>Возможные значения</h2>
<div class="table table--small">
<div class="part-table">
<div class="row-header">
<div>Значения</div>
<div>Описание</div>
</div>
{% for value in values %}
<div class="row-body">
<div>{{ value.value }}</div>
<div>{{ value.description }}</div>
</div>
{% endfor %}
</div>
</div>
{%- include 'blocks/enum-body.html.twig' with { structure: structure } %}
</div>
</div>
</div>

View File

@ -11,7 +11,8 @@
<menu class="secondary">
{% include 'blocks/secondary-menu.html.twig' with {
menu: enumsMenu,
menuTitle: "Перечисления"
menuTitle: "Перечисления",
activeItemTypeName: name
} %}
{% include 'blocks/secondary-menu.html.twig' with {
menu: classesMenu,
@ -25,34 +26,15 @@
<div class="aside aside-right">
{%- include 'blocks/header.html.twig' with {
imagesFolderPath: imagesFolderPath,
methodsPath: methodsPath,
relativeToRootPath: relativeToRootPath
} %}
<div class="content">
<div class="page-data">
<h2>Описание</h2>
<p class="sub-header">{{ type.baseTypeName }} - {{ description }}</p>
{%- include 'blocks/comment.html.twig' with { comment: comment } %}
<h2>Структура данных</h2>
<div class="table">
<div class="part-table">
<div class="row-header">
<div>Название поля</div>
<div>Тип поля</div>
<div class="text-centered">Описание</div>
<div>Обязательность</div>
</div>
{% for field in allFieldsOrdered -%}
{%- include 'blocks/field-row.html.twig' with {
field: field,
objectsLinks: objectsLinks
} %}
{%- endfor %}
</div>
</div>
{%- include 'blocks/class-body.html.twig' with {
structure: structure,
objectsLinks: objectsLinks
} %}
</div>
</div>
</div>

View File

@ -13,46 +13,16 @@
<div class="aside aside-right">
{%- include 'blocks/header.html.twig' with {
imagesFolderPath: imagesFolderPath,
methodsPath: methodsPath,
relativeToRootPath: relativeToRootPath
} %}
<div class="content">
<div class="page-data">
{%- if tableOfContents.methods is not null %}
<h2>
<a href="{{ tableOfContents.methods.path }}">Методы</a>
</h2>
{% for methodsGroup in tableOfContents.methods.items %}
<h3>
<a href="{{ methodsGroup.path }}">{{ methodsGroup.title }}</a>
</h3>
{% for method in methodsGroup.items -%}
<li><a href="{{ method.path }}">{{ method.title }}</a></li>
{% endfor -%}
{% endfor %}
{%- endif %}
{%- if tableOfContents.classes is not null %}
<h2>
<a href="{{ tableOfContents.classes.path }}">Классы</a>
</h2>
{% for class in tableOfContents.classes.items -%}
<li><a href="{{ class.path }}">{{ class.title }}</a></li>
{% endfor %}
{% endif %}
{%- if tableOfContents.enums is not null %}
<h2>
<a href="{{ tableOfContents.enums.path }}">Перечисления</a>
</h2>
{% for enum in tableOfContents.enums.items -%}
<li><a href="{{ enum.path }}">{{ enum.title }}</a></li>
{% endfor %}
{%- endif %}
{%- include 'blocks/table-of-contents-body.html.twig' with {
methods: tableOfContents.methods,
classes: tableOfContents.classes,
enums: tableOfContents.enums
} %}
</div>
</div>
</div>