SYL-3947: UI bundle cleanup (#17036)

Cleaned up UiBundle templates and assets
This commit is contained in:
Grzegorz Sadowski 2024-10-01 13:30:40 +02:00 committed by GitHub
commit 957fd873ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
111 changed files with 38 additions and 1624 deletions

View file

@ -148,7 +148,7 @@ To have templates for your Entity administration out of the box you can use Grid
type: twig
label: sylius.ui.enabled
options:
template: "@SyliusUi/Grid/Field/enabled.html.twig"
template: "@SyliusUi/grid/field/enabled.html.twig"
actions:
main:
create:

View file

@ -415,7 +415,7 @@ To have templates for your Entity administration out of the box you can use Grid
type: twig
label: sylius.ui.enabled
options:
template: "@SyliusUi/Grid/Field/enabled.html.twig"
template: "@SyliusUi/grid/field/enabled.html.twig"
actions:
main:
create:

View file

@ -113,7 +113,7 @@ Now we will walk through the process of migrating your project from Gulp to Webp
.. code-block:: twig
{% include '@SyliusUi/Security/_login.html.twig'
{% include '@SyliusUi/security/_login.html.twig'
with {
'action': path('sylius_admin_login_check'),
'paths': {'logo': asset('build/admin/images/logo.png', 'admin')}

View file

@ -58,7 +58,7 @@ Copy the contents of the original template to make your work easier. And then mo
{% extends '@SyliusShop/shared/layout/base.html.twig' %}
{% import '@SyliusUi/Macro/messages.html.twig' as messages %}
{% import '@SyliusUi/macro/messages.html.twig' as messages %}
{% block content %}
<div class="ui column stackable center page grid">

View file

@ -14,7 +14,7 @@ sylius_grid:
type: twig
label: sylius.ui.action
options:
template: "@SyliusUi/Grid/Field/logAction.html.twig"
template: "@SyliusUi/grid/field/log_action.html.twig"
loggedAt:
type: datetime
label: sylius.ui.logged_at
@ -24,4 +24,4 @@ sylius_grid:
type: twig
label: sylius.ui.changes
options:
template: "@SyliusUi/Grid/Field/logData.html.twig"
template: "@SyliusUi/grid/field/log_data.html.twig"

View file

@ -16,7 +16,7 @@ sylius_grid:
label: sylius.ui.position
sortable: ~
options:
template: "@SyliusUi/Grid/Field/position.html.twig"
template: "@SyliusUi/grid/field/position.html.twig"
vars:
th_class: "w-1 text-center"
td_class: "text-center"
@ -38,7 +38,7 @@ sylius_grid:
label: sylius.ui.gateway
sortable: gatewayConfig.factoryName
options:
template: "@SyliusUi/Grid/Field/humanized.html.twig"
template: "@SyliusUi/grid/field/humanized.html.twig"
enabled:
type: twig
label: sylius.ui.enabled

View file

@ -32,7 +32,7 @@ sylius_grid:
label: sylius.ui.type
sortable: ~
options:
template: "@SyliusUi/Grid/Field/label.html.twig"
template: "@SyliusUi/grid/field/label.html.twig"
translatable:
type: twig
label: sylius.ui.translatable
@ -44,7 +44,7 @@ sylius_grid:
label: sylius.ui.position
sortable: ~
options:
template: "@SyliusUi/Grid/Field/position.html.twig"
template: "@SyliusUi/grid/field/position.html.twig"
vars:
th_class: "w-1 text-center"
td_class: "text-center"

View file

@ -16,7 +16,7 @@ sylius_grid:
label: sylius.ui.position
sortable: ~
options:
template: "@SyliusUi/Grid/Field/position.html.twig"
template: "@SyliusUi/grid/field/position.html.twig"
vars:
th_class: "w-1 text-center"
td_class: "text-center"

View file

@ -23,7 +23,7 @@ sylius_grid:
path: .
sortable: ~
options:
template: "@SyliusUi/Grid/Field/nameAndDescription.html.twig"
template: "@SyliusUi/grid/field/name_and_description.html.twig"
vars:
th_class: "w-100"
code:

View file

@ -16,7 +16,7 @@ sylius_grid:
label: sylius.ui.position
sortable: ~
options:
template: "@SyliusUi/Grid/Field/position.html.twig"
template: "@SyliusUi/grid/field/position.html.twig"
vars:
th_class: "w-1 text-center"
td_class: "text-center"

View file

@ -14,7 +14,7 @@ sylius_grid:
path: .
sortable: name
options:
template: "@SyliusUi/Grid/Field/nameAndDescription.html.twig"
template: "@SyliusUi/grid/field/name_and_description.html.twig"
code:
type: twig
label: sylius.ui.code

View file

@ -31,7 +31,7 @@ sylius_grid:
label: sylius.ui.amount
sortable: ~
options:
template: "@SyliusUi/Grid/Field/percent.html.twig"
template: "@SyliusUi/grid/field/percent.html.twig"
filters:
startDate:
type: date

View file

@ -30,7 +30,6 @@ sylius_admin_promotion_archive:
_sylius:
section: admin
permission: true
template: '@SyliusUi/Grid/Action/archive.html.twig'
form:
type: Sylius\Bundle\ResourceBundle\Form\Type\ArchivableType
redirect:

View file

@ -19,7 +19,6 @@ sylius_admin_shipping_method_archive:
_sylius:
section: admin
permission: true
template: '@SyliusUi/Grid/Action/archive.html.twig'
form:
type: Sylius\Bundle\ResourceBundle\Form\Type\ArchivableType
redirect:

View file

@ -45,7 +45,7 @@ sylius_grid:
label: sylius.ui.state
sortable: ~
options:
template: "@SyliusUi/Grid/Field/label.html.twig"
template: "@SyliusUi/grid/field/label.html.twig"
vars:
labels: "@SyliusShop/account/order/label/state"
actions:

View file

@ -1 +0,0 @@
{% extends '@SyliusUi/Grid/_default.html.twig' %}

View file

@ -1,5 +1,4 @@
{% import '@SyliusShop/shared/macro/grid/table.html.twig' as table %}
{% import '@SyliusUi/Macro/messages.html.twig' as messages %}
{% import '@SyliusShop/shared/macro/pagination.html.twig' as pagination %}
{% set resources = hookable_metadata.context.resources %}

View file

@ -47,7 +47,7 @@ final class SecurityController
$options = $request->attributes->get('_sylius', []);
$template = $options['template'] ?? '@SyliusUi/Security/login.html.twig';
$template = $options['template'] ?? '@SyliusUi/security/login.html.twig';
$formType = $options['form'] ?? SecurityLoginType::class;
$form = $this->formFactory->createNamed('', $formType);

View file

@ -1,27 +1,2 @@
imports:
- { resource: "@SyliusUiBundle/Resources/config/app/events.yaml" }
webpack_encore:
output_path: '%kernel.project_dir%/public/build/default'
sylius_grid:
templates:
action:
default: "@SyliusUi/Grid/Action/default.html.twig"
create: "@SyliusUi/Grid/Action/create.html.twig"
delete: "@SyliusUi/Grid/Action/delete.html.twig"
show: "@SyliusUi/Grid/Action/show.html.twig"
update: "@SyliusUi/Grid/Action/update.html.twig"
apply_transition: "@SyliusUi/Grid/Action/applyTransition.html.twig"
links: "@SyliusUi/Grid/Action/links.html.twig"
archive: "@SyliusUi/Grid/Action/archive.html.twig"
filter:
string: "@SyliusUi/Grid/Filter/string.html.twig"
boolean: "@SyliusUi/Grid/Filter/boolean.html.twig"
date: "@SyliusUi/Grid/Filter/date.html.twig"
entity: "@SyliusUi/Grid/Filter/entity.html.twig"
money: "@SyliusUi/Grid/Filter/money.html.twig"
exists: "@SyliusUi/Grid/Filter/exists.html.twig"
select: "@SyliusUi/Grid/Filter/select.html.twig"
bulk_action:
delete: "@SyliusUi/Grid/BulkAction/delete.html.twig"

View file

@ -1,54 +0,0 @@
# This file is part of the Sylius package.
# (c) Sylius Sp. z o.o.
sylius_ui:
events:
sylius.grid:
blocks:
content:
template: "@SyliusUi/Grid/_content.html.twig"
priority: 10
sylius.grid.body:
blocks:
navigation:
template: "@SyliusUi/Grid/Body/_navigation.html.twig"
priority: 30
table:
template: "@SyliusUi/Grid/Body/_table.html.twig"
priority: 20
pagination:
template: "@SyliusUi/Grid/Body/_pagination.html.twig"
priority: 10
sylius.grid.filters:
blocks:
content:
template: "@SyliusUi/Grid/Filter/_content.html.twig"
priority: 10
sylius.admin.login.before_form:
blocks:
legacy:
template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
priority: 30
context:
event: sylius.admin.login.before_form
logo:
template: "@SyliusUi/Security/_logo.html.twig"
priority: 20
error:
template: "@SyliusUi/Security/_error.html.twig"
priority: 10
flashes:
template: "@SyliusUi/_flashes.html.twig"
priority: 0
sylius.admin.login.form.content:
blocks:
credentials:
template: "@SyliusUi/Security/Form/_credentials.html.twig"
priority: 20
submit:
template: "@SyliusUi/Security/Form/_submit.html.twig"
priority: 10

View file

@ -17,7 +17,7 @@
<service id="Sylius\Bundle\UiBundle\DataCollector\TemplateBlockDataCollector">
<argument type="service" id="Sylius\Bundle\UiBundle\DataCollector\BlockRenderingHistory" />
<tag name="data_collector" template="@SyliusUi/DataCollector/templateBlock.html.twig" id="sylius_ui.template_block" />
<tag name="data_collector" template="@SyliusUi/data_collector/template_block.html.twig" id="sylius_ui.template_block" />
</service>
<service id="Sylius\Bundle\UiBundle\DataCollector\TraceableBlockRenderer" decorates="sylius.ui.block_renderer.composite">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

View file

@ -7,64 +7,10 @@
* file that was distributed with this source code.
*/
import 'semantic-ui-css/components/accordion';
import 'semantic-ui-css/components/checkbox';
import 'semantic-ui-css/components/dimmer';
import 'semantic-ui-css/components/dropdown';
import 'semantic-ui-css/components/rating';
import 'semantic-ui-css/components/sidebar';
import 'semantic-ui-css/components/tab';
import 'semantic-ui-css/components/transition';
import $ from 'jquery';
import './sylius-bulk-action-require-confirmation';
import './sylius-form-collection';
import './sylius-require-confirmation';
import './sylius-toggle';
import './sylius-check-all';
$(document).ready(() => {
$('#sidebar').addClass('visible');
$('#sidebar').sidebar('attach events', '#sidebar-toggle', 'toggle');
$('#sidebar').sidebar('setting', {
dimPage: false,
closable: false,
});
$('.ui.checkbox').checkbox();
$('.ui.accordion').accordion();
$('.ui.menu .dropdown').dropdown({ action: 'hide' });
$('.ui.inline.dropdown').dropdown();
$('.link.ui.dropdown').dropdown({ action: 'hide' });
$('.button.ui.dropdown').dropdown({ action: 'hide' });
$('.ui.fluid.search.selection.ui.dropdown').dropdown();
$('.ui.tabular.menu .item, .sylius-tabular-form .menu .item').tab();
$('.ui.card .dimmable.image, .ui.cards .card .dimmable.image').dimmer({ on: 'hover' });
$('.ui.rating').rating('disable');
$('form.loadable button[type=submit]').on('click', (event) => {
$(event.currentTarget).closest('form').addClass('loading');
});
$('.loadable.button').on('click', (event) => {
$(event.currentTarget).addClass('loading');
});
$('.message .close').on('click', (event) => {
$(event.currentTarget).closest('.message').transition('fade');
});
$('[data-requires-confirmation]').requireConfirmation();
$('[data-bulk-action-requires-confirmation]').bulkActionRequireConfirmation();
$('[data-toggles]').toggleElement();
$('[data-js-bulk-checkboxes]').checkAll();
$('.special.cards .image').dimmer({
on: 'hover',
});
$('[data-form-type="collection"]').CollectionForm();
$('[data-js-disable]').on('click', (e) => {
const $current = $(e.currentTarget);
$(document).find($current.attr('data-js-disable')).addClass('disabled');
});
});

View file

@ -1,59 +0,0 @@
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import 'semantic-ui-css/components/api';
import $ from 'jquery';
$.fn.extend({
apiLogin({
method,
dataType = 'json',
throttle = 0,
debug = false,
}) {
const element = this;
const passwordField = element.find('input[type="password"]');
const emailField = element.find('input[type="email"]');
const csrfTokenField = element.find('input[type="hidden"]');
const signInButton = element.find('.button');
const validationField = element.find('.red.label');
signInButton.api({
method,
dataType,
throttle,
debug,
beforeSend(settings) {
/* eslint-disable-next-line no-param-reassign */
settings.data = {
_username: emailField.val(),
_password: passwordField.val(),
[csrfTokenField.attr('name')]: csrfTokenField.val(),
};
return settings;
},
successTest(response) {
return response.success;
},
onSuccess() {
element.remove();
window.location.reload();
},
onFailure(response) {
validationField.removeClass('hidden');
validationField.html(response.message);
},
});
},
});

View file

@ -1,46 +0,0 @@
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import 'semantic-ui-css/components/api';
import $ from 'jquery';
$.fn.extend({
apiToggle({
method,
dataType = 'json',
throttle = 0,
debug = false,
beforeSend,
successTest,
}, toggleableElement, isHidden = true) {
const element = this;
if (isHidden) {
toggleableElement.hide();
}
element.api({
method,
dataType,
throttle,
debug,
beforeSend,
successTest,
onSuccess() {
toggleableElement.show();
},
onFailure() {
toggleableElement.hide();
},
});
},
});

View file

@ -1,87 +0,0 @@
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import 'semantic-ui-css/components/dropdown';
import $ from 'jquery';
import { sanitizeInput } from "./sylius-sanitizer";
$.fn.extend({
autoComplete() {
this.each((idx, el) => {
const element = $(el);
const criteriaName = element.data('criteria-name');
const choiceName = element.data('choice-name');
const choiceValue = element.data('choice-value');
const autocompleteValue = element.find('input.autocomplete').val();
const loadForEditUrl = element.data('load-edit-url');
element.dropdown({
delay: {
search: 250,
},
forceSelection: false,
saveRemoteData: false,
apiSettings: {
dataType: 'JSON',
cache: false,
beforeSend(settings) {
/* eslint-disable-next-line no-param-reassign */
settings.data[criteriaName] = settings.urlData.query;
return settings;
},
onResponse(response) {
let results = response.map(item => ({
name: sanitizeInput(item[choiceName]),
value: sanitizeInput(item[choiceValue]),
}));
if (!element.hasClass('multiple')) {
results.unshift({
name: '&nbsp;',
value: '',
});
}
return {
success: true,
results: results,
};
},
},
});
if (autocompleteValue.split(',').filter(String).length > 0) {
const menuElement = element.find('div.menu');
menuElement.api({
on: 'now',
method: 'GET',
url: loadForEditUrl,
beforeSend(settings) {
/* eslint-disable-next-line no-param-reassign */
settings.data[choiceValue] = autocompleteValue.split(',').filter(String);
return settings;
},
onSuccess(response) {
response.forEach((item) => {
menuElement.append((
$(`<div class="item" data-value="${item[choiceValue]}">${sanitizeInput(item[choiceName])}</div>`)
));
});
element.dropdown('refresh');
element.dropdown('set selected', element.find('input.autocomplete').val().split(',').filter(String));
},
});
}
});
},
});

View file

@ -1,46 +0,0 @@
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import 'semantic-ui-css/components/modal';
import $ from 'jquery';
$.fn.extend({
bulkActionRequireConfirmation() {
this.each((idx, el) => {
$(el).on('click', (evt) => {
evt.preventDefault();
const actionButton = $(evt.currentTarget);
if (actionButton.is('a')) {
$('#confirmation-button').on('click', (event) => {
event.preventDefault();
window.location.href = actionButton.attr('href');
});
}
if (actionButton.is('button')) {
$('#confirmation-button').on('click', (event) => {
event.preventDefault();
const form = actionButton.closest('form');
$('input.bulk-select-checkbox:checked').each((index, element) => {
$(`<input type="hidden" name="ids[]" value="${element.value}">`).appendTo(form);
});
form.submit();
});
}
$('#confirmation-modal').modal('show');
});
});
},
});

View file

@ -1,134 +0,0 @@
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import $ from 'jquery';
/**
* Collection Form plugin
*
* @param element
* @constructor
*/
class CollectionForm {
constructor(element) {
this.addItem = this.addItem.bind(this);
this.updateItem = this.updateItem.bind(this);
this.deleteItem = this.constructor.deleteItem;
this.updatePrototype = this.updatePrototype.bind(this);
this.$element = $(element);
this.$list = this.$element.find('[data-form-collection="list"]:first');
this.count = this.$list.children().length;
this.lastChoice = null;
this.$element.on('click', '[data-form-collection="add"]:last', this.addItem);
this.$element.on('click', '[data-form-collection="delete"]', this.deleteItem);
this.$element.on('change', '[data-form-collection="update"]', this.updateItem);
$(document).on('change', '[data-form-prototype="update"]', this.updatePrototype);
$(document).on('collection-form-add', (event, addedElement) => {
$(addedElement).find('[data-form-type="collection"]').CollectionForm();
$(document).trigger('dom-node-inserted', [$(addedElement)]);
});
}
/**
* Add a item to the collection.
* @param event
*/
addItem(event) {
event.preventDefault();
let prototype = this.$element.data('prototype');
let prototypeName = new RegExp(this.$element.data('prototype-name'), 'g');
prototype = prototype.replace(prototypeName, this.count);
this.$list.append(prototype);
this.count = this.count + 1;
$(document).trigger('collection-form-add', [this.$list.children().last()]);
}
/**
* Update item from the collection
*/
updateItem(event) {
event.preventDefault();
const $element = $(event.currentTarget);
const url = $element.data('form-url');
const value = $element.val();
const $container = $element.closest('[data-form-collection="item"]');
const index = $container.data('form-collection-index');
const position = $container.data('form-collection-index');
if (url) {
$container.load(url, { id: value, position });
} else {
let $prototype = this.$element.find(`[data-form-prototype="${value}"]`);
let prototypeName = new RegExp($prototype.data('subprototype-name'), 'g');
let prototype = $prototype.val().replace(prototypeName, index);
$container.replaceWith(prototype);
}
$(document).trigger('collection-form-update', [$(event.currentTarget)]);
}
/**
* Delete item from the collection
* @param event
*/
static deleteItem(event) {
event.preventDefault();
$(event.currentTarget)
.closest('[data-form-collection="item"]')
.remove();
$(document).trigger('collection-form-delete', [$(event.currentTarget)]);
}
/**
* Update the prototype
* @param event
*/
updatePrototype(event) {
const $target = $(event.currentTarget);
let prototypeName = $target.val();
if ($target.data('form-prototype-prefix') !== undefined) {
prototypeName = $target.data('form-prototype-prefix') + prototypeName;
}
if (this.lastChoice !== null && this.lastChoice !== prototypeName) {
this.$list.html('');
}
this.lastChoice = prototypeName;
this.$element.data('prototype', this.$element.find(`[data-form-prototype="${prototypeName}"]`).val());
}
}
/*
* Plugin definition
*/
$.fn.CollectionForm = function CollectionFormPlugin(option) {
this.each((idx, el) => {
const $element = $(el);
const data = $element.data('collectionForm');
const options = typeof option === 'object' && option;
if (!data) {
$element.data('collectionForm', new CollectionForm(el, options));
}
});
};
$.fn.CollectionForm.Constructor = CollectionForm;

View file

@ -1,67 +0,0 @@
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import 'semantic-ui-css/components/dropdown';
import $ from 'jquery';
import { sanitizeInput } from "./sylius-sanitizer";
$.fn.extend({
productAutoComplete() {
this.each((index, element) => {
const $element = $(element);
$element.dropdown('set selected', $element.find('input[name*="[associations]"]').val().split(',').filter(String));
});
this.dropdown({
delay: {
search: 250,
},
forceSelection: false,
apiSettings: {
dataType: 'JSON',
cache: false,
data: {
criteria: { search: { type: 'contains', value: '' } },
},
beforeSend(settings) {
/* eslint-disable-next-line no-param-reassign */
settings.data.criteria.search.value = settings.urlData.query;
return settings;
},
onResponse(response) {
return {
success: true,
results: response._embedded.items.map(item => ({
name: sanitizeInput(item.name),
value: sanitizeInput(item.code),
})),
};
},
},
onAdd(addedValue, addedText, $addedChoice) {
const inputAssociation = $addedChoice.parents('.product-select').find('input[name*="[associations]"]');
const associatedProductCodes = inputAssociation.val().length > 0 ? inputAssociation.val().split(',').filter(String) : [];
associatedProductCodes.push(addedValue);
$.unique(associatedProductCodes.sort());
inputAssociation.attr('value', associatedProductCodes.join());
},
onRemove(removedValue, removedText, $removedChoice) {
const inputAssociation = $removedChoice.parents('.product-select').find('input[name*="[associations]"]');
const associatedProductCodes = inputAssociation.val().length > 0 ? inputAssociation.val().split(',').filter(String) : [];
associatedProductCodes.splice($.inArray(removedValue, associatedProductCodes), 1);
inputAssociation.attr('value', associatedProductCodes.join());
},
});
},
});

View file

@ -1,68 +0,0 @@
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import $ from 'jquery';
const methods = {
init(options) {
const settings = $.extend({
prototypePrefix: false,
containerSelector: false,
}, options);
const show = function show(element, replace) {
const selectedValue = element.val();
let prototypePrefix = element.attr('id');
if (settings.prototypePrefix != false) {
({ prototypePrefix } = settings);
}
const prototypeElement = $(`#${prototypePrefix}_${selectedValue}`);
let container;
if (settings.containerSelector) {
container = $(settings.containerSelector);
} else {
container = $(prototypeElement.data('container'));
}
if (!container.length) {
return;
}
if (!prototypeElement.length) {
container.empty();
return;
}
if (replace || !container.html().trim()) {
container.html(prototypeElement.data('prototype'));
}
};
return this.each((index, element) => {
show($(element), false);
$(element).change((event) => {
show($(event.currentTarget), true);
});
});
},
};
$.fn.handlePrototypes = function handlePrototypes(method, ...args) {
if (methods[method]) {
return methods[method].apply(this, args);
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, [method, ...args]);
}
$.error(`Method ${method} does not exist on jQuery.handlePrototypes`);
return undefined;
};

View file

@ -1,41 +0,0 @@
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import 'semantic-ui-css/components/modal';
import $ from 'jquery';
$.fn.extend({
requireConfirmation() {
this.each((idx, el) => {
$(el).on('click', (evt) => {
evt.preventDefault();
const actionButton = $(evt.currentTarget);
if (actionButton.is('a')) {
$('#confirmation-button').on('click', (event) => {
event.preventDefault();
window.location.href = actionButton.attr('href');
});
}
if (actionButton.is('button')) {
$('#confirmation-button').on('click', (event) => {
event.preventDefault();
actionButton.closest('form').submit();
});
}
$('#confirmation-modal').modal('show');
});
});
},
});

View file

@ -1,5 +0,0 @@
export function sanitizeInput(input) {
const div = document.createElement('div');
div.textContent = input;
return div.innerHTML; // Converts text content to plain HTML, stripping any scripts
}

View file

@ -1,31 +0,0 @@
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import $ from 'jquery';
$.fn.extend({
toggleElement() {
this.each((idx, el) => {
$(el).on('change', (event) => {
event.preventDefault();
const toggle = $(event.currentTarget);
const targetElement = $(`#${toggle.data('toggles')}`);
if (toggle.is(':checked')) {
targetElement.show();
} else {
targetElement.hide();
}
});
$(el).trigger('change');
});
},
});

View file

@ -1,4 +0,0 @@
{{ sonata_block_render_event(
event,
_context|filter((value, key) => key in sonata_block_whitelisted_variables())
) }}

View file

@ -1,3 +0,0 @@
<a href="{{ path|default(app.request.headers.get('referer')) }}" class="ui button" {{ sylius_test_html_attribute('cancel-changes-button')}}>
{{ 'sylius.ui.cancel'|trans }}
</a>

View file

@ -1,11 +0,0 @@
{% if paths.cancel is not null %}
{% set cancelPath = paths.cancel|split('?')[0] %}
{% else %}
{% set cancelPath = null %}
{% endif %}
<div class="ui hidden divider"></div>
<div class="ui buttons">
<button class="ui labeled icon primary button" type="submit"><i class="plus icon"></i>{{- 'sylius.ui.create'|trans -}}</button>
{% include '@SyliusUi/Form/Buttons/_cancel.html.twig' with {'path': sylius_generate_redirect_path(cancelPath)} %}
</div>

View file

@ -1,5 +0,0 @@
<div class="ui hidden divider"></div>
<div class="ui buttons">
<button class="ui labeled icon primary button" type="submit" id="sylius_save_changes_button"><i class="save icon"></i> {{ 'sylius.ui.save_changes'|trans }}</button>
{% include '@SyliusUi/Form/Buttons/_cancel.html.twig' with {'path': paths.cancel|default(null)} %}
</div>

View file

@ -1,114 +0,0 @@
{% extends '@SyliusUi/Form/theme.html.twig' %}
{% block collection_widget -%}
{% from '@SyliusResource/Macros/notification.html.twig' import error %}
{% import _self as self %}
{% set attr = attr|merge({'class': attr.class|default ~ ' controls collection-widget'}) %}
{% apply spaceless %}
<div data-form-type="collection" {{ block('widget_container_attributes') }}
{% if prototype is defined and allow_add %}
data-prototype='{{ self.collection_item(prototype, allow_delete, button_delete_label, prototype.vars.name)|e }}'
data-prototype-name='{{ prototype.vars.name }}'
{%- endif -%}
>
{{ error(form.vars.errors) }}
{% if prototypes|default is iterable %}
{% for key, subPrototype in prototypes %}
<input type="hidden" data-form-prototype="{{ key }}"
value="{{ self.collection_item(subPrototype, allow_delete, button_delete_label, subPrototype.vars.name)|e }}"
data-subprototype-name="{{ subPrototype.vars.name }}"
/>
{% endfor %}
{% endif %}
<div data-form-collection="list" class="ui three column stackable grid">
{% for child in form %}
{{ self.collection_item(child, allow_delete, button_delete_label, loop.index0) }}
{% endfor %}
</div>
{% if prototype is defined and allow_add %}
<a href="#" class="ui labeled icon button" data-form-collection="add">
<i class="plus square outline icon"></i>
{{ button_add_label|trans }}
</a>
{% endif %}
</div>
{% endapply %}
{%- endblock collection_widget %}
{% macro collection_item(form, allow_delete, button_delete_label, index) %}
{% apply spaceless %}
<div data-form-collection="item" data-form-collection-index="{{ index }}" class="column">
<div class="ui box segment">
{{ form_widget(form) }}
</div>
{% if allow_delete %}
<a href="#" data-form-collection="delete" class="ui red labeled icon button" style="margin-bottom: 1em;">
<i class="trash icon"></i>
{{ button_delete_label|trans }}
</a>
{% endif %}
</div>
{% endapply %}
{% endmacro %}
{% block sylius_product_image_widget %}
{% apply spaceless %}
{{ form_row(form.type) }}
<div class="ui-element-spacer">
<label for="{{ form.file.vars.id }}" class="ui icon labeled button"><i class="cloud upload icon"></i> {{ 'sylius.ui.choose_file'|trans }}</label>
</div>
{% if form.vars.value.path|default(null) is not null %}
<img class="ui small bordered image" src="{{ form.vars.value.path|imagine_filter('sylius_small') }}" alt="{{ form.vars.value.type }}" />
{% endif %}
<div class="ui hidden element">
{{ form_widget(form.file) }}
</div>
<div class="ui element">
{{- form_errors(form.file) -}}
</div>
{% if product.id is not null and 0 != product.variants|length and not product.simple %}
{{ form_row(form.productVariants) }}
{% endif %}
{% endapply %}
{% endblock %}
{% block sylius_taxon_image_widget %}
{% apply spaceless %}
{{ form_row(form.type) }}
{% if form.vars.value.path|default(null) is null %}
<div class="ui-element-spacer">
<label for="{{ form.file.vars.id }}" class="ui icon labeled button"><i class="cloud upload icon"></i> {{ 'sylius.ui.choose_file'|trans }}</label>
</div>
{% else %}
<img class="ui small bordered image" src="{{ form.vars.value.path|imagine_filter('sylius_small') }}" alt="{{ form.vars.value.type }}" />
<label for="{{ form.file.vars.id }}" class="ui icon labeled button"><i class="cloud upload icon"></i> {{ 'sylius.ui.change_file'|trans }}</label>
{% endif %}
<div class="ui hidden element">
{{ form_widget(form.file) }}
</div>
<div class="ui element">
{{- form_errors(form.file) -}}
</div>
{% endapply %}
{% endblock %}
{% block sylius_avatar_image_widget %}
{% apply spaceless %}
{% if form.vars.value.path|default(null) is not null %}
<img class="ui small bordered image" src="{{ form.vars.value.path|imagine_filter('sylius_small') }}" alt="{{ form.vars.value.type }}" />
{% endif %}
<div class="ui hidden element">
{{ form_widget(form.file) }}
</div>
<div style="margin-top: 10px" >
<label for="{{ form.file.vars.id }}" class="ui icon labeled button"><i class="cloud upload icon"></i> {{ 'sylius.ui.choose_file'|trans }}</label>
</div>
<div class="ui element">
{{- form_errors(form.file) -}}
</div>
{% endapply %}
{% endblock %}

View file

@ -1,3 +0,0 @@
{% set path = link.url is defined ? link.url : path(link.route, link.parameters|default([])) %}
<a class="item" href="{{ path }}">{% if link.icon is defined %}<i class="{{ link.icon }} icon"></i> {% endif %}{{ link.label|trans }}</a>

View file

@ -1,12 +0,0 @@
{% set labeled = options.labeled is defined ? options.labeled : true %}
{% if sylius_sm_can(data, options.graph, options.transition) %}
<form action="{{ path(options.link.route, options.link.parameters) }}" method="post">
<input type="hidden" name="_csrf_token" value="{{ csrf_token(data.id) }}">
<input type="hidden" name="_method" value="PUT">
<button class="ui loadable {{ options.class|default }} {% if labeled %}labeled{% endif %} icon button" type="submit" data-js-disable=".sylius-grid-table-wrapper button, .sylius-grid-table-wrapper a">
<i class="{{ action.icon }} icon"></i>
{% if labeled %}{{ action.label|trans }}{% endif %}
</button>
</form>
{% endif %}

View file

@ -1,15 +0,0 @@
{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('archive')), options.link.parameters|default({'id': data.id}))) %}
<form action="{{ path }}" method="POST" name="sylius_archivable">
<input type="hidden" name="_method" value="PATCH">
<input type="hidden" name="sylius_archivable[_token]" value="{{ csrf_token('sylius_archivable') }}" />
<button class="ui brown labeled icon button" type="submit" data-requires-confirmation>
<i class="{{ action.icon|default('archive') }} icon"></i>
{% if data.archivedAt is not null %}
{{ action.options.restore_label|default('sylius.ui.restore')|trans }}
{% else %}
{{ action.label|default('sylius.ui.archive')|trans }}
{% endif %}
</button>
</form>

View file

@ -1,6 +0,0 @@
{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %}
{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('create')), options.link.parameters|default([]))) %}
{% set labeled = options.labeled is defined ? options.labeled : true %}
{{ buttons.create(path, action.label, null, labeled) }}

View file

@ -1,5 +0,0 @@
{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %}
{% set path = options.link.url|default(path(options.link.route, options.link.parameters|default({}))) %}
{{ buttons.default(path, action.label, null, action.icon) }}

View file

@ -1,6 +0,0 @@
{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %}
{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('delete')), options.link.parameters|default({'id': data.id}))) %}
{% set labeled = options.labeled is defined ? options.labeled : true %}
{{ buttons.delete(path, action.label, labeled, data.id) }}

View file

@ -1,24 +0,0 @@
{% set visible = options.visible is defined ? options.visible : true %}
{% if visible %}
<div class="ui{% if options.icon is defined %} labeled icon{% endif %} floating dropdown {{ options.class|default('') }} link button">
{% if options.icon is defined %}<i class="{{ options.icon }} icon"></i>{% endif %}
<span class="text">{{ action.label|trans }}</span>
<div class="menu">
{% if options.header is defined %}
<div class="header">
{% if options.header.icon is defined %}<i class="{{ options.header.icon }} icon"></i>{% endif %}
{{ options.header.label|trans }}
</div>
<div class="divider"></div>
{% endif %}
{% for link in options.links %}
{% set is_link_visible = link.visible is defined ? link.visible : true %}
{% if is_link_visible %}
{% include '@SyliusUi/Grid/Action/_link.html.twig' %}
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}

View file

@ -1,6 +0,0 @@
{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %}
{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('show')), options.link.parameters|default({'id': data.id}))) %}
{% set labeled = options.labeled is defined ? options.labeled : true %}
{{ buttons.show(path, action.label, null, null, labeled) }}

View file

@ -1,6 +0,0 @@
{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %}
{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('update')), options.link.parameters|default({'id': data.id}))) %}
{% set labeled = options.labeled is defined ? options.labeled : true %}
{{ buttons.edit(path, action.label, null, labeled) }}

View file

@ -1,21 +0,0 @@
{% import '@SyliusUi/Macro/pagination.html.twig' as pagination %}
<div class="sylius-grid-nav">
{% if data|length > 0 and definition.actionGroups.bulk is defined and definition.getEnabledActions('bulk')|length > 0 %}
<div class="sylius-grid-nav__bulk">
{% for action in definition.getEnabledActions('bulk') %}
{{ sylius_grid_render_bulk_action(grid, action, null) }}
{% endfor %}
</div>
{% endif %}
<div class="sylius-grid-nav__pagination">
{{ pagination.simple(data) }}
</div>
{% if definition.limits|length > 1 and data|length > min(definition.limits) %}
<div class="sylius-grid-nav__perpage">
<div class="ui fluid one menu sylius-paginate">
{{ pagination.perPage(data, definition.limits) }}
</div>
</div>
{% endif %}
</div>

View file

@ -1,3 +0,0 @@
{% import '@SyliusUi/Macro/pagination.html.twig' as pagination %}
{{ pagination.simple(data) }}

View file

@ -1,21 +0,0 @@
{% import '@SyliusUi/Macro/table.html.twig' as table %}
{% import '@SyliusUi/Macro/messages.html.twig' as messages %}
{% if data|length > 0 %}
<div class="ui segment spaceless sylius-grid-table-wrapper">
<table class="ui sortable stackable very basic celled table" {{ sylius_test_html_attribute('grid-table') }}>
<thead>
<tr>
{{ table.headers(grid, definition, app.request.attributes) }}
</tr>
</thead>
<tbody {{ sylius_test_html_attribute('grid-table-body') }}>
{% for row in data %}
{{ table.row(grid, definition, row) }}
{% endfor %}
</tbody>
</table>
</div>
{% else %}
{{ messages.info('sylius.ui.no_results_to_display') }}
{% endif %}

View file

@ -1,5 +0,0 @@
{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %}
{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('bulk_delete')), options.link.parameters|default({}))) %}
{{ buttons.bulkDelete(path, action.label, true) }}

View file

@ -1,2 +0,0 @@
{% import '@SyliusUi/Macro/labels.html.twig' as label %}
{{ label.status(data) }}

View file

@ -1 +0,0 @@
{% include '@SyliusUi/Label/_default.html.twig' with {'value': data} %}

View file

@ -1,2 +0,0 @@
{% import '@SyliusUi/Macro/labels.html.twig' as label %}
{{ label.yesNo(data) }}

View file

@ -1,25 +0,0 @@
{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %}
{% if definition.enabledFilters|length > 0 %}
<div class="ui hidden divider"></div>
<div class="ui styled fluid accordion">
<div class="title {% if criteria is not null %}active{% endif %}">
<i class="dropdown icon"></i>
<i class="filter icon"></i>
{{ 'sylius.ui.filters'|trans }}
</div>
<div class="content {% if criteria is not null %}active{% endif %}">
<form method="get" action="{{ path }}" class="ui loadable form" novalidate>
<div class="sylius-filters">
{% for filter in definition.enabledFilters|filter(filter => filter.enabled)|sort_by('position') %}
<div class="sylius-filters__field">
{{ sylius_grid_render_filter(grid, filter) }}
</div>
{% endfor %}
</div>
{{ buttons.filter() }}
{{ buttons.resetFilters(path) }}
</form>
</div>
</div>
{% endif %}

View file

@ -1,3 +0,0 @@
{% form_theme form '@SyliusUi/Form/theme.html.twig' %}
{{ form_row(form, {'label': filter.label}) }}

View file

@ -1,10 +0,0 @@
{% form_theme form '@SyliusUi/Form/theme.html.twig' %}
<div class="sylius-filters__group">
{{ form_row(form.from, { attr: {'class': 'sylius-filters__group'}, 'label': 'sylius.ui.date_filter', 'label_translation_parameters': {'%label%': filter.label|trans, '%altLabel%': form.from.vars.label|trans} }) }}
<div class="disabled field">
<label>&nbsp;</label>
<input type="text" value="-" disabled>
</div>
{{ form_row(form.to, { attr: {'class': 'sylius-filters__group'} }) }}
</div>

View file

@ -1,3 +0,0 @@
{% form_theme form '@SyliusUi/Form/theme.html.twig' %}
{{ form_row(form, {'label': filter.label}) }}

View file

@ -1,3 +0,0 @@
{% form_theme form '@SyliusUi/Form/theme.html.twig' %}
{{ form_row(form, {'label': filter.label}) }}

View file

@ -1,3 +0,0 @@
{% form_theme form '@SyliusUi/Form/theme.html.twig' %}
{{ form_row(form, {'label': filter.label}) }}

View file

@ -1,11 +0,0 @@
{% form_theme form '@SyliusUi/Form/theme.html.twig' %}
<div class="sylius-filters__group">
{{ form_row(form.greaterThan, {attr: {'placeholder': form.greaterThan.vars.label}, 'label': 'sylius.ui.money_filter', 'label_translation_parameters': {'%label%': filter.label|trans, '%altLabel%': form.greaterThan.vars.label|trans}}) }}
<div class="disabled field">
<label>&nbsp;</label>
<input type="text" value="-" disabled>
</div>
{{ form_row(form.lessThan, {attr: { 'placeholder': form.lessThan.vars.label }}) }}
{{ form_row(form.currency) }}
</div>

View file

@ -1,3 +0,0 @@
{% form_theme form '@SyliusUi/Form/theme.html.twig' %}
{{ form_row(form, {'label': filter.label, 'remote_url': path(filter.formOptions.remote_path), 'load_edit_url': path(filter.formOptions.load_edit_path)}) }}

View file

@ -1,3 +0,0 @@
{% form_theme form '@SyliusUi/Form/theme.html.twig' %}
{{ form_row(form, {'label': filter.label}) }}

View file

@ -1,8 +0,0 @@
{% form_theme form '@SyliusUi/Form/theme.html.twig' %}
<div class="sylius-filters__group">
{% if form.type is defined %}
{{ form_row(form.type, {'label': filter.label}) }}
{% endif %}
{{ form_row(form.value, {attr: {placeholder: form.value.vars.label}, 'label': form.type is defined ? form.value.vars.label : filter.label}) }}
</div>

View file

@ -1,12 +0,0 @@
{% set definition = grid.definition %}
{% set data = grid.data %}
{% set path = path(app.request.attributes.get('_route'), app.request.attributes.all('_route_params')) %}
{% set criteria = app.request.query.all('criteria') %}
{{ sylius_template_event('sylius.grid.filters', _context) }}
<div class="ui hidden divider"></div>
<div class="sylius-grid-wrapper">
{{ sylius_template_event('sylius.grid.body', _context) }}
</div>

View file

@ -1 +0,0 @@
{{ sylius_template_event('sylius.grid', _context) }}

View file

@ -1,23 +0,0 @@
{% import '@SyliusUi/Macro/table.html.twig' as table %}
{% import '@SyliusUi/Macro/messages.html.twig' as messages %}
{% set definition = resources.definition %}
{% set data = resources.data %}
{% if data|length > 0 %}
<table class="ui stackable celled table">
<thead>
<tr>
{{ table.headers(resources, definition, app.request.attributes) }}
</tr>
</thead>
<tbody>
{% for row in data %}
{{ table.row(resources, definition, row) }}
{% endfor %}
</tbody>
</table>
{% else %}
{{ messages.info('sylius.ui.no_results_to_display') }}
{% endif %}

View file

@ -1,2 +0,0 @@
{% import '@SyliusUi/Macro/labels.html.twig' as label %}
{{ label.default(value) }}

View file

@ -1,61 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{% block title %}Sylius{% endblock %}</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
{% block metatags %}
{% endblock %}
{% block stylesheets %}
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
{% endblock %}
</head>
<body class="pushable">
<div class="ui sidebar vertical inverted menu visible left" id="sidebar">
{% block sidebar %}
{% endblock %}
</div>
<div class="ui borderless fixed menu">
{% block topbar %}
{% endblock %}
</div>
<div class="pusher">
<div class="full height" id="wrapper">
<div id="content">
{% block flash_messages %}
{% include '@SyliusUi/_flashes.html.twig' %}
{% endblock %}
{% block pre_content %}
{% endblock %}
{% block content %}
{% endblock %}
{% block post_content %}
{% endblock %}
</div>
<div class="sylius-footer">
{% block footer %}
{% endblock %}
</div>
</div>
</div>
{% include '@SyliusUi/Modal/_confirmation.html.twig' %}
{% block javascripts %}
{% endblock %}
</body>
</html>

View file

@ -1,17 +0,0 @@
{% macro crumble(crumbs = {}, root_path, root_label) %}
<div class="ui breadcrumb">
{% for crumb in crumbs %}
{% if loop.last %}
<div class="active section">{{ crumb.label }}</div>
{% elseif crumb.url is defined %}
<a href="{{ crumb.url }}" class="section">{{ crumb.label }}</a>
<i class="right chevron icon divider"></i>
{% else %}
<div class="section">{{ crumb.label }}</div>
<i class="right chevron icon divider"></i>
{% endif %}
{% else %}
<a href="{{ root_url|default('/') }}" class="section">{{ root_label|default('sylius.ui.root'|trans) }}</a>
{% endfor %}
</div>
{% endmacro %}

View file

@ -1,72 +0,0 @@
{% macro default(url, message, id, icon, class) %}
<a class="ui {% if message is not empty %}labeled {% endif %}{% if icon is not empty %}icon {% endif %}button {% if class is not empty %} {{ class }} {% endif %}" {% if id is not null %} id="{{ id }}"{% endif %} href="{{ url }}" {{ sylius_test_html_attribute('button', id|default(message)) }}>
{% if icon is not empty %}
<i class="icon {{ icon }}"></i>
{% endif %}
{% if message is not empty %}
{{ message|trans }}
{% endif %}
</a>
{% endmacro %}
{% macro show(url, message, id, class, labeled = true) %}
{% import _self as buttons %}
{% if message is empty and labeled %}
{% set message = 'sylius.ui.show' %}
{% endif %}
{{ buttons.default(url, message, id, 'search') }}
{% endmacro %}
{% macro create(url, message, id, labeled = true) %}
{% import _self as buttons %}
{% if message is empty and labeled %}
{% set message = 'sylius.ui.create' %}
{% endif %}
{{ buttons.default(url, message, id, 'plus', 'primary') }}
{% endmacro %}
{% macro edit(url, message, id, labeled = true) %}
{% import _self as buttons %}
{% if message is empty and labeled %}
{% set message = 'sylius.ui.edit' %}
{% endif %}
{{ buttons.default(url, message, id, 'pencil') }}
{% endmacro %}
{% macro filter(message) %}
<button class="ui blue labeled icon button" type="submit">
<i class="icon search"></i> {{ (message is empty ? 'sylius.ui.filter' : message)|trans }}
</button>
{% endmacro %}
{% macro resetFilters(url, message) %}
<a class="ui labeled icon button" href="{{ url }}">
<i class="icon remove"></i> {{ (message is empty ? 'sylius.ui.clear_filters' : message)|trans }}
</a>
{% endmacro %}
{% macro delete(url, message, labeled = true, resourceId = null) %}
<form action="{{ url }}" method="post">
<input type="hidden" name="_method" value="DELETE">
<button class="ui red {% if labeled %}labeled {% endif %}icon button" type="submit" data-requires-confirmation {{ sylius_test_html_attribute('delete-button') }}>
<i class="icon trash"></i> {{ ((message is empty and labeled) ? 'sylius.ui.delete' : message)|trans }}
</button>
<input type="hidden" name="_csrf_token" value="{{ csrf_token(resourceId) }}" />
</form>
{% endmacro %}
{% macro bulkDelete(url, message, labeled = true) %}
<form action="{{ url }}" method="post">
<input type="hidden" name="_method" value="DELETE">
<button class="ui red {% if labeled %}labeled {% endif %}icon button" type="submit" data-bulk-action-requires-confirmation disabled>
<i class="icon trash"></i> {{ ((message is empty and labeled) ? 'sylius.ui.delete' : message)|trans }}
</button>
<input type="hidden" name="_csrf_token" value="{{ csrf_token('bulk_delete') }}" />
</form>
{% endmacro %}

View file

@ -1,7 +0,0 @@
{% macro attributes(attributes) %}
{% for name, value in attributes %}
{%- if value is not none and value is not same as(false) -%}
{{- ' %s="%s"'|format(name, value is same as(true) ? name|e : value|e)|raw -}}
{%- endif -%}
{%- endfor -%}
{% endmacro %}

View file

@ -1,13 +0,0 @@
{% macro fromCountryCode(country_code) %}
<i class="{{ country_code|lower }} flag"></i>
{% endmacro %}
{% macro fromLocaleCode(locale_code) %}
{% import _self as flags %}
{% set country_code = locale_code|sylius_locale_country %}
{% if country_code %}
{{ flags.fromCountryCode(country_code) }}
{% endif %}
{% endmacro %}

View file

@ -1,13 +0,0 @@
{% macro default(header, icon, subheader) %}
<h1 class="ui header">
{% if icon is not empty %}
<i class="circular {{ icon }} icon"></i>
{% endif %}
<div class="content">
{{ header }}
{% if subheader is not empty %}
<div class="sub header">{{ subheader }}</div>
{% endif %}
</div>
</h1>
{% endmacro %}

View file

@ -1,18 +0,0 @@
{% macro simple(paginator, options) %}
{% if paginator.haveToPaginate() %}
{{ pagerfanta(paginator, 'twig', options|default({'template': '@BabDevPagerfanta/semantic_ui.html.twig'})) }}
{% endif %}
{% endmacro %}
{% macro perPage(paginator, paginationLimits) %}
<div class="ui simple fluid dropdown item">
{{ 'sylius.ui.show'|trans }} {{ paginator.maxPerPage }}
<i class="dropdown icon"></i>
<div class="menu">
{% for limit in paginationLimits|filter(limit => limit != paginator.maxPerPage) %}
{% set path = path(app.request.attributes.get('_route'), app.request.attributes.all('_route_params')|merge(app.request.query)|merge({'limit': limit})) %}
<a class="item" href="{{ path }}">{{ limit }}</a>
{% endfor %}
</div>
</div>
{% endmacro %}

View file

@ -1,21 +0,0 @@
{% macro tableHeader(grid, field, attributes) %}
{% from _self import link %}
{% set order = grid.getSortingOrder(field.name) %}
{% if grid.isSortedBy(field.name) %}
<th class="sortable sorted {{ order == 'desc' ? 'descending' : 'ascending' }} sylius-table-column-{{ field.name }}">
<a href="{{ link(field.name, attributes, (order == 'desc' ? 'asc' : 'desc'), grid.parameters.all) }}">{{ field.label|trans }}</a>
</th>
{% else %}
<th class="sortable sylius-table-column-{{ field.name }}">
<a href="{{ link(field.name, attributes, order, grid.parameters.all) }}">{{ field.label|trans }}<i class="sort icon"></i></a>
</th>
{% endif %}
{% endmacro %}
{% macro link(fieldName, attributes, order, parameters) %}
{% set params = attributes.all('_route_params')|merge(parameters) %}
{% set sorting = {'sorting': {(fieldName): (order)}} %}
{{ path(attributes.get('_route'), params|merge(sorting)|merge({'page': 1})) }}
{% endmacro %}

View file

@ -1,50 +0,0 @@
{% macro headers(grid, definition, requestAttributes) %}
{% import '@SyliusUi/Macro/sorting.html.twig' as sorting %}
{% if definition.actionGroups.bulk is defined and definition.getEnabledActions('bulk')|length > 0 %}
<th class="center aligned">
<input data-js-bulk-checkboxes=".bulk-select-checkbox" data-js-bulk-buttons=".sylius-grid-nav__bulk" type="checkbox">
</th>
{% endif %}
{% for field in definition.fields|sort_by('position') %}
{% if field.enabled %}
{% if field.isSortable %}
{{ sorting.tableHeader(grid, field, requestAttributes) }}
{% else %}
<th class="sylius-table-column-{{ field.name }}">{{ field.label|trans }}</th>
{% endif %}
{% endif %}
{% endfor %}
{% if definition.actionGroups.item is defined and definition.getEnabledActions('item')|length > 0 %}
<th class="sylius-table-column-actions">{{ 'sylius.ui.actions'|trans }}</th>
{% endif %}
{% endmacro %}
{% macro row(grid, definition, row) %}
<tr class="item" {{ sylius_test_html_attribute('row') }}>
{% if definition.actionGroups.bulk is defined and definition.getEnabledActions('bulk')|length > 0 %}
<td class="center aligned"><input class="bulk-select-checkbox" type="checkbox" value="{{ row.id }}" /></td>
{% endif %}
{% for field in definition.enabledFields|sort_by('position') %}
<td>{{ sylius_grid_render_field(grid, field, row) }}</td>
{% endfor %}
{% if definition.actionGroups.item is defined and definition.getEnabledActions('item')|length > 0 %}
<td {{ sylius_test_html_attribute('actions') }}>
<div class="ui buttons">
{% for action in definition.getEnabledActions('item')|sort_by('position') %}
{{ sylius_grid_render_action(grid, action, row) }}
{% endfor %}
</div>
{% if definition.actionGroups.subitem is defined and definition.getEnabledActions('subitem')|length > 0 %}
<div class="ui divider"></div>
<div class="ui buttons">
{% for action in definition.getEnabledActions('subitem')|sort_by('position') %}
{{ sylius_grid_render_action(grid, action, row) }}
{% endfor %}
</div>
{% endif %}
</td>
{% endif %}
</tr>
{% endmacro %}

View file

@ -1,56 +0,0 @@
{% extends 'knp_menu.html.twig' %}
{% block list %}
{% for item in item.children %}
{{ block('item') }}
{% endfor %}
{% endblock %}
{% block item %}
{# building the class of the item #}
{%- set classes = item.attribute('class') is not empty ? [item.attribute('class')] : [] %}
{%- if matcher.isCurrent(item) %}
{%- set classes = classes|merge([options.currentClass]) %}
{%- elseif matcher.isAncestor(item, options.matchingDepth) %}
{%- set classes = classes|merge([options.ancestorClass]) %}
{%- endif %}
{%- if item.actsLikeFirst %}
{%- set classes = classes|merge([options.firstClass]) %}
{%- endif %}
{%- if item.actsLikeLast %}
{%- set classes = classes|merge([options.lastClass]) %}
{%- endif %}
{# Mark item as "leaf" (no children) or as "branch" (has children that are displayed) #}
{% if item.hasChildren and options.depth is not same as(0) %}
{% if options.branch_class is not empty and item.displayChildren %}
{%- set classes = classes|merge([options.branch_class]) %}
{% endif %}
{% elseif options.leaf_class is not empty %}
{%- set classes = classes|merge([options.leaf_class]) %}
{%- endif %}
{%- set attributes = item.attributes %}
{%- if classes is not empty %}
{%- set attributes = attributes|merge({'class': classes|join(' ')}) %}
{%- endif %}
{% if item.level is same as(1) %}
<div class="item {% if attributes.class is defined %}{{ attributes.class }}{% endif %}">
<div class="header">{{ item.label|trans }}</div>
<div class="menu">
{{ block('list') }}
</div>
</div>
{% else %}
<a class="item {% if attributes.class is defined %}{{ attributes.class }}{% endif %}" href="{{ item.uri }}" {% for linkAttributeName, linkAttributeValue in item.linkAttributes %}{{ linkAttributeName }}="{{ linkAttributeValue }}"{% endfor %}>
{{ block('icon') }}
{{ item.label|trans }}
</a>
{% endif %}
{% endblock %}
{% block icon %}
{% set icon = item.labelAttribute('icon') %}
{% if icon %}<i class="icon {{ icon }}"></i> {% endif %}
{% endblock %}

View file

@ -1,26 +0,0 @@
{% extends 'knp_menu.html.twig' %}
{% block root %}
<div class="ui fluid vertical menu">
<div class="header item">{{ item.label|trans }}</div>
{{ block('list') }}
</div>
{% endblock %}
{% block list %}
{% for item in item.children %}
{{ block('item') }}
{% endfor %}
{% endblock %}
{% block item %}
<a class="item" href="{{ item.uri }}">
{{ block('icon') }}
{{ item.label|trans }}
</a>
{% endblock %}
{% block icon %}
{% set icon = item.labelAttribute('icon') %}
{% if icon %}<i class="icon {{ icon }}"></i> {% endif %}
{% endblock %}

View file

@ -1,81 +0,0 @@
{% extends 'knp_menu.html.twig' %}
{% import '@SyliusUi/Macro/buttons.html.twig' as buttons %}
{% block root %}
{% set id = item.extra('column_id') %}
<div class="six wide right aligned column"{% if id %} id="{{ id }}"{% endif %}>
{{ block('items') }}
</div>
{% endblock %}
{% block items %}
<div class="ui buttons">
{% for item in item.children %}
{{ block('item') }}
{% endfor %}
</div>
{% endblock %}
{% block item %}
{% if 'edit' == item.attribute('type') %}
{{ buttons.edit(item.uri, item.label) }}
{% elseif 'show' == item.attribute('type') %}
{{ buttons.show(item.uri, item.label) }}
{% elseif 'delete' == item.attribute('type') %}
{{ buttons.delete(item.uri, item.label|trans, true, item.attribute('resource_id')) }}
{% elseif 'transition' == item.attribute('type') %}
{{ block('transition') }}
{% elseif 'links' == item.attribute('type') %}
{{ block('links') }}
{% else %}
{{ block('link') }}
{% endif %}
{% endblock %}
{% block link %}
{% set color = item.labelAttribute('color') %}
<a href="{{ item.uri }}" class="ui {% if color %}{{ color }} {% endif %}labeled icon button">
{{ block('icon') }}
{{ item.label|trans }}
</a>
{% endblock %}
{% block links %}
{% set color = item.labelAttribute('color') %}
{% set icon = item.labelAttribute('icon') %}
<div class="ui{% if icon %} labeled icon{% endif %} floating dropdown {% if color %}{{ color }} {% endif %}link button">
{% if icon %}<i class="{{ icon }} icon"></i>{% endif %}
<span class="text">{{ item.label|trans }}</span>
<div class="menu">
{% for child in item.children %}
{% set icon = child.labelAttribute('icon') %}
<a href="{{ child.uri }}" class="item">
{% if icon %}<i class="icon {{ icon }}"></i> {% endif %}
{{ child.label|trans }}
</a>
{% endfor %}
</div>
</div>
{% endblock %}
{% block transition %}
{% set color = item.labelAttribute('color') %}
<form action="{{ item.uri }}" method="post" style="float: right;">
<input type="hidden" name="_method" value="PUT">
<button class="ui {% if color %}{{ color }} {% endif %}labeled icon {% if not item.attribute('confirmation')|default(false) %}loadable{% endif %} button" type="submit" {% if item.attribute('confirmation')|default(false) %}data-requires-confirmation{% endif %}>
{{ block('icon') }}
{{ item.label|trans }}
</button>
</form>
{% endblock %}
{% block icon %}
{% set icon = item.labelAttribute('icon') %}
{% if icon %}<i class="icon {{ icon }}"></i> {% endif %}
{% endblock %}

View file

@ -1,19 +0,0 @@
<div class="ui small basic modal" id="confirmation-modal">
<div class="ui icon header">
<i class="warning sign icon"></i>
{{ 'sylius.ui.confirm_your_action'|trans }}
</div>
<div class="content">
<p>{{ 'sylius.ui.are_your_sure_you_want_to_perform_this_action'|trans }}</p>
</div>
<div class="actions">
<div class="ui red basic cancel inverted button">
<i class="remove icon"></i>
{{ 'sylius.ui.no_label'|trans }}
</div>
<div class="ui green ok inverted button" id="confirmation-button">
<i class="checkmark icon"></i>
{{ 'sylius.ui.yes_label'|trans }}
</div>
</div>
</div>

View file

@ -1,5 +0,0 @@
{% extends '@SyliusUi/Layout/centered.html.twig' %}
{% block content %}
{% include '@SyliusUi/Security/_login.html.twig' %}
{% endblock %}

View file

@ -1,31 +0,0 @@
{% if app.session is not null and app.session.started %}
{% for type in ['success', 'error', 'info', 'warning'] %}
{% for flash in app.session.flashbag.get(type) %}
{% if 'error' == type %}
{% set result = 'negative' %}
{% set icon = 'remove' %}
{% endif %}
{% if 'info' == type %}
{% set result = 'info' %}
{% set icon = 'info' %}
{% endif %}
<div class="ui icon {{ result|default('positive') }} message sylius-flash-message" data-test-flash-message>
<i class="close icon"></i>
<i class="{{ icon|default('checkmark') }} icon"></i>
<div class="content">
<div class="header">
{% set header = 'sylius.ui.'~type %}
{{ header|trans }}
</div>
<p {{ sylius_test_html_attribute('flash-messages') }}>
{% if flash is iterable %}
{{ flash.message|trans(flash.parameters, 'flashes') }}
{% else %}
{{ flash|trans({}, 'flashes') }}
{% endif %}
</p>
</div>
</div>
{% endfor %}
{% endfor %}
{% endif %}

View file

@ -1 +0,0 @@
<script src="{{ asset(path) }}"></script>

View file

@ -1 +0,0 @@
<link rel="stylesheet" href="{{ asset(path) }}">

View file

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 641 B

View file

@ -4,7 +4,7 @@
<div class="sf-toolbar-block">
<a href="{{ path('_profiler', { 'token': token, 'panel': name }) }}">
<div class="sf-toolbar-icon">
{{ include('@SyliusUi/DataCollector/icon.svg') }}
{{ include('@SyliusUi/data_collector/icon.svg') }}
<span class="sf-toolbar-value">{{ collector.numberOfRenderedEvents }}</span>
</div>
</a>
@ -25,7 +25,7 @@
{% block menu %}
<span class="label">
<span class="icon">
{{ include('@SyliusUi/DataCollector/icon.svg') }}
{{ include('@SyliusUi/data_collector/icon.svg') }}
</span>
<strong>Template events</strong>
<span class="count">

View file

@ -0,0 +1,2 @@
{% import '@SyliusUi/macro/labels.html.twig' as label %}
{{ label.status(data) }}

View file

@ -1,7 +1,7 @@
{% set value = 'sylius.ui.' ~ data %}
{% if options.vars.labels is defined %}
{% include [(options.vars.labels ~ '/' ~ data ~ '.html.twig'), '@SyliusUi/Label/_default.html.twig'] with {'value': value} %}
{% include [(options.vars.labels ~ '/' ~ data ~ '.html.twig'), '@SyliusUi/label/_default.html.twig'] with {'value': value} %}
{% else %}
{% include '@SyliusUi/Label/_default.html.twig' with {'value': value} %}
{% include '@SyliusUi/label/_default.html.twig' with {'value': value} %}
{% endif %}

View file

@ -0,0 +1 @@
{% include '@SyliusUi/label/_default.html.twig' with {'value': data} %}

View file

@ -1,7 +1,7 @@
{% set value = 'sylius.ui.' ~ data %}
{% if options.vars.labels is defined %}
{% include [(options.vars.labels ~ '/' ~ data ~ '.html.twig'), '@SyliusUi/Label/_default.html.twig'] with {'value': value} %}
{% include [(options.vars.labels ~ '/' ~ data ~ '.html.twig'), '@SyliusUi/label/_default.html.twig'] with {'value': value} %}
{% else %}
{% include '@SyliusUi/Label/_default.html.twig' with {'value': value} %}
{% include '@SyliusUi/label/_default.html.twig' with {'value': value} %}
{% endif %}

Some files were not shown because too many files have changed in this diff Show more