Skip to content

Commit

Permalink
189: improve event edition
Browse files Browse the repository at this point in the history
- add "rows" attribute to the text area
- remove annoying max and min attribute contraints
  • Loading branch information
Atmos4 committed Apr 10, 2024
1 parent 6d4c29e commit c67db93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/pages/events/event_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<?= $limit_date->render() ?>
</div>
<?= $bulletin_url->render() ?>
<?= $description->render() ?>
<?= $description->attributes(["rows" => "8"])->render() ?>
</div>
</article>
</form>
12 changes: 6 additions & 6 deletions engine/validation/fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,19 +279,17 @@ function check(string $msg = null)
}

/** Set upper date limit */
function max(string|null $date, string $msg = null, bool $addAttribute = true)
function max(string|null $date, string $msg = null)
{
$addAttribute ? $this->attributes(["max" => $date ?? ""]) : null;
if ($this->should_test() && $date && strtotime($this->value) > strtotime($date)) {
$this->set_error($msg ?? "Trop tard");
}
return $this;
}

/** Set lower date limit */
function min(string|null $date, string $msg = null, bool $addAttribute = true)
function min(string|null $date, string $msg = null)
{
$addAttribute ? $this->attributes(["min" => $date ?? ""]) : null;
if ($this->should_test() && $date && strtotime($this->value) < strtotime($date)) {
$this->set_error($msg ?? "Trop tôt");
}
Expand Down Expand Up @@ -365,12 +363,14 @@ class UploadField extends Field
'image/jp2',
'image/heif'
],
'doc' => ['application/msword',
'doc' => [
'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.ms-word.document.macroEnabled.12',
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'application/vnd.ms-word.template.macroEnabled.12',
'application/vnd.oasis.opendocument.text',],
'application/vnd.oasis.opendocument.text',
],
'pdf' => ['application/pdf'],
'excel' => [
'application/vnd.ms-excel',
Expand Down

0 comments on commit c67db93

Please sign in to comment.