Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
53f9e8f2
Unverified
Commit
53f9e8f2
authored
Jul 25, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using new sidebar event listener for Translation module
parent
a964d63d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
20 deletions
+14
-20
RegisterTranslationSidebar.php
...ranslation/Events/Handlers/RegisterTranslationSidebar.php
+4
-19
TranslationServiceProvider.php
Modules/Translation/Providers/TranslationServiceProvider.php
+9
-1
changelog.yml
Modules/Translation/changelog.yml
+1
-0
No files found.
Modules/Translation/
Sidebar/SidebarExtende
r.php
→
Modules/Translation/
Events/Handlers/RegisterTranslationSideba
r.php
View file @
53f9e8f2
<?php
namespace
Modules\Translation\
Sidebar
;
namespace
Modules\Translation\
Events\Handlers
;
use
Maatwebsite\Sidebar\Group
;
use
Maatwebsite\Sidebar\Item
;
use
Maatwebsite\Sidebar\Menu
;
use
Modules\
User\Contracts\Authentication
;
use
Modules\
Core\Sidebar\AbstractAdminSidebar
;
class
SidebarExtender
implements
\Maatwebsite\Sidebar\SidebarExtende
r
class
RegisterTranslationSidebar
extends
AbstractAdminSideba
r
{
/**
* @var Authentication
*/
protected
$auth
;
/**
* @param Authentication $auth
*
* @internal param Guard $guard
*/
public
function
__construct
(
Authentication
$auth
)
{
$this
->
auth
=
$auth
;
}
/**
* Method used to define your sidebar menu groups and items
* @param Menu $menu
*
* @return Menu
*/
public
function
extendWith
(
Menu
$menu
)
...
...
Modules/Translation/Providers/TranslationServiceProvider.php
View file @
53f9e8f2
...
...
@@ -6,9 +6,12 @@ use Illuminate\Support\Facades\Schema;
use
Illuminate\Support\Facades\Validator
;
use
Illuminate\Support\ServiceProvider
;
use
Modules\Core\Composers\CurrentUserViewComposer
;
use
Modules\Core\Events\BuildingSidebar
;
use
Modules\Core\Traits\CanGetSidebarClassForModule
;
use
Modules\Core\Traits\CanPublishConfiguration
;
use
Modules\Translation\Console\BuildTranslationsCacheCommand
;
use
Modules\Translation\Entities\Translation
;
use
Modules\Translation\Events\Handlers\RegisterTranslationSidebar
;
use
Modules\Translation\Repositories\Cache\CacheTranslationDecorator
;
use
Modules\Translation\Repositories\Eloquent\EloquentTranslationRepository
;
use
Modules\Translation\Repositories\File\FileTranslationRepository
as
FileDiskTranslationRepository
;
...
...
@@ -18,7 +21,7 @@ use Modules\Translation\Services\TranslationLoader;
class
TranslationServiceProvider
extends
ServiceProvider
{
use
CanPublishConfiguration
;
use
CanPublishConfiguration
,
CanGetSidebarClassForModule
;
/**
* Indicates if loading of the provider is deferred.
*
...
...
@@ -37,6 +40,11 @@ class TranslationServiceProvider extends ServiceProvider
$this
->
registerConsoleCommands
();
view
()
->
composer
(
'translation::admin.translations.index'
,
CurrentUserViewComposer
::
class
);
$this
->
app
[
'events'
]
->
listen
(
BuildingSidebar
::
class
,
$this
->
getSidebarClassForModule
(
'translation'
,
RegisterTranslationSidebar
::
class
)
);
}
public
function
boot
()
...
...
Modules/Translation/changelog.yml
View file @
53f9e8f2
...
...
@@ -7,6 +7,7 @@ versions:
-
Using the @push js stacks over the scripts section
-
Using the @push css stacks over the styles section
-
No more 1 query per translation. Translations are group together to greatly reduce the query amount.
-
Sidebar is now loaded via the <code>BuildingSidebar</code> hook
"
2.2.0"
:
changed
:
-
Optimising the checking and loading of module translations (~20% speed increase)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment