update default template
This commit is contained in:
parent
e50d2668f9
commit
d7659735cb
|
@ -1,5 +1 @@
|
||||||
$theme-colors: (
|
|
||||||
"primary": #1ab5dc,
|
|
||||||
"primary-light": lighten(#3183aa, 40%),
|
|
||||||
"dark-blue": #1e2430,
|
|
||||||
) !default;
|
|
||||||
|
|
0
assets/css/app.scss
Normal file
0
assets/css/app.scss
Normal file
1
assets/js/app.js
Normal file
1
assets/js/app.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
import '../css/app.scss'
|
|
@ -1,19 +1,62 @@
|
||||||
|
{% apply spaceless %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="{{ _locale }}">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="utf-8">
|
||||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
{# Run `composer require symfony/webpack-encore-bundle`
|
|
||||||
and uncomment the following Encore helpers to start using Symfony UX #}
|
|
||||||
{% block stylesheets %}
|
|
||||||
{#{{ encore_entry_link_tags('app') }}#}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block javascripts %}
|
<link rel="icon" type="image/x-icon" href="{{ asset('build/images/logo.png') }}" />
|
||||||
{#{{ encore_entry_script_tags('app') }}#}
|
|
||||||
{% endblock %}
|
{%- block opengraph -%}
|
||||||
|
<meta property="og:title" content="{{ _page.ogTitle }}" />
|
||||||
|
<meta property="og:description" content="{{ _page.ogDescription }}" />
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
<meta property="og:url" content="{{ app.request.uri }}" />
|
||||||
|
|
||||||
|
{%- if _page.ogImage -%}
|
||||||
|
<meta property="og:image" content="{{ absolute_url(asset(_page.ogImage)) }}" />
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endblock -%}
|
||||||
|
|
||||||
|
{%- block stylesheets -%}
|
||||||
|
{{ encore_entry_link_tags('app') }}
|
||||||
|
{%- endblock -%}
|
||||||
|
|
||||||
|
<title>{{ _page.metaTitle }}</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{% block body %}{% endblock %}
|
{#
|
||||||
|
- The current node is `_node` and its menu is `_menu`
|
||||||
|
- The current navigation is `_navigation`
|
||||||
|
- The current locale is `_locale`
|
||||||
|
|
||||||
|
- Retrieve all navigations: `_store.navigations`
|
||||||
|
- Retrieve a navigation by its code: `_store.navigation('the_code')`
|
||||||
|
|
||||||
|
- Retrieve all navigation menus: `_navigation.menus`
|
||||||
|
- Retrieve a menu by its code: `_navigation.menu('the_code')`
|
||||||
|
- Retrieve all nodes of a menu: `menu.rootNode.children`
|
||||||
|
- Retrieve visible nodes of a menu: `menu.rootNode.children({visible: true})`
|
||||||
|
|
||||||
|
- Test if a node is the current one: `_store.isActiveNode(node)`
|
||||||
|
- Test if a node is or contains the current one: `_store.isActiveNode(node, true)`
|
||||||
|
- Generate a node url:
|
||||||
|
```
|
||||||
|
{% if node.hasExternalUrl or node.hasAppUrl %}
|
||||||
|
{% set url = node.url %}
|
||||||
|
{% else %}
|
||||||
|
{% set url = safe_node_path(node) %}
|
||||||
|
{% endif %}
|
||||||
|
```
|
||||||
|
- Generate a node url when the navigation has several domains: `safe_node_path(node, {_domain: _domain})`
|
||||||
|
#}
|
||||||
|
|
||||||
|
{% block page %}{% endblock %}
|
||||||
|
|
||||||
|
{%- block javascripts -%}
|
||||||
|
{{ encore_entry_script_tags('app') }}
|
||||||
|
{%- endblock -%}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
{% endapply %}
|
||||||
|
|
|
@ -1,99 +1,16 @@
|
||||||
{% import _self as macros %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% macro item(node, store) %}
|
|
||||||
{% set isActive = store.isActiveNode(node, true) %}
|
|
||||||
|
|
||||||
{% if node.isVisible %}
|
|
||||||
{% if node.code == 'post' %}
|
|
||||||
<a {% if isActive %}style="color: red"{% endif %} href="{{ url(node.routeName, {post: 1}) }}">
|
|
||||||
{{ node.label }}
|
|
||||||
</a>
|
|
||||||
{% elseif node.page %}
|
|
||||||
{% set url = node.hasExternalUrl ? node.url : url(node.routeName) %}
|
|
||||||
|
|
||||||
<a {% if isActive %}style="color: red"{% endif %} href="{{ url }}">
|
|
||||||
{{ node.label }}
|
|
||||||
</a>
|
|
||||||
{% else %}
|
|
||||||
<span {% if isActive %}style="color: red"{% endif %}>
|
|
||||||
{{ node.label }}
|
|
||||||
</span>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.children|length %}
|
|
||||||
<ul>
|
|
||||||
{% for child in node.children %}
|
|
||||||
{% if child.isVisible %}
|
|
||||||
<li>
|
|
||||||
{{ macros.item(child, store) }}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% endmacro %}
|
|
||||||
|
|
||||||
{% macro menu(menu, store) %}
|
|
||||||
<ul>
|
|
||||||
{% for child in menu.rootNode.children %}
|
|
||||||
{% if child.isVisible %}
|
|
||||||
<li>
|
|
||||||
{{ macros.item(child, store) }}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endmacro %}
|
|
||||||
|
|
||||||
|
{%- block page -%}
|
||||||
<h1>{{ _page.title.value }}</h1>
|
<h1>{{ _page.title.value }}</h1>
|
||||||
|
|
||||||
<pre>{{ _page.content.value|murph_url|file_attributes }}</pre>
|
{{ _page.content.value|murph_url|file_attributes|raw }}
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
{% set image = _page.image.value %}
|
{% set image = _page.image.value %}
|
||||||
|
|
||||||
{% if image %}
|
{% if image %}
|
||||||
<img src="{{ asset(image) }}" alt="">
|
<img src="{{ asset(image) }}" alt="{{ image|file_attribute('alt') }}" title="{{ image|file_attribute('title') }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{%- endblock -%}
|
||||||
|
|
||||||
<h1>Request</h1>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
Node: {{ _node.label }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Menu: {{ _menu.label }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Navigation: {{ _navigation.label }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Locale:
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
Var: {{ _locale }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Navigation: {{ _navigation.locale }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Request: {{ app.request.attributes.get('_locale') }}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Test: {{ 'This is a test of translation'|trans }}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h1>Menus</h1>
|
|
||||||
|
|
||||||
{# {% set menu = _navigation.menu('top') %} #}
|
|
||||||
|
|
||||||
{% for menu in _navigation.menus %}
|
|
||||||
<h2>{{ menu.label }} / {{ menu.code }}</h2>
|
|
||||||
|
|
||||||
{{ macros.menu(menu, _store) }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ Encore
|
||||||
* and one CSS file (e.g. app.css) if your JavaScript imports CSS.
|
* and one CSS file (e.g. app.css) if your JavaScript imports CSS.
|
||||||
*/
|
*/
|
||||||
.addEntry('admin', './assets/js/admin.js')
|
.addEntry('admin', './assets/js/admin.js')
|
||||||
|
.addEntry('app', './assets/js/app.js')
|
||||||
|
|
||||||
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
|
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
|
||||||
.splitEntryChunks()
|
.splitEntryChunks()
|
||||||
|
|
Loading…
Reference in a new issue