Skip to content
Snippets Groups Projects
Commit 5a837baf authored by Arnaud Levy's avatar Arnaud Levy
Browse files

image

parent 4a06791d
No related branches found
No related tags found
No related merge requests found
class Communication::Block::Template::Image < Communication::Block::Template
def build_git_dependencies
add_dependency image&.blob
end
def image
blob = find_blob data, 'image'
return if blob.nil?
{
blob: blob,
alt: data['image_alt'],
credit: data['image_credit']
}.to_dot
end
def text
"#{data['text']}"
end
end
<div class="row mb-5">
<div class="col-xxl-4 col-md-6">
<div v-if="!data.image">
<label class="form-label"
for="image">
<%= t 'admin.communication.blocks.components.image.input.label' %>
</label>
<input class="form-control mb-4"
type="file"
accept="image/*"
@change="onFileImageChange( $event, data, 'image' )"
id="image">
</div>
<div v-if="data.image">
<img :src="getImageUrl(data.image)"
class="img-fluid"
style="max-height: 80px"
/>
<br>
<a class="btn btn-sm btn-danger mt-2"
v-on:click="data.image=null">
<i class="fas fa-times"></i>
<%= t 'admin.communication.blocks.components.image.input.remove' %>
</a>
</div>
</div>
<div class="col-xxl-4 col-md-6">
<label class="form-label"
for="image_alt">
<%= t 'admin.communication.blocks.components.image.alt.label' %>
</label>
<input id="image_alt"
type="text"
class="form-control mb-3"
v-model="data.image_alt"
placeholder="<%= t 'admin.communication.blocks.components.image.alt.placeholder' %>" />
<label class="form-label"
for="image_credit">
<%= t 'admin.communication.blocks.components.image.credit.label' %>
</label>
<input id="image_alt"
type="text"
class="form-control mb-3"
v-model="data.image_credit"
placeholder="<%= t 'admin.communication.blocks.components.image.credit.placeholder' %>" />
<label class="form-label"
for="text">
<%= t 'admin.communication.blocks.components.text.label' %>
</label>
<div class="summernote">
<textarea id="text"
class="form-control summernote-vue"
v-model="data.text"
data-summernote-config="mini"
placeholder="<%= t 'admin.communication.blocks.components.text.placeholder' %>"></textarea>
</div>
</div>
</div>
<div class="<%= 'row' unless @preview %>">
<div class="<%= 'col-lg-3' unless @preview %>">
<% if @block.template.image %>
<%= kamifusen_tag @block.template.image.blob,
width: 600,
alt: @block.template.image.alt,
class: 'img-fluid' %>
<% end %>
</div>
<div class="<%= 'col-lg-3' unless @preview %>">
<caption><%= @block.template.image.alt %></caption>
<p class="small"><%= @block.template.image.credit %></p>
</div>
<div class="<%= 'col-lg-4' unless @preview %>">
<%= @block.template.text.html_safe %>
</div>
</div>
text: >-
<%= prepare_html_for_static block.template.text, about.university %>
<% if block.template.image %>
image:
file: "<%= block.template.image.blob.id %>"
alt: <%= prepare_text_for_static block.template.image.alt %>
credit: <%= prepare_text_for_static block.template.image.credit %>
<% end %>
......@@ -123,6 +123,20 @@ en:
admin:
communication:
blocks:
components:
text:
label: Text
placeholder: Enter text
image:
input:
label: Image (.png, .jpg, .svg)
remove: Remove image
alt:
label: Alternative text
placeholder: Enter alternative text
credit:
label: Credit
placeholder: Enter credit
template_kinds:
chapter:
edit:
......@@ -130,6 +144,22 @@ en:
notes_placeholder: Enter notes
text_label: Text
text_placeholder: Enter text
call_to_action:
edit:
text_label: Text
text_placeholder: Enter text here
url_label: Link
url_placeholder: Enter the URL with "https://..."
buttons: Action buttons
button_1: Primary button
button_2: Secondary button
button_label: Text
button_placeholder: Enter the button text here
image_title: Image
image_label: File
remove_image: Remove image
image_alt_label: Alternative text
image_alt_placeholder: Enter text description
gallery:
edit:
add_image: Add image
......@@ -186,22 +216,6 @@ en:
title_placeholder: Enter title here
text_label: Text
text_placeholder: Enter text here
call_to_action:
edit:
text_label: Text
text_placeholder: Enter text here
url_label: Lien
url_placeholder: Enter the URL with "https://..."
buttons: Action buttons
button_1: Primary button
button_2: Secondary button
button_label: Text
button_placeholder: Enter the button text here
image_title: Image
image_label: Fichier
remove_image: Supprimer l'image
image_alt_label: Texte alternatif
image_alt_placeholder: Entrer le texte alternatif de l'image ici
website:
pages:
delete_special_page_notice: Can't delete this page
......@@ -317,14 +331,19 @@ en:
template:
call_to_action: Call to action
chapter: Chapter
datatable: Table
definitions: Definitions
embed: HTML embed
files: Files
gallery: Gallery
image: Image
organization_chart: Organization chart
pages: Pages
partners: Partners
posts: Posts
testimonials: Testimonials
timeline: Timeline
video: Video
website:
menu:
item:
......
......@@ -319,14 +319,19 @@ fr:
template_kind:
call_to_action: Appel à actions
chapter: Chapitre
datatable: Tableau
definitions: Définitions
embed: Intégration HTML
files: Fichiers
gallery: Galerie
image: Image
organization_chart: Organigramme
pages: Liste de pages
partners: Partenaires
posts: Liste d'actualités
testimonials: Témoignages
timeline: Frise chronologique
video: Vidéo
website:
menu:
item:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment