Commit c9f40fc9 authored by Nicolas Widart's avatar Nicolas Widart

Merge commit '5be6994d'

* commit '5be6994d':
  Squashed 'Modules/Core/' changes from fac6305..aa20d4a
parents d91dcb11 5be6994d
...@@ -140,7 +140,7 @@ $(function() { ...@@ -140,7 +140,7 @@ $(function() {
if ($('.slugify').length) { if ($('.slugify').length) {
$('.slugify').slug({ $('.slugify').slug({
slug: 'slug', // class of input / span that contains the generated slug slug: 'slug', // class of input / span that contains the generated slug
hide: false // hide the text input, true by default hide: false // hide the text input, true by default
}); });
} }
......
...@@ -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": [
\ No newline at end of file "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