mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Added the possibility to add additional CSS to label.
This commit is contained in:
parent
8b372a3443
commit
fde1d7be4f
6 changed files with 116 additions and 23 deletions
|
@ -195,6 +195,46 @@ class LabelOptions
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets additional CSS (it will simply be attached
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getAdditionalCss(): string
|
||||||
|
{
|
||||||
|
return $this->additional_css;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param string $additional_css
|
||||||
|
* @return LabelOptions
|
||||||
|
*/
|
||||||
|
public function setAdditionalCss(string $additional_css): LabelOptions
|
||||||
|
{
|
||||||
|
$this->additional_css = $additional_css;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLinesMode(): string
|
||||||
|
{
|
||||||
|
return $this->lines_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $lines_mode
|
||||||
|
* @return LabelOptions
|
||||||
|
*/
|
||||||
|
public function setLinesMode(string $lines_mode): LabelOptions
|
||||||
|
{
|
||||||
|
$this->lines_mode = $lines_mode;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -26,6 +26,7 @@ use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
@ -95,6 +96,15 @@ class LabelOptionsType extends AbstractType
|
||||||
],
|
],
|
||||||
'config_name' => 'label_config',
|
'config_name' => 'label_config',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$builder->add('additional_css', TextareaType::class, [
|
||||||
|
'label' => 'label_options.additional_css.label',
|
||||||
|
'empty_data' => '',
|
||||||
|
'attr' => [
|
||||||
|
'rows' => 4,
|
||||||
|
],
|
||||||
|
'required' => false,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
|
|
@ -5,17 +5,41 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block additional_pills %}
|
{% block additional_pills %}
|
||||||
<li class="nav-item"><a data-toggle="tab" class="nav-link link-anchor" href="#tab_options">{% trans %}admin.options{% endtrans %}</a></li>
|
<li class="nav-item"><a data-toggle="tab" class="nav-link link-anchor" href="#tab_advanced">{% trans %}label_profile.advanced{% endtrans %}</a></li>
|
||||||
|
<li class="nav-item"><a data-toggle="tab" class="nav-link link-anchor" href="#tab_comment">{% trans %}label_profile.comment{% endtrans %}</a></li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block additional_panes %}
|
{% block additional_panes %}
|
||||||
<div class="tab-pane" id="tab_options">
|
<div class="tab-pane" id="tab_advanced">
|
||||||
|
{{ form_row(form.options.additional_css) }}
|
||||||
{{ form_widget(form.options) }}
|
{{ form_widget(form.options) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane" id="tab_comment">
|
||||||
|
{{ form_widget(form.comment) }}
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block comment %}{% endblock %}
|
||||||
|
|
||||||
{% block additional_controls %}
|
{% block additional_controls %}
|
||||||
{{ form_row(form.show_in_dropdown) }}
|
{{ form_row(form.show_in_dropdown) }}
|
||||||
|
{{ form_row(form.options.supported_element) }}
|
||||||
|
<div class="form-group row">
|
||||||
|
{{ form_label(form.options.width) }}
|
||||||
|
<div class="input-group col-9">
|
||||||
|
{{ form_widget(form.options.width) }}
|
||||||
|
<div class="input-group-append input-group-prepend">
|
||||||
|
<span class="input-group-text">x</span>
|
||||||
|
</div>
|
||||||
|
{{ form_widget(form.options.height) }}
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text">mm</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ form_row(form.options.barcode_type) }}
|
||||||
|
{{ form_row(form.options.lines) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block additional_content %}
|
{% block additional_content %}
|
||||||
|
|
|
@ -46,25 +46,6 @@
|
||||||
{{ form_errors(form.value) }}
|
{{ form_errors(form.value) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block label_options_widget %}
|
|
||||||
{{ form_row(form.supported_element) }}
|
|
||||||
<div class="form-group row">
|
|
||||||
{{ form_label(form.width) }}
|
|
||||||
<div class="input-group col-9">
|
|
||||||
{{ form_widget(form.width) }}
|
|
||||||
<div class="input-group-append input-group-prepend">
|
|
||||||
<span class="input-group-text">x</span>
|
|
||||||
</div>
|
|
||||||
{{ form_widget(form.height) }}
|
|
||||||
<div class="input-group-append">
|
|
||||||
<span class="input-group-text">mm</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{ form_row(form.barcode_type) }}
|
|
||||||
{{ form_row(form.lines) }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{#######################################################################################
|
{#######################################################################################
|
||||||
#
|
#
|
||||||
# Definitions for Tristate Checkbox Type (mostly based on bootstrap checkbox type)
|
# Definitions for Tristate Checkbox Type (mostly based on bootstrap checkbox type)
|
||||||
|
|
|
@ -4,8 +4,45 @@
|
||||||
|
|
||||||
{% block card_content %}
|
{% block card_content %}
|
||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
{{ form_row(form.target_id) }}
|
|
||||||
{{ form_widget(form.options) }}
|
<ul class="nav nav-tabs">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-toggle="tab" id="common-tab" role="tab" aria-controls="common" aria-selected="true" href="#common">Common</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="tab" id="advanced-tab" role="tab" aria-controls="common" aria-selected="false" href="#advanced">Advanced</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content mt-2">
|
||||||
|
|
||||||
|
<div class="tab-pane active" id="common" role="tabpanel" aria-labelledby="common-tab">
|
||||||
|
{{ form_row(form.target_id) }}
|
||||||
|
|
||||||
|
{{ form_row(form.options.supported_element) }}
|
||||||
|
<div class="form-group row">
|
||||||
|
{{ form_label(form.options.width) }}
|
||||||
|
<div class="input-group col-9">
|
||||||
|
{{ form_widget(form.options.width) }}
|
||||||
|
<div class="input-group-append input-group-prepend">
|
||||||
|
<span class="input-group-text">x</span>
|
||||||
|
</div>
|
||||||
|
{{ form_widget(form.options.height) }}
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text">mm</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ form_row(form.options.barcode_type) }}
|
||||||
|
{{ form_row(form.options.lines) }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane" id="advanced" role="tabpanel" aria-labelledby="advanced-tab">
|
||||||
|
{{ form_row(form.options.additional_css) }}
|
||||||
|
{{ form_widget(form.options) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{ form_end(form) }}
|
{{ form_end(form) }}
|
||||||
{% if pdf_data %}
|
{% if pdf_data %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<meta name="keywords" content="Part-DB, Label, Barcode">
|
<meta name="keywords" content="Part-DB, Label, Barcode">
|
||||||
<style>
|
<style>
|
||||||
{% include("LabelSystem/labels/label_style.css.twig") %}
|
{% include("LabelSystem/labels/label_style.css.twig") %}
|
||||||
|
{{ options.additionalCss | escape("html") }}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue