Skip to content

Commit

Permalink
small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tischsoic committed Apr 11, 2022
1 parent 305429d commit e249408
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/bundle/Resources/public/js/scripts/adaptive.filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const adaptiveFilters = doc.querySelectorAll('.ibexa-adaptive-filters');
const initializeAdaptiveFilters = (adaptiveFilter) => {
const adaptiveItemsContainer = adaptiveFilter.querySelector('.ibexa-adaptive-filters__items');
const adaptiveItemsCollapsibleContainer = adaptiveFilter.querySelector('.ibexa-adaptive-filters__hidden');
const adaptiveItemsCollapsibleContainer = adaptiveFilter.querySelector('.ibexa-adaptive-filters__collapsible');
const actionsContainer = adaptiveFilter.querySelector('.ibexa-adaptive-filters__actions');
const toggleBtn = adaptiveFilter.querySelector('.ibexa-adaptive-filters__toggler');
const collapse = global.bootstrap.Collapse.getOrCreateInstance(adaptiveItemsCollapsibleContainer, {
Expand Down
4 changes: 2 additions & 2 deletions src/bundle/Resources/public/scss/_adaptive-filters.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
margin: calculateRem(-33px) calculateRem(-33px) calculateRem(24px) calculateRem(-33px);
}

&__main {
&__visible {
display: flex;
align-items: flex-end;
width: 100%;
Expand Down Expand Up @@ -76,7 +76,7 @@
overflow: hidden;
}

&__hidden {
&__collapsible {
display: flex;
padding: calculateRem(8px) 0 calculateRem(16px);
border-top: calculateRem(1px) solid $ibexa-color-light;
Expand Down
31 changes: 31 additions & 0 deletions src/bundle/Resources/translations/adaptive_filters.en.xliff
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
<file source-language="en" target-language="en" datatype="plaintext" original="not.available">
<header>
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
</header>
<body>
<trans-unit id="c01c090bbfe9cd32a0a37ffc5727688abe01c30f" resname="actions.apply_btn">
<source>Apply</source>
<target state="new">Apply</target>
<note>key: actions.apply_btn</note>
</trans-unit>
<trans-unit id="e3eeaff256b4c7e7597477c8ab94aca52265d5b8" resname="actions.clear_btn">
<source>Clear filters</source>
<target state="new">Clear filters</target>
<note>key: actions.clear_btn</note>
</trans-unit>
<trans-unit id="67fc4ec6b05265db6a275d88f8df4e09c727fa58" resname="toggler.close">
<source>Less filters</source>
<target state="new">Less filters</target>
<note>key: toggler.close</note>
</trans-unit>
<trans-unit id="3d0affb0e0a5f08df3390232a861d63d283d6b1d" resname="toggler.open">
<source>More filters</source>
<target state="new">More filters</target>
<note>key: toggler.open</note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% import "@ibexadesign/ui/component/macros.html.twig" as html %}

{% trans_default_domain 'ibexa_adaptive_filters' %}
{% trans_default_domain 'adaptive_filters' %}

{% set attr = attr|default({})|merge({
class: ('ibexa-adaptive-filters '
Expand All @@ -15,7 +15,7 @@
{% set collapse_id = collapse_id|default('ibexa-adaptive-filters-collapse-' ~ random()) %}

{{ form_start(form, { attr: attr|merge(attr_form)}) }}
<div class="ibexa-adaptive-filters__main">
<div class="ibexa-adaptive-filters__visible">
<div class="ibexa-adaptive-filters__static-left">
{% block static_left %}
<div class="form-group">
Expand All @@ -25,13 +25,15 @@
{% endblock %}
</div>
<div class="ibexa-adaptive-filters__items ibexa-adaptive-filters__items--empty ibexa-adaptive-items">
{% block collapsible_items %}
{% for item in collapsible_items %}
{% include '@ibexadesign/ui/component/adaptive_filters/adaptive_filters_item.html.twig' with {
content: item,
} %}
{% endfor %}
{% endblock %}
{% if not no_collapsible_items|default(false) %}
{% block collapsible_items %}
{% for item in collapsible_items %}
{% include '@ibexadesign/ui/component/adaptive_filters/adaptive_filters_item.html.twig' with {
content: item,
} %}
{% endfor %}
{% endblock %}
{% endif %}
<div class="ibexa-adaptive-filters__actions ibexa-adaptive-items__item ibexa-adaptive-items__item--force-show">
{% block actions %}
<button
Expand Down Expand Up @@ -83,5 +85,5 @@
</div>
</div>
</div>
<div class="ibexa-adaptive-filters__hidden collapse" id="{{ collapse_id }}"></div>
<div class="ibexa-adaptive-filters__collapsible collapse" id="{{ collapse_id }}"></div>
{{ form_end(form) }}

0 comments on commit e249408

Please sign in to comment.