Commit 5be6994d authored by Nicolas Widart's avatar Nicolas Widart

Squashed 'Modules/Core/' changes from fac6305..aa20d4a

aa20d4a Update to conform to the new pingpong/Modules package
70cd6a3 Use the new asset method signature
5f66d88 Need to refactor the slug option
c201dc9 Add the ul element
18e433e Extract the i18n tab headers
2c715f4 Brainstorm on how public routes could be handled
a6d83de Remove the booted closure
1f8755b Add the singleton for the public routes
89ea315 Add a routing service provider

git-subtree-dir: Modules/Core
git-subtree-split: aa20d4a75dc211908b21e63220d4b4abf3241d88
parent e583a4d4
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
jQuery.fn.slug = function (options) { jQuery.fn.slug = function (options) {
var settings = { var settings = {
slug: 'slug', // Class used for slug destination input and span. The span is created on $(document).ready() slug: 'slug', // Class used for slug destination input and span. The span is created on $(document).ready()
hide: true // Boolean - By default the slug input field is hidden, set to false to show the input field and hide the span. hide: true, // Boolean - By default the slug input field is hidden, set to false to show the input field and hide the span.
override: false
}; };
if (options) { if (options) {
......
<?php namespace Modules\Core\Permissions; <?php namespace Modules\Core\Permissions;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
use Pingpong\Modules\Module;
class PermissionManager class PermissionManager
{ {
...@@ -11,11 +10,10 @@ class PermissionManager ...@@ -11,11 +10,10 @@ class PermissionManager
private $module; private $module;
/** /**
* @param Module $module
*/ */
public function __construct(Module $module) public function __construct()
{ {
$this->module = $module; $this->module = app('modules');
} }
/** /**
...@@ -26,9 +24,9 @@ class PermissionManager ...@@ -26,9 +24,9 @@ class PermissionManager
{ {
$permissions = []; $permissions = [];
foreach ($this->module->enabled() as $enabledModule) { foreach ($this->module->enabled() as $enabledModule) {
$configuration = Config::get(strtolower($enabledModule) . '::permissions'); $configuration = Config::get(strtolower($enabledModule->getName()) . '::permissions');
if ($configuration) { if ($configuration) {
$permissions[$enabledModule] = $configuration; $permissions[$enabledModule->getName()] = $configuration;
} }
} }
return $permissions; return $permissions;
......
<?php namespace Modules\Core\Providers; <?php namespace Modules\Core\Providers;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Routing\Router; use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Modules\Core\Console\InstallCommand; use Modules\Core\Console\InstallCommand;
use Modules\Menu\Entities\Menuitem;
use Modules\Menu\Repositories\Eloquent\EloquentMenuItemRepository;
class CoreServiceProvider extends ServiceProvider class CoreServiceProvider extends ServiceProvider
{ {
...@@ -38,9 +41,8 @@ class CoreServiceProvider extends ServiceProvider ...@@ -38,9 +41,8 @@ class CoreServiceProvider extends ServiceProvider
public function register() public function register()
{ {
$this->loadModuleProviders(); $this->loadModuleProviders();
$this->app->booted(function ($app) { $this->registerMenuRoutes();
$this->registerFilters($app['router']); $this->registerFilters($this->app['router']);
});
$this->registerCommands(); $this->registerCommands();
} }
...@@ -113,4 +115,17 @@ class CoreServiceProvider extends ServiceProvider ...@@ -113,4 +115,17 @@ class CoreServiceProvider extends ServiceProvider
'command.asgard.install' 'command.asgard.install'
); );
} }
private function registerMenuRoutes()
{
$this->app->bind(
'Modules\Menu\Repositories\MenuItemRepository',
function() {
return new EloquentMenuItemRepository(new Menuitem);
}
);
$this->app->singleton('Asgard.routes', function (Application $app) {
return $app->make('Modules\Menu\Repositories\MenuItemRepository')->getForRoutes();
});
}
} }
<?php namespace Modules\Core\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Routing\Router;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
class RoutingServiceProvider extends ServiceProvider
{
public function before(Router $router)
{
// $modules = app('modules');
// $routes = app('Asgard.routes');
// foreach ($modules->enabled() as $module) {
// $router->group(
// ['namespace' => "Modules\\$module\\Http\\Controllers"],
// function (Router $router) use ($module, $routes) {
// foreach (LaravelLocalization::getSupportedLocales() as $locale => $language) {
// if ($this->moduleHasRoute($routes, $module, $locale)) {
// $uri = $routes[strtolower($module)][$locale];
// $router->get(
// $uri,
// [
// 'as' => "{$locale}.{$module}",
// 'uses' => 'PublicController@index'
// ]
// );
// $router->get(
// $uri . '/{slug}',
// [
// 'as' => "{$locale}.{$module}.slug",
// 'uses' => 'PublicController@show'
// ]
// );
// }
// }
// }
// );
// }
}
/**
* @param $routes
* @param $module
* @param $locale
* @return bool
*/
private function moduleHasRoute($routes, $module, $locale)
{
return isset($routes[strtolower($module)][$locale]);
}
public function map(Router $router)
{
}
}
...@@ -9,17 +9,17 @@ ...@@ -9,17 +9,17 @@
</title> </title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- bootstrap 3.0.2 --> <!-- bootstrap 3.0.2 -->
<link href="{{{ Module::asset('core', 'css/vendor/bootstrap.min.css') }}}" rel="stylesheet" type="text/css" /> <link href="{{{ Module::asset('core:css/vendor/bootstrap.min.css') }}}" rel="stylesheet" type="text/css" />
<!-- font Awesome --> <!-- font Awesome -->
<link href="{{{ Module::asset('core', 'css/vendor/font-awesome.min.css') }}}" rel="stylesheet" type="text/css" /> <link href="{{{ Module::asset('core:css/vendor/font-awesome.min.css') }}}" rel="stylesheet" type="text/css" />
<!-- Ionicons --> <!-- Ionicons -->
<link href="{{{ Module::asset('core', 'css/vendor/ionicons.min.css') }}}" rel="stylesheet" type="text/css" /> <link href="{{{ Module::asset('core:css/vendor/ionicons.min.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ Module::asset('core', 'css/vendor/alertify/alertify.core.css') }}}" rel="stylesheet" type="text/css" /> <link href="{{{ Module::asset('core:css/vendor/alertify/alertify.core.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ Module::asset('core', 'css/vendor/alertify/alertify.default.css') }}}" rel="stylesheet" type="text/css" /> <link href="{{{ Module::asset('core:css/vendor/alertify/alertify.default.css') }}}" rel="stylesheet" type="text/css" />
<link href="{{{ Module::asset('core', 'css/vendor/datatables/dataTables.bootstrap.css') }}}" rel="stylesheet" type="text/css" /> <link href="{{{ Module::asset('core:css/vendor/datatables/dataTables.bootstrap.css') }}}" rel="stylesheet" type="text/css" />
<!-- Theme style --> <!-- Theme style -->
<link href="{{{ Module::asset('core', 'css/AdminLTE.css') }}}" rel="stylesheet" type="text/css" /> <link href="{{{ Module::asset('core:css/AdminLTE.css') }}}" rel="stylesheet" type="text/css" />
<script src="{{{ Module::asset('core', 'js/vendor/jquery.min.js') }}}"></script> <script src="{{{ Module::asset('core:js/vendor/jquery.min.js') }}}"></script>
@section('styles') @section('styles')
@show @show
...@@ -56,13 +56,13 @@ ...@@ -56,13 +56,13 @@
</aside><!-- /.right-side --> </aside><!-- /.right-side -->
</div><!-- ./wrapper --> </div><!-- ./wrapper -->
<script src="{!! Module::asset('core', 'js/vendor/bootstrap.min.js') !!}" type="text/javascript"></script> <script src="{!! Module::asset('core:js/vendor/bootstrap.min.js') !!}" type="text/javascript"></script>
<script src="{!! Module::asset('core', 'js/vendor/alertify/alertify.js') !!}" type="text/javascript"></script> <script src="{!! Module::asset('core:js/vendor/alertify/alertify.js') !!}" type="text/javascript"></script>
<script src="{!! Module::asset('core', 'js/vendor/iCheck/icheck.min.js') !!}" type="text/javascript"></script> <script src="{!! Module::asset('core:js/vendor/iCheck/icheck.min.js') !!}" type="text/javascript"></script>
<script src="{!! Module::asset('core', 'js/vendor/datatables/jquery.dataTables.js') !!}" type="text/javascript"></script> <script src="{!! Module::asset('core:js/vendor/datatables/jquery.dataTables.js') !!}" type="text/javascript"></script>
<script src="{!! Module::asset('core', 'js/vendor/datatables/dataTables.bootstrap.js') !!}" type="text/javascript"></script> <script src="{!! Module::asset('core:js/vendor/datatables/dataTables.bootstrap.js') !!}" type="text/javascript"></script>
<script src="{!! Module::asset('core', 'js/vendor/jquery.slug.js') !!}" type="text/javascript"></script> <script src="{!! Module::asset('core:js/vendor/jquery.slug.js') !!}" type="text/javascript"></script>
<script src="{!! Module::asset('core', 'js/app.js') !!}" type="text/javascript"></script> <script src="{!! Module::asset('core:js/app.js') !!}" type="text/javascript"></script>
@section('scripts') @section('scripts')
@show @show
</body> </body>
......
<ul class="nav nav-tabs">
<?php $i = 0; ?>
<?php foreach(LaravelLocalization::getSupportedLocales() as $locale => $language): ?>
<?php $i++; ?>
<li class="{{ App::getLocale() == $locale ? 'active' : '' }}">
<a href="#tab_{{ $i }}" data-toggle="tab">{{ trans('core::core.tab.'. strtolower($language['name'])) }}</a>
</li>
<?php endforeach; ?>
</ul>
...@@ -12,5 +12,8 @@ ...@@ -12,5 +12,8 @@
"dimsav/laravel-translatable": "dev-laravel-5", "dimsav/laravel-translatable": "dev-laravel-5",
"mcamara/laravel-localization": "dev-Laravel5Support" "mcamara/laravel-localization": "dev-Laravel5Support"
}, },
"active": 1 "active": 1,
"providers": [
"Modules\\Core\\Providers\\RoutingServiceProvider"
]
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment