Skip to content

Commit

Permalink
Исправление ошибок
Browse files Browse the repository at this point in the history
  • Loading branch information
butschster committed Feb 20, 2016
1 parent f4016de commit 2905170
Show file tree
Hide file tree
Showing 35 changed files with 459 additions and 143 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
composer.phar
composer.lock
.DS_Store
.idea
/.idea
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "laravelruscollective/sleepingowl",
"name": "laravelrus/sleepingowl",
"description": "Aministrative interface builder for Laravel.",
"homepage": "http://sleeping-owl.github.io",
"keywords": [
Expand Down
11 changes: 6 additions & 5 deletions resources/assets.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?php

if (! function_exists('resources_url')) {
function resources_url()
function resources_url($path)
{
return public_path('packages/sleepingowl/default/');
return '/packages/sleepingowl/default/'.$path;
}
}

PackageManager::add('libraries')
->js(null, resources_url('js/libraries.js'));
->js(null, resources_url('js/libraries.js'), ['jquery']);

PackageManager::add('admin-default')
->js(null, resources_url('js/admin-default.js'));
->js(null, resources_url('js/admin-default.js'), ['metisMenu'])
->css(null, resources_url('css/common.css'));

PackageManager::add('flow.js')
->js(null, resources_url('libs/flow.js/js/flow.js'), ['jquery']);
Expand Down Expand Up @@ -44,7 +45,7 @@ function resources_url()
->js(null, resources_url('libs/jquery/js/jquery.min.js'));

PackageManager::add('metisMenu')
->js(null, resources_url('libs/metisMenu/js/metisMenu.js'), ['jquery'])
->js(null, resources_url('libs/metisMenu/js/metisMenu.js'), ['jquery', 'libraries'])
->css(null, resources_url('libs/metisMenu/css/metisMenu.css'));

PackageManager::add('moment')
Expand Down
7 changes: 3 additions & 4 deletions resources/views/default/_layout/inner.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
@extends(AdminTemplate::view('_layout.base'))
@extends(AdminTemplate::getTemplateViewPath('_layout.base'))

@section('content')
<div id="wrapper">
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
@include(AdminTemplate::view('_partials.header'))
@include(AdminTemplate::view('_partials.user'))
@include(AdminTemplate::view('_partials.menu'))
@include(AdminTemplate::getTemplateViewPath('_partials.header'))
@include(AdminTemplate::getTemplateViewPath('_partials.navigation'))
</nav>

<div id="page-wrapper">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/default/_partials/header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">{{{ config('admin.title') }}}</a>
<a class="navbar-brand" href="#">{{{ config('sleeping_owl.title') }}}</a>
</div>
9 changes: 0 additions & 9 deletions resources/views/default/_partials/menu.blade.php

This file was deleted.

15 changes: 0 additions & 15 deletions resources/views/default/_partials/menu_item.blade.php

This file was deleted.

18 changes: 18 additions & 0 deletions resources/views/default/_partials/navigation.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
@foreach(AdminNavigation::getRootSection()->getPages() as $item)
<li @if($item->isActive())class="active"@endif>
<a href="{{ $item->getUrl() }}">
{!! $item->getIcon() !!}
<span class="mm-text">{!! $item->getName() !!}</span>
</a>
</li>
@endforeach

@foreach(AdminNavigation::getRootSection()->getSections() as $section)
@include('cms::navigation.sections', ['section' => $section])
@endforeach
</ul>
</div>
</div>
23 changes: 23 additions & 0 deletions resources/views/default/_partials/navigation/sections.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@if(count($section) > 0 or $section->hasSections())
<li class="mm-dropdown @if($section->isActive()) open @endif">
<a href="#">
{!! $section->getIcon() !!}
<span class="mm-text">{!! $section->getName() !!}</span>
</a>
<ul>
@foreach($section as $item)
<?php if($item->isHidden()) continue; ?>
<li @if ($item->isActive())class="active"@endif>
<a href="{{ $item->getUrl() }}">
{!! $item->getIcon() !!}
<span class="mm-text">{!! $item->getName() !!}</span>
</a>
</li>
@endforeach

@foreach($section->getSections() as $sub_section )
@include('cms::navigation.sections', ['section' => $sub_section])
@endforeach
</ul>
</li>
@endif
10 changes: 0 additions & 10 deletions resources/views/default/_partials/user.blade.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function addMenuLink($class)
*/
public function buildMenu(Navigation $navigation)
{
$section = $navigation->addSection('SleepingOwl', null, 999);
$section = $navigation->getRootSection();

foreach ($this->menuItems as $item) {
$section->addPage($item);
Expand All @@ -148,6 +148,6 @@ public function view($content, $title = null)
{
$controller = app(AdminController::class);

return $controller->render($title, $content);
return $controller->renderContent($content, $title);
}
}
149 changes: 149 additions & 0 deletions src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<?php

namespace SleepingOwl\Admin\Commands;

use App;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Console\Input\InputOption;
use SleepingOwl\Admin\Providers\SleepingOwlServiceProvider;

class InstallCommand extends Command
{

/**
* The console command name.
* @var string
*/
protected $name = 'sleepingowl:install';

/**
* The console command description.
* @var string
*/
protected $description = 'Install the SleepingOwl Admin package';

/**
* @var Filesystem
*/
protected $files;

/**
* Execute the console command.
*
* @param Filesystem $files
*/
public function fire(Filesystem $files)
{
$this->files = $files;

$title = $this->option('title');

$this->call('vendor:publish', ['--provider' => SleepingOwlServiceProvider::class]);

$this->publishConfig($title);

$this->createBootstrapDirectory();
$this->createNavigationFile();
$this->createBootstrapFile();
$this->createRoutesFile();
$this->createPublicDefaultStructure();
}

/**
* Create bootstrap directory
*/
protected function createBootstrapDirectory()
{
$directory = config('sleeping_owl.bootstrapDirectory');

if (! is_dir($directory)) {
$this->files->makeDirectory($directory, 0755, true, true);
$this->line('<info>Admin bootstrap directory was created:</info> '.str_replace(base_path(), '', $directory));
}
}

/**
* Create default menu file
*/
protected function createNavigationFile()
{
$file = config('sleeping_owl.bootstrapDirectory').'/navigation.php';

if (! file_exists($file)) {
$contents = $this->files->get(__DIR__.'/stubs/navigation.stub');
$this->files->put($file, $contents);
$this->line('<info>Menu file was created:</info> '.str_replace(base_path(), '', $file));
}
}

/**
* Create default bootstrap file
*/
protected function createBootstrapFile()
{
$file = config('sleeping_owl.bootstrapDirectory').'/bootstrap.php';
if (! file_exists($file)) {
$contents = $this->files->get(__DIR__.'/stubs/bootstrap.stub');
$this->files->put($file, $contents);
$this->line('<info>Bootstrap file was created:</info> '.str_replace(base_path(), '', $file));
}
}

/**
* Create default routes file
*/
protected function createRoutesFile()
{
$file = config('sleeping_owl.bootstrapDirectory').'/routes.php';
if (! file_exists($file)) {
$contents = $this->files->get(__DIR__.'/stubs/routes.stub');
$this->files->put($file, $contents);
$this->line('<info>Bootstrap file was created:</info> '.str_replace(base_path(), '', $file));
}
}

/**
* Create public default structure
*/
protected function createPublicDefaultStructure()
{
$uploadsDirectory = public_path('images/uploads');
if (! is_dir($uploadsDirectory)) {
$this->files->makeDirectory($uploadsDirectory, 0755, true, true);
}
}

/**
* Publish package config
*
* @param string|null $title
*/
protected function publishConfig($title = null)
{
$file = config_path('sleeping_owl.php');

if (! is_null($title)) {
$contents = $this->files->get($file);
$contents = str_replace('Sleeping Owl administrator', $title, $contents);
$this->files->put($file, $contents);
}
}

/**
* Get the console command options.
* @return array
*/
protected function getOptions()
{
return [
[
'title',
null,
InputOption::VALUE_REQUIRED,
'Title for admin module.'
],
];
}

}
13 changes: 13 additions & 0 deletions src/Commands/stubs/bootstrap.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/*
* Describe you custom displays, columns and form items here.
*
* Display::register('customDisplay', '\Foo\Bar\MyCustomDisplay');
*
* Column::register('customColumn', '\Foo\Bar\MyCustomColumn');
*
* FormItem::register('customElement', \Foo\Bar\MyCustomElement::class);
*
*/

9 changes: 9 additions & 0 deletions src/Commands/stubs/navigation.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

return [
[
'name' => 'Dashboard',
'icon' => 'dashboard',
'url' => route('admin.dashboard'),
]
];
6 changes: 6 additions & 0 deletions src/Commands/stubs/routes.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

Route::get('', ['as' => 'admin.dashboard', function () {
$content = 'Define your dashboard here.';
return AdminSection::view($content, 'Dashboard');
}]);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions src/Facades/AdminNavigation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace SleepingOwl\Admin\Facades;

use Illuminate\Support\Facades\Facade;

class AdminNavigation extends Facade
{

/**
* @return string
*/
protected static function getFacadeAccessor()
{
return 'sleeping_owl.navigation';
}

}
2 changes: 1 addition & 1 deletion src/Facades/AdminTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AdminTemplate extends Facade
*/
protected static function getFacadeAccessor()
{
return 'sleepingowl.template';
return 'sleeping_owl.template';
}

}
Loading

0 comments on commit 2905170

Please sign in to comment.