#include "blog_commons.html" />
<#assign manageUrl='jsp/admin/plugins/blog/ManageBlogs.jsp' />
<#assign blogTagSize=blog.tag?size />
<@pageContainer>
<@pageColumn>
<@tform name='create_blog' id='form-editor' enctype='multipart/form-data' action=manageUrl>
<@input type='hidden' id='id' name='id' value='0' />
<@input type='hidden' id='action' name='action' value='createBlog' />
<@input type='hidden' id='tag_remove' name='tag_remove' value='' />
<@pageHeader title='#i18n{blog.create_blog.pageTitle}'>
<#-- #blog-toolbar and the .action class are used by blog.js to lock saving while mandatory tags are missing -->
<@div id='blog-toolbar' class='d-flex flex-wrap align-items-center gap-1'>
<@aButton href=manageUrl color='' buttonIcon='arrow-left' title='#i18n{portal.util.labelBack}' hideTitle=['all'] />
<#-- "Appliquer" creates the post and opens it in the editor; "Créer" creates it and goes back to the list -->
<@button type='submit' class='action' color='light' id='apply_createBlog' name='button' value='update' buttonIcon='device-floppy' title='#i18n{blog.create_blog.labelApply}' hideTitle=['xs','sm'] />
<@button type='submit' class='action' color='primary' id='action_createBlog' name='action_createBlog' buttonIcon='check' title='#i18n{blog.create_blog.labelCreate}' hideTitle=['xs','sm'] />
@div>
@pageHeader>
<@messages infos=infos![] errors=errors![] />
<#if number_mandatory_tags gt 0>
<#assign alertClass><#if number_mandatory_tags lte blogTagSize>visually-hidden#if>#assign>
<@alert id='required-tag' color='warning' iconTitle='tags' class=alertClass title=i18n("blog.mandatoryTags.assign.mandatory.tags", number_mandatory_tags) />
#if>
<@row class='row-cards'>
<#-- Main column: the post itself -->
<@columns lg=9>
<@box>
<@boxBody>
<@formGroup labelFor='content_label' labelKey='#i18n{blog.create_blog.labelContentLabel}' helpKey='#i18n{blog.create_blog.labelContentLabel.help}' rows=2 mandatory=true>
<@input name='content_label' id='content_label' class='form-control-lg fw-bold' value='${blog.contentLabel!?trim}' maxlength=75 mandatory=true />
@formGroup>
<@formGroup labelFor='description' labelKey='#i18n{blog.create_blog.labelDescription}' rows=2>
<@input type='textarea' name='description' id='description' rows=3 value='${blog.description!}' maxlength=300 />
@formGroup>
<@blogHtmlContent labelKey='#i18n{blog.create_blog.labelHtmlContent}' />
@boxBody>
<@boxFooter>
<@formGroup labelFor='edit_comment' labelKey='#i18n{blog.create_blog.labelEditComment}' helpKey='#i18n{blog.create_blog.labelEditComment.help}' rows=2 class='mb-0'>
<@input name='edit_comment' id='edit_comment' value='${blog.editComment!}' />
@formGroup>
@boxFooter>
@box>
@columns>
<#-- Side column: properties, always visible (no more offcanvas) -->
<@columns lg=3>
<@div class='position-sticky top-0 d-flex flex-column gap-3'>
<@blogPropertiesCards />
<@blogOptionsCard />
@div>
@columns>
@row>
@tform>
@pageColumn>
@pageContainer>
<@blogInitEditor />
<@blogJSInit />
<#if is_crop_image>
<@modal id='imageModal' size='xl'>
<@modalHeader modalTitle='#i18n{blog.modify_blog.labelAttachment}' />
<@modalBody>
<@div id='uploadimage-group'>
<#include "/skin/plugins/uploadimage/uploadimage.html" />
<@addRequiredJsUploadImages/>
<@cropimage fieldName='attachment' file='images/admin/skin/plugins/uploadimage/picture.jpg' cssClass='text-center' synchronous='false'/>
@div>
@modalBody>
@modal>
#if>