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.
Showing
7 changed files
with
70 additions
and
51 deletions
| ... | @@ -13,7 +13,7 @@ return [ | ... | @@ -13,7 +13,7 @@ return [ |
| 13 | 'page_update' => 'página actualizada', | 13 | 'page_update' => 'página actualizada', |
| 14 | 'page_update_notification' => 'Página actualizada exitosamente', | 14 | 'page_update_notification' => 'Página actualizada exitosamente', |
| 15 | 'page_delete' => 'página borrada', | 15 | 'page_delete' => 'página borrada', |
| 16 | - 'page_delete_notification' => 'Página borrada exitosamente, | 16 | + 'page_delete_notification' => 'Página borrada exitosamente', |
| 17 | 'page_restore' => 'página restaurada', | 17 | 'page_restore' => 'página restaurada', |
| 18 | 'page_restore_notification' => 'Página restaurada exitosamente', | 18 | 'page_restore_notification' => 'Página restaurada exitosamente', |
| 19 | 'page_move' => 'página movida', | 19 | 'page_move' => 'página movida', | ... | ... |
| ... | @@ -21,6 +21,10 @@ | ... | @@ -21,6 +21,10 @@ |
| 21 | <form action="{{ baseUrl("/settings/users/create") }}" method="post"> | 21 | <form action="{{ baseUrl("/settings/users/create") }}" method="post"> |
| 22 | {!! csrf_field() !!} | 22 | {!! csrf_field() !!} |
| 23 | @include('users/forms/' . $authMethod) | 23 | @include('users/forms/' . $authMethod) |
| 24 | + <div class="form-group"> | ||
| 25 | + <a href="{{ baseUrl($currentUser->can('users-manage') ? "/settings/users" : "/") }}" class="button muted">{{ trans('common.cancel') }}</a> | ||
| 26 | + <button class="button pos" type="submit">{{ trans('common.save') }}</button> | ||
| 27 | + </div> | ||
| 24 | </form> | 28 | </form> |
| 25 | </div> | 29 | </div> |
| 26 | 30 | ... | ... |
| ... | @@ -19,38 +19,42 @@ | ... | @@ -19,38 +19,42 @@ |
| 19 | </div> | 19 | </div> |
| 20 | </div> | 20 | </div> |
| 21 | <div class="row"> | 21 | <div class="row"> |
| 22 | - <div class="col-md-6" ng-non-bindable> | 22 | + <div class="col-sm-6" ng-non-bindable> |
| 23 | - {!! csrf_field() !!} | 23 | + {!! csrf_field() !!} |
| 24 | - <input type="hidden" name="_method" value="put"> | 24 | + <input type="hidden" name="_method" value="put"> |
| 25 | - @include('users.forms.' . $authMethod, ['model' => $user]) | 25 | + @include('users.forms.' . $authMethod, ['model' => $user]) |
| 26 | 26 | ||
| 27 | - </div> | ||
| 28 | - <div class="col-md-6"> | ||
| 29 | - <div class="form-group" id="logo-control"> | ||
| 30 | - <label for="user-avatar">{{ trans('settings.users_avatar') }}</label> | ||
| 31 | - <p class="small">{{ trans('settings.users_avatar_desc') }}</p> | ||
| 32 | - | ||
| 33 | - @include('components.image-picker', [ | ||
| 34 | - 'resizeHeight' => '512', | ||
| 35 | - 'resizeWidth' => '512', | ||
| 36 | - 'showRemove' => false, | ||
| 37 | - 'defaultImage' => baseUrl('/user_avatar.png'), | ||
| 38 | - 'currentImage' => $user->getAvatar(80), | ||
| 39 | - 'currentId' => $user->image_id, | ||
| 40 | - 'name' => 'image_id', | ||
| 41 | - 'imageClass' => 'avatar large' | ||
| 42 | - ]) | ||
| 43 | </div> | 27 | </div> |
| 44 | - <div class="form-group"> | 28 | + <div class="col-sm-6"> |
| 45 | - <label for="user-language">{{ trans('settings.users_preferred_language') }}</label> | 29 | + <div class="form-group" id="logo-control"> |
| 46 | - <select name="setting[language]" id="user-language"> | 30 | + <label for="user-avatar">{{ trans('settings.users_avatar') }}</label> |
| 47 | - @foreach(trans('settings.language_select') as $lang => $label) | 31 | + <p class="small">{{ trans('settings.users_avatar_desc') }}</p> |
| 48 | - <option @if(setting()->getUser($user, 'language') === $lang) selected @endif value="{{ $lang }}">{{ $label }}</option> | 32 | + |
| 49 | - @endforeach | 33 | + @include('components.image-picker', [ |
| 50 | - </select> | 34 | + 'resizeHeight' => '512', |
| 35 | + 'resizeWidth' => '512', | ||
| 36 | + 'showRemove' => false, | ||
| 37 | + 'defaultImage' => baseUrl('/user_avatar.png'), | ||
| 38 | + 'currentImage' => $user->getAvatar(80), | ||
| 39 | + 'currentId' => $user->image_id, | ||
| 40 | + 'name' => 'image_id', | ||
| 41 | + 'imageClass' => 'avatar large' | ||
| 42 | + ]) | ||
| 43 | + </div> | ||
| 44 | + <div class="form-group"> | ||
| 45 | + <label for="user-language">{{ trans('settings.users_preferred_language') }}</label> | ||
| 46 | + <select name="setting[language]" id="user-language"> | ||
| 47 | + @foreach(trans('settings.language_select') as $lang => $label) | ||
| 48 | + <option @if(setting()->getUser($user, 'language') === $lang) selected @endif value="{{ $lang }}">{{ $label }}</option> | ||
| 49 | + @endforeach | ||
| 50 | + </select> | ||
| 51 | + </div> | ||
| 51 | </div> | 52 | </div> |
| 52 | </div> | 53 | </div> |
| 53 | - </div> | 54 | + <div class="form-group"> |
| 55 | + <a href="{{ baseUrl($currentUser->can('users-manage') ? "/settings/users" : "/") }}" class="button muted">{{ trans('common.cancel') }}</a> | ||
| 56 | + <button class="button pos" type="submit">{{ trans('common.save') }}</button> | ||
| 57 | + </div> | ||
| 54 | </form> | 58 | </form> |
| 55 | 59 | ||
| 56 | <hr class="margin-top large"> | 60 | <hr class="margin-top large"> |
| ... | @@ -60,7 +64,7 @@ | ... | @@ -60,7 +64,7 @@ |
| 60 | <p class="text-muted">{{ trans('settings.users_social_accounts_info') }}</p> | 64 | <p class="text-muted">{{ trans('settings.users_social_accounts_info') }}</p> |
| 61 | <div class="row"> | 65 | <div class="row"> |
| 62 | @foreach($activeSocialDrivers as $driver => $enabled) | 66 | @foreach($activeSocialDrivers as $driver => $enabled) |
| 63 | - <div class="col-md-3 text-center"> | 67 | + <div class="col-sm-3 col-xs-6 text-center"> |
| 64 | <div>@icon($driver, ['width' => 56])</div> | 68 | <div>@icon($driver, ['width' => 56])</div> |
| 65 | <div> | 69 | <div> |
| 66 | @if($user->hasSocialAccount($driver)) | 70 | @if($user->hasSocialAccount($driver)) | ... | ... |
| ... | @@ -22,9 +22,4 @@ | ... | @@ -22,9 +22,4 @@ |
| 22 | <label for="external_auth_id">{{ trans('settings.users_external_auth_id') }}</label> | 22 | <label for="external_auth_id">{{ trans('settings.users_external_auth_id') }}</label> |
| 23 | @include('form.text', ['name' => 'external_auth_id']) | 23 | @include('form.text', ['name' => 'external_auth_id']) |
| 24 | </div> | 24 | </div> |
| 25 | -@endif | ||
| 26 | - | ||
| 27 | -<div class="form-group"> | ||
| 28 | - <a href="{{ baseUrl("/settings/users") }}" class="button muted">{{ trans('common.cancel') }}</a> | ||
| 29 | - <button class="button pos" type="submit">{{ trans('common.save') }}</button> | ||
| 30 | -</div> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 25 | +@endif | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -31,10 +31,4 @@ | ... | @@ -31,10 +31,4 @@ |
| 31 | <div class="form-group"> | 31 | <div class="form-group"> |
| 32 | <label for="password-confirm">{{ trans('auth.password_confirm') }}</label> | 32 | <label for="password-confirm">{{ trans('auth.password_confirm') }}</label> |
| 33 | @include('form.password', ['name' => 'password-confirm']) | 33 | @include('form.password', ['name' => 'password-confirm']) |
| 34 | -</div> | 34 | +</div> |
| 35 | - | ||
| 36 | -<div class="form-group"> | ||
| 37 | - <a href="{{ baseUrl("/settings/users") }}" class="button muted">{{ trans('common.cancel') }}</a> | ||
| 38 | - <button class="button pos" type="submit">{{ trans('common.save') }}</button> | ||
| 39 | -</div> | ||
| 40 | - | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -19,8 +19,3 @@ | ... | @@ -19,8 +19,3 @@ |
| 19 | </div> | 19 | </div> |
| 20 | @endif | 20 | @endif |
| 21 | 21 | ||
| 22 | -<div class="form-group"> | ||
| 23 | - <a href="{{ baseUrl("/settings/users") }}" class="button muted">{{ trans('common.cancel') }}</a> | ||
| 24 | - <button class="button pos" type="submit">{{ trans('common.save') }}</button> | ||
| 25 | -</div> | ||
| 26 | - | ... | ... |
| ... | @@ -3,13 +3,24 @@ | ... | @@ -3,13 +3,24 @@ |
| 3 | class LanguageTest extends TestCase | 3 | class LanguageTest extends TestCase |
| 4 | { | 4 | { |
| 5 | 5 | ||
| 6 | - public function test_js_endpoint_for_each_language() { | 6 | + protected $langs; |
| 7 | + | ||
| 8 | + /** | ||
| 9 | + * LanguageTest constructor. | ||
| 10 | + */ | ||
| 11 | + public function setUp() | ||
| 12 | + { | ||
| 13 | + parent::setUp(); | ||
| 14 | + $this->langs = array_diff(scandir(resource_path('lang')), ['..', '.']); | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + public function test_js_endpoint_for_each_language() | ||
| 18 | + { | ||
| 7 | 19 | ||
| 8 | - $langs = array_diff(scandir(resource_path('lang')), ['..', '.']); | ||
| 9 | $visibleKeys = ['common', 'components', 'entities', 'errors']; | 20 | $visibleKeys = ['common', 'components', 'entities', 'errors']; |
| 10 | 21 | ||
| 11 | $this->asEditor(); | 22 | $this->asEditor(); |
| 12 | - foreach ($langs as $lang) { | 23 | + foreach ($this->langs as $lang) { |
| 13 | setting()->putUser($this->getEditor(), 'language', $lang); | 24 | setting()->putUser($this->getEditor(), 'language', $lang); |
| 14 | $transResp = $this->get('/translations'); | 25 | $transResp = $this->get('/translations'); |
| 15 | foreach ($visibleKeys as $key) { | 26 | foreach ($visibleKeys as $key) { |
| ... | @@ -18,4 +29,20 @@ class LanguageTest extends TestCase | ... | @@ -18,4 +29,20 @@ class LanguageTest extends TestCase |
| 18 | } | 29 | } |
| 19 | } | 30 | } |
| 20 | 31 | ||
| 32 | + public function test_all_lang_files_loadable() | ||
| 33 | + { | ||
| 34 | + $files = array_diff(scandir(resource_path('lang/en')), ['..', '.']); | ||
| 35 | + foreach ($this->langs as $lang) { | ||
| 36 | + foreach ($files as $file) { | ||
| 37 | + $loadError = false; | ||
| 38 | + try { | ||
| 39 | + $translations = trans(str_replace('.php', '', $file), [], $lang); | ||
| 40 | + } catch (\Exception $e) { | ||
| 41 | + $loadError = true; | ||
| 42 | + } | ||
| 43 | + $this->assertFalse($loadError, "Translation file {$lang}/{$file} failed to load"); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + | ||
| 21 | } | 48 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment