Skip to content

Commit

Permalink
Forms: visual alignment and spacing tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
SKuipers committed Nov 12, 2024
1 parent aae42bf commit bc0a0c5
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 44 deletions.
1 change: 1 addition & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@

$page->addData([
'isLoggedIn' => $isLoggedIn,
'isHomePage' => empty($page->getAddress()),
'organisationLogo' => $session->get('organisationLogo'),
'organisationName' => $session->get('organisationName'),
'cacheString' => $session->get('cacheString'),
Expand Down
2 changes: 1 addition & 1 deletion modules/Activities/activities_attendance.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
$row = $form->addRow()->addClass('flex w-full')->addTable()->setClass('smallIntBorder w-full doublescroll-wrapper')->addRow();
$row->addContent(__('All highlighted columns will be updated when you press submit.'))
->wrap('<span class="text-xs italic">', '</span>');
$row->addSubmit()->addClass('text-right');
$row->addSubmit();

echo $form->getOutput();

Expand Down
2 changes: 1 addition & 1 deletion modules/Activities/choices_manage_generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
]));

$table = $form->addRow()->addTable()->setClass('smallIntBorder w-full');
$row = $table->addRow()->addSubmit(__('Submit'))->addClass('text-right');
$row = $table->addRow()->addSubmit(__('Submit'));
} elseif ($form->getCurrentPage() >= 3) {
// STEP 4
$enrolmentList = $_POST['person'] ?? [];
Expand Down
2 changes: 1 addition & 1 deletion modules/Activities/enrolment_manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
]));

$table = $form->addRow()->addTable()->setClass('smallIntBorder w-full');
$row = $table->addRow()->addSubmit(__('Submit'))->addClass('text-right');
$row = $table->addRow()->addSubmit(__('Submit'));

echo $form->getOutput();
}
2 changes: 1 addition & 1 deletion modules/Activities/enrolment_manage_staffing.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
]));

$table = $form->addRow()->addTable()->setClass('smallIntBorder w-full');
$row = $table->addRow()->addSubmit(__('Submit'))->addClass('text-right');
$row = $table->addRow()->addSubmit(__('Submit'));

echo $form->getOutput();
}
2 changes: 1 addition & 1 deletion modules/Admissions/src/Forms/ApplicationMilestonesForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function createForm($urlParams, $milestones)
->setClass('w-24');
}

$form->addRow()->addSubmit()->addClass('text-right');
$form->addRow()->addSubmit();

return $form;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/Messenger/messageWall_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

$form->addHiddenValue('address', $session->get('address'));

$row = $form->addRow()->addClass('flex flex-wrap');
$row = $form->addRow()->addClass('flex flex-wrap mb-4');

$link = $session->get('absoluteURL').'/index.php?q=/modules/'.$session->get('module').'/messageWall_view.php';
$prevDay = DateTime::createFromFormat('Y-m-d', $date)->modify('-1 day')->format('Y-m-d');
Expand Down
4 changes: 1 addition & 3 deletions modules/Planner/planner_view_full.php
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,6 @@


$row = $form->addRow();
$row->addFooter();
$row->addSubmit();

echo $form->getOutput();
Expand Down Expand Up @@ -1108,7 +1107,6 @@
$col->addEditor('homeworkDetails', $guid)->setRows(15)->showMedia()->required()->setValue($rowMyHomework['homeworkDetails'] ?? '');

$row = $form->addRow();
$row->addFooter();
$row->addSubmit();

echo '<tr><td colspan="3">';
Expand Down Expand Up @@ -1298,7 +1296,7 @@
$form->addHiddenValue('count', $count);
$form->addHiddenValues($params);

$form->addRow()->addSubmit();
$form->addRow()->addSubmit()->addClass('mt-2');
}

$page->addSidebarExtra($form->getOutput());
Expand Down
4 changes: 2 additions & 2 deletions modules/Staff/coverage_planner.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
$form = Form::createBlank('dateNav', $link);
$form->addHiddenValue('address', $session->get('address'));

$row = $form->addRow()->addClass('flex flex-wrap');
$row = $form->addRow()->addClass('flex flex-wrap mb-4');

$lastDay = $date->modify('-1 day')->format('Y-m-d');
$thisDay = (new DateTime('Today'))->format('Y-m-d');
Expand Down Expand Up @@ -93,7 +93,7 @@
->setIcon('duplicate')
->modalWindow(true)
->displayLabel()
->setClass('float-right mt-4')
->setClass('float-right')
->getOutput();

echo '<h2>'.__(Format::dayOfWeekName($date->format('Y-m-d'))).'</h2>';
Expand Down
2 changes: 1 addition & 1 deletion modules/Staff/coverage_planner_assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
$form->toggleVisibilityByClass('unavailableSub')->onCheckbox('showUnavailable')->when('Y');

$row = $form->addRow();
$row->addSubmit()->addClass('text-right');
$row->addSubmit();

echo $form->getOutput();
}
Expand Down
2 changes: 1 addition & 1 deletion modules/Staff/report_absences_weekly.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
$form = Form::createBlank('action', $session->get('absoluteURL').'/index.php?q=/modules/Staff/report_absences_weekly.php');
$form->addHiddenValue('address', $session->get('address'));

$row = $form->addRow()->addClass('flex flex-wrap');
$row = $form->addRow()->addClass('flex flex-wrap mb-4');

$link = $session->get('absoluteURL').'/index.php?q=/modules/Staff/report_absences_weekly.php';
$lastWeek = $date->modify('-1 week')->format('Y-m-d');
Expand Down
4 changes: 2 additions & 2 deletions modules/Staff/report_subs_availabilityWeekly.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
$form = Form::createBlank('action', $session->get('absoluteURL').'/index.php?q=/modules/Staff/report_subs_availabilityWeekly.php&sidebar=false');
$form->addHiddenValue('address', $session->get('address'));

$row = $form->addRow()->addClass('flex flex-wrap');
$row = $form->addRow()->addClass('flex flex-wrap mb-4');

$link = $session->get('absoluteURL').'/index.php?q=/modules/Staff/report_subs_availabilityWeekly.php&sidebar=false';

Expand Down Expand Up @@ -90,7 +90,7 @@
// Attach availability info to each sub
$availability = $subGateway->selectUnavailableDatesByDateRange($dateStart->format('Y-m-d'), $dateEnd->format('Y-m-d'))->fetchAll();
$subsAvailability = array_reduce($availability, function ($group, $item) {
$gibbonPersonID = str_pad($item['gibbonPersonID'], 10, '0', STR_PAD_LEFT);
$gibbonPersonID = str_pad($item['gibbonPersonID'] ?? '', 10, '0', STR_PAD_LEFT);
if (!isset($group[$gibbonPersonID])) return $group;

$group[$gibbonPersonID]['dates'][$item['date']][] = $item;
Expand Down
36 changes: 13 additions & 23 deletions modules/Timetable/moduleFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function getCalendarEvents($connection2, $guid, $xml, $startDayStamp, $endDaySta
}

if (!empty($ssoMicrosoft) && $ssoMicrosoft['enabled'] == 'Y' && $session->has('microsoftAPIAccessToken')) {
$eventsSchool = array();
$eventsSchool = [];

// Create a Graph client
$oauthProvider = $container->get('Microsoft_Auth');
Expand Down Expand Up @@ -261,7 +261,7 @@ function getCalendarEvents($connection2, $guid, $xml, $startDayStamp, $endDaySta

if (!empty($ssoGoogle) && $ssoGoogle['enabled'] == 'Y' && $session->has('googleAPIAccessToken') && $session->has('googleAPICalendarEnabled')) {

$eventsSchool = array();
$eventsSchool = [];
$start = date("Y-m-d\TH:i:s", strtotime(date('Y-m-d', $startDayStamp)));
$end = date("Y-m-d\TH:i:s", (strtotime(date('Y-m-d', $endDayStamp)) + 86399));

Expand All @@ -278,7 +278,7 @@ function getCalendarEvents($connection2, $guid, $xml, $startDayStamp, $endDaySta
}

if ($getFail) {
$eventsSchool = false;
$eventsSchool = [];
} else {
$count = 0;
foreach ($calendarListEntry as $entry) {
Expand Down Expand Up @@ -341,7 +341,7 @@ function getCalendarEvents($connection2, $guid, $xml, $startDayStamp, $endDaySta
}
}
} else {
$eventsSchool = false;
$eventsSchool = [];
}

$session->set($calendarEventsCache, $eventsSchool);
Expand Down Expand Up @@ -626,17 +626,15 @@ function renderTT($guid, $connection2, $gibbonPersonID, $gibbonTTID, $title = ''

//Get school calendar array
$allDay = false;
$eventsSchool = false;
$eventsSchool = [];
if ($self == true and $session->get('viewCalendarSchool') == 'Y' && $session->has('googleAPIAccessToken')) {
if ($session->get('calendarFeed') != '') {
$eventsSchool = getCalendarEvents($connection2, $guid, $session->get('calendarFeed'), $startDayStamp, $endDayStamp);
}
//Any all days?
if ($eventsSchool != false) {
foreach ($eventsSchool as $event) {
if ($event[1] == 'All Day') {
$allDay = true;
}
foreach ($eventsSchool as $event) {
if ($event[1] == 'All Day') {
$allDay = true;
}
}
}
Expand Down Expand Up @@ -686,16 +684,14 @@ function renderTT($guid, $connection2, $gibbonPersonID, $gibbonTTID, $title = ''
}

//Get personal calendar array
$eventsPersonal = false;
$eventsPersonal = [];
if ($self == true and $session->get('viewCalendarPersonal') == 'Y') {
$eventsPersonal = getCalendarEvents($connection2, $guid, $session->get('calendarFeedPersonal'), $startDayStamp, $endDayStamp);

//Any all days?
if ($eventsPersonal != false) {
foreach ($eventsPersonal as $event) {
if ($event[1] == 'All Day') {
$allDay = true;
}
foreach ($eventsPersonal as $event) {
if ($event[1] == 'All Day') {
$allDay = true;
}
}
}
Expand Down Expand Up @@ -801,13 +797,7 @@ function renderTT($guid, $connection2, $gibbonPersonID, $gibbonTTID, $title = ''
$eventsCombined = false;
$maxAllDays = 0;
if ($allDay == true) {
if ($eventsPersonal != false and $eventsSchool != false) {
$eventsCombined = array_merge($eventsSchool, $eventsPersonal);
} elseif ($eventsSchool != false) {
$eventsCombined = $eventsSchool;
} elseif ($eventsPersonal != false) {
$eventsCombined = $eventsPersonal;
}
$eventsCombined = array_merge($eventsSchool, $eventsPersonal);

// Sort $eventsCombined by the value of their start timestamp (key = 2) ascendingly.
// See getCalendarEvents() for field details of each events.
Expand Down
2 changes: 1 addition & 1 deletion modules/User Admin/permission_manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
->append(sprintf(__('This form is very large and data will be truncated unless you edit php.ini. Add the line <i>max_input_vars=%1$s</i> to your php.ini file on your server.'), $total_vars_rounded));
} else {
$row = $form->addRow();
$row->addSubmit()->addClass('text-right');
$row->addSubmit()->addClass('mt-2');
}

echo $form->getOutput();
Expand Down
4 changes: 2 additions & 2 deletions resources/templates/index.twig.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
{% block beforePage %}
{% endblock beforePage %}

<div id="content-wrap" class="relative w-full min-h-1/2 flex content-start gap-4 lg:gap-6 {{ sidebar ? 'flex flex-col' : 'flex-col' }} {{ sidebarPos == 'left' ? 'lg:flex-row' : 'lg:flex-row-reverse' }} {{ sidebar and not isLoggedIn and address is not empty ? 'flex-col-reverse'}} clearfix">
<div id="content-wrap" class="relative w-full min-h-1/2 flex content-start {{ sidebar ? 'gap-4 lg:gap-6 flex flex-col' : 'flex-col' }} {{ sidebarPos == 'left' ? 'lg:flex-row' : 'lg:flex-row-reverse' }} {{ not isHomePage and not isLoggedIn ? 'flex-col-reverse'}} clearfix">

<div class="block md:hidden shadow bg-white rounded px-4 mx-4 sm:mx-0 mb-4">
{% for type, alerts in page.alerts %}
Expand All @@ -113,7 +113,7 @@
{{ include('navigation.twig.html') }}
{% endif %}

<div id="content" class="{{ contentClass ? contentClass : 'max-w-full' }} {{ isLoggedIn and menuModuleName is empty ? 'bg-gray-100' : 'bg-white pb-6'}} w-full shadow sm:rounded lg:flex-1 px-4 sm:px-8">
<div id="content" class="{{ contentClass ? contentClass : 'max-w-full' }} {{ isHomePage and isLoggedIn ? 'bg-gray-100' : 'bg-white pb-6'}} w-full shadow sm:rounded lg:flex-1 px-4 sm:px-8">

<div id="content-inner" class="h-full">

Expand Down
2 changes: 1 addition & 1 deletion src/Forms/FormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public function createAlert($content, $level = 'warning')

public function createSubmit($label = 'Submit', $id = null)
{
return (new Input\Button($label, 'submit', null, $id));
return $this->createButton($label, null, $id)->setType('submit')->addClass('text-right');
}

public function createSearchSubmit($session, $clearLabel = 'Clear Filters', $passParams = array())
Expand Down
4 changes: 3 additions & 1 deletion src/Forms/Layout/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

use Gibbon\Forms\OutputableInterface;
use Gibbon\Forms\FormFactoryInterface;
use Gibbon\Forms\Input\Button;

/**
* Holds a collection of form elements to be output vertically.
Expand Down Expand Up @@ -70,7 +71,8 @@ public function getOutput()
$output = '';

foreach ($this->getElements() as $element) {
if ($class = $this->getContainerClass($element)) {
$class = $this->getContainerClass($element);
if (!empty($class) && !$element instanceof Button) {
$output .= '<div class="'.$class.'">';
$output .= $element->getOutput();
$output .= '</div>';
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Prefab/DeleteForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static function createForm($action, $confirmation = false, $submit = true
}

if ($submit) {
$form->addRow()->addClass('text-right mt-6')->addConfirmSubmit(__('Delete'))->setColor('red');
$form->addRow()->addClass('mt-6')->addConfirmSubmit(__('Delete'))->setColor('red');
}

return $form;
Expand Down

0 comments on commit bc0a0c5

Please sign in to comment.