-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move templates from Utils lib to make them overridable.
- Loading branch information
Igor Nikolaev
committed
Jul 28, 2021
1 parent
91a164e
commit ccba9dc
Showing
10 changed files
with
240 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{% macro block(view, show_title = true) %} | ||
<div class="details-list__property"> | ||
|
||
{% if show_title and view.hasTitle %} | ||
<span class="details-list__property-name" | ||
style="font-family: Arial, sans-serif; font-size: 15px; line-height: 23px; color: #7e7e7e;"> | ||
{{ view.title }} | ||
</span> | ||
{% endif %} | ||
|
||
<span class="details-list__property-value" | ||
style="font-family: Arial, sans-serif; font-size: 15px; line-height: 23px; color: #333333;"> | ||
|
||
{% if view.empty %} | ||
— | ||
{% else %} | ||
|
||
{% if view.hasChildren %} | ||
|
||
{% if view.associative %} | ||
<ul> | ||
|
||
{% for child in view.children %} | ||
<li>{{ _self.block(child) }}</li> | ||
{% endfor %} | ||
|
||
</ul> | ||
{% else %} | ||
<ol> | ||
|
||
{% for child in view.children %} | ||
<li>{{ _self.block(child) }}</li> | ||
{% endfor %} | ||
|
||
</ol> | ||
{% endif %} | ||
|
||
{% endif %} | ||
|
||
{% if view.hasValue %} | ||
|
||
{% if view.hasUrl %} | ||
<a href="{{ view.url }}" | ||
style="font-family: Arial, sans-serif; font-size: 15px; line-height: 23px; color: #333333;"> | ||
{{ view.value }} | ||
</a> | ||
{% else %} | ||
{{ view.value|raw }} | ||
{% endif %} | ||
|
||
{% endif %} | ||
|
||
{% endif %} | ||
|
||
</span> | ||
</div> | ||
{% endmacro %} | ||
|
||
{% if view %} | ||
|
||
{{ _self.block(view, false) }} | ||
|
||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{% macro row(view, show_title = true) %} | ||
<tr> | ||
|
||
{% if show_title and view.hasTitle %} | ||
<th>{{ view.title }}</th> | ||
{% endif %} | ||
|
||
<td> | ||
|
||
{% if view.empty %} | ||
— | ||
{% else %} | ||
|
||
{% if view.hasChildren %} | ||
<table> | ||
|
||
{% for child in view.children %} | ||
|
||
{{ _self.row(child) }} | ||
|
||
{% endfor %} | ||
|
||
</table> | ||
{% endif %} | ||
|
||
{% if view.hasValue %} | ||
|
||
{% if view.hasUrl %} | ||
<a href="{{ view.url }}" | ||
style="font-family: Arial, sans-serif; font-size: 15px; line-height: 23px; color: #333333;"> | ||
{{ view.value }} | ||
</a> | ||
{% else %} | ||
{{ view.value|raw }} | ||
{% endif %} | ||
|
||
{% endif %} | ||
|
||
{% endif %} | ||
|
||
</td> | ||
<tr> | ||
{% endmacro %} | ||
|
||
{% if view %} | ||
<table> | ||
|
||
{% if view.hasChildren %} | ||
|
||
{% for child in view.children %} | ||
|
||
{{ _self.row(child) }} | ||
|
||
{% endfor %} | ||
|
||
{% else %} | ||
|
||
{{ _self.row(view, false) }} | ||
|
||
{% endif %} | ||
|
||
</table> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{%- macro text(view, level = 0) -%} | ||
|
||
{%- if level > 0 and view.hasTitle -%} | ||
{{- view.title ~ ': ' -}} | ||
{%- endif -%} | ||
|
||
{%- if view.empty -%} | ||
- | ||
{%- else -%} | ||
|
||
{%- if view.hasChildren -%} | ||
|
||
{%- for child in view.children %} | ||
|
||
{% if level > 0 %}{% for i in 1..level %}{{ ' ' }}{% endfor %}{% endif %}{{ _self.text(child, level + 1) -}} | ||
|
||
{%- endfor -%} | ||
|
||
{%- endif -%} | ||
|
||
{%- if view.hasValue -%} | ||
{{- view.value|striptags -}} | ||
{%- endif -%} | ||
|
||
{%- endif -%} | ||
|
||
{%- endmacro -%} | ||
|
||
{%- if view -%} | ||
|
||
{{- _self.text(view) -}} | ||
|
||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{%- block darvin_utils_anti_spam_row -%} | ||
{{- form_widget(form) -}} | ||
{%- endblock darvin_utils_anti_spam_row -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% macro div_data(data, name, trans_domain = 'messages') %}{{ utils_data_render('block', data, name, trans_domain) }}{% endmacro %} | ||
|
||
{% macro plain_data(data, name, trans_domain = 'messages') %}{{ utils_data_render('text', data, name, trans_domain) }}{% endmacro %} | ||
|
||
{% macro table_data(data, name, trans_domain = 'messages') %}{{ utils_data_render('table', data, name, trans_domain) }}{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* @copyright Copyright (c) {{ 'now'|date('Y') }}, Darvin Studio | ||
* @link https://www.darvin-studio.ru | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace App\Entity\{{ package_namespace }}{% if entity_namespace %}\{{ entity_namespace }}{% endif %}; | ||
use {{ fqcn }}; | ||
use Doctrine\ORM\Mapping as ORM; | ||
/** | ||
* {{ class|humanize }} | ||
* | ||
* @ORM\Entity{% if has_repository %}(repositoryClass="App\Repository\{{ package_namespace }}{% if entity_namespace %}\{{ entity_namespace }}{% endif %}\{{ class }}Repository"){% endif %} | ||
*/ | ||
class App{{ class }} extends {{ class }} | ||
{ | ||
{% if translatable %} | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public static function getTranslatableEntityClass(): string | ||
{ | ||
return App{{ translatable }}::class; | ||
} | ||
{% endif %} | ||
{% if translation %} | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public static function getTranslationEntityClass(): string | ||
{ | ||
return App{{ translation }}::class; | ||
} | ||
{% endif %} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* @copyright Copyright (c) {{ 'now'|date('Y') }}, Darvin Studio | ||
* @link https://www.darvin-studio.ru | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace App\Repository\{{ package_namespace }}{% if entity_namespace %}\{{ entity_namespace }}{% endif %}; | ||
use {{ repository }} as Base{{ class }}Repository; | ||
/** | ||
* {{ class|humanize }} entity repository | ||
*/ | ||
class {{ class }}Repository extends Base{{ class }}Repository | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% if price > 0 or options.allow_empty %} | ||
{{ ('price.value.' ~ options.format)|trans({'%price%': price|number_format(0, null, options.thousands_separator), '%count%': price|number_format(0, '', '')})|raw }} | ||
{% else %} | ||
{{ ('price.empty.' ~ options.empty_format)|trans|raw }} | ||
{% endif %} |