-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lightbox to header, add tooltip to buttons and small styling adjustments (Meta #119) #63
Changes from all commits
10470f4
19d3acc
965e20d
8bc17c2
c34722b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
{# Table Header #} | ||
{% if table.option('title') or (view is defined and table.option('definition').hasCapability(constant('araise\\CrudBundle\\Enums\\Page::EXPORT'))) or (table.filterExtension and table.filterExtension.filters|length > 0) or (table.searchExtension and table.option('searchable')) %} | ||
<header class="whatwedo_table:header sm:flex sm:justify-between mb-4"> | ||
<header class="whatwedo_table:header sm:flex sm:justify-between my-3"> | ||
<div class="whatwedo_table:header__title flex-1 min-w-0 whatwedo-utility-heading-1 sm:truncate"> | ||
{% if table.option('title') %} | ||
<h1> | ||
{{ table.option('title')|trans }} | ||
</h1> | ||
{% endif %} | ||
</div> | ||
<div class="mt-4 flex sm:mt-0 sm:ml-4 space-x-2"> | ||
<div class="mt-4 flex sm:mt-0 sm:ml-4 space-x-3 items-center {{ block is defined ? ' mr-3' : '' }}"> | ||
{% if table.exporters|length > 0 and table.option('definition') and table.option('definition').hasCapability(constant('araise\\CrudBundle\\Enums\\Page::EXPORT')) %} | ||
<div | ||
{{ stimulus_controller('araise/core-bundle/dropdown') }} | ||
class="relative inline-block"> | ||
<button | ||
{{ stimulus_action('araise/core-bundle/dropdown', 'toggle') | stimulus_action('araise/core-bundle/dropdown', 'close', 'keydown.esc') }} | ||
class="whatwedo_table:header__button whatwedo_table:header__button--download whatwedo_table-button h-full" tabindex="-1" | ||
{{ stimulus_controller('araise/crud-bundle/tooltip', { 'title': 'araise_table.download.tooltip'|trans } ) }} | ||
class="whatwedo_table:header__button whatwedo_table:header__button--download whatwedo_table-button" | ||
> | ||
{{ bootstrap_icon('download', { class: 'w-4 h-4' }) }} | ||
</button> | ||
|
@@ -73,13 +74,18 @@ | |
</div> | ||
{% endif %} | ||
|
||
{% if block is defined and content is defined %} | ||
{{ _self.add_button(content, view, isOnShow) }} | ||
{% endif %} | ||
|
||
{% if table.filterExtension and table.filterExtension.filters|length > 0 %} | ||
<button | ||
class="whatwedo_table:header__button whatwedo_table:header__button--filter whatwedo_table-button whatwedo_table-button--filter {{ table.filterExtension.getFilterCount() > 0 ? 'araise_table-button--filter-active' : '' }} }}" | ||
data-filter-count="{{ table.filterExtension.getFilterCount() }}" | ||
type="button" | ||
{{ stimulus_action('araise/table-bundle/filter', 'open') }} | ||
{{ stimulus_target('araise/table-bundle/filter', 'triggerButton') }} | ||
{{ stimulus_controller('araise/crud-bundle/tooltip', { 'title': 'araise_table.filter.tooltip'|trans } ) }} | ||
> | ||
{{ bootstrap_icon('funnel-fill', { class: 'w-4 h-4' }) }} | ||
</button> | ||
|
@@ -98,17 +104,82 @@ | |
<input | ||
class="whatwedo_core-input--rounded-left" | ||
type="search" | ||
name="{{ araise_table_parameter(table, 'query') }}" placeholder="Suchbegriff ..." | ||
name="{{ araise_table_parameter(table, 'query') }}" placeholder="{{ 'araise_table.search.placeholder'|trans }}" | ||
value="{{ table.searchExtension.query }}" | ||
> | ||
</div> | ||
<button class="whatwedo_table-button--search" type="submit"> | ||
{{ bootstrap_icon('search', { class: 'h-4 w-4 text-neutral-400', alt: 'Suchen' }) }} | ||
<button class="whatwedo_table-button--search" type="submit" title="{{ 'araise_table.search.title'|trans }}"> | ||
{{ bootstrap_icon('search', { class: 'h-4 w-4 text-neutral-400' }) }} | ||
<span class="sr-only">{{ 'araise_table.search.title'|trans }}</span> | ||
</button> | ||
</div> | ||
</form> | ||
{% endif %} | ||
</div> | ||
</header> | ||
|
||
{% endif %} | ||
|
||
{% macro add_button(content, view, isOnShow) %} | ||
{% set createUrl = content.createUrl(view.data) %} | ||
{% if createUrl and (content.addVoterAttribute is null or is_granted(content.addVoterAttribute, view.data)) %} | ||
|
||
|
||
{% set additionalClass = (not isOnShow) ? (content.option('attr')['class'] ?? '') : '' %} | ||
{% set additionalAttributes = (not isOnShow) ? attr|map((value, attr) => "#{attr}=\"#{value}\"")|join(' ') : '' %} | ||
|
||
<div | ||
class="flex justify-end {{ additionalClass }}" | ||
{{ additionalAttributes|raw }} | ||
{{ stimulus_controller('araise/core-bundle/modal-form', { formUrl: createUrl }) }}> | ||
|
||
<button | ||
type="button" | ||
class="whatwedo-crud-button--action whatwedo-crud-button--rounded" | ||
{{ stimulus_action('araise/core-bundle/modal-form', 'openModal') }} | ||
{{ stimulus_controller('araise/crud-bundle/tooltip', { 'title': 'araise_crud.relation.add'|trans } ) }} | ||
> | ||
{{ bootstrap_icon('plus', { class: 'w-6 h-6' }) }} | ||
</button> | ||
|
||
<div | ||
{{ stimulus_target('araise/core-bundle/modal-form', 'menu') }} | ||
class="hidden whatwedo-crud-modal whatwedo-utility-modal" | ||
data-transition-enter-from="opacity-0" | ||
data-transition-enter-to="opacity-100" | ||
data-transition-leave-from="opacity-100" | ||
data-transition-leave-to="opacity-0" | ||
role="dialog" | ||
aria-modal="true" | ||
> | ||
<div class="whatwedo-crud-modal__overlay whatwedo-utility-modal__overlay"> | ||
<div | ||
class="whatwedo-crud-modal__backdrop whatwedo-utility-modal__backdrop" | ||
{{ stimulus_action('araise/core-bundle/modal-form', 'close', 'click') }} | ||
></div> | ||
|
||
{# This element is to trick the browser into centering the modal contents. #} | ||
<span class="hidden md:inline-block md:align-middle md:h-screen" aria-hidden="true">​</span> | ||
|
||
<div class="whatwedo-crud-modal__wrapper whatwedo-utility-modal__wrapper"> | ||
<div class="whatwedo-utility-modal__wrapper-inner"> | ||
<button | ||
type="button" | ||
class="whatwedo-crud-modal__close whatwedo-utility-modal__close" | ||
{{ stimulus_action('araise/core-bundle/modal-form', 'close') | stimulus_action('araise/core-bundle/modal-form', 'close', 'keydown.esc@window') }} | ||
> | ||
<span class="sr-only">Close</span> | ||
{{ bootstrap_icon('x', { class: 'inline w-8 h-8' }) }} | ||
</button> | ||
|
||
<div | ||
class="whatwedo-crud-modal__body w-full" | ||
{{ stimulus_target('araise/core-bundle/modal-form', 'modalBody') }} | ||
></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% endmacro %} | ||
Comment on lines
+122
to
+184
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: That macro should at least go to the bottom of the file. But the best approach would be, putting it into a separate file and importing it. The current approach works, but is the messy one. Another Nit is that the macro is using snake_case and the variables are using camelCase. The official coding standards of Twig say to use snake_case (See paragrpah https://twig.symfony.com/doc/3.x/coding_standards.html but this Nit is really out of scope as the overall code does not apply any coding standards and checks and is currently already mixed between snake_case and camelCase. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Still a button without a text or aria-label.