Skip to content

Commit 0f9cc4f

Browse files
committed
Update page notices add/edit page to bs5
1 parent bd6a2d4 commit 0f9cc4f

File tree

6 files changed

+51
-25
lines changed

6 files changed

+51
-25
lines changed

src/Form/NoticeType.php

+13-5
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ public function buildForm(FormBuilderInterface $builder, array $options)
2020
'required' => false,
2121
'attr' => [
2222
'data-toggle' => 'toggle',
23-
'data-on' => 'Enable',
24-
'data-off' => 'Disable',
25-
'data-onstyle' => 'success'
23+
'data-onlabel' => 'Enable',
24+
'data-offlabel' => 'Disable',
25+
'data-onstyle' => 'success',
26+
'data-offstyle' => 'secondary'
27+
2628
]
2729
])
2830
->add('url', Type\TextType::class, [
@@ -64,24 +66,30 @@ public function buildForm(FormBuilderInterface $builder, array $options)
6466
'required' => false,
6567
'label' => 'Start Time (optional)',
6668
'widget' => 'single_text',
67-
'format' => 'M/d/yyyy h:mm a',
69+
'format' => 'MM/dd/yyyy h:mm a',
6870
'html5' => false,
6971
'view_timezone' => $options['timezone'],
7072
'model_timezone' => 'UTC',
7173
'constraints' => [
7274
new Constraints\Type('datetime')
75+
],
76+
'attr' => [
77+
'autocomplete' => 'off'
7378
]
7479
])
7580
->add('end_ts', Type\DateTimeType::class, [
7681
'required' => false,
7782
'label' => 'End Time (optional)',
7883
'widget' => 'single_text',
79-
'format' => 'M/d/yyyy h:mm a',
84+
'format' => 'MM/dd/yyyy h:mm a',
8085
'html5' => false,
8186
'view_timezone' => $options['timezone'],
8287
'model_timezone' => 'UTC',
8388
'constraints' => [
8489
new Constraints\Type('datetime')
90+
],
91+
'attr' => [
92+
'autocomplete' => 'off'
8593
]
8694
]);
8795

templates/notice/edit.html.twig

+20-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1+
{% set bootstrapVersion = 5 %}
12
{% extends 'base.html.twig' %}
23
{% block title %}Edit Notice - {% endblock %}
34
{% block body %}
4-
<ol class="breadcrumb">
5-
<li><a href="{{ path(routePrefix ~ 'home') }}">Home</a></li>
6-
<li><a href="{{ path(routePrefix ~ 'admin_home') }}">Admin</a></li>
7-
<li><a href="{{ path(routePrefix ~ 'admin_notices') }}">Page Notices</a></li>
8-
<li class="active">{{ notice.id ? 'Edit' : 'Create' }} Page Notice</li>
9-
</ol>
10-
<div class="page-header">
5+
{% form_theme form 'bootstrap_5_layout.html.twig' %}
6+
<nav class="mt-4" aria-label="breadcrumb">
7+
<ol class="breadcrumb">
8+
<li class="breadcrumb-item"><a href="{{ path(routePrefix ~ 'home') }}">Home</a></li>
9+
<li class="breadcrumb-item"><a href="{{ path(routePrefix ~ 'admin_home') }}">Admin</a></li>
10+
<li class="breadcrumb-item"><a href="{{ path(routePrefix ~ 'admin_notices') }}">Page Notices</a></li>
11+
<li class="breadcrumb-item active">{{ notice.id ? 'Edit' : 'Create' }} Page Notice</li>
12+
</ol>
13+
</nav>
14+
<div class="page-header pb-1 mb-3 border-bottom">
1115
<h2><i class="fa fa-info-circle" aria-hidden="true"></i> {{ notice.id ? 'Edit' : 'Create' }} Page Notice</h2>
1216
</div>
1317
<div class="row">
14-
<div class="col-sm-8 col-sm-offset-2">
15-
{{ form_start(form, { attr: { class: 'warn-unsaved prevent-resubmit', 'data-route': routePrefix } }) }}
18+
<div class="col-sm-8 offset-sm-2">
19+
{{ form_start(form, { attr: { class: 'warn-unsaved prevent-resubmit page-notice-form', 'data-route': routePrefix } }) }}
1620
{{ form_errors(form) }}
1721

1822
{{ form_row(form.status) }}
@@ -26,11 +30,11 @@
2630
</ul>
2731
</div>
2832

29-
<div class="panel panel-default">
30-
<div class="panel-heading">
31-
<h3 class="panel-title">Timing</h3>
33+
<div class="card">
34+
<div class="card-header">
35+
<h5 class="card-title">Timing</h5>
3236
</div>
33-
<div class="panel-body">
37+
<div class="card-body">
3438
<p><strong>Your time zone</strong>: {{ timezone_display(app.user.info.timezone)|default('Not set!') }} <a href="{{ path('settings', { return: settings_return_url }) }}" class="small">change</a></p>
3539
{{ form_rest(form) }}
3640
<div class="alert alert-info">
@@ -43,11 +47,11 @@
4347
</div>
4448
</div>
4549
</div>
46-
<p>
50+
<p class="my-3">
4751
<button type="submit" class="btn btn-primary">Save</button>
48-
<a class="btn btn-default" href="{{ path(routePrefix ~ 'admin_notices') }}">Cancel</a>
52+
<a class="btn btn-secondary" href="{{ path(routePrefix ~ 'admin_notices') }}">Cancel</a>
4953
{% if notice.id is defined and notice.id is not empty %}
50-
<button type="submit" name="delete" class="btn btn-danger pull-right confirm">Delete</button>
54+
<button type="submit" name="delete" class="btn btn-danger float-end confirm">Delete</button>
5155
{% endif %}
5256
</p>
5357
{{ form_end(form) }}

web/assets/css/bs5.css

+4
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,7 @@ a {
141141
background-color: #eeeeee;
142142
opacity: 1;
143143
}
144+
145+
.page-notice-form .form-check {
146+
padding-left: 0;
147+
}

web/assets/js/app-bs5.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require("datatables.net-responsive/js/dataTables.responsive.js");
1313
require("datatables.net-responsive-bs/js/responsive.bootstrap.js");
1414
require("jsbarcode/dist/barcodes/JsBarcode.code128.min.js");
1515
require("inputmask/dist/jquery.inputmask.bundle.js");
16-
require("bootstrap-toggle/js/bootstrap-toggle.js");
16+
require("bootstrap5-toggle/js/bootstrap5-toggle.jquery.min")
1717
require("./bootstrap-session-timeout-bs5.js");
1818
require("corejs-typeahead");
1919
window.Bloodhound = require("corejs-typeahead/dist/bloodhound.js");
@@ -30,7 +30,7 @@ require("@fortawesome/fontawesome-free/css/v4-shims.css");
3030
require("@eonasdan/tempus-dominus/dist/css/tempus-dominus.min.css");
3131
require("datatables.net-bs5/css/dataTables.bootstrap5.css");
3232
require("datatables.net-responsive-bs/css/responsive.bootstrap.css");
33-
require("bootstrap-toggle/css/bootstrap-toggle.css");
33+
require("bootstrap5-toggle/css/bootstrap5-toggle.min.css")
3434
require("../css/app.css");
3535
require("../css/bs5.css");
3636

web/assets/js/global.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ $(document).ready(function () {
227227
************************************************************************/
228228
$.fn.dropdownOther = function (choices) {
229229
var self = this;
230-
var select = $('<select class="form-control">');
230+
var select = $('<select class="form-select">');
231231
var optionSelected = false;
232232
var other = $('<option value="">-- Other --</option>');
233233
select.append(other);

web/assets/js/views/NoticeEdit.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
$(document).ready(function () {
2-
$("#notice_start_ts, #notice_end_ts").pmiDateTimePicker();
2+
const startEndDates = ["notice_start_ts", "notice_end_ts"];
3+
4+
startEndDates.forEach(id => {
5+
const element = document.querySelector(`#${id}`);
6+
bs5DateTimepicker(element, {
7+
clock: true,
8+
sideBySide: true,
9+
useCurrent: true
10+
});
11+
});
12+
313
let urlOptions = {
414
All: "/*",
515
"In-Person Enrollment": "/ppsc/participant/p",

0 commit comments

Comments
 (0)