1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-23 19:32:29 +01:00

Made fixes to es languge files and users page

Fixed PHP formatting error in ES lang file and added tests to cover.
Made user edit page more responsive on smaller devices.
Fixed 'cancel' button on profile screen when the user does not have
permission to manage users.
This commit is contained in:
Dan Brown 2017-03-05 15:34:54 +00:00
parent d4e790d3cf
commit 4499ae84bb
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
7 changed files with 70 additions and 51 deletions

View File

@ -13,7 +13,7 @@ return [
'page_update' => 'página actualizada',
'page_update_notification' => 'Página actualizada exitosamente',
'page_delete' => 'página borrada',
'page_delete_notification' => 'Página borrada exitosamente,
'page_delete_notification' => 'Página borrada exitosamente',
'page_restore' => 'página restaurada',
'page_restore_notification' => 'Página restaurada exitosamente',
'page_move' => 'página movida',

View File

@ -21,6 +21,10 @@
<form action="{{ baseUrl("/settings/users/create") }}" method="post">
{!! csrf_field() !!}
@include('users/forms/' . $authMethod)
<div class="form-group">
<a href="{{ baseUrl($currentUser->can('users-manage') ? "/settings/users" : "/") }}" class="button muted">{{ trans('common.cancel') }}</a>
<button class="button pos" type="submit">{{ trans('common.save') }}</button>
</div>
</form>
</div>

View File

@ -19,38 +19,42 @@
</div>
</div>
<div class="row">
<div class="col-md-6" ng-non-bindable>
{!! csrf_field() !!}
<input type="hidden" name="_method" value="put">
@include('users.forms.' . $authMethod, ['model' => $user])
<div class="col-sm-6" ng-non-bindable>
{!! csrf_field() !!}
<input type="hidden" name="_method" value="put">
@include('users.forms.' . $authMethod, ['model' => $user])
</div>
<div class="col-md-6">
<div class="form-group" id="logo-control">
<label for="user-avatar">{{ trans('settings.users_avatar') }}</label>
<p class="small">{{ trans('settings.users_avatar_desc') }}</p>
@include('components.image-picker', [
'resizeHeight' => '512',
'resizeWidth' => '512',
'showRemove' => false,
'defaultImage' => baseUrl('/user_avatar.png'),
'currentImage' => $user->getAvatar(80),
'currentId' => $user->image_id,
'name' => 'image_id',
'imageClass' => 'avatar large'
])
</div>
<div class="form-group">
<label for="user-language">{{ trans('settings.users_preferred_language') }}</label>
<select name="setting[language]" id="user-language">
@foreach(trans('settings.language_select') as $lang => $label)
<option @if(setting()->getUser($user, 'language') === $lang) selected @endif value="{{ $lang }}">{{ $label }}</option>
@endforeach
</select>
<div class="col-sm-6">
<div class="form-group" id="logo-control">
<label for="user-avatar">{{ trans('settings.users_avatar') }}</label>
<p class="small">{{ trans('settings.users_avatar_desc') }}</p>
@include('components.image-picker', [
'resizeHeight' => '512',
'resizeWidth' => '512',
'showRemove' => false,
'defaultImage' => baseUrl('/user_avatar.png'),
'currentImage' => $user->getAvatar(80),
'currentId' => $user->image_id,
'name' => 'image_id',
'imageClass' => 'avatar large'
])
</div>
<div class="form-group">
<label for="user-language">{{ trans('settings.users_preferred_language') }}</label>
<select name="setting[language]" id="user-language">
@foreach(trans('settings.language_select') as $lang => $label)
<option @if(setting()->getUser($user, 'language') === $lang) selected @endif value="{{ $lang }}">{{ $label }}</option>
@endforeach
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<a href="{{ baseUrl($currentUser->can('users-manage') ? "/settings/users" : "/") }}" class="button muted">{{ trans('common.cancel') }}</a>
<button class="button pos" type="submit">{{ trans('common.save') }}</button>
</div>
</form>
<hr class="margin-top large">
@ -60,7 +64,7 @@
<p class="text-muted">{{ trans('settings.users_social_accounts_info') }}</p>
<div class="row">
@foreach($activeSocialDrivers as $driver => $enabled)
<div class="col-md-3 text-center">
<div class="col-sm-3 col-xs-6 text-center">
<div>@icon($driver, ['width' => 56])</div>
<div>
@if($user->hasSocialAccount($driver))

View File

@ -22,9 +22,4 @@
<label for="external_auth_id">{{ trans('settings.users_external_auth_id') }}</label>
@include('form.text', ['name' => 'external_auth_id'])
</div>
@endif
<div class="form-group">
<a href="{{ baseUrl("/settings/users") }}" class="button muted">{{ trans('common.cancel') }}</a>
<button class="button pos" type="submit">{{ trans('common.save') }}</button>
</div>
@endif

View File

@ -31,10 +31,4 @@
<div class="form-group">
<label for="password-confirm">{{ trans('auth.password_confirm') }}</label>
@include('form.password', ['name' => 'password-confirm'])
</div>
<div class="form-group">
<a href="{{ baseUrl("/settings/users") }}" class="button muted">{{ trans('common.cancel') }}</a>
<button class="button pos" type="submit">{{ trans('common.save') }}</button>
</div>
</div>

View File

@ -19,8 +19,3 @@
</div>
@endif
<div class="form-group">
<a href="{{ baseUrl("/settings/users") }}" class="button muted">{{ trans('common.cancel') }}</a>
<button class="button pos" type="submit">{{ trans('common.save') }}</button>
</div>

View File

@ -3,13 +3,24 @@
class LanguageTest extends TestCase
{
public function test_js_endpoint_for_each_language() {
protected $langs;
/**
* LanguageTest constructor.
*/
public function setUp()
{
parent::setUp();
$this->langs = array_diff(scandir(resource_path('lang')), ['..', '.']);
}
public function test_js_endpoint_for_each_language()
{
$langs = array_diff(scandir(resource_path('lang')), ['..', '.']);
$visibleKeys = ['common', 'components', 'entities', 'errors'];
$this->asEditor();
foreach ($langs as $lang) {
foreach ($this->langs as $lang) {
setting()->putUser($this->getEditor(), 'language', $lang);
$transResp = $this->get('/translations');
foreach ($visibleKeys as $key) {
@ -18,4 +29,20 @@ class LanguageTest extends TestCase
}
}
public function test_all_lang_files_loadable()
{
$files = array_diff(scandir(resource_path('lang/en')), ['..', '.']);
foreach ($this->langs as $lang) {
foreach ($files as $file) {
$loadError = false;
try {
$translations = trans(str_replace('.php', '', $file), [], $lang);
} catch (\Exception $e) {
$loadError = true;
}
$this->assertFalse($loadError, "Translation file {$lang}/{$file} failed to load");
}
}
}
}