Compare commits

..
3 Commits
Author SHA1 Message Date
Wojtek 7d9c87bcb6 Tighten question and answer spacing 2026-10-15 13:08:26 +02:00
Wojtek b4af647616 Place question number beside text 2026-10-15 13:06:24 +02:00
Wojtek 252348a07f Expand frontend question layout 2026-10-15 13:01:37 +02:00
8 changed files with 117 additions and 8 deletions
+1 -1
View File
@@ -22,6 +22,6 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych.
## Instalacja ## Instalacja
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.8.0). W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.8.3).
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**. Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
@@ -0,0 +1 @@
-- No database changes required for version 1.8.1.
@@ -0,0 +1 @@
-- No database changes required for version 1.8.2.
@@ -0,0 +1 @@
-- No database changes required for version 1.8.3.
+1 -1
View File
@@ -4,7 +4,7 @@
<creationDate>2026-10-14</creationDate> <creationDate>2026-10-14</creationDate>
<author>Komponent</author> <author>Komponent</author>
<license>GNU General Public License version 2 or later</license> <license>GNU General Public License version 2 or later</license>
<version>1.8.0</version> <version>1.8.3</version>
<description>COM_TESTQUESTIONS_DESCRIPTION</description> <description>COM_TESTQUESTIONS_DESCRIPTION</description>
<element>com_testquestions</element> <element>com_testquestions</element>
<namespace path="src">Komponent\Component\Testquestions</namespace> <namespace path="src">Komponent\Component\Testquestions</namespace>
+55 -3
View File
@@ -1,3 +1,16 @@
.com-testquestions {
width: 100%;
max-width: 100%;
box-sizing: border-box;
}
.com-testquestions .testquestion {
display: block;
width: 100%;
max-width: 100%;
box-sizing: border-box;
}
.com-testquestions .timer-container { .com-testquestions .timer-container {
position: relative; position: relative;
width: 120px; width: 120px;
@@ -41,7 +54,8 @@
margin: 25px 5px 11px; margin: 25px 5px 11px;
border: 1px #dfe3e7 solid; border: 1px #dfe3e7 solid;
border-radius: .25rem; border-radius: .25rem;
width: 98%; width: 100%;
box-sizing: border-box;
padding: 10px; padding: 10px;
text-align: left; text-align: left;
color: white; color: white;
@@ -54,6 +68,31 @@
font-size: inherit; font-size: inherit;
} }
.com-testquestions .question-header {
display: flex;
align-items: flex-start;
gap: .25rem;
}
.com-testquestions .question-number {
flex: 0 0 auto;
white-space: nowrap;
font-weight: 700;
}
.com-testquestions .question-text {
flex: 1 1 auto;
min-width: 0;
}
.com-testquestions .question-text > :first-child {
margin-top: 0;
}
.com-testquestions .question-text > :last-child {
margin-bottom: 0;
}
.com-testquestions .odp, .com-testquestions .odp,
.com-testquestions .odpp, .com-testquestions .odpp,
.com-testquestions .odpu, .com-testquestions .odpu,
@@ -62,7 +101,8 @@
margin: 5px; margin: 5px;
border: 1px #dfe3e7 solid; border: 1px #dfe3e7 solid;
border-radius: .25rem; border-radius: .25rem;
width: 98%; width: 100%;
box-sizing: border-box;
padding: 10px; padding: 10px;
text-align: left; text-align: left;
box-shadow: 2px 2px 2px rgba(0, 0, 0, .2); box-shadow: 2px 2px 2px rgba(0, 0, 0, .2);
@@ -105,10 +145,22 @@
} }
.com-testquestions .answer-list label { .com-testquestions .answer-list label {
display: block; display: flex;
align-items: flex-start;
gap: .25rem;
cursor: pointer; cursor: pointer;
} }
.com-testquestions .answer-list label input {
flex: 0 0 auto;
margin-top: .25rem;
}
.com-testquestions .answer-text {
flex: 1 1 auto;
min-width: 0;
}
.com-testquestions select.egzamin { .com-testquestions select.egzamin {
color: #4a86cf; color: #4a86cf;
padding: 5px; padding: 5px;
@@ -36,7 +36,12 @@ use Joomla\CMS\HTML\HTMLHelper;
<form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8'); ?>" method="post"> <form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8'); ?>" method="post">
<?php foreach ($this->items as $number => $item) : ?> <?php foreach ($this->items as $number => $item) : ?>
<article class="testquestion mb-4"> <article class="testquestion mb-4">
<div class="pyt"><h2><?php echo ($number + 1) . '. '; ?><?php echo $item->question; ?></h2></div> <div class="pyt">
<div class="question-header">
<span class="question-number"><?php echo ($number + 1) . '.'; ?></span>
<div class="question-text"><?php echo $item->question; ?></div>
</div>
</div>
<?php if ($item->image) : ?> <?php if ($item->image) : ?>
<div class="foto_pyt"><img src="<?php echo htmlspecialchars($item->image, ENT_QUOTES, 'UTF-8'); ?>" alt="" loading="lazy"></div> <div class="foto_pyt"><img src="<?php echo htmlspecialchars($item->image, ENT_QUOTES, 'UTF-8'); ?>" alt="" loading="lazy"></div>
<?php endif; ?> <?php endif; ?>
@@ -53,7 +58,8 @@ use Joomla\CMS\HTML\HTMLHelper;
<li class="<?php echo $isSelected && $this->results['items'][$item->id]['correct'] ? 'odpup' : ($isSelected ? 'odpu' : ($isCorrectAnswer ? 'odpp' : 'odp')); ?>"> <li class="<?php echo $isSelected && $this->results['items'][$item->id]['correct'] ? 'odpup' : ($isSelected ? 'odpu' : ($isCorrectAnswer ? 'odpp' : 'odp')); ?>">
<label> <label>
<input type="radio" name="answers[<?php echo (int) $item->id; ?>]" value="<?php echo $answerIndex + 1; ?>" <?php echo $isSelected ? 'checked' : ''; ?>> <input type="radio" name="answers[<?php echo (int) $item->id; ?>]" value="<?php echo $answerIndex + 1; ?>" <?php echo $isSelected ? 'checked' : ''; ?>>
<strong><?php echo chr(65 + $answerIndex); ?>.</strong> <?php echo $item->$answerField; ?> <strong><?php echo chr(65 + $answerIndex); ?>.</strong>
<span class="answer-text"><?php echo $item->$answerField; ?></span>
<?php if ($isSelected) : ?> <?php if ($isSelected) : ?>
<span class="badge bg-info"><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_SELECTED_ANSWER'); ?></span> <span class="badge bg-info"><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_SELECTED_ANSWER'); ?></span>
<?php endif; ?> <?php endif; ?>
+48
View File
@@ -127,3 +127,51 @@ div.odpup
margin-right:10px; margin-right:10px;
} }
.com-testquestions {
width: 100%;
max-width: 100%;
box-sizing: border-box;
}
.com-testquestions .testquestion {
display: block;
width: 100%;
max-width: 100%;
box-sizing: border-box;
}
.com-testquestions .pyt,
.com-testquestions .odp,
.com-testquestions .odpp,
.com-testquestions .odpu,
.com-testquestions .odpup {
box-sizing: border-box;
}
.com-testquestions .question-header {
display: flex;
align-items: flex-start;
gap: .25rem;
}
.com-testquestions .question-number {
flex: 0 0 auto;
white-space: nowrap;
font-weight: 700;
}
.com-testquestions .question-text {
flex: 1 1 auto;
min-width: 0;
}
.com-testquestions .answer-list label {
display: flex;
align-items: flex-start;
gap: .25rem;
}
.com-testquestions .answer-text {
flex: 1 1 auto;
min-width: 0;
}