Skip to content

Commit

Permalink
Merge pull request #72 from maximehuran/feature/fix-sort-grid
Browse files Browse the repository at this point in the history
We need a default sorting in grid to have sorting works
  • Loading branch information
maximehuran authored Aug 2, 2024
2 parents 46c0987 + 0a9727a commit 73fd672
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/Resources/config/sylius/grid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ sylius_grid:
method: createListQueryBuilder
arguments: ["%locale%"]
limits: [25, 50, 100, 200]
sorting:
id: desc
fields:
id:
type: string
label: monsieurbiz_cms_page.ui.form.id
sortable: ~
code:
type: string
label: monsieurbiz_cms_page.ui.form.code
Expand Down
1 change: 1 addition & 0 deletions src/Resources/translations/messages.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ monsieurbiz_cms_page:
pages_subheader: "CMS Page management"
back_to_admin: "Back to admin"
form:
id: 'ID'
page_info: 'Page information'
page_content: 'Page content'
enabled: "Enabled"
Expand Down
1 change: 1 addition & 0 deletions src/Resources/translations/messages.fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ monsieurbiz_cms_page:
pages_subheader: "Gestion des contenus CMS"
back_to_admin: "Retour à l'admin"
form:
id: 'ID'
page_info: 'Informations de la page'
page_content: 'Contenu de la page'
enabled: "Activée"
Expand Down
1 change: 1 addition & 0 deletions src/Resources/translations/messages.pl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ monsieurbiz_cms_page:
pages_subheader: "Zarządzanie stronami CMS"
back_to_admin: "Powrót do administracji"
form:
id: 'ID'
page_info: 'Informacje o stronie'
page_content: 'Treść strony'
enabled: "Włączone"
Expand Down
4 changes: 2 additions & 2 deletions src/Routing/RequestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private function prepareSlug(string $slug): string
}

// Remove the locale code which is at the beginning of the slug
return (string) preg_replace(sprintf('/^%s\//', $localeCode), '', $slug);
return (string) preg_replace(\sprintf('/^%s\//', $localeCode), '', $slug);
}

/**
Expand All @@ -97,6 +97,6 @@ public function __call(string $name, array $arguments)
return \call_user_func($callback, ...$arguments);
}

throw new Exception(sprintf('Method %s not found for class "%s"', $name, \get_class($this->decorated)));
throw new Exception(\sprintf('Method %s not found for class "%s"', $name, \get_class($this->decorated)));
}
}
2 changes: 1 addition & 1 deletion src/Validator/Constraints/UniqueSlugByChannelValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function validate($value, Constraint $constraint): void
'%channel%' => $channel->getCode(),
'%locale%' => $translation->getLocale(),
])
->atPath(sprintf('translations[%s].slug', $translation->getLocale()))
->atPath(\sprintf('translations[%s].slug', $translation->getLocale()))
->addViolation()
;
}
Expand Down

0 comments on commit 73fd672

Please sign in to comment.