index.twig 5.99 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{% extends "layout.twig" %}

{% macro input(name, label, value, type, attributes) %}
<div class="form-group">
    <label class="control-label hidden-xs hidden-sm col-md-3" for="el-{{ name }}">{{ label|raw }}</label>
    <div class="col-xs-12 col-sm-12 col-md-9">
        <input placeholder="{{ label|striptags }}" class="form-control input-sm"
            type="{{ type|default('text') }}" name="{{ name }}"
            id="el-{{ name }}" value="{{ value|default('')|raw }}"
        {% for attr_name, attr_value in attributes|default({}) %}
            {{ attr_name }}="{{ attr_value }}"
        {% endfor %}>
    </div>
</div>
{% endmacro %}

kanellov's avatar
kanellov committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{% macro checkbox(name, label, checked, attributes) %}
<div class="form-group">
    <div class="col-xs-12 col-sm-12 col-md-9 col-md-offset-3">
        <div class="checkbox">
            <label>
                <input type="checkbox" name="{{ name}}" id="el-{{ name }}"
                    {% if checked %} checked{% endif %} 
                        {% for attr_name, attr_value in attributes|default({}) %}
                        {{ attr_name }}="{{ attr_value }}"
                    {% endfor %}>
                {{ label|raw }}
            </label>
        </div>
    </div>
</div>
{% endmacro %}

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
{% macro file(name, label, value, attributes) %}
<div class="form-group">
    <label class="control-label hidden-xs hidden-sm col-md-3" for="el-{{ name }}">{{ label|raw }}</label>
    <div class="col-xs-12 col-sm-12 col-md-9">
        <div class="input-group">
            <span class="input-group-btn">
                <span class="btn btn-default btn-file">
                    Επιλέξτε&hellip; <input type="file" multiple name="{{ name }}" id="el-{{ name }}">
                </span>
            </span>
            <input type="text" class="form-control" readonly placeholder="{{ label|striptags }}"
            {% for attr_name, attr_value in attributes|default({}) %}
                {{ attr_name }}="{{ attr_value }}"
            {% endfor %}>
            <span class="input-group-btn">
                <span class="btn btn-default btn-file-remove">
                    <i class="fa fa-remove"></i>
                </span>
            </span>
        </div>
    </div>
</div>
{% endmacro %}

{% macro select(name, label, options, selected, attributes) %}
<div class="form-group">
    <label class="control-label hidden-xs hidden-sm col-md-3" for="el-{{ name }}">{{ label|raw }}</label>
    <div class="col-xs-12 col-sm-12 col-md-9">
        <select class="form-control input-sm" name="{{ name }}" id="el-{{ name }}"
        {% for attr_name, attr_value in attributes|default({}) %}
            {{ attr_name }}="{{ attr_value }}"
        {% endfor %}>
        {% set multi = attributes.multiple is defined %}
        {% if multi %}
            <optgroup label="{{ label|striptags }}">
        {% endif %}
            {% if not multi %}
                <option value="" disabled{% if selected is empty %} selected{% endif %}>{{ label|striptags }}</option>
            {% endif %}
            {% for option in options %}
                <option value="{{ option.value|e }}"{% if selected == option.value %} selected{% endif %}>
                    {{ option.label }}
                </option>
            {% endfor %}
        {% if multi %}
            </optgroup>
        {% endif %}
        </select>
    </div>
</div>
{% endmacro %}

{% macro select_year(name, label, selected, start, attributes) %}
    <div class="form-group">
    <label class="control-label hidden-xs hidden-sm col-md-3" for="el-{{ name }}">{{ label|raw }}</label>
    <div class="col-xs-12 col-sm-12 col-md-9">
        <select class="form-control input-sm" name="{{ name }}" id="el-{{ name }}"
        {% for attr_name, attr_value in attributes|default({}) %}
            {{ attr_name }}="{{ attr_value }}"
        {% endfor %}>
            <option value="" disabled{% if selected is empty %} selected{% endif %}>{{ label|striptags }}</option>
            {% for option in range("now"|date("Y"), start|default(1980)) %}
            <option value="{{ option|e }}"{% if selected == option %} selected{% endif %}>
                {{ option }}
            </option>
            {% endfor %}
        </select>
    </div>
</div>
{% endmacro %}

{% macro text(name, label, value, attributes) %}
    <div class="form-group">
        <label for="el-{{ name }}" class="col-xs-12 pull-left">
            {{ label|e }}
        </label>
        <div class="col-xs-12">
            <textarea id="el-{{ name }}" name="{{ name }}" class="form-control" placeholder="{{ label|striptags }}"
        {% for attr_name, attr_value in attributes|default({}) %}
            {{ attr_name }}="{{ attr_value }}"
        {% endfor %}>
                {{ value|striptags }}
            </textarea>
        </div>
    </div>
{% endmacro %}

{% block content %}
    <div id="school">
        <h1>
        {% block schoolTitle %}
            Το σχολείο
        {% endblock %}
        </h1>
        <ul class="nav nav-tabs">
            {% for page in nav('main').school.pages %}
            <li role="presentation" class="{% if page.active %}active{% endif %}">
                <a href="{{ page.href }}" {% if page.id %}id="{{ page.id }}"{% endif %} title="{{ page.label }}">
                    <i class="visible-xs fa fa-{{ page.icon }}"></i>
                    <span class="hidden-xs">{{ page.label }}</span>
                </a>
            </li>
            {% endfor %}
            {% block navItems %}{% endblock %}
        </ul>
        <br>
        <div class="row">
            <div class="col-xs-12 school-container">
                {% block schoolContent %}

Vassilis Kanellopoulos's avatar
Vassilis Kanellopoulos committed
144
                {{ school.name }}
145
146
147
148
149
150
151
152
                {% endblock %}
            </div>
        </div>
    </div>
{% endblock %}
{% block inlinejs %}
    <script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.2.3/backbone-min.js"></script>
153
    <script type="text/javascript" src="{{ base_url }}/js/schools/index.js"></script>
154
{% endblock %}