Skip to content

Commit

Permalink
[Admin] Fixed bug with editing checkbox attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zales0123 committed Jun 20, 2016
1 parent 38355f9 commit de17f28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 6 additions & 6 deletions Resources/views/Product/Attribute/attributeValues.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<div class="attribute" data-id="{{ attributeId }}">
{% set id = form.vars.label|replace(' ', '_')|lower %}
{% if 'type_checkbox' in form.vars.cache_key %}
{{ _self.checkboxField(form, count, id, subject, metadata) }}
{{ _self.checkboxField(form, count, id, subject, metadata.applicationName) }}
{% else %}
{{ _self.textField(form, count, id, subject, metadata) }}
{{ _self.textField(form, count, id, subject, metadata.applicationName) }}
{% endif %}
<input type="hidden"
name="{{ metadata.applicationName }}_{{ subject }}[attributes][{{ count }}][attribute]"
Expand All @@ -29,19 +29,19 @@
{% endif %}
{% endmacro %}

{% macro textField(form, count, id, subject, metadata) %}
{% macro textField(form, count, id, subject, applicationName) %}
<div class="ui right fluid labeled input" style="margin-top: 15px; margin-bottom: 15px;">
<div class="ui label">{{ form.vars.label }}</div>
{{ _self.formField(form, count, id, '', subject, metadata.applicationName) }}
{{ _self.formField(form, count, id, '', subject, applicationName) }}
<button class="ui red right labeled icon button">
<i class="remove icon"></i> {{ 'sylius.ui.delete'|trans }}
</button>
</div>
{% endmacro %}

{% macro checkboxField(form, count, id, subject, metadata) %}
{% macro checkboxField(form, count, id, subject, applicationName) %}
<div class="ui toggle checkbox" style="margin-top: 15px; margin-bottom: 15px;">
{{ _self.formField(form, count, id, '', subject, metadata.applicationName) }}
{{ _self.formField(form, count, id, '', subject, applicationName) }}
<label>{{ form.vars.label }}</label>
</div>
<button class="ui red right labeled icon button" style="float: right;">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{% from '@SyliusAdmin/Product/Attribute/attributeValues.html.twig' import checkboxField %}
{% from '@SyliusAdmin/Product/Attribute/attributeValues.html.twig' import textField %}


{% block collection_widget -%}
{% from 'SyliusResourceBundle:Macros:notification.html.twig' import error %}
{% set attr = attr|merge({'class': attr.class|default ~ ' controls collection-widget'}) %}
Expand Down Expand Up @@ -56,8 +55,8 @@
<button class="ui red right labeled icon button">
<i class="remove icon"></i> {{ 'sylius.ui.delete'|trans }}
</button>
{{ form_widget(form.attribute, {'attr': {'style': 'display: none'}}) }}
</div>
{% endif %}
<input type="hidden" name="{{ form.attribute.vars.full_name }}" id="{{ form.attribute.vars.id }}" value="{{ form.vars.data.attribute.id }}"/>
</div>
{% endmacro %}

0 comments on commit de17f28

Please sign in to comment.