diff --git a/Java/ApiDateFormattingService.swift.twig b/Java/ApiDateFormattingService.swift.twig deleted file mode 100644 index 6339878..0000000 --- a/Java/ApiDateFormattingService.swift.twig +++ /dev/null @@ -1,23 +0,0 @@ -import LeadKit -import ObjectMapper - -final class ApiDateFormattingService: DateFormattingService { - - static let shared = ApiDateFormattingService() - - private init() { - super.init(formattingArguments: [ - {% for dateFormat in dateFormats -%} - DateFormattingArguments(dateFormat: "{{ dateFormat }}"){% if not (loop.last) %},{%- endif %} - {% endfor %} - ]) - } -} - -extension ApiDateFormattingService { - - func mappingTransform(for dateFormat: String) -> TransformOf { - return mappingTransform(for: DateFormattingArguments(dateFormat: dateFormat)) - } - -} diff --git a/Java/Class.java.twig b/Java/Class.java.twig index 07401e3..461ff74 100644 --- a/Java/Class.java.twig +++ b/Java/Class.java.twig @@ -14,6 +14,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.math.BigDecimal; import java.util.List; import java.util.ArrayList; import java.util.Collection; @@ -93,4 +94,4 @@ public class {% include 'blocks/class/classtype.twig' with { type: type } %} ext {%- include 'blocks/class/fields-read-object.twig' with { fields: fields } %} } -} \ No newline at end of file +} diff --git a/Java/blocks/class/fields-getters-setters.twig b/Java/blocks/class/fields-getters-setters.twig index 6f0b295..0696c91 100644 --- a/Java/blocks/class/fields-getters-setters.twig +++ b/Java/blocks/class/fields-getters-setters.twig @@ -6,15 +6,13 @@ * {{ field.description }} */ {{ utils.writeNullCheckAnnotation(field.type.type.baseTypeName, field.nullable, field.optional) }} - //TODO: getter with is**** - public {{ utils.formatValueType(field.type.type, field.nullable, field.optional) }} get{{ utils.capitalize(field.name) }}() { + public {{ utils.formatValueType(field.type.type, field.nullable, field.optional) }} {% if (field.type.type.baseTypeName == "Bool") and (field.name matches "^is[A-Z,0-9].*") -%}{{ field.name }}{%- else -%}get{{ utils.capitalize(field.name) }}{%- endif -%}() { {{ utils.formatValueGetter(field.name, field.type.type, field.nullable, field.optional) }} } /** * {{ field.description }} */ - //TODO: setter with is**** public void set{{ utils.capitalize(field.name) }}({{ utils.writeNullCheckAnnotation(field.type.type.baseTypeName, field.nullable, field.optional) }} final {{ utils.formatValueType(field.type.type, field.nullable, field.optional) }} {{ field.name }}) { {{ utils.formatValueSetter("this", field.name, field.type.type.baseTypeName, fiel.nullable, field.optional ) }} } diff --git a/Java/blocks/class/fields-validate.twig b/Java/blocks/class/fields-validate.twig index 4485689..1f2b135 100644 --- a/Java/blocks/class/fields-validate.twig +++ b/Java/blocks/class/fields-validate.twig @@ -1,8 +1,8 @@ {%- import '../../utils.twig' as utils -%} {% for field in fields -%} {%- if field.optional -%} -{{ utils.formatValidateObject(concat("this.", field.name, ".get()"), field.type.type, field.nullable) }} +{{ utils.formatValidateObject(concat("this.", field.name, ".get()"), field.type, field.type.type, field.nullable) }} {%- else -%} -{{ utils.formatValidateObject(concat("this.", field.name), field.type.type, field.nullable) }} +{{ utils.formatValidateObject(concat("this.", field.name), field.type, field.type.type, field.nullable) }} {%- endif -%} {%- endfor -%} \ No newline at end of file diff --git a/Java/utils.twig b/Java/utils.twig index 15a58c9..8059dc2 100644 --- a/Java/utils.twig +++ b/Java/utils.twig @@ -201,7 +201,7 @@ inputStream.readBoolean() {%- endif -%} {% endmacro %} -{% macro formatValidateObject(object, valueType, nullable) %} +{% macro formatValidateObject(object, valueTopType, valueType, nullable) %} {% import _self as self %} {%- if not nullable and valueType.baseTypeName != "Int" and valueType.baseTypeName != "Long" and valueType.baseTypeName != "Double" and valueType.baseTypeName != "Bool" %} validateNotNull({{ object }}); @@ -213,7 +213,7 @@ inputStream.readBoolean() } {%- else -%} validateCollection({{ object }}.values(), CollectionValidationRule.EXCEPTION_IF_ANY_INVALID); -{%- endif -%} +{%- endif -%} {%- elseif valueType.baseTypeName == "Array" %} {%- if nullable -%} if ({{ object }} != null) { @@ -222,9 +222,28 @@ inputStream.readBoolean() {%- else -%} validateCollection({{ object }}, CollectionValidationRule.EXCEPTION_IF_ANY_INVALID); {%- endif -%} -{%- elseif valueType.baseTypeName != "Int" and valueType.baseTypeName != "Long" and valueType.baseTypeName != "Double" and valueType.baseTypeName != "Bool" and valueType.baseTypeName != "String" and valueType.baseTypeName != "Decimal" and valueType.baseTypeName != "DateTime" %} +{%- elseif valueType.baseTypeName != "Int" + and valueType.baseTypeName != "Long" + and valueType.baseTypeName != "Double" + and valueType.baseTypeName != "Bool" + and valueType.baseTypeName != "String" + and valueType.baseTypeName != "Decimal" + and valueType.baseTypeName != "DateTime" + and (valueTopType.values is empty) %} +{%- if valueTopType.allFieldsOrdered is empty %} if ({{ object }} instanceof ApiModel) { ((ApiModel) {{ object }}).validate(); + } else if ({{ object }} instanceof List) { + validateCollection(((List) {{ object }}), CollectionValidationRule.EXCEPTION_IF_ANY_INVALID); + } else if ({{ object }} instanceof Map) { + validateCollection(((Map) {{ object }}).values(), CollectionValidationRule.EXCEPTION_IF_ANY_INVALID); } +{%- elseif nullable %} + if ({{ object }} != null) { + {{ object }}.validate(); + } +{%- else -%} + {{ object }}.validate(); +{%- endif -%} {%- endif -%} {% endmacro %} diff --git a/Swift/Class.swift.twig b/Swift/Class.swift.twig index 748c4a1..42f0a76 100644 --- a/Swift/Class.swift.twig +++ b/Swift/Class.swift.twig @@ -7,7 +7,7 @@ import ObjectMapper -{%- include 'blocks/class/date-transformers.twig' with { fields: fields } %} +{%- include 'blocks/class/date-transformers.twig' with { fields: fields, classType: classType } %} /// {{ description }} {% if (not hasChilds) -%}final {% endif %}class {{ classType }}: {{ parentClassType }} { @@ -23,20 +23,27 @@ import ObjectMapper } required init(map: Map) throws { - {%- include 'blocks/class/fields-mapping-from-map.twig' with { fields: fields } -%} + {%- include 'blocks/class/fields-mapping-from-map.twig' with { + fields: fields, + classType: classType + } -%} {% if hasParent %} try super.init(map: map) {%- endif %} } {% if hasParent %} override {% endif %}func mapping(map: Map) { - {%- include 'blocks/class/fields-mapping-to-map.twig' with { fields: fields } -%} + {%- include 'blocks/class/fields-mapping-to-map.twig' with { + fields: fields, + classType: classType + } -%} {% if hasParent %} super.mapping(map: map) {%- endif %} } } +{# {% if not hasChilds %} extension {{ type.baseTypeName }}: Equatable { @@ -46,4 +53,5 @@ extension {{ type.baseTypeName }}: Equatable { } } -{% endif -%} \ No newline at end of file +{% endif -%} +#} \ No newline at end of file diff --git a/Swift/Enum.swift.twig b/Swift/Enum.swift.twig index 32a3095..e868936 100644 --- a/Swift/Enum.swift.twig +++ b/Swift/Enum.swift.twig @@ -8,7 +8,7 @@ import Foundation {% for value in values -%} /// - {{ utils.decapitalize(value.name) }}: {{ value.description }} {% endfor -%} -enum {{ name }}: {{ enumutils.enumType(valuesTypes) }} { +enum {{ name }}: {{ enumutils.enumType(valuesTypes) }}, RawRepresentable { {% include 'blocks/enum/cases.twig' with { values: values } %} } diff --git a/Swift/NetworkService.swift.twig b/Swift/NetworkService.swift.twig index 5acf6ee..efa461f 100644 --- a/Swift/NetworkService.swift.twig +++ b/Swift/NetworkService.swift.twig @@ -14,4 +14,4 @@ class {{ serviceName }}: ApiNetworkService { return "{{ apiUrl }}" } -} \ No newline at end of file +} diff --git a/Swift/blocks/class/date-transformers.twig b/Swift/blocks/class/date-transformers.twig index e441fe3..f9e4203 100644 --- a/Swift/blocks/class/date-transformers.twig +++ b/Swift/blocks/class/date-transformers.twig @@ -15,7 +15,7 @@ {%- for field in fields -%} {% if field.type.type.baseTypeName == "DateTime" -%} -private let {{ field.name }}Transform = ApiDateFormattingService.shared.mappingTransform(for: "{{ field.type.dateFormat }}") +private let {{ utils.dateTransformName(field.name, classType) }} = ApiDateFormattingService.shared.mappingTransform(for: "{{ field.type.dateFormat }}") {% endif -%} {%- endfor -%} {%- endif -%} \ No newline at end of file diff --git a/Swift/blocks/class/fields-mapping-from-map.twig b/Swift/blocks/class/fields-mapping-from-map.twig index e109ea5..6b2b9dd 100644 --- a/Swift/blocks/class/fields-mapping-from-map.twig +++ b/Swift/blocks/class/fields-mapping-from-map.twig @@ -1,4 +1,4 @@ {%- import '../../macroses/common.utils.twig' as utils -%} {%- for field in fields %} - {{ field.name }} = {{ utils.formatNullableOrOptional('try', field.nullable, field.optional) }} {{ utils.mappingFromMapForField(field) }} + {{ field.name }} = {{ utils.formatNullableOrOptional('try', field.nullable, field.optional) }} {{ utils.mappingFromMapForField(field, classType) }} {%- endfor -%} \ No newline at end of file diff --git a/Swift/blocks/class/fields-mapping-to-map.twig b/Swift/blocks/class/fields-mapping-to-map.twig index 98d9cc3..253edae 100644 --- a/Swift/blocks/class/fields-mapping-to-map.twig +++ b/Swift/blocks/class/fields-mapping-to-map.twig @@ -2,9 +2,9 @@ {%- for field in fields %} {%- if field.optional %} if {{ field.name }} != nil { - {{ field.name }} >>> {{ utils.mappingToMapForField(field) }} + {{ field.name }} >>> {{ utils.mappingToMapForField(field, classType) }} } {%- else %} - {{ field.name }} >>> {{ utils.mappingToMapForField(field) }} + {{ field.name }} >>> {{ utils.mappingToMapForField(field, classType) }} {%- endif -%} {%- endfor -%} \ No newline at end of file diff --git a/Swift/macroses/common.utils.twig b/Swift/macroses/common.utils.twig index 9efcc65..220b5e0 100644 --- a/Swift/macroses/common.utils.twig +++ b/Swift/macroses/common.utils.twig @@ -2,19 +2,27 @@ {{- concat(slice(text, 0, 1) | lower, slice(text, 1, text | length)) -}} {% endmacro %} +{% macro capitalize(text) %} + {{- concat(slice(text, 0, 1) | upper, slice(text, 1, text | length)) -}} +{% endmacro %} + {% macro formatNullableOrOptional(expr, nullable, optional) %} {{- expr -}}{%- if nullable or optional -%}?{%- endif -%} {% endmacro %} {% macro formatValueType(valueType) %} + {%- import _self as self -%} + {%- if valueType.baseTypeName == "Array" -%} - [{{ valueType.itemsType.baseTypeName }}] + [{{ self.formatValueType(valueType.itemsType) }}] {%- elseif valueType.baseTypeName == "Map" -%} - [{{ valueType.keysType.baseTypeName }}: {{ valueType.valuesType.baseTypeName }}] + [{{ self.formatValueType(valueType.keysType) }}: {{ self.formatValueType(valueType.valuesType) }}] {%- elseif valueType.baseTypeName == "DateTime" -%} Date {%- elseif valueType.baseTypeName == "Long" -%} Int64 + {%- elseif valueType.baseTypeName == "Decimal" -%} + NSDecimalNumber {%- else -%} {{ valueType.baseTypeName }} {%- endif -%} @@ -28,18 +36,30 @@ {%- endif -%} {% endmacro %} -{% macro mappingFromMapForField(field) %} +{% macro mappingFromMapForField(field, className) %} + {%- import _self as self -%} + {%- if field.type.type.baseTypeName == "DateTime" -%} - map.value("{{ field.jsonName }}", using: {{ field.name -}}Transform) + map.value("{{ field.jsonName }}", using: {{ self.dateTransformName(field.name, className) -}}) + {%- elseif field.type.type.baseTypeName == "Decimal" -%} + map.value("{{ field.jsonName }}", using: NSDecimalNumberTransform()) {%- else -%} map.value("{{ field.jsonName }}") {%- endif -%} {% endmacro %} -{% macro mappingToMapForField(field) %} +{% macro mappingToMapForField(field, className) %} + {%- import _self as self -%} + {%- if field.type.type.baseTypeName == "DateTime" -%} - (map["{{ field.jsonName }}"], {{ field.name -}}Transform) + (map["{{ field.jsonName }}"], {{ self.dateTransformName(field.name, className) -}}) {%- else -%} map["{{ field.jsonName }}"] {%- endif -%} {% endmacro %} + +{% macro dateTransformName(fieldName, className) %} + {%- import _self as self -%} + + {{ self.decapitalize(className) }}{{ self.capitalize(fieldName) -}}Transform +{%- endmacro %} diff --git a/Web-documentation/all_contents.html.twig b/Web-documentation/all_contents.html.twig new file mode 100644 index 0000000..44d4b52 --- /dev/null +++ b/Web-documentation/all_contents.html.twig @@ -0,0 +1,80 @@ +{%- include 'blocks/head.html.twig' with { title: pageTitle, cssFolderPath: cssFolderPath } %} + + +
+
+
{{ pageTitle }}
+
+
+ {%- include 'blocks/main-menu.html.twig' with { mainMenu: mainMenu } %} +
+
+ +
+ {%- include 'blocks/header.html.twig' with { + imagesFolderPath: imagesFolderPath, + methodsPath: methodsPath, + relativeToRootPath: relativeToRootPath + } %} + +
+

+ Оглавление +

+
+ {%- include 'blocks/table-of-contents-body.html.twig' with { + methods: tableOfContents.methods, + classes: tableOfContents.classes, + enums: tableOfContents.enums + } %} +
+ + {% if methods is not null %} +

+ Методы +

+ {% for method in methods %} +
+ {%- include 'blocks/method-body.html.twig' with { + method: method, + objectsLinks: objectsLinks, + showSandbox: false + } %} +
+ {% endfor %} + {% endif %} + + {% if classes is not null %} +

+ Классы +

+ {% for class in classes %} +
+ {%- include 'blocks/class-body.html.twig' with { + structure: class, + objectsLinks: objectsLinks + } %} +
+ {% endfor %} + {% endif %} + + {% if enums is not null %} +

+ Перечисления +

+ {% for enum in enums %} +
+ {%- include 'blocks/enum-body.html.twig' with { + structure: enum, + objectsLinks: objectsLinks + } %} +
+ {% endfor %} + {% endif %} +
+
+ +{%- include 'blocks/scripts.html.twig' with { jsFolderPath: jsFolderPath } %} + + + \ No newline at end of file diff --git a/Web-documentation/blocks/class-body.html.twig b/Web-documentation/blocks/class-body.html.twig new file mode 100644 index 0000000..4089328 --- /dev/null +++ b/Web-documentation/blocks/class-body.html.twig @@ -0,0 +1,22 @@ +

Описание

+

{{ structure.type.baseTypeName }} - {{ structure.description }}

+ +{%- include 'comment.html.twig' with { comment: structure.comment } %} + +

Структура данных

+
+
+
+
Название поля
+
Тип поля
+
Описание
+
Обязательность
+
+ {% for field in structure.allFieldsOrdered -%} + {%- include 'field-row.html.twig' with { + field: field, + objectsLinks: objectsLinks + } %} + {%- endfor %} +
+
\ No newline at end of file diff --git a/Web-documentation/blocks/comment.html.twig b/Web-documentation/blocks/comment.html.twig new file mode 100644 index 0000000..0f0e5b3 --- /dev/null +++ b/Web-documentation/blocks/comment.html.twig @@ -0,0 +1,4 @@ +{%- if comment is not null -%} +

Комментарий

+

{{ comment }}

+{%- endif -%} \ No newline at end of file diff --git a/Web-documentation/blocks/enum-body.html.twig b/Web-documentation/blocks/enum-body.html.twig new file mode 100644 index 0000000..6c7997a --- /dev/null +++ b/Web-documentation/blocks/enum-body.html.twig @@ -0,0 +1,20 @@ +

Описание

+

{{ structure.name }} - {{ structure.description }}

+ +{%- include 'comment.html.twig' with { comment: structure.comment } %} + +

Возможные значения

+
+
+
+
Значения
+
Описание
+
+ {% for value in structure.values %} +
+
{{ value.value }}
+
{{ value.description }}
+
+ {% endfor %} +
+
\ No newline at end of file diff --git a/Web-documentation/blocks/field-row.html.twig b/Web-documentation/blocks/field-row.html.twig index 35be319..e498357 100644 --- a/Web-documentation/blocks/field-row.html.twig +++ b/Web-documentation/blocks/field-row.html.twig @@ -3,9 +3,16 @@ {%- import '../utils.twig' as utils -%} {%- if valueType.baseTypeName == "Map" -%} - Map<{{- self.formatValueType(valueType.keysType, false, objectsLinks) -}}, {{- self.formatValueType(valueType.valuesType, false, objectsLinks) -}}> + {%- set keysType = self.formatValueType(valueType.keysType, false, objectsLinks) -%} + {%- set valuesType = self.formatValueType(valueType.valuesType, false, objectsLinks) -%} + {%- set mapType = concat("Map<", keysType, ", ", valuesType, ">") -%} + + {{- utils.formatNullable(mapType, nullable) -}} {%- elseif valueType.baseTypeName == "Array" -%} - {{- self.formatValueType(valueType.itemsType, false, objectsLinks) -}}[] + {%- set itemsType = self.formatValueType(valueType.itemsType, false, objectsLinks) -%} + {%- set arrayType = concat(itemsType, "[]") -%} + + {{- utils.formatNullable(arrayType, nullable) -}} {%- else -%} {%- set link = null -%} diff --git a/Web-documentation/blocks/header.html.twig b/Web-documentation/blocks/header.html.twig index f72818c..a317891 100644 --- a/Web-documentation/blocks/header.html.twig +++ b/Web-documentation/blocks/header.html.twig @@ -1,7 +1,7 @@
- +
diff --git a/Web-documentation/blocks/main-menu.html.twig b/Web-documentation/blocks/main-menu.html.twig index 140cd3d..73ac049 100644 --- a/Web-documentation/blocks/main-menu.html.twig +++ b/Web-documentation/blocks/main-menu.html.twig @@ -1,8 +1,35 @@ -
  • Общие принципы построения API
  • -
  • Методы
  • -
  • PUSH-нотификации
  • -
  • Структуры данных
  • -
  • Версионирование API
  • -
  • Список возможных ошибок
  • + + {%- if mainMenu.indexMenuItem is not null %} +
  • Общие принципы построения API
  • + {% endif %} + + {%- if mainMenu.methodsMenuItem is not null %} +
  • Методы
  • + {% endif %} + + {%- if mainMenu.notificationsMenuItem is not null %} +
  • PUSH-нотификации
  • + {% endif %} + + {%- if mainMenu.structuresMenuItem is not null %} +
  • Структуры данных
  • + {% endif %} + + {%- if mainMenu.versioningMenuItem is not null %} +
  • Версионирование API
  • + {% endif %} + + {%- if mainMenu.errorsMenuItem is not null %} +
  • Список возможных ошибок
  • + {% endif %} + + {%- if mainMenu.tableOfContents is not null %} +
  • Оглавление
  • + {% endif %} + + {%- if mainMenu.allContents is not null %} +
  • Версия для печати
  • + {% endif %} +
    \ No newline at end of file diff --git a/Web-documentation/blocks/method-body.html.twig b/Web-documentation/blocks/method-body.html.twig new file mode 100644 index 0000000..7c0268d --- /dev/null +++ b/Web-documentation/blocks/method-body.html.twig @@ -0,0 +1,96 @@ +

    Метод

    +

    POST {{ method.url }}

    + +

    Описание

    +

    {{ method.description }}

    + +{%- include 'comment.html.twig' with { comment: method.comment } %} + +

    Параметры

    +{% if method.requestFields is not empty %} +
    +
    +
    +
    Название параметра
    +
    Тип параметра
    +
    Описание
    +
    Обязательность
    +
    + {% for field in method.requestFields -%} + {%- include 'field-row.html.twig' with { + field: field, + objectsLinks: objectsLinks + } %} + {%- endfor %} +
    + {% if default(showSandbox, true) %} + +
    +
    + {% for field in method.requestFields -%} + + {% endfor %} + + +
    +
    +
    + {% endif %} +
    +{% else %} +

    Параметры отсутствуют

    +{% endif %} + +

    Возможные ошибки

    +{% for value in method.errorsEnumeration.values -%} + {%- if value.value in method.errorsEnumeration.allowedValues %} +

    #Код {{ value.value }} — {{ value.description }}

    + {%- endif -%} +{%- endfor %} + +

    Результат

    +

    Объект следующей структуры:

    + +
    +
    +
    +
    Название поля
    +
    Тип поля
    +
    Описание
    +
    Обязательность
    +
    + {% for field in method.responseFields -%} + {%- include 'field-row.html.twig' with { + field: field, + objectsLinks: objectsLinks + } %} + {%- endfor %} +
    +
    \ No newline at end of file diff --git a/Web-documentation/blocks/sandbox-optional-nullable.html.twig b/Web-documentation/blocks/sandbox-optional-nullable.html.twig new file mode 100644 index 0000000..a6bae62 --- /dev/null +++ b/Web-documentation/blocks/sandbox-optional-nullable.html.twig @@ -0,0 +1,6 @@ +{%- if field.optional -%} +
    ×
    +{%- endif -%} +{% if field.nullable -%} +
    NULL
    +{%- endif -%} \ No newline at end of file diff --git a/Web-documentation/blocks/scripts.html.twig b/Web-documentation/blocks/scripts.html.twig index 737f78d..b0a8a94 100644 --- a/Web-documentation/blocks/scripts.html.twig +++ b/Web-documentation/blocks/scripts.html.twig @@ -1,2 +1,4 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/Web-documentation/blocks/table-of-contents-body.html.twig b/Web-documentation/blocks/table-of-contents-body.html.twig new file mode 100644 index 0000000..6e13ee3 --- /dev/null +++ b/Web-documentation/blocks/table-of-contents-body.html.twig @@ -0,0 +1,32 @@ +{%- if methods is not null %} +

    + Методы +

    + {% for methodsGroup in methods.items %} +

    + {{ methodsGroup.title }} +

    + {% for method in methodsGroup.items -%} +
  • {{ method.title }}
  • + {% endfor -%} + {% endfor %} + +{%- endif %} + +{%- if classes is not null %} +

    + Классы +

    + {% for class in classes.items -%} +
  • {{ class.title }}
  • + {% endfor %} +{% endif %} + +{%- if enums is not null %} +

    + Перечисления +

    + {% for enum in enums.items -%} +
  • {{ enum.title }}
  • + {% endfor %} +{%- endif %} \ No newline at end of file diff --git a/Web-documentation/css/fonts.css b/Web-documentation/css/fonts.css index 01a401b..7b36e3b 100644 --- a/Web-documentation/css/fonts.css +++ b/Web-documentation/css/fonts.css @@ -1,19 +1,19 @@ @font-face { - font-family: SanFrancisco; + font-family: Roboto; font-weight: 400; - src: url(../fonts/SanFranciscoDisplay-Regular.otf); + src: url(../fonts/Roboto-Regular.ttf); } @font-face { - font-family: SanFrancisco; + font-family: Roboto; font-weight: 500; - src: url(../fonts/SanFranciscoDisplay-Medium.otf); + src: url(../fonts/Roboto-Medium.ttf); } @font-face { - font-family: SanFrancisco; + font-family: Roboto; font-weight: 600; - src: url(../fonts/SanFranciscoDisplay-Semibold.otf); + src: url(../fonts/Roboto-Bold.ttf); } diff --git a/Web-documentation/css/main.css b/Web-documentation/css/main.css old mode 100644 new mode 100755 index 0981259..029ad0b --- a/Web-documentation/css/main.css +++ b/Web-documentation/css/main.css @@ -1,6 +1,9 @@ -*,:after,:before { +*, +:after, +:before { box-sizing: border-box } + html { font-size: 10px; } @@ -14,96 +17,122 @@ body { font-size: 0; line-height: 0; min-width: 128rem; - font-family: 'SanFrancisco', sans-serif; - } - .aside { - display: inline-block; - vertical-align: top; - font-size: 14px; - } - .header { - height: 7rem; - font-size: 14px; - } - .content { - min-height: calc(100vh - 7rem); - font-size: 14px; - line-height: 1rem; - } - .aside-left { - width: 38.85rem; - } - .aside-left .header { - background-color: #333c48; - border-right: 1px solid #323b46; - border-bottom: 1px solid #2b333e; - } - .logo img { - height: 3.6em; - margin: .7em 0 0 2em; - } - .search-block { - float: right; - margin: 1.85rem 1.28rem 0 0; - font-size: 1.28rem; - padding: 0 1.07rem; - border-radius: 1.71rem; - border: 1px solid #E4E6EA; - background: #F0F2F5; - color: #8D9299; - position: relative; - } - .search-block input[type="text"] { - width: 21.5rem; - height: 3.14rem; - border: 0; - background: transparent; - padding-left: 0.71rem; - color: #666; - font-size: 1.42rem; - } - .search-block input[type="text"]::-webkit-input-placeholder { - color: #777; - } - .search-block input[type="text"]:focus { - outline: none; - } + font-family: 'Roboto', sans-serif; + font-weight: 400; +} - .typeahead-container { - position: absolute; - width: 100%; - background-color: white; - padding: 1.3rem .6rem 1.3rem 1.3rem; - box-shadow: 0 0 4px 1px #ccc; - left: 0; - top: 3.8rem; - } - .typeahead-container--hide { - display: none; - } - .typeahead-container:hover { - display: block; - } +.main-page { + display: flex; +} +.gutter { + cursor: col-resize; + background-image: url("../images/vertical-split.png"); + background-color: transparent; + background-repeat: no-repeat; + background-position: 50%; +} - .typeahead-content { - width: 100%; - max-height: 22rem; - overflow: auto; +.aside { + display: inline-block; + vertical-align: top; + font-size: 14px; +} + +.header { + height: 7rem; + font-size: 14px; +} + +.content { + min-height: calc(100vh - 7rem); + font-size: 14px; + line-height: 1rem; +} + +.aside-left { + min-width: 300px; +} + +.aside-left .header { + background-color: #333c48; + border-right: 1px solid #323b46; + border-bottom: 1px solid #2b333e; +} + +.logo img { + height: 3.6em; + margin: .7em 0 0 2em; +} + +.search-block { + float: right; + margin: 1.85rem 1.28rem 0 0; + font-size: 1.28rem; + padding: 0 1.07rem; + border-radius: 1.71rem; + border: 1px solid #E4E6EA; + background: #F0F2F5; + color: #8D9299; + position: relative; +} + +.search-block input[type="text"] { + width: 21.5rem; + height: 3.14rem; + border: 0; + background: transparent; + padding-left: 0.71rem; + color: #666; + font-size: 1.42rem; +} + +.search-block input[type="text"]::-webkit-input-placeholder { + color: #777; +} + +.search-block input[type="text"]:focus { + outline: none; +} + +.typeahead-container { + position: absolute; + width: 100%; + background-color: white; + padding: 1.3rem .6rem 1.3rem 1.3rem; + box-shadow: 0 0 4px 1px #ccc; + left: 0; + top: 3.8rem; +} + +.typeahead-container--hide { + display: none; +} + +.typeahead-container:hover { + display: block; +} + +.typeahead-content { + width: 100%; + max-height: 22rem; + overflow: auto; +} + +.typeahead-container a:hover { + text-decoration: underline; +} + +.typeahead-container a { + display: block; + line-height: 2.8rem; + font-size: 1.5rem; + color: #0ca9e6; + text-decoration: blink; + width: 85%; + overflow: hidden; + text-overflow: ellipsis; +} - } - .typeahead-container a:hover { - text-decoration: underline; - } - .typeahead-container a { - display: block; - line-height: 2.8rem; - font-size: 1.5rem; - color: #0ca9e6; - text-decoration: blink; - width: 85%; - overflow: hidden; - text-overflow: ellipsis; - } .typeahead-content::-webkit-scrollbar { width: 0.6rem; } @@ -117,384 +146,466 @@ body { background-color: #d5d6d8; border-radius: 0.3rem; } - .aside-left .content { - background-color: #222933; - border-right: 1px solid #888d94; - } - menu li { - cursor: pointer; - } - .aside-left menu.main { - list-style: none; - margin: 0; - background: #2b333e; - padding: 0 0 2.2rem; - } - .aside-left menu.main li a { - display: block; - line-height: 4rem; - vertical-align: middle; - padding-left: 3.57rem; - padding-right: 1.42rem; - font-size: 1.57rem; - color: #BEBFC1; - text-decoration: none; - transition: line-height .3s ease-out 0s; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - .aside-left menu.main > li a:hover, - .aside-left menu.main > li.active a { - line-height: 5.28rem; - background-color: #222933; - padding-left: 3.14rem; - border-left: 6px solid #0ca9e6; - color: white - } - .aside-left menu.main > li:first-child + li.active { - margin-top: 0; - } - .aside-left menu.secondary { - list-style: none; - margin: 0; - padding: 3.57rem 0 0 6.28rem; - } - .aside-left menu.secondary li a { - line-height: 2.64rem; - vertical-align: middle; - font-size: 1.42rem; - color: #0ca9e6; - text-decoration: none; - transition: line-height .3s ease-out 0s; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - padding-right: 1.42rem; - display: inline-block; - width: 100%; - } - .aside-left menu.secondary > li:not(.active) > a:hover { - opacity: 0.8; - } - .aside-left menu.secondary > li.active > a { - color: white - } - .aside-left menu.secondary > li.active menu.child { - display: block; - } - .aside-left menu.child { - display: none; - list-style: none; - margin: 6px 0; - padding-left: 1.57rem; - border-left: 1px solid #fff; - width: 205px; - } - .aside-left menu.child > li > a{ - color: #7a7f85; - } - .aside-left menu.child > li.active > a{ - color: #fff; - } - .aside-right { - width: calc(100% - 38.85rem); - background-color: #f0f2f5; - } - .aside-right .header { - background-color: white; - box-shadow: 2px 1px 3px 0 #e9ebee; - width: calc(100% - 1.07rem); - border-bottom: 1px solid #e1e3e4; - } - .title { - font-size: 2rem; - line-height: 2.4rem; - padding-top: 2.2rem; - color: white; - padding-left: 4rem; - font-weight: bold; - } - .aside-right .content { - padding: 1rem; - } - .page-data { - width: 100%; - background-color: white; - min-height: calc(100vh - 9rem); - border: 1px solid #e9ebee; - padding: 5.28rem 14rem 5.28rem 6.14rem; - } - .page-data h2 { - font-size: 2rem; - margin: 4.28rem 0 1rem; - line-height: 2rem; - font-weight: 500; - } - .page-data h2:first-child { - margin-top: 0; - } - .page-data p { - font-size: 1.57rem; - color: #838890; - line-height: 2.2rem; - margin: 0.85rem 0 0; - } - .page-data a.info { - color: #0ca9e6; - cursor: pointer; - text-decoration: none; - } - .page-data a.info:hover { - text-decoration: underline; - } - .page-data p.sub-header { - font-weight: 500; - } - .table--small.table { - width: 50%; - min-width: 350px; - } - .table:first-child { margin-top: 0} - .table { - width: 100%; - border: 1px solid #c8cdd6; - border-radius: 0.71rem 0.71rem 0 0; - background-color: #e9edf3; - margin-top: 1.71rem; - } - .table > .part-table { - display: table; - width: 100%; - } - .table p { - font-size: 1.4rem; - margin: 0; - line-height: 2rem; - } - .row-header { - display: table-row; - } - .row-header > * { - display: table-cell; - font-size: 1.15rem; - text-transform: uppercase; - color: #838890; - padding: 1rem 1.42rem 1rem; - border-bottom: 1px solid #c8cdd6; - border-right: 1px solid #c8cdd6; - line-height: 1.8rem; - white-space: nowrap; - } - .row-header > *:last-child { - border-right: 0; - } - .row-body { - display: table-row; - background-color: white; - } - .row-body > * { - display: table-cell; - font-size: 1.4rem; - color: #838890; - line-height: 1.2em; - padding: 1rem; - border-bottom: 1px solid #c8cdd6; - border-right: 1px solid #c8cdd6; - } - .row-body:last-child > * { - border-bottom: 0; - } - .row-body > *:last-child { - border-right: 0; - } - .part-block { - display: block; - font-size: 1.57rem; - padding: 1.42rem 1.42rem 1.28rem; - background-color: white; - border-radius: 0 0 0.71rem 0.71rem; - border-top: 1px solid #c8cdd6; - } - .example-response-expanded .part-block { - border-radius: 0; - border-bottom: 1px solid #c8cdd6; - } +.aside-left .content { + background-color: #222933; +} - .part-example-response { - display: none; - padding: 1.42rem 1.42rem 1.28rem; - } - .example-response-expanded .part-example-response { - display: block; - } - .text-response { - padding: 1.42rem; - background-color: white; - border: 1px solid #c8cdd6; - margin: 0; - font-size: 1.2rem; - line-height: 1.57rem; - white-space: pre; - font-family: monospace; - min-height: 140px; - } - .example-response-expanded a.show-example-response:after { - transform: rotate(225deg); - top: 3px; - } - .example-response { - padding: 1.4rem; - background-color: #e9edf3; - border: 1px solid #c8cdd6; - margin-top: 10px; - } - .example-response > .text-response { - display: block; - } - .part-example-response > .inputs { - display: inline-block; - width: 14.15rem; - vertical-align: top; - margin-right: 1.42rem; - } - .part-example-response .inputs label { - display: block; - font-size: 1.28rem; - margin-top: 0.64rem; - line-height: 1.28rem; - } - .part-example-response .inputs label input { - width: 100%; - padding: 0.85rem 0.85rem 0.78rem; - margin-top: 0.35rem; - border: 1px solid #c8cdd6; - color: #838890; - height: 3.28rem; - } - .part-example-response .inputs label input::-ms-clear { - display: none; - } - .part-example-response .inputs label:first-child { - margin-top: 0.57rem; - } - .styled-select { - width: 100%; - margin-top: 0.35rem; - border: 1px solid #c8cdd6; - background: white; - overflow: hidden; - position: relative; - } - .styled-select:after { - content: ''; - display: block; - position: absolute; - top: 1.07rem; - right: 1.07rem; - border: 0.35rem solid #838890; - border-bottom-color: transparent; - border-right-color: transparent; - transform: rotate(225deg); - } - .styled-select select { - position: relative; - z-index: 2; +menu li { + cursor: pointer; +} - width: 100%; - height: 100%; - padding: 0.85rem; - border: 0; - color: #838890; - background: transparent; +.aside-left menu.main { + list-style: none; + margin: 0; + background: #2b333e; + padding: 0 0 2.2rem; +} - -ms-appearance: none; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none !important; - } - .styled-select select::-ms-expand { - display: none; - } +.aside-left menu.main li a { + display: block; + line-height: 4rem; + vertical-align: middle; + padding-left: 3.57rem; + padding-right: 1.42rem; + font-size: 1.57rem; + color: #BEBFC1; + text-decoration: none; + transition: color .25s, background .25s linear; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} - .styled-input { - position: relative; - } - .clear-btn { - position: absolute; - right: 0; - bottom: 0; - border: 1px solid #c9ccd3; - color: #c9ccd3; - background-color: #f7faff; - width: 3.14rem; - text-align: center; - height: 1.71rem; - font-size: 2.14rem; - line-height: 1.15rem; - } - .null-btn { - position: absolute; - right: 0; - bottom: 1.64rem; - border: 1px solid #c9ccd3; - color: #c9ccd3; - background-color: #f7faff; - width: 3.14rem; - text-align: center; - height: 1.64rem; - font-size: 1rem; - line-height: 1.57rem; - } - .clear-btn:hover, .null-btn:hover { - color: #999; - cursor: pointer; - } - .disabled { - pointer-events: none; - color: #bdc0c5; - } - .disabled input{ - pointer-events: all; - background-color: #f4f6f9; - } +.aside-left menu.main>li a:hover, +.aside-left menu.main>li.active a { + background-color: #222933; + padding-left: 3.14rem; + border-left: 0.43rem solid #0ca9e6; + color: white +} - .btn { - background-color: #0ca9e6; - border: 0; - color: white; - font-size: 1.42rem; - padding: 1.15rem; - width: 100%; - margin-top: 1.71rem; - font-weight: 500; - } - .part-example-response > .text-response { - display: inline-block; - width: calc(100% - 16rem); - vertical-align: top; - margin-top: 2.2rem; - overflow: auto; - } - span.text-digit { - color: #0060ff; - } - span.text-string { - color: #037400; - } - a.show-example-response { - color: #0275eb; - cursor: pointer; - } - a.show-example-response:after { - content: ''; - border: 0.42rem solid; - position: relative; - display: inline-block; - border-top-color: transparent; - border-left-color: transparent; - transform: rotate(45deg); - margin-left: 0.71em; - top: -.28em; - } \ No newline at end of file +.aside-left menu.main>li:first-child+li.active { + margin-top: 0; +} + +.aside-left menu.secondary { + list-style: none; + margin: 0; + padding: 3.57rem 0 3.57rem 6.28rem; +} + +.aside-left menu.secondary li a { + line-height: 2.64rem; + vertical-align: middle; + font-size: 1.42rem; + color: #0ca9e6; + text-decoration: none; + transition: line-height .3s ease-out 0s; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + padding-right: 1.42rem; + display: inline-block; + width: 100%; +} + +.aside-left menu.secondary>li:not(.active)>a:hover { + opacity: 0.8; +} + +.aside-left menu.secondary>li.active>a { + color: white +} + +.aside-left menu.secondary>li.active menu.child { + display: block; +} + +.aside-left menu.child { + display: none; + list-style: none; + margin: 6px 0; + padding: 0 3.75rem 0 1.57rem; + border-left: 1px solid #fff; + min-width: 205px; + width: auto; +} + +.aside-left menu.child>li>a { + color: #7a7f85; +} + +.aside-left menu.child>li.active>a { + color: #fff; +} + +.aside-right { + width: calc(100% - 38.85rem); + background-color: #f0f2f5; +} + +.aside-right .header { + background-color: white; + box-shadow: 2px 1px 3px 0 #e9ebee; + width: calc(100% - 1.07rem); + border-bottom: 1px solid #e1e3e4; +} + +.title { + font-size: 2rem; + line-height: 2.4rem; + padding-top: 2.2rem; + color: white; + padding-left: 4rem; + font-weight: 700; +} + +.aside-right .content { + padding: 1rem; +} + +.page-data { + width: 100%; + background-color: white; + min-height: calc(100vh - 9rem); + border: 1px solid #e9ebee; + padding: 5.28rem; +} + +.page-data h2 { + font-size: 2rem; + margin: 4.28rem 0 1rem; + line-height: 2rem; + font-weight: 500; +} + +.page-data h2:first-child { + margin-top: 0; +} + +.page-data p { + font-size: 1.57rem; + color: #838890; + line-height: 2.2rem; + margin: 0.85rem 0 0; +} + +.page-data p.sub-header { +} + +.page-data a { + color: #000000; + cursor: pointer; + text-decoration: none; +} + +.page-data a:hover { + text-decoration: underline; +} + +.page-data a.info, +.page-data li a { + color: #0ca9e6; +} + +.page-data h3 { + font-size: 1.75rem; + margin: 1.2rem 0; + line-height: 2rem; + font-weight: 500; +} + +.page-data li { + list-style: none; + font-size: 1.57rem; + color: #838890; + line-height: 2.2rem; + margin: 0.85rem 0 0; + padding-left: 1.5rem; +} + +.table--small.table { + width: 50%; + min-width: 350px; +} + +.table:first-child { + margin-top: 0 +} + +.table { + width: 100%; + border: 1px solid #c8cdd6; + border-radius: 0.71rem 0.71rem 0 0; + background-color: #e9edf3; + margin-top: 1.71rem; +} + +.table>.part-table { + display: table; + width: 100%; +} + +.table p { + font-size: 1.4rem; + margin: 0; + line-height: 2rem; +} + +.row-header { + display: table-row; +} + +.row-header>* { + display: table-cell; + font-size: 1.15rem; + text-transform: uppercase; + color: #838890; + padding: 1rem 1.42rem 1rem; + border-bottom: 1px solid #c8cdd6; + border-right: 1px solid #c8cdd6; + line-height: 1.8rem; + white-space: nowrap; +} + +.row-header>*:last-child { + border-right: 0; +} + +.row-body { + display: table-row; + background-color: white; +} + +.row-body>* { + display: table-cell; + font-size: 1.4rem; + color: #838890; + line-height: 1.2em; + padding: 1rem; + border-bottom: 1px solid #c8cdd6; + border-right: 1px solid #c8cdd6; +} + +.row-body:last-child>* { + border-bottom: 0; +} + +.row-body>*:last-child { + border-right: 0; +} + +.part-block { + display: block; + font-size: 1.57rem; + padding: 1.42rem 1.42rem 1.28rem; + background-color: white; + border-radius: 0 0 0.71rem 0.71rem; + border-top: 1px solid #c8cdd6; +} + +.example-response-expanded .part-block { + border-radius: 0; + border-bottom: 1px solid #c8cdd6; +} + +.part-example-response { + display: none; + padding: 1.42rem 1.42rem 1.28rem; +} + +.example-response-expanded .part-example-response { + display: block; +} + +.text-response { + padding: 1.42rem; + background-color: white; + border: 1px solid #c8cdd6; + margin: 0; + font-size: 1.2rem; + line-height: 1.57rem; + white-space: pre; + font-family: monospace; + min-height: 140px; +} + +.example-response-expanded a.show-example-response:after { + transform: rotate(225deg); + top: 3px; +} + +.example-response { + padding: 1.4rem; + background-color: #e9edf3; + border: 1px solid #c8cdd6; + margin-top: 10px; +} + +.example-response>.text-response { + display: block; +} + +.part-example-response>.inputs { + display: inline-block; + width: 14.15rem; + vertical-align: top; + margin-right: 1.42rem; +} + +.part-example-response .inputs label { + display: block; + font-size: 1.28rem; + margin-top: 0.64rem; + line-height: 1.28rem; +} + +.part-example-response .inputs label input { + width: 100%; + padding: 0.85rem 0.85rem 0.78rem; + margin-top: 0.35rem; + border: 1px solid #c8cdd6; + color: #838890; + height: 3.28rem; +} + +.part-example-response .inputs label input::-ms-clear { + display: none; +} + +.part-example-response .inputs label:first-child { + margin-top: 0.57rem; +} + +.styled-select { + width: 100%; + margin-top: 0.35rem; + border: 1px solid #c8cdd6; + background: white; + overflow: hidden; + position: relative; +} + +.styled-select:after { + content: ''; + display: block; + position: absolute; + top: 1.07rem; + right: 1.07rem; + border: 0.35rem solid #838890; + border-bottom-color: transparent; + border-right-color: transparent; + transform: rotate(225deg); +} + +.styled-select select { + position: relative; + z-index: 2; + width: 100%; + height: 100%; + padding: 0.85rem; + border: 0; + color: #838890; + background: transparent; + -ms-appearance: none; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none !important; +} + +.styled-select select::-ms-expand { + display: none; +} + +.styled-input { + position: relative; +} + +.clear-btn { + position: absolute; + right: 0; + bottom: 0; + border: 1px solid #c9ccd3; + color: #c9ccd3; + background-color: #f7faff; + width: 3.14rem; + text-align: center; + height: 1.71rem; + font-size: 2.14rem; + line-height: 1.15rem; +} + +.null-btn { + position: absolute; + right: 0; + bottom: 1.64rem; + border: 1px solid #c9ccd3; + color: #c9ccd3; + background-color: #f7faff; + width: 3.14rem; + text-align: center; + height: 1.64rem; + font-size: 1rem; + line-height: 1.57rem; +} + +.clear-btn:hover, +.null-btn:hover { + color: #999; + cursor: pointer; +} + +.disabled { + pointer-events: none; + color: #bdc0c5; +} + +.disabled input { + pointer-events: all; + background-color: #f4f6f9; +} + +.btn { + background-color: #0ca9e6; + border: 0; + color: white; + font-size: 1.42rem; + padding: 1.15rem; + width: 100%; + margin-top: 1.71rem; + font-weight: 500; +} + +.part-example-response>.text-response { + display: inline-block; + width: calc(100% - 16rem); + vertical-align: top; + margin-top: 2.2rem; + overflow: auto; +} + +span.text-digit { + color: #0060ff; +} + +span.text-string { + color: #037400; +} + +a.show-example-response { + color: #0275eb; + cursor: pointer; +} + +a.show-example-response:after { + content: ''; + border: 0.42rem solid; + position: relative; + display: inline-block; + border-top-color: transparent; + border-left-color: transparent; + transform: rotate(45deg); + margin-left: 0.71em; + top: -.28em; +} diff --git a/Web-documentation/fonts/Roboto-Bold.ttf b/Web-documentation/fonts/Roboto-Bold.ttf new file mode 100644 index 0000000..5fd9dd9 Binary files /dev/null and b/Web-documentation/fonts/Roboto-Bold.ttf differ diff --git a/Web-documentation/fonts/Roboto-Medium.ttf b/Web-documentation/fonts/Roboto-Medium.ttf new file mode 100644 index 0000000..98c4538 Binary files /dev/null and b/Web-documentation/fonts/Roboto-Medium.ttf differ diff --git a/Web-documentation/fonts/Roboto-Regular.ttf b/Web-documentation/fonts/Roboto-Regular.ttf new file mode 100644 index 0000000..c1c3700 Binary files /dev/null and b/Web-documentation/fonts/Roboto-Regular.ttf differ diff --git a/Web-documentation/fonts/SanFranciscoDisplay-Medium.otf b/Web-documentation/fonts/SanFranciscoDisplay-Medium.otf deleted file mode 100644 index 481172e..0000000 Binary files a/Web-documentation/fonts/SanFranciscoDisplay-Medium.otf and /dev/null differ diff --git a/Web-documentation/fonts/SanFranciscoDisplay-Regular.otf b/Web-documentation/fonts/SanFranciscoDisplay-Regular.otf deleted file mode 100644 index b95988b..0000000 Binary files a/Web-documentation/fonts/SanFranciscoDisplay-Regular.otf and /dev/null differ diff --git a/Web-documentation/fonts/SanFranciscoDisplay-Semibold.otf b/Web-documentation/fonts/SanFranciscoDisplay-Semibold.otf deleted file mode 100644 index 53203ff..0000000 Binary files a/Web-documentation/fonts/SanFranciscoDisplay-Semibold.otf and /dev/null differ diff --git a/Web-documentation/images/vertical-split.png b/Web-documentation/images/vertical-split.png new file mode 100755 index 0000000..0ac8fa1 Binary files /dev/null and b/Web-documentation/images/vertical-split.png differ diff --git a/Web-documentation/js/main.js b/Web-documentation/js/main.js index 5701972..52ed746 100644 --- a/Web-documentation/js/main.js +++ b/Web-documentation/js/main.js @@ -1,5 +1,50 @@ $(function () { $(document).ready(function () { + let sizes = [30, 70]; + + 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); @@ -67,39 +112,25 @@ $(function () { $(document).on('keyup', '.search-block input', function (e) { var $searchInput = $(this); - var methodsUrl = $searchInput.data('methodsPath'); var relativeUrl = $searchInput.data('relativeToRootPath'); var $typeaheadContainer = $searchInput.closest('.search-block').find('.typeahead-container'); var $typeaheadContent = $typeaheadContainer.find('.typeahead-content'); - $.ajax({ - type: 'POST', - contentType: 'application/json', - dataType: 'json', - url: methodsUrl + var itemsLink = ''; + searchItems + .filter(function (item) { + return item.name.toLowerCase().indexOf($searchInput.val().toLowerCase()) >= 0; }) - .done( - function (response) { - var itemsLink = ''; - response - .filter(function (item) { - return item.name.toLowerCase().indexOf($searchInput.val().toLowerCase()) >= 0; - }) - .forEach(function (item) { - itemsLink += '' + item.name + '' - }); - $typeaheadContent.html(itemsLink); + .forEach(function (item) { + itemsLink += '' + item.name + '' + }); + $typeaheadContent.html(itemsLink); - if (itemsLink != '') { - $typeaheadContainer.removeClass('typeahead-container--hide'); - } else { - $typeaheadContainer.addClass('typeahead-container--hide'); - } - }) - .fail( - function () { - alert('Ошибка запроса.'); - }); + if (itemsLink != '') { + $typeaheadContainer.removeClass('typeahead-container--hide'); + } else { + $typeaheadContainer.addClass('typeahead-container--hide'); + } }); diff --git a/Web-documentation/methods.html.twig b/Web-documentation/methods.html.twig index 4b601f4..b1cd5b6 100644 --- a/Web-documentation/methods.html.twig +++ b/Web-documentation/methods.html.twig @@ -10,11 +10,11 @@ {% 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 %} @@ -30,96 +30,10 @@
    -

    Метод

    -

    POST {{ url }}

    - -

    Параметры

    -
    -
    -
    -
    Название параметра
    -
    Тип параметра
    -
    Описание
    -
    Обязательность
    -
    - {% for field in requestFields -%} - {%- include 'blocks/field-row.html.twig' with { - field: field, - objectsLinks: objectsLinks - } %} - {%- endfor %} -
    - -
    -
    - {% for field in requestFields -%} - - {% endfor %} - - -
    -
    -
    -
    - -

    Возможные ошибки

    - {% for value in errorsEnumeration.values -%} - {%- if value.value in errorsEnumeration.allowedValues %} -

    #Код {{ value.value }} — {{ value.description }}

    - {%- endif -%} - {%- endfor %} - -

    Результат

    -

    Объект следующей структуры:

    - -
    -
    -
    -
    Название поля
    -
    Тип поля
    -
    Описание
    -
    Обязательность
    -
    - {% for field in responseFields -%} - {%- include 'blocks/field-row.html.twig' with { - field: field, - objectsLinks: objectsLinks - } %} - {%- endfor %} -
    -
    - -

    Комментарий

    -

    {{ description }}

    + {%- include 'blocks/method-body.html.twig' with { + method: method, + objectsLinks: objectsLinks + } %}
    diff --git a/Web-documentation/searchItems.js.twig b/Web-documentation/searchItems.js.twig new file mode 100644 index 0000000..a5a4eb1 --- /dev/null +++ b/Web-documentation/searchItems.js.twig @@ -0,0 +1 @@ +const searchItems = {{ searchItems }}; \ No newline at end of file diff --git a/Web-documentation/structure_enumeration.html.twig b/Web-documentation/structure_enumeration.html.twig index 57daca3..2fa217c 100644 --- a/Web-documentation/structure_enumeration.html.twig +++ b/Web-documentation/structure_enumeration.html.twig @@ -6,7 +6,7 @@
    {{ pageTitle }}
    - {%- include 'blocks/main-menu.html.twig' %} + {%- include 'blocks/main-menu.html.twig' with { mainMenu: mainMenu } %} {% include 'blocks/secondary-menu.html.twig' with { @@ -24,28 +24,14 @@
    - {%- include 'blocks/header.html.twig' with { imagesFolderPath: imagesFolderPath } %} + {%- include 'blocks/header.html.twig' with { + imagesFolderPath: imagesFolderPath, + relativeToRootPath: relativeToRootPath + } %}
    -

    Описание

    -

    {{ description }}

    - -

    Возможные значения

    -
    -
    -
    -
    Значения
    -
    Описание
    -
    - {% for value in values %} -
    -
    {{ value.value }}
    -
    {{ value.description }}
    -
    - {% endfor %} -
    -
    + {%- include 'blocks/enum-body.html.twig' with { structure: structure } %}
    diff --git a/Web-documentation/structure_objects.html.twig b/Web-documentation/structure_objects.html.twig index b20911d..eb912b5 100644 --- a/Web-documentation/structure_objects.html.twig +++ b/Web-documentation/structure_objects.html.twig @@ -11,7 +11,8 @@ {% include 'blocks/secondary-menu.html.twig' with { menu: enumsMenu, - menuTitle: "Перечисления" + menuTitle: "Перечисления", + activeItemTypeName: name } %} {% include 'blocks/secondary-menu.html.twig' with { menu: classesMenu, @@ -25,32 +26,15 @@
    {%- include 'blocks/header.html.twig' with { imagesFolderPath: imagesFolderPath, - methodsPath: methodsPath, relativeToRootPath: relativeToRootPath } %}
    -

    Описание

    -

    {{ description }}

    - -

    Структура данных

    -
    -
    -
    -
    Название поля
    -
    Тип поля
    -
    Описание
    -
    Обязательность
    -
    - {% for field in allFieldsOrdered -%} - {%- include 'blocks/field-row.html.twig' with { - field: field, - objectsLinks: objectsLinks - } %} - {%- endfor %} -
    -
    + {%- include 'blocks/class-body.html.twig' with { + structure: structure, + objectsLinks: objectsLinks + } %}
    diff --git a/Web-documentation/table_of_contents.html.twig b/Web-documentation/table_of_contents.html.twig new file mode 100644 index 0000000..f39053f --- /dev/null +++ b/Web-documentation/table_of_contents.html.twig @@ -0,0 +1,33 @@ +{%- include 'blocks/head.html.twig' with { title: pageTitle, cssFolderPath: cssFolderPath } %} + + +
    +
    +
    {{ pageTitle }}
    +
    +
    + {%- include 'blocks/main-menu.html.twig' with { mainMenu: mainMenu } %} +
    +
    + +
    + {%- include 'blocks/header.html.twig' with { + imagesFolderPath: imagesFolderPath, + relativeToRootPath: relativeToRootPath + } %} + +
    +
    + {%- include 'blocks/table-of-contents-body.html.twig' with { + methods: tableOfContents.methods, + classes: tableOfContents.classes, + enums: tableOfContents.enums + } %} +
    +
    +
    + +{%- include 'blocks/scripts.html.twig' with { jsFolderPath: jsFolderPath } %} + + + \ No newline at end of file diff --git a/Web-documentation/versioning.html.twig b/Web-documentation/versioning.html.twig index e8bd55e..11d93be 100644 --- a/Web-documentation/versioning.html.twig +++ b/Web-documentation/versioning.html.twig @@ -1,5 +1,8 @@ {%- include 'blocks/head.html.twig' with { title: pageTitle, cssFolderPath: cssFolderPath } %} +{# FIXME. Discuss: https://github.com/TouchInstinct/api-generator/issues/41 #} +{%- set outOfDateError = first(errorType.values) -%} +
    @@ -23,7 +26,7 @@

    Необходимо иметь возможность поддержки нескольких версий API (для одновременной работы нескольких версий приложения). Также необходимо предусмотреть принудительное обновление какой-либо из версий.

    Версии API будут размещаться на url-адресах вида <base_url>/v<version_number>/, где <version_number> - версия API.

    При вызове любого метода в случае, если вызываемая версия API требует обновления приложения, сервер должен вернуть ошибку:
    - "Версия приложения устарела. Необходимо обновить приложение. Код 1."

    + "{{ outOfDateError.description }} Код {{ outOfDateError.value }}."

    При этом приложение должно показать пользователю диалог с предложением установить новую версию из маркета, а остальные функции должны стать недоступными.

    @@ -33,24 +36,9 @@
    { - "response": { - "count": 2428, - "items": - [ - { - "id": 54832560, - "first_name": "Anyutka", - "last_name": "Kiseleva", - "photo_50": "http://cs417830.v...4a7/Y-zZa02zvmQ.jpg" - }, - { - "id": 221194575, - "first_name": "Lera", - "last_name": "Chistova", - "photo_50": "http://cs322328.v...0fb/qi2nofkqneI.jpg" - } - ] - } + "result": null + "error_code": {{ outOfDateError.value }}, + "error_message": "{{ outOfDateError.description }}" }