Added error message if bundle wasn't found.

This commit is contained in:
Prominence 2016-06-27 13:31:16 +03:00
parent 675eb1d055
commit 0a90793b02
6 changed files with 22 additions and 7 deletions

View File

@ -12,13 +12,15 @@ class TranslationsOverviewController {
def show() {
if (!params.bundleName) {
// render error
redirect action: 'index'
return
}
Bundle bundle = bundleService.findBundleByName(params.bundleName as String)
if (!bundle) {
// render error
render view: 'index', model: [message: g.message(code: 'plugin.translations.error.bundleNotFound', args: [params.bundleName as String])]
return
}
render view: 'show', model: [bundle: bundle]

View File

@ -3,3 +3,5 @@ plugin.translations.overview.show.page.title = Bundle {0}
plugin.translations.totalRecords = Total: {0} records
plugin.translations.totalBundles = Total: {0} bundles
plugin.translations.error.bundleNotFound = Cannot find bundle <b>{0}</b>.

View File

@ -3,3 +3,5 @@ plugin.translations.overview.show.page.title = Bundle {0}
plugin.translations.totalRecords = Total: {0} records
plugin.translations.totalBundles = Total: {0} bundles
plugin.translations.error.bundleNotFound = Cannot find bundle <b>{0}</b>.

View File

@ -3,3 +3,5 @@ plugin.translations.overview.show.page.title = Bundle {0}
plugin.translations.totalRecords = Total: {0} records
plugin.translations.totalBundles = Total: {0} bundles
plugin.translations.error.bundleNotFound = Cannot find bundle <b>{0}</b>.

View File

@ -3,3 +3,5 @@ plugin.translations.overview.show.page.title = Бандл {0}
plugin.translations.totalRecords = Всего: {0} записей
plugin.translations.totalBundles = Всего: {0} бандлов
plugin.translations.error.bundleNotFound = Бандл с именем <b>{0}</b> не найден.

View File

@ -7,16 +7,21 @@
</head>
<body>
<g:if test="${message}">
<div class="alert alert-danger">
${message}
</div>
</g:if>
<g:if test="${bundles}">
<ol>
<g:each in="${bundles}" var="bundle">
<li><g:link action="show" params="${[bundleName: bundle.name]}" >${bundle.name}</g:link></li>
</g:each>
</ol>
<g:message code="plugin.translations.totalBundles" args="${[bundles.size()]}"/>
</g:if>
<g:else>
There is no bundles!
</g:else>
<g:message code="plugin.translations.totalBundles" args="${[bundles.size()]}"/>
</body>
</html>