Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,19 @@

namespace Novactive\Bundle\NovaeZEditHelpBundle\Command;

use eZ\Publish\API\Repository\Exceptions\ForbiddenException;
use eZ\Publish\API\Repository\Exceptions\NotFoundException;
use eZ\Publish\API\Repository\Exceptions\UnauthorizedException;
use eZ\Publish\API\Repository\Repository;
use eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroupCreateStruct;
use Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException;
use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException;
use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException;
use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroupCreateStruct;
use Novactive\Bundle\NovaeZEditHelpBundle\Services\FetchDocumentation;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

final class CreateContentTypeCommand extends Command
{
/**
* @var Repository
*/
private $repository;
private Repository $repository;

/**
* @required
Expand Down Expand Up @@ -140,9 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$contentTypeDraft->id
)
);
} catch (UnauthorizedException $e) {
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
} catch (ForbiddenException $e) {
} catch (UnauthorizedException|ForbiddenException $e) {
$output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
}
}
Expand Down
15 changes: 6 additions & 9 deletions components/EditHelpBundle/bundle/Listener/PreContentView.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@

namespace Novactive\Bundle\NovaeZEditHelpBundle\Listener;

use eZ\Publish\Core\MVC\Symfony\Event\PreContentViewEvent;
use EzSystems\EzPlatformContentForms\Content\View\ContentCreateView;
use EzSystems\EzPlatformContentForms\Content\View\ContentEditView;
use Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent;
use Ibexa\ContentForms\Content\View\ContentCreateView;
use Ibexa\ContentForms\Content\View\ContentEditView;
use Novactive\Bundle\NovaeZEditHelpBundle\Services\FetchDocumentation;

class PreContentView
{
protected $fetchDocumentation;

public function __construct(FetchDocumentation $fetchDocumentation)
{
$this->fetchDocumentation = $fetchDocumentation;
}
public function __construct(
protected FetchDocumentation $fetchDocumentation
) { }

public function onPreContentView(PreContentViewEvent $event): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

{% block form_before %}
{{ parent() }}
{% include "@ezdesign/content/edit/tophelp.html.twig" %}
{% include "@ibexadesign/content/edit/tophelp.html.twig" %}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,24 +1,59 @@
{#

@var Content documentation
@var Content[] documentation_items (Indexé par l'identifier du field

extend_from_template = "@ibexadesign/content/edit/edit.html.twig"

@admin/content/edit/edit_help.html.twig (templates/themes/admin/content/edit/edit_help.html.twig)
@admin/content/edit/edit.html.twig (@admin/content/edit/edit.html.twig)
@IbexaAdminUi/themes/admin/content/edit_base.html.twig (@IbexaAdminUi/themes/admin/content/edit_base.html.twig)
@IbexaAdminUi/themes/admin/ui/edit_base.html.twig (@IbexaAdminUi/themes/admin/ui/edit_base.html.twig)
@IbexaAdminUi/themes/admin/ui/layout.html.twig (@IbexaAdminUi/themes/admin/ui/layout.html.twig)

#}
{% extends extend_from_template %}

{% trans_default_domain 'content_edit' %}

{% block form_before %}
{{ parent() }}
{% include "@ezdesign/content/edit/tophelp.html.twig" %}
{% include "@ibexadesign/content/edit/tophelp.html.twig" %}
{% endblock %}

{% block form_fields %}
{#
TODO Cette partie du bundle est a revoir en respecter la nouvelle façon de présenter le formulaire d'édition sans le casser.
#}
{% block form_fields__TODO %}

{# <div class="card ibexa-card ibexa-card--light">#}
{# <div class="card-body">#}
{# {{ parent() }}#}
{# {{ form_widget(form.publish, {'attr': {'hidden': 'hidden'}}) }}#}
{# {{ form_widget(form.saveDraft, {'attr': {'hidden': 'hidden'}}) }}#}
{# {{ form_widget(form.cancel, {'attr': {'hidden': 'hidden'}}) }}#}
{# </div>#}
{# </div>#}





<section class="container mt-4 px-5 mb-5">
<div class="card ez-card">

{% set items = items|default({}) %}

<div class="card ibexa-card ibexa-card--light">
<div class="card-body">

{% for field in form.fieldsData if not field.rendered -%}
{% for field in form.fieldsData -%}
{# {% not field.rendered %}#}
{% if field.value is defined %}
{% if items[field.vars.name] is defined %}

<div class="position-absolute" data-toggle="modal" data-target="#modal-{{ field.vars.name }}"
aria-expanded="false" aria-controls="modal-{{ field.vars.name }}">

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="20px" height="20px" viewBox="0 0 20 20" version="1.1">
<g>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,59 +1,70 @@
{% trans_default_domain 'ezedithelp' %}
{% if documentation is defined %}
<div class="alert alert-primary alert-dismissible fade show" role="alert">
<p>{{ "edithelp.alert"|trans }}:</p>
<div class="row">
<div class="col-4">
<div class="card p-2">
{% if not ez_field_is_empty(documentation, 'image') %}
{{ ez_render_field(documentation, 'image') }}
{% endif %}
<div class="card-body">
{% if not ez_field_is_empty(documentation, 'title') %}
<h5>{{ ez_render_field(documentation, 'title') }}</h5>
{% endif %}
{% if not ez_field_is_empty(documentation, 'body') %}
{{ ez_render_field(documentation, 'body') }}
{% endif %}
</div>
</div>
</div>
<div class="col-8">
<div class="alert ibexa-alert ibexa-alert--info ibexa-alert--toast" role="alert">
<div class="ibexa-alert__content ">
<div class="ibexa-alert__title">{{ "edithelp.alert"|trans }}:</div>
<div class="ibexa-alert__extra_content">
<div class="row">
<div class="col-3">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
{% for identifier,item in documentation_items %}
<a class="nav-link {% if loop.first %} active {% endif %}" id="{{ identifier }}" data-toggle="pill" href="#v-pills-{{ identifier }}" role="tab">
{% if not ez_field_is_empty(item, 'title') %}
{{ ez_render_field(item, 'title') }}
{% else %}
{{ identifier }}
{% endif %}
</a>
{% endfor %}
<div class="col-4">
<div class="card p-2">
{% if not ibexa_field_is_empty(documentation, 'image') %}
{{ ibexa_render_field(documentation, 'image', {
template: '@ibexadesign/fields/simple_ezimage_field.html.twig'
}) }}
{% endif %}
<div class="card-body">
{% if not ibexa_field_is_empty(documentation, 'title') %}
<h5>{{ ibexa_render_field(documentation, 'title') }}</h5>
{% endif %}
{% if not ibexa_field_is_empty(documentation, 'body') %}
{{ ibexa_render_field(documentation, 'body') }}
{% endif %}
</div>
</div>
</div>
<div class="col-9">
<div class="tab-content" id="v-pills-tabContent">
{% for identifier,item in documentation_items %}
<div class="tab-pane fade show {% if loop.first %} active {% endif %}" id="v-pills-{{ identifier }}" role="tabpanel">
{% if item != 'identifier' and not ez_field_is_empty(item, identifier) %}
{% if not ez_field_is_empty(item, 'body') %}
{{ ez_render_field(item, 'body') }}
{% endif %}
{% if not ez_field_is_empty(item, 'image') %}
{{ ez_render_field(item, 'image') }}
{% endif %}
{% endif %}
<div class="col-8">
<div class="row">
<div class="col-3">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
{% for identifier, item in documentation_items %}
<a class="nav-link {% if loop.first %} active {% endif %}" id="{{ identifier }}" data-bs-toggle="pill"
href="#v-pills-{{ identifier }}"
data-bs-target="#v-pills-{{ identifier }}"
role="tab">
{% if not ibexa_field_is_empty(item, 'title') %}
{{ ibexa_render_field(item, 'title') }}
{% else %}
{{ identifier }}
{% endif %}
</a>
{% endfor %}
</div>
</div>
<div class="col-9">
<div class="tab-content" id="v-pills-tabContent">
{% for identifier, item in documentation_items %}
<div class="tab-pane fade show {% if loop.first %} active {% endif %}" id="v-pills-{{ identifier }}" role="tabpanel">
{% if not ibexa_field_is_empty(item, 'body') %}
{{ ibexa_render_field(item, 'body') }}
{% endif %}
{% if not ibexa_field_is_empty(item, 'image') %}
{{ ibexa_render_field(item, 'image', {
template: '@ibexadesign/fields/simple_ezimage_field.html.twig'
}) }}
{% endif %}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
<button class="btn ibexa-btn ibexa-btn--ghost ibexa-btn--small ibexa-btn--no-text ibexa-alert__close-btn" data-bs-dismiss="alert">
<svg class="ibexa-icon ibexa-icon--tiny-small">
<use xlink:href="/bundles/ibexaicons/img/all-icons.svg#discard"></use>
</svg>
</button>
</div>
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends '@IbexaAdminUi/themes/admin/ui/field_type/preview/content_fields.html.twig' %}

{% block ezimage_field %}
{% apply spaceless %}
{% if not ibexa_field_is_empty( content, field ) %}
{% set imageAlias = ibexa_image_alias( field, versionInfo, parameters.alias|default( 'original' ) ) %}
{% set src = imageAlias ? asset( imageAlias.uri ) : "//:0" %}
{% set attr = attr|merge({'class': (attr.class|default('') ~ ' ez-field-preview ez-field-preview--ezimage')|trim}) %}
<div {{ block( 'field_attributes' ) }}>
<div class="ez-field-preview__image-wrapper">
<div class="ez-field-preview__image">
<img src="{{ src }}">
</div>
</div>
</div>
{% endif %}
{% endapply %}
{% endblock %}
12 changes: 3 additions & 9 deletions components/EditHelpBundle/bundle/Services/FetchDocumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,9 @@ class FetchDocumentation
{
public const TOOLTIP_CONTENT_TYPE = 'nova_help_tooltip';

/**
* @var Repository
*/
protected $repository;

public function __construct(Repository $repository)
{
$this->repository = $repository;
}
public function __construct(
protected Repository $repository
) { }

public function getByContentType(ContentType $contentType): ?Content
{
Expand Down
4 changes: 2 additions & 2 deletions components/EditHelpBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ezplatform"
],
"homepage": "https://github.com/Novactive/NovaeZEditHelpBundle",
"type": "ezplatform-bundle",
"type": "ibexa-bundle",
"authors": [
{
"name": "AlmaviaCX",
Expand All @@ -20,7 +20,7 @@
"MIT"
],
"require": {
"php": "^7.3"
"php": "^8.1"
},
"autoload": {
"psr-4": {
Expand Down