mirror of
https://github.com/Prominence/grails-translations-plugin.git
synced 2026-07-03 02:36:46 +03:00
Code refactoring. Changed design for index page.
Minor changes...
This commit is contained in:
+1
-18
@@ -1,6 +1,6 @@
|
||||
package by.prominence.translations
|
||||
|
||||
class TranslationsOverviewController {
|
||||
class TranslationsManagementController {
|
||||
|
||||
def bundleService
|
||||
|
||||
@@ -9,23 +9,6 @@ class TranslationsOverviewController {
|
||||
render view: 'index', model: [bundles: bundleService.getBundles()]
|
||||
}
|
||||
|
||||
def show() {
|
||||
|
||||
if (!params.bundleName) {
|
||||
redirect action: 'index'
|
||||
return
|
||||
}
|
||||
|
||||
Bundle bundle = bundleService.findBundleByName(params.bundleName as String)
|
||||
|
||||
if (!bundle) {
|
||||
render view: 'index', model: [message: g.message(code: 'plugin.translations.error.bundleNotFound', args: [params.bundleName as String])]
|
||||
return
|
||||
}
|
||||
|
||||
render view: 'show', model: [bundle: bundle]
|
||||
}
|
||||
|
||||
def edit() {
|
||||
|
||||
if (!params.bundleName) {
|
||||
@@ -1,10 +0,0 @@
|
||||
plugin.translations.overview.index.page.title = Translations overview
|
||||
plugin.translations.overview.show.page.title = Bundle {0}
|
||||
plugin.translations.overview.edit.page.title = Edit {0} bundle
|
||||
|
||||
plugin.translations.totalRecords = Total: {0} records
|
||||
plugin.translations.totalBundles = Total: {0} bundles
|
||||
|
||||
plugin.translations.error.bundleNotFound = Cannot find bundle <b>{0}</b>.
|
||||
|
||||
plugin.translations.action.save = Save
|
||||
@@ -7,4 +7,11 @@ plugin.translations.totalBundles = Total: {0} bundles
|
||||
|
||||
plugin.translations.error.bundleNotFound = Cannot find bundle <b>{0}</b>.
|
||||
|
||||
plugin.translations.action.save = Save
|
||||
plugin.translations.message.noBundles = There is no bundles in your application!
|
||||
|
||||
plugin.translations.action.save = Save
|
||||
plugin.translations.action.edit = Edit
|
||||
plugin.translations.action.export = Export
|
||||
|
||||
plugin.translations.header.bundleName = Bundle
|
||||
plugin.translations.header.actions = Actions
|
||||
+8
-1
@@ -7,4 +7,11 @@ plugin.translations.totalBundles = Total: {0} bundles
|
||||
|
||||
plugin.translations.error.bundleNotFound = Cannot find bundle <b>{0}</b>.
|
||||
|
||||
plugin.translations.action.save = Save
|
||||
plugin.translations.message.noBundles = There is no bundles in your application!
|
||||
|
||||
plugin.translations.action.save = Save
|
||||
plugin.translations.action.edit = Edit
|
||||
plugin.translations.action.export = Export
|
||||
|
||||
plugin.translations.header.bundleName = Bundle
|
||||
plugin.translations.header.actions = Actions
|
||||
+8
-1
@@ -7,4 +7,11 @@ plugin.translations.totalBundles = Всего: {0} бандлов
|
||||
|
||||
plugin.translations.error.bundleNotFound = Бандл с именем <b>{0}</b> не найден.
|
||||
|
||||
plugin.translations.action.save = Сохранить
|
||||
plugin.translations.message.noBundles = В вашем приложении нет бандлов!
|
||||
|
||||
plugin.translations.action.save = Сохранить
|
||||
plugin.translations.action.edit = Редактировать
|
||||
plugin.translations.action.export = Экспорт
|
||||
|
||||
plugin.translations.header.bundleName = Бандл
|
||||
plugin.translations.header.actions = Действия
|
||||
@@ -5,9 +5,13 @@
|
||||
<title><g:layoutTitle default="Translations overview" /></title>
|
||||
<r:layoutResources/>
|
||||
</head>
|
||||
<g:layoutBody />
|
||||
<r:layoutResources/>
|
||||
<link rel="stylesheet" href="${resource(dir: 'css', file: 'translations.css')}" type="text/css">
|
||||
<body>
|
||||
|
||||
<div class="container main-container">
|
||||
<g:layoutBody />
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,63 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="layout" content="main"/>
|
||||
<title><g:message code="plugin.translations.overview.index.page.title" /></title>
|
||||
<r:require modules="bootstrap"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="raw">
|
||||
<h2 align="center"><g:message code="plugin.translations.overview.index.page.title"/></h2>
|
||||
<g:if test="${message}">
|
||||
<div class="alert alert-danger">
|
||||
${message}
|
||||
</div>
|
||||
</g:if>
|
||||
<g:if test="${bundles}">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>#</td>
|
||||
<td width="95%" colspan="2">
|
||||
<g:message code="plugin.translations.header.bundleName"/>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<g:each in="${bundles}" var="bundle" status="index">
|
||||
<tr>
|
||||
<td width="5%">
|
||||
${index + 1}
|
||||
</td>
|
||||
<td width="75%">
|
||||
<b>${bundle.name}</b>
|
||||
</td>
|
||||
<td>
|
||||
<div class="action-buttons">
|
||||
<g:link action="edit" params="${[bundleName: bundle.name]}"
|
||||
class="btn btn-default">
|
||||
<g:message code="plugin.translations.action.edit"/>
|
||||
</g:link>
|
||||
<g:link action="export" params="${[bundleName: bundle.name]}"
|
||||
class="btn btn-primary">
|
||||
<g:message code="plugin.translations.action.export"/>
|
||||
</g:link>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</g:each>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="total">
|
||||
<g:message code="plugin.translations.totalBundles" args="${[bundles.size()]}"/>
|
||||
</div>
|
||||
</g:if>
|
||||
<g:else>
|
||||
<div class="alert alert-warning">
|
||||
<g:message code="plugin.translations.message.noBundles"/>
|
||||
</div>
|
||||
</g:else>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,27 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="layout" content="main"/>
|
||||
<title><g:message code="plugin.translations.overview.index.page.title" /></title>
|
||||
<r:require modules="bootstrap"/>
|
||||
</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>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,38 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="layout" content="main"/>
|
||||
<title><g:message code="plugin.translations.overview.show.page.title" args="${[bundle.name]}" /></title>
|
||||
<r:require modules="bootstrap"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1><g:message code="plugin.translations.overview.show.page.title" args="${[bundle.name]}" /></h1>
|
||||
<br/>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<g:each in="${bundle.languages}" var="language">
|
||||
<th>${language.languageTag.toUpperCase()}</th>
|
||||
</g:each>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<g:each in="${bundle.languages}" var="language">
|
||||
<td>
|
||||
<g:each in="${language.translations}" var="translation">
|
||||
${translation.key} = ${translation.value} </br>
|
||||
</g:each>
|
||||
</td>
|
||||
</g:each>
|
||||
</tr>
|
||||
<tr>
|
||||
<g:each in="${bundle.languages}" var="language">
|
||||
<td><g:message code="plugin.translations.totalRecords" args="${language.translations.size() ?: '0'}"/></td>
|
||||
</g:each>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user