Skip to content

Commit

Permalink
Add and adapt many twig templates related to the public site.
Browse files Browse the repository at this point in the history
  • Loading branch information
pascallapointe committed Mar 7, 2019
1 parent b3616ad commit cfc85f3
Show file tree
Hide file tree
Showing 50 changed files with 3,861 additions and 8 deletions.
8 changes: 8 additions & 0 deletions config/packages/twig_extensions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
# Uncomment any lines below to activate that Twig extension
#Twig\Extensions\ArrayExtension: ~
#Twig\Extensions\IntlExtension: ~
Twig\Extensions\TextExtension:
tags: [twig.extension]
Twig\Extensions\DateExtension:
tags: [twig.extension]
2 changes: 1 addition & 1 deletion templates/global/copyright.html.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- BEGIN COPYRIGHT -->
{{ 'now'|date('Y') }} &copy; Tutoriux
{{ 'now'|date('Y:ss') }} &copy; Tutoriux
<!-- END COPYRIGHT -->
8 changes: 4 additions & 4 deletions templates/global/page_title.html.twig
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{% trans_default_domain "system" %}
{% trans_default_domain "site" %}
{% block title -%}
{%- if element_page_title is defined and element_override_page_title is defined and element_override_page_title -%}
{{ element_page_title|trans }}
{{ element_page_title }}
{%- else -%}
{%- if element_page_title is defined and element_page_title -%}
{{ element_page_title }} - {% endif -%}
{%- for element in elements -%}
{% set entityTitle = element|transTitle|striptags|truncate(100)|raw %}
{%- if (element.id is defined and element.id is null) or element.id is not defined -%}
{% set entityTitle = entityTitle|trans %}
{% set entityTitle = entityTitle %}
{%- elseif element.metaTitle is defined and element.metaTitle is not empty -%}
{% set entityTitle = element.metaTitle|trans %}
{% set entityTitle = element.metaTitle %}
{%- endif -%}
{{ entityTitle }} - {% endfor -%}
{{ project_title|trans }}
Expand Down
12 changes: 12 additions & 0 deletions templates/site/core/analytics.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% if app.environment == 'prod' %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ google_analytics_id }}', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
54 changes: 54 additions & 0 deletions templates/site/core/footer.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% trans_default_domain "site" %}
<!-- BEGIN PRE-FOOTER -->
<div class="page-prefooter">
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-12 footer-block">
<h2>{% trans %}More On Us{% endtrans %}</h2>
{{ render_esi(controller('App\\Controller\\Site\\NavigationController:byCode', { code: 'footer', template: 'footer', attr: { class: 'footer-nav' } })) }}
</div>
<div class="col-md-3 col-sm-6 col-xs-12 footer-block">
<h2>{% trans %}We would love to hear from you{% endtrans %} !</h2>
<a href="{{ path('section_id_50') }}" class="btn yellow-lemon">
{% trans %}Send a feedback{% endtrans %} !
</a>
</div>
<div class="col-md-3 col-sm-6 col-xs-12 footer-block">
<h2>{% trans from 'system' %}Follow Us On{% endtrans %}</h2>
<ul class="social-icons">
{#<li>#}
{#<a href="javascript:;" data-original-title="rss" class="rss"></a>#}
{#</li>#}
<li>
<a href="https://www.facebook.com/tutoriux/" data-original-title="facebook" class="facebook"></a>
</li>
<li>
<a href="https://twitter.com/tutoriux" data-original-title="twitter" class="twitter"></a>
</li>
</ul>
</div>
<div class="col-md-3 col-sm-6 col-xs-12 footer-block">
<h2>{% trans from 'system' %}About{% endtrans %}</h2>
<p>
{% trans from 'system' %}Tutoriux is a community based on sharing knowledge and expertise of its members.{% endtrans %}
</p>
<br>
<p>
<strong>{% trans from 'system' %}Our mission{% endtrans %}</strong>
{% trans from 'system' %}is to create the ideal tool to make accessible knowledge on various topics in the best possible format.{% endtrans %}
</p>
</div>
</div>
</div>
</div>
<!-- END PRE-FOOTER -->
<!-- BEGIN FOOTER -->
<div class="page-footer">
<div class="container">
{% include 'global/copyright.html.twig' %}
</div>
</div>
<div class="scroll-to-top">
<i class="icon-arrow-up"></i>
</div>
<!-- END FOOTER -->
1 change: 1 addition & 0 deletions templates/site/core/form/form_fields_vertical.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends 'global/form/_form_fields_vertical.html.twig' %}
138 changes: 138 additions & 0 deletions templates/site/core/form/form_fields_vertical_md.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{% extends 'global/form/_form_fields_vertical.html.twig' %}

{# form_row #}

{% block form_row %}
{% spaceless %}
<div class="{{ 'form-group' ~ ((form.vars.expanded is defined and form.vars.expanded) ? ' form-md-radios':' form-md-line-input form-md-floating-label') }}{% if errors|length > 0 %} has-error{% endif %}{% if isTextarea is defined and isTextarea %} is-textarea{% endif %}">
{% if icon is defined %}
<div class="input-group right-addon{% if errors|length > 0 %} left-addon{% endif %}">
{% elseif errors|length %}
<div class="input-group left-addon">
{% endif %}
{% if errors|length %}

<span class="input-group-addon">
<i class="fa fa-warning tooltips" data-original-title="{{ errors[0].message|trans({}, translation_domain) }}" data-container="body"></i>
</span>

{% if form.vars.expanded is defined and form.vars.expanded %}
{{ form_label(form) }}
{% endif %}

{{ form_widget(form, {'attr': {'class': 'form-control' ~ ((form.vars.value is empty) ? '':' edited')} }) }}

{% if not (form.vars.expanded is defined and form.vars.expanded) %}
{{ form_label(form) }}
{% endif %}
{% else %}
{% if form.vars.expanded is defined and form.vars.expanded %}
{{ form_label(form) }}
{% endif %}

{{ form_widget(form, {'attr': {'class': 'form-control' ~ ((form.vars.value is empty) ? '':' edited')} }) }}

{% if not (form.vars.expanded is defined and form.vars.expanded) %}
{{ form_label(form) }}
{% endif %}
{% endif %}

{% if isChoice is defined and isChoice %}
{{ form_label(form, null, {'label_attr': {'class': 'control-label'}} ) }}
{% endif %}

{% if errors|length %}
<span id="{{ form.vars.id }}-error" class="help-block">
{% for error in errors %}
{{ error.message|trans({}, translation_domain) }}{% if not loop.last %}<br>{% endif %}
{% endfor %}
</span>
{% elseif attr.alt is defined %}
<span class="help-block">{{ attr.alt|trans({}, translation_domain)|raw }}</span>
{% endif %}

{% if icon is defined %}
<span class="input-group-addon">
<i class="{{ icon }}"></i>
</span>
</div>
{% elseif errors|length %}
</div>
{% endif %}

</div>
{% endspaceless %}
{% endblock form_row %}

{# Widgets #}

{% block form_widget_simple %}
{% spaceless %}
{% set type = type|default('text') %}
{% if type == 'date' %}<div class="input-group input-medium date date-picker" data-date="{% if value %}{{ value|date('Y-m-d') }}{% else %}1990-01-01{% endif %}" data-date-format="yyyy-mm-dd" data-date-viewmode="years">{% endif %}
<input type="{{ (type == 'date') ? 'text' : type }}" {{ block('widget_attributes') }}{% if errors|length > 0 %} aria-describedby="{{ form.vars.id }}-error"{% endif %} {% if value is not empty %}value="{{ value }}" {% endif %}/>
{% if type == 'date' %}
<span class="input-group-btn">
<button class="btn default" type="button"><i class="fa fa-calendar"></i></button>
</span>
</div>
{% endif %}
{% endspaceless %}
{% endblock form_widget_simple %}

{%- block textarea_widget -%}
{% spaceless %}
<textarea {{ block('widget_attributes') }}{% if errors|length > 0 %} aria-describedby="{{ form.vars.id }}-error"{% endif %}>{{ value }}</textarea>
{% endspaceless %}
{%- endblock textarea_widget -%}

{% block choice_widget %}
{% spaceless %}
{% if expanded %}
<div class="{% if multiple %}md-checkbox-list{% else %}md-radio-list{% endif %}">
{% for key, child in form %}
<div class="{% if multiple %}md-checkbox{% else %}md-radio{% endif %}">
{% if child.vars.label is not same as(false) %}
{% if not child.vars.compound %}
{% set label_attr = child.vars.label_attr|merge({'for': child.vars.id}) %}
{% endif %}
{% if child.vars.label is empty %}
{% set label = child.vars.name|humanize %}
{% endif %}
{{ form_widget(child, {'attr': {'class': 'md-radiobtn'}}) }}
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
<span></span>
<span class="check"></span>
<span class="box"></span>
{%- if child.vars.data.id is defined -%}
{% include 'global/entity_title.html.twig' with { 'entity': child.vars.data } %}
{%- else -%}
{{ child.vars.label|trans({}, translation_domain)|raw }}
{%- endif -%}
{% if child.vars.required and child.vars.checked is not defined %}
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
<span class="required">* </span>
{% endif %}
</label>
{% endif %}
</div>
{% endfor %}
</div>
{% else %}
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
{% if placeholder is not none %}
<option value="">{{ placeholder|trans({}, translation_domain) }}</option>
{% endif %}
{% if preferred_choices|length > 0 %}
{% set options = preferred_choices %}
{{ block('choice_widget_options') }}
{% if choices|length > 0 and separator is not none %}
<option disabled="disabled">{{ separator }}</option>
{% endif %}
{% endif %}
{% set options = choices %}
{{ block('choice_widget_options') }}
</select>
{% endif %}
{% endspaceless %}
{% endblock choice_widget %}
1 change: 1 addition & 0 deletions templates/site/core/head_extra.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ headExtra|raw }}
97 changes: 97 additions & 0 deletions templates/site/core/header.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{% trans_default_domain "site" %}
<!-- BEGIN HEADER -->
<div class="page-header">
{% block header_top %}
<!-- BEGIN HEADER TOP -->
<div class="page-header-top">
<div class="container">
<!-- BEGIN LOGO -->
<div class="page-logo">
<a href="{{ path('section_id_1') }}">
<img src="{{ asset('bundles/system/frontend/images/logos/logo_slogan_' ~ app.request.locale ~ '.png') }}" width="216" height="72" alt="{{ project_title }}" class="tutoriux-logo"/>
</a>
</div>
<!-- END LOGO -->
<!-- BEGIN RESPONSIVE MENU TOGGLER -->
<a href="javascript:;" class="menu-toggler"></a>
<!-- END RESPONSIVE MENU TOGGLER -->
<!-- BEGIN TOP NAVIGATION MENU -->
<div class="top-menu">
<ul class="nav navbar-nav pull-right">
{% block top_menu_widgets %}
<!-- BEGIN NOTIFICATION DROPDOWN -->
{% if is_granted('ROLE_USER') %}
{{ render(controller('App\\Controller\\Site\\NotificationController:headerNotification')) }}
{% endif %}
<!-- END NOTIFICATION DROPDOWN -->
<!-- BEGIN LANGUAGE DROPDOWN -->
{{ render(controller('App\\Controller\\Site\\NavigationController:localeSwitcher')) }}
<!-- END LANGUAGE DROPDOWN -->
{% endblock top_menu_widgets %}
<li class="droddown dropdown-separator">
<span class="separator"></span>
</li>
<!-- BEGIN USER LOGIN DROPDOWN -->
{% if is_granted('ROLE_USER') %}
<li class="dropdown dropdown-user">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
{% if app.user.avatar %}<img alt="{{ app.user }}" class="img-circle" src="{{ app.user.avatar.mediaPath|imagine_filter('media_user_avatar_medium_round') }}">{% endif %}
<span class="username username-hide-mobile">{{ app.user }}</span>
<i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-menu-default">
<li>
<a href="{{ path('section_id_35', {'username': app.user.username}) }}">
<i class="icon-user{% if app.user.gender == 'f' %}-female{% endif %}"></i>{% trans %}My Profile{% endtrans %}</a>
</li>
<li>
<a href="{{ path('section_id_35_messages') }}">
<i class="icon-envelope-open"></i>
{% trans %}My Inbox{% endtrans %}
<span id="hmenu-unread-messages" class="badge badge-danger hide">0</span>
</a>
</li>
<li>
<a href="{{ path('section_id_35_settings') }}">
<i class="icon-settings"></i>
{% trans %}Settings{% endtrans %}
</a>
</li>
<li class="divider">
</li>
<li>
<a href="{{ path('system_frontend_logout') }}"><i class="icon-key"></i> {% trans %}Log Out{% endtrans %}</a>
</li>
</ul>
</li>
{% else %}
<li class="link">
<a class="login-link" href="{{ path('system_frontend_login') }}"><i class="icon-user"></i> {% trans %}Login{% endtrans %}</a>
</li>
{% endif %}
<!-- END USER LOGIN DROPDOWN -->
</ul>
</div>
<!-- END TOP NAVIGATION MENU -->
</div>
</div>
<!-- END HEADER TOP -->
{% endblock header_top %}
{% block header_menu %}
<!-- BEGIN HEADER MENU -->
<div class="page-header-menu">
<div class="container">
<!-- BEGIN SEARCH BUTTON -->
<button class="search-button">
<i class="icon-magnifier"></i>
</button>
<!-- END SEARCH BUTTON -->

{{ render_esi(controller('App\\Controller\\Site\\NavigationController:byCode', { code: 'header', template: 'header', maxLevel: 4, attr: { class: 'hor-menu hor-menu-light'} })) }}

</div>
</div>
<!-- END HEADER MENU -->
{% endblock header_menu %}
</div>
<!-- END HEADER -->
Loading

0 comments on commit cfc85f3

Please sign in to comment.