diff --git a/src/NukaCode/Bootstrap/BootstrapServiceProvider.php b/src/NukaCode/Bootstrap/BootstrapServiceProvider.php index 3bab85a..22fac15 100755 --- a/src/NukaCode/Bootstrap/BootstrapServiceProvider.php +++ b/src/NukaCode/Bootstrap/BootstrapServiceProvider.php @@ -4,103 +4,101 @@ class BootstrapServiceProvider extends BaseServiceProvider { - /** - * Indicates if loading of the provider is deferred. - * - * @var bool - */ - protected $defer = false; + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = false; - const version = '1.0.0'; + const version = '1.0.0'; - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->shareWithApp(); - $this->setConfig(); - $this->registerViews(); - $this->registerAliases(); - $this->registerArtisanCommands(); - } + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->shareWithApp(); + $this->setPublishGroups(); + $this->registerViews(); + $this->registerAliases(); + $this->registerArtisanCommands(); + } - /** - * Share the package with application - * - * @return void - */ - protected function shareWithApp() - { - $this->app['bootstrap'] = $this->app->share(function ($app) { - return true; - }); - } + /** + * Share the package with application + * + * @return void + */ + protected function shareWithApp() + { + $this->app['bootstrap'] = $this->app->share(function ($app) { + return true; + }); + } - /** - * Load the config for the package - * - * @return void - */ - protected function setConfig() - { - $this->app['config']->set( - [ - 'nukacode' => [ - 'bootstrap' => $this->getConfig() - ] - ] - ); - } + /** + * Load the config for the package + * + * @return void + */ + protected function setPublishGroups() + { + $this->publishes( + [ + __DIR__ . '/../../config/config.php' => config_path('nukacode-frontend.php') + ], 'config' + ); + } - /** - * Register views - * - * @return void - */ - protected function registerViews() - { - $this->app['view']->addLocation(__DIR__ . '/../../views'); - } + /** + * Register views + * + * @return void + */ + protected function registerViews() + { + $this->app['view']->addLocation(__DIR__ . '/../../views'); + } - /** - * Register aliases - * - * @return void - */ - protected function registerAliases() - { - $aliases = [ - // Facades - 'HTML' => 'NukaCode\Bootstrap\Support\Html\HTML', - 'Form' => 'NukaCode\Bootstrap\Support\Html\Form', - 'BBCode' => 'NukaCode\Bootstrap\Support\Html\BBCode', - ]; + /** + * Register aliases + * + * @return void + */ + protected function registerAliases() + { + $aliases = [ + // Facades + 'HTML' => 'NukaCode\Bootstrap\Support\Html\HTML', + 'Form' => 'NukaCode\Bootstrap\Support\Html\Form', + 'BBCode' => 'NukaCode\Bootstrap\Support\Html\BBCode', + ]; - $exclude = $this->app['config']->get('nukacode.bootstrap.excludeAliases'); + $exclude = $this->app['config']->get('nukacode-frontend.excludeAliases'); + + $this->loadAliases($aliases, $exclude); + } - $this->loadAliases($aliases, $exclude); - } + public function registerArtisanCommands() + { + $this->commands( + [ + 'NukaCode\Bootstrap\Console\ThemeCommand', + ] + ); + } - public function registerArtisanCommands() - { - $this->commands( - [ - 'NukaCode\Bootstrap\Console\ThemeCommand', - ] - ); - } + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['bootstrap']; + } - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return ['bootstrap']; - } - -} \ No newline at end of file +} diff --git a/src/NukaCode/Bootstrap/Html/FormBuilder.php b/src/NukaCode/Bootstrap/Html/FormBuilder.php index 95d1ecc..f7c3d74 100755 --- a/src/NukaCode/Bootstrap/Html/FormBuilder.php +++ b/src/NukaCode/Bootstrap/Html/FormBuilder.php @@ -124,7 +124,7 @@ public function offsetGroupOpen($labelSize = null, $inputSize = null, $iconSize } - public function smallGroupClose() + public function offsetGroupClose() { if ($this->previousSizes != null) { call_user_func_array([$this, 'setSizes'], $this->previousSizes); @@ -138,7 +138,6 @@ public function smallGroupClose() return << - HTML; } @@ -494,6 +493,7 @@ private function checkForOptionals($name, $arguments) private function strpos_array($haystack, $needles, $offset = 0) { if (is_array($needles)) { + pp($needles); foreach ($needles as $needle) { $pos = $this->strpos_array($haystack, $needle); if ($pos !== false) { diff --git a/src/views/errors/400.blade.php b/src/views/errors/400.blade.php new file mode 100644 index 0000000..e16ae10 --- /dev/null +++ b/src/views/errors/400.blade.php @@ -0,0 +1 @@ +@include('errors.layout', ['error' => 400, 'subTitle' => 'We cannot process your request currently.']) diff --git a/src/views/errors/401.blade.php b/src/views/errors/401.blade.php index 236d2f7..e6855b3 100755 --- a/src/views/errors/401.blade.php +++ b/src/views/errors/401.blade.php @@ -1,13 +1 @@ -
-
-
-
- 401 Unauthorized Error -
- You are not authorized to view this page.
- @if (Session::has('errorMessage')) - Error Message: {{ Session::get('errorMessage') }} - @endif -
-
-
\ No newline at end of file +@include('errors.layout', ['error' => 401, 'subTitle' => 'You are not authorized to view this page.']) diff --git a/src/views/errors/404.blade.php b/src/views/errors/404.blade.php index 40e58b2..f971ccc 100755 --- a/src/views/errors/404.blade.php +++ b/src/views/errors/404.blade.php @@ -1,13 +1 @@ -
-
-
-
- 404 File Not Found Error -
- Sorry, the page you are looking for could not be found.
- @if (Session::has('errorMessage')) - Error Message: {{ Session::get('errorMessage') }} - @endif -
-
-
\ No newline at end of file +@include('errors.layout', ['error' => 404, 'subTitle' => 'The page you requested could not be found.']) diff --git a/src/views/errors/500.blade.php b/src/views/errors/500.blade.php new file mode 100644 index 0000000..4846e12 --- /dev/null +++ b/src/views/errors/500.blade.php @@ -0,0 +1 @@ +@include('errors.layout', ['error' => 500, 'subTitle' => 'We cannot process your request currently.']) diff --git a/src/views/errors/layout.blade.php b/src/views/errors/layout.blade.php new file mode 100644 index 0000000..ec24a7b --- /dev/null +++ b/src/views/errors/layout.blade.php @@ -0,0 +1,60 @@ + +@extends('layouts.default') + +@section('css') + @parent + + + +@stop + +
+
+
Error {{ $error }}
+
{{ $subTitle }}
+
+ @if (Session::has('errorMessage')) + Error Message: {{ Session::get('errorMessage') }} +
+ @endif +
+
+ {!! HTML::linkRoute('home', 'Go Back to the Home Page', [], ['class' => 'btn btn-primary']) !!} +
+
+
diff --git a/src/views/layouts/default.blade.php b/src/views/layouts/default.blade.php index c83c04e..79239c6 100755 --- a/src/views/layouts/default.blade.php +++ b/src/views/layouts/default.blade.php @@ -1,19 +1,22 @@ - - @include('layouts.partials.header') - - - @include('layouts.partials.menu') - @if (isset($content)) - {{ $content }} - @else - @yield('content') - @endif + + @include('layouts.partials.header') + + + @include('layouts.partials.menu') - @include('layouts.partials.modals') +
+ @if (isset($content)) + {{ $content }} + @else + @yield('content') + @endif +
- @include('layouts.partials.javascript') + @include('layouts.partials.modals') - - \ No newline at end of file + @include('layouts.partials.javascript') + + + diff --git a/src/views/layouts/partials/menu.blade.php b/src/views/layouts/partials/menu.blade.php index faadf89..d1ecf56 100755 --- a/src/views/layouts/partials/menu.blade.php +++ b/src/views/layouts/partials/menu.blade.php @@ -1,6 +1,6 @@ @if (Menu::count() > 0)
-@endif \ No newline at end of file +@endif