diff options
Diffstat (limited to 'resources/views')
-rw-r--r-- | resources/views/admin/schedule/index.twig | 41 | ||||
-rw-r--r-- | resources/views/admin/schedule/load.twig | 79 | ||||
-rw-r--r-- | resources/views/macros/form.twig | 35 | ||||
-rw-r--r-- | resources/views/pages/password/reset-form.twig | 4 | ||||
-rw-r--r-- | resources/views/pages/password/reset.twig | 2 |
5 files changed, 149 insertions, 12 deletions
diff --git a/resources/views/admin/schedule/index.twig b/resources/views/admin/schedule/index.twig new file mode 100644 index 00000000..08a9cb2b --- /dev/null +++ b/resources/views/admin/schedule/index.twig @@ -0,0 +1,41 @@ +{% extends 'layouts/app.twig' %} +{% import 'macros/base.twig' as m %} +{% import 'macros/form.twig' as f %} + +{% set title %}{% block title %}{{ __('schedule.import.title') }}{% endblock %}{% endset %} + +{% block content %} + <div class="container"> + <h1>{% block content_title %}{{ title }}{% endblock %}</h1> + + {% for message in errors|default([]) %} + {{ m.alert(__(message), 'danger') }} + {% endfor %} + {% for message in success|default([]) %} + {{ m.alert(__(message), 'success') }} + {% endfor %} + + <div class="row"> + {% block row_content %} + <form method="POST" action="{{ url('/admin/schedule/load') }}"> + {{ csrf() }} + + <div class="col-md-12"> + <p>{{ __('schedule.import.text') }}</p> + </div> + + <div class="col-lg-6"> + {{ f.input('schedule-url', __('schedule.url'), 'url', {'required': true}) }} + + {{ f.select('shift-type', shift_types|default([]), __('schedule.shift-type')) }} + + {{ f.input('minutes-before', __('schedule.minutes-before'), 'number', {'value': 15, 'required': true}) }} + {{ f.input('minutes-after', __('schedule.minutes-after'), 'number', {'value': 15, 'required': true}) }} + + {{ f.submit(__('form.load_schedule')) }} + </div> + </form> + {% endblock %} + </div> + </div> +{% endblock %} diff --git a/resources/views/admin/schedule/load.twig b/resources/views/admin/schedule/load.twig new file mode 100644 index 00000000..8c936bec --- /dev/null +++ b/resources/views/admin/schedule/load.twig @@ -0,0 +1,79 @@ +{% extends 'admin/schedule/index.twig' %} +{% import 'macros/form.twig' as f %} + +{% block title %}{{ __('schedule.import.load.title') }}{% endblock %} + +{% block row_content %} + <form method="POST" action="{{ url('/admin/schedule/import') }}"> + {{ csrf() }} + {{ f.hidden('schedule-url', schedule_url) }} + {{ f.hidden('shift-type', shift_type) }} + {{ f.hidden('minutes-before', minutes_before) }} + {{ f.hidden('minutes-after', minutes_after) }} + + <div class="col-lg-12"> + <p>{{ __('schedule.import.load.info', [schedule.conference.title, schedule.version]) }}</p> + + <h2>{{ __('schedule.import.rooms.add') }}</h2> + {{ _self.roomsTable(rooms.add) }} + + <h2>{{ __('schedule.import.shifts.add') }}</h2> + {{ _self.shiftsTable(shifts.add) }} + + <h2>{{ __('schedule.import.shifts.update') }}</h2> + {{ _self.shiftsTable(shifts.update) }} + + <h2>{{ __('schedule.import.shifts.delete') }}</h2> + {{ _self.shiftsTable(shifts.delete) }} + + {{ f.submit(__('form.import')) }} + </div> + </form> +{% endblock %} + + +{% macro roomsTable(rooms) %} + <div class="table-responsive"> + <table class="table table-striped"> + <thead> + <tr> + <th>{{ __('schedule.import.rooms.name') }}</th> + </tr> + </thead> + + <tbody> + {% for room in rooms %} + <tr> + <td>{{ room.name }}</td> + </tr> + {% endfor %} + </tbody> + </table> + </div> +{% endmacro %} + +{% macro shiftsTable(shifts) %} + <div class="table-responsive"> + <table class="table table-striped"> + <thead> + <tr> + <th>{{ __('schedule.import.shift.dates') }}</th> + <th>{{ __('schedule.import.shift.type') }}</th> + <th>{{ __('schedule.import.shift.title') }}</th> + <th>{{ __('schedule.import.shift.room') }}</th> + </tr> + </thead> + + <tbody> + {% for shift in shifts %} + <tr> + <td>{{ shift.date.format(__('Y-m-d H:i')) }} - {{ shift.endDate.format(__('H:i')) }}</td> + <td>{{ shift.type }}</td> + <td>{{ shift.title }}{% if shift.subtitle %}<br><small>{{ shift.subtitle }}</small>{% endif %}</td> + <td>{{ shift.room.name }}</td> + </tr> + {% endfor %} + </tbody> + </table> + </div> +{% endmacro %} diff --git a/resources/views/macros/form.twig b/resources/views/macros/form.twig index 5d41b085..ece85fcf 100644 --- a/resources/views/macros/form.twig +++ b/resources/views/macros/form.twig @@ -1,18 +1,35 @@ -{% macro input(name, label, type, required) %} +{% macro input(name, label, type, opt) %} <div class="form-group"> - {% if label %} + {% if label -%} <label for="{{ name }}">{{ label }}</label> - {% endif %} - <input type="{{ type|default('text') }}" class="form-control" id="{{ name }}" name="{{ name }}" - {%- if required|default(false) %} required="required"{% endif -%} + {%- endif %} + <input type="{{ type|default('text') }}" class="form-control" + id="{{ name }}" name="{{ name }}" + value="{{ opt.value|default('') }}" + {%- if opt.required|default(false) %} + required="required" + {%- endif -%} > </div> -{% endmacro %} +{%- endmacro %} + +{% macro select(name, data, label, selected) %} + <div class="form-group"> + {% if label -%} + <label for="{{ name }}">{{ label }}</label> + {% endif %} + <select id="{{ name }}" name="{{ name }}" class="form-control"> + {% for value,decription in data -%} + <option value="{{ value }}" {% if name == selected %} selected{% endif %}>{{ decription }}</option> + {% endfor %} + </select> + </div> +{%- endmacro %} {% macro hidden(name, value) %} <input type="hidden" id="{{ name }}" name="{{ name }}" value="{{ value }}"> -{% endmacro %} +{%- endmacro %} {% macro submit(label) %} - <button type="submit" class="btn btn-default">{{ label|default(__('form.submit')) }}</button> -{% endmacro %} + <button type="submit" class="btn btn-primary">{{ label|default(__('form.submit')) }}</button> +{%- endmacro %} diff --git a/resources/views/pages/password/reset-form.twig b/resources/views/pages/password/reset-form.twig index 60eb2499..a72dc92b 100644 --- a/resources/views/pages/password/reset-form.twig +++ b/resources/views/pages/password/reset-form.twig @@ -7,8 +7,8 @@ <form action="" enctype="multipart/form-data" method="post"> {{ csrf() }} - {{ f.input('password', __('Password'), 'password', true) }} - {{ f.input('password_confirmation', __('Confirm password'), 'password', true) }} + {{ f.input('password', __('Password'), 'password', {'required': true}) }} + {{ f.input('password_confirmation', __('Confirm password'), 'password', {'required': true}) }} <div class="form-group"> {{ f.submit(__('Save')) }} diff --git a/resources/views/pages/password/reset.twig b/resources/views/pages/password/reset.twig index 289152ea..b1de4eae 100644 --- a/resources/views/pages/password/reset.twig +++ b/resources/views/pages/password/reset.twig @@ -19,7 +19,7 @@ {{ csrf() }} {{ __('We will send you an e-mail with a password recovery link. Please use the email address you used for registration.') }} - {{ f.input('email', __('E-Mail'), 'email', true) }} + {{ f.input('email', __('E-Mail'), 'email', {'required': true}) }} <div class="form-group"> {{ f.submit(__('Recover')) }} |