Skip to content
Snippets Groups Projects
Commit fcfc2077 authored by alexisben's avatar alexisben
Browse files

Block key_figures

parent 70136e11
No related branches found
No related tags found
No related merge requests found
app/assets/images/communication/blocks/templates/key_figures.jpg

17.6 KiB

......@@ -46,6 +46,7 @@ class Communication::Block < ApplicationRecord
partners: 200,
posts: 500,
pages: 600,
key_figures: 56,
}
before_save :update_template_images
......
class Communication::Block::Template::KeyFigure < Communication::Block::Template
def build_git_dependencies
end
def figures
@figures ||= elements.map { |element| figure(element) }
.compact
end
protected
def figure(element)
element.to_dot
end
end
<a class="<%= button_classes('mb-4') %>"
v-on:click="data.elements.push({number: 0, unit: '', description: ''})">
<%= t '.add_key' %>
</a>
<draggable :list="data.elements" handle=".dragHandle" class="row">
<div v-for="(key, index) in data.elements" class="col-md-4">
<div class="card">
<div class="card-body">
<div class="d-flex">
<div>
<a class="btn ps-0 pt-0 dragHandle">
<i class="fa fa-bars handle"></i>
</a>
</div>
<div class="flex-fill">
<label class="form-label"
:for="'key-' + index + '-number'"><%= t '.number_label' %></label>
<input class="form-control mb-3"
v-model="key.number"
placeholder="<%= t '.number_placeholder' %>"
type="number"
:id="'key-' + index + '-number'" />
<label class="form-label"
:for="'key-' + index + '-unit'"><%= t '.unit_label' %></label>
<input class="form-control mb-3"
v-model="key.unit"
placeholder="<%= t '.unit_placeholder' %>"
:id="'key-' + index + '-unit'">
<label class="form-label"
:for="'key-' + index + '-description'"><%= t '.description_label' %></label>
<input class="form-control mb-3"
v-model="key.description"
placeholder="<%= t '.description_placeholder' %>"
:id="'key-' + index + '-description'">
</div>
<div>
<a class="btn btn-sm btn-danger ms-3"
v-on:click="data.elements.splice(data.elements.indexOf(key), 1)"
title="<%= t '.remove_key' %>">
<i class="fas fa-times"></i>
</a>
</div>
</div>
</div>
</div>
</div>
</draggable>
figures:
<% block.template.figures.each do |figure| %>
- number: >-
<%= prepare_text_for_static figure.number, 6 %>
unit: >-
<%= prepare_text_for_static figure.unit, 6 %>
description: >-
<%= prepare_text_for_static figure.description, 6 %>
<% end %>
......@@ -196,6 +196,16 @@ en:
text_label: Text
text_placeholder: Enter text
remove_image: Remove image
key_figures:
edit:
add_key: Add key figure
unit_label: Unit
unit_placeholder: Enter unit here
number_label: Number
number_placeholder: Enter key figure's value here
description_label: Description
description_placeholder: Enter description here
remove_key: Remove key figure
organization_chart:
edit:
add_person: Add person
......
......@@ -197,6 +197,16 @@ fr:
text_label: Texte
text_placeholder: Entrer le texte
remove_image: Enlever l'image
key_figures:
edit:
add_key: Add key figure
unit_label: Unit
unit_placeholder: Enter unit here
number_label: Number
number_placeholder: Enter key figure's value here
description_label: Description
description_placeholder: Enter description here
remove_key: Remove key figure
organization_chart:
edit:
add_person: Ajouter une personne
......
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