Skip to content

Commit

Permalink
EZP-29117: Improve Content Type view design
Browse files Browse the repository at this point in the history
  • Loading branch information
mikadamczyk committed Apr 19, 2018
1 parent 42841af commit 537afa2
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 59 deletions.
10 changes: 9 additions & 1 deletion src/bundle/Resources/public/scss/_tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
color: $ez-color-base-dark;
}

.ez-info-view, .ez-link-manager-view {
.ez-info-view, .ez-link-manager-view, .ez-content-type-view {
.ez-table {
&--list {
background: none;
Expand Down Expand Up @@ -117,6 +117,14 @@
}
}

.ez-content-type-view {
.ez-table-field-definitions {
thead th {
width: 33.33%;
}
}
}

.ez-checkbox-cell {
width: 5%;
}
Expand Down
14 changes: 12 additions & 2 deletions src/bundle/Resources/translations/content_type.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
<target state="new">Container</target>
<note>key: content_type.container</note>
</trans-unit>
<trans-unit id="3066b4a1b2277f4e299d9c91ad3134d725467b39" resname="content_type.content_type">
<source>Content Type</source>
<target state="new">Content Type</target>
<note>key: content_type.content_type</note>
</trans-unit>
<trans-unit id="693f9ade0c2bb6a7c19b6f9b818d96aa23f1e013" resname="content_type.default_availability">
<source>Default content availability</source>
<target state="new">Default content availability</target>
Expand All @@ -47,8 +52,8 @@
<note>key: content_type.default_availability.value</note>
</trans-unit>
<trans-unit id="5ebf6515da27060877064931a5ac1d5a8540e28d" resname="content_type.default_children_sorting">
<source>Default property for sorting children</source>
<target state="new">Default property for sorting children</target>
<source>Default field for sorting children</source>
<target state="new">Default field for sorting children</target>
<note>key: content_type.default_children_sorting</note>
</trans-unit>
<trans-unit id="cefc13177fd81d4c9df6f8e86eb5278fccbe5a5a" resname="content_type.default_sort">
Expand All @@ -71,6 +76,11 @@
<target state="new">Do you want to delete selected field definitions?</target>
<note>key: content_type.field_definitions.modal.message</note>
</trans-unit>
<trans-unit id="8bf6d91a6b0731a38103e04e03f3f9e8bf4459a1" resname="content_type.global_properties">
<source>Global properties</source>
<target state="new">Global properties</target>
<note>key: content_type.global_properties</note>
</trans-unit>
<trans-unit id="238db0c5dee8ec13199b073f7cc78728f53ffa36" resname="content_type.identifier">
<source>Identifier</source>
<target state="new">Identifier</target>
Expand Down
122 changes: 66 additions & 56 deletions src/bundle/Resources/views/admin/content_type/view.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,100 +25,110 @@
{% set language_code = content_type.mainLanguageCode %}

{% block content %}
<div class="container mt-4 px-4">
<section class="ez-fieldgroup">
<h2 class="ez-fieldgroup-name">{{ "content_type.global_properties"|trans|desc("Global properties") }}</h2>
</section>
</div>
<section class="container mt-4 px-5">
<header class="ez-table-header">
<div class="ez-table-header__headline">Global properties</div>
<div>
{{ macros.content_type_edit(content_type, content_type_group, 'btn btn-primary') }}
</div>
<div class="ez-table-header__headline">{{ "content_type.content_type"|trans|desc("Content Type") }}</div>
</header>

<table class="table">
<colgroup>
<col width="30%"/>
<col />
</colgroup>

<tbody>
<table class="table mb-3">
<thead>
<tr>
<th>{{ "content_type.name"|trans|desc("Name") }}</th>
<td>{{ content_type.name }}</td>
</tr>
<tr>
<th>{{ "content_type.identifier"|trans|desc("Identifier") }}</th>
<td>{{ content_type.identifier }}</td>
</tr>
<tr>
<th>{{ "content_type.description"|trans|desc("Description") }}</th>
<td>{{ content_type.descriptions[language_code]|default('') }}</td>
<th></th>
</tr>
</thead>

<tbody>
<tr>
<td>{{ content_type.name }}</td>
<td>{{ content_type.identifier }}</td>
<td>{{ content_type.descriptions[language_code]|default('') }}</td>
<td class="text-right">
{{ macros.content_type_edit(content_type, content_type_group, 'btn btn-icon mx-3') }}
</td>
</tr>
</tbody>
</table>

<table class="table ez-table--list table">
<tbody>
<tr>
<th>{{ "content_type.name_schema"|trans|desc("Content name pattern") }}</th>
<td>{{ "content_type.name_schema"|trans|desc("Content name pattern") }}</td>
<td>{{ content_type.nameSchema }}</td>
</tr>
<tr>
<th>{{ "content_type.url_alias_schema"|trans|desc("URL alias name pattern") }}</th>
<td>{{ "content_type.url_alias_schema"|trans|desc("URL alias name pattern") }}</td>
<td>{{ content_type.urlAliasSchema }}</td>
</tr>
<tr>
<th>{{ "content_type.container"|trans|desc("Container") }}</th>
<td>{{ "content_type.container"|trans|desc("Container") }}</td>
<td>{{ 'yes_no'|transchoice(content_type.isContainer)|desc("{0}No|{1}Yes") }}</td>
</tr>
<tr>
<th>{{ "content_type.default_children_sorting"|trans|desc("Default property for sorting children") }}</th>
<td>{{ "content_type.default_children_sorting"|trans|desc("Default field for sorting children") }}</td>
<td>
{{ ("content_type.sort_field." ~ content_type.defaultSortField)|trans(domain="ezrepoforms_content_type") }} / {{ ("content_type.sort_order." ~ content_type.defaultSortOrder)|trans(domain="ezrepoforms_content_type") }}
</td>
</tr>
<tr>
<th>{{ "content_type.default_sort"|trans|desc("Default sort order") }}</th>
<td>{{ content_type.defaultSortOrder }}</td>
<td>{{ "content_type.default_sort"|trans|desc("Default sort order") }}</td>
<td>
{{ ("content_type.sort_order." ~ content_type.defaultSortOrder)|trans(domain="ezrepoforms_content_type") }}
</td>
</tr>
<tr>
<th>
<td>
{{ "content_type.default_availability"|trans|desc('Default content availability') }}
<p class="text-secondary small">
{{ "content_type.default_availability.help"|trans|desc("Default availability in primary language, if translation is absent") }}
</p>
</th>
</td>
<td>{{ 'content_type.default_availability.value'|transchoice(content_type.defaultAlwaysAvailable)|desc("{0} Not available|{1} Available") }}</td>
</tr>
</tbody>
</table>
</section>

<section class="container mt-4 px-5">
<header class="ez-table-header mb-5">
<div class="ez-table-header__headline">Content field definitions</div>
</header>

{% for group, field_definitions in field_definitions_by_group %}
<header class="ez-table-header ez-table-header">
<div class="ez-table-header__headline">{{ group|capitalize }}</div>
</header>
<div class="container mt-4 px-4">
<section class="ez-fieldgroup">
<h2 class="ez-fieldgroup-name">{{ "content_type.content_field_definitions"|trans|desc("Content field definitions") }}</h2>
</section>
</div>
<section class="container mt-4 px-5">
{% for group, field_definitions in field_definitions_by_group %}
<header class="ez-table-header ez-table-header">
<div class="ez-table-header__headline">{{ group|capitalize }}</div>
</header>

<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Identifier</th>
<th>Type</th>
</tr>
</thead>
<table class="table ez-table-field-definitions">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Identifier</th>
<th scope="col">Type</th>
</tr>
</thead>

<tbody>
{% for field_definition in field_definitions %}
<tr>
<th>{{ field_definition.name }}</th>
<td>{{ field_definition.identifier }}</td>
<td>{{ field_definition.fieldTypeIdentifier }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
</section>
<tbody>
{% for field_definition in field_definitions %}
<tr>
<th scope="row">{{ field_definition.name }}</th>
<td>{{ field_definition.identifier }}</td>
<td>{{ field_definition.fieldTypeIdentifier }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
</section>

<br />
<br />

{% endblock %}

0 comments on commit 537afa2

Please sign in to comment.