<!-- BEGIN [% component.name %] -->
[% IF vars.input_error # after 'forward' %]
<div class="container alert alert-warning my-3" role="alert">[% vars.input_error %]</div>
[% ELSIF deferred.input_success # after 'redirect' %]
<div class="container alert alert-success my-3" role="alert">Input success ...</div>
[% END %]
[%# PROCESS dumper.tt dump = entry %]
[% SET label = 'Submit'; # default
IF entry; # has content
IF vars.is_edit;
SET link = uri_for_section.infolib.update;
ELSE;
SET link = uri_for_section.infolib.edit;
SET label ='Edit'; # override
END;
link = link _ '/' _ entry.id;
ELSE; # new document
SET link = uri_for_section.infolib.create;
END;
%]
<div class="">
<form hx-post="[% link %]" hx-target="#hx-container">
<div class="my-3">
<div class="input-group flex-nowrap">
<span class="input-group-text col-md-2" id="title">Title</span>
<input type="text" class="form-control" [% IF entry.title %]
value="[% entry.title %]" [% 'disabled' IF NOT vars.is_edit %]
[% ELSE %]required="true"[% END %] aria-label="title" name="title"
placeholder="">
</div>
[% IF entry.time AND NOT vars.is_edit;
USE date(format = '%d/%m/%Y @ %H:%M') %]
<div class="input-group flex-nowrap">
<span class="input-group-text col-md-2 id="title">Created</span>
<input type="text" class="form-control" disabled aria-label="created"
value="[% date.format(entry.time) %] [#[% entry.id %]]">
</div>
<div id="content">[% entry.content | html %]</div>
[% ELSE %]
<div class="mb-3">
<textarea class="form-control" id="content" rows="5" name="content"
required="true">[% entry.content %]</textarea>
</div>
[% END %]
</div>
<div class="my-3">
<button type="submit" class="btn btn-outline-primary">[% label %]</button>
<button type="reset" class="btn btn-outline-secondary">Clear</button>
</div>
</form>
</div>
<!-- END [% component.name %] -->