├── .styleci.yml
├── src
├── Console
│ ├── stubs
│ │ └── make
│ │ │ └── views
│ │ │ ├── auth
│ │ │ ├── login.stub
│ │ │ ├── register.stub
│ │ │ └── passwords
│ │ │ │ ├── email.stub
│ │ │ │ └── reset.stub
│ │ │ └── home.stub
│ ├── AdminLteMakeCommand.php
│ └── MakeAdminLteCommand.php
├── Menu
│ ├── Filters
│ │ ├── FilterInterface.php
│ │ ├── ActiveFilter.php
│ │ ├── SubmenuFilter.php
│ │ ├── GateFilter.php
│ │ ├── HrefFilter.php
│ │ └── ClassesFilter.php
│ ├── Builder.php
│ └── ActiveChecker.php
├── Events
│ └── BuildingMenu.php
├── Http
│ └── ViewComposers
│ │ └── AdminLteComposer.php
├── AdminLte.php
└── ServiceProvider.php
├── resources
├── assets
│ ├── css
│ │ └── auth.css
│ ├── plugins
│ │ └── iCheck
│ │ │ ├── square
│ │ │ ├── blue.png
│ │ │ ├── blue@2x.png
│ │ │ └── blue.css
│ │ │ ├── icheck.min.js
│ │ │ └── icheck.js
│ ├── vendor
│ │ ├── Ionicons
│ │ │ └── fonts
│ │ │ │ ├── ionicons.eot
│ │ │ │ ├── ionicons.ttf
│ │ │ │ └── ionicons.woff
│ │ ├── font-awesome
│ │ │ └── fonts
│ │ │ │ ├── FontAwesome.otf
│ │ │ │ ├── fontawesome-webfont.eot
│ │ │ │ ├── fontawesome-webfont.ttf
│ │ │ │ ├── fontawesome-webfont.woff
│ │ │ │ └── fontawesome-webfont.woff2
│ │ └── bootstrap
│ │ │ └── dist
│ │ │ └── fonts
│ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ ├── glyphicons-halflings-regular.woff
│ │ │ └── glyphicons-halflings-regular.woff2
│ └── dist
│ │ ├── css
│ │ └── skins
│ │ │ ├── skin-red.min.css
│ │ │ ├── skin-green.min.css
│ │ │ ├── skin-purple.min.css
│ │ │ ├── skin-yellow.min.css
│ │ │ ├── skin-blue.min.css
│ │ │ ├── skin-black.min.css
│ │ │ ├── skin-red-light.min.css
│ │ │ ├── skin-green-light.min.css
│ │ │ ├── skin-purple-light.min.css
│ │ │ ├── skin-yellow-light.min.css
│ │ │ ├── skin-blue-light.min.css
│ │ │ ├── skin-black-light.min.css
│ │ │ ├── skin-red.css
│ │ │ ├── skin-green.css
│ │ │ ├── skin-purple.css
│ │ │ ├── skin-yellow.css
│ │ │ ├── skin-blue.css
│ │ │ ├── skin-red-light.css
│ │ │ ├── skin-black.css
│ │ │ ├── skin-green-light.css
│ │ │ ├── skin-purple-light.css
│ │ │ ├── skin-yellow-light.css
│ │ │ ├── skin-blue-light.css
│ │ │ └── skin-black-light.css
│ │ └── js
│ │ └── adminlte.min.js
├── lang
│ ├── cn
│ │ └── adminlte.php
│ ├── hr
│ │ └── adminlte.php
│ ├── en
│ │ └── adminlte.php
│ ├── pt-br
│ │ └── adminlte.php
│ ├── ar
│ │ └── adminlte.php
│ ├── es
│ │ └── adminlte.php
│ ├── nl
│ │ └── adminlte.php
│ ├── fr
│ │ └── adminlte.php
│ └── de
│ │ └── adminlte.php
└── views
│ ├── partials
│ ├── menu-item.blade.php
│ └── menu-item-top-nav.blade.php
│ ├── passwords
│ ├── email.blade.php
│ └── reset.blade.php
│ ├── master.blade.php
│ ├── register.blade.php
│ ├── login.blade.php
│ └── page.blade.php
├── phpunit.xml
├── .editorconfig
├── composer.json
├── LICENSE
├── config
└── adminlte.php
└── README.md
/.styleci.yml:
--------------------------------------------------------------------------------
1 | preset: laravel
2 |
3 | linting: true
4 |
--------------------------------------------------------------------------------
/src/Console/stubs/make/views/auth/login.stub:
--------------------------------------------------------------------------------
1 | @extends('adminlte::login')
--------------------------------------------------------------------------------
/resources/assets/css/auth.css:
--------------------------------------------------------------------------------
1 | .auth-links {
2 | margin-top: 10px;
3 | }
--------------------------------------------------------------------------------
/src/Console/stubs/make/views/auth/register.stub:
--------------------------------------------------------------------------------
1 | @extends('adminlte::register')
--------------------------------------------------------------------------------
/src/Console/stubs/make/views/auth/passwords/email.stub:
--------------------------------------------------------------------------------
1 | @extends('adminlte::passwords.email')
--------------------------------------------------------------------------------
/src/Console/stubs/make/views/auth/passwords/reset.stub:
--------------------------------------------------------------------------------
1 | @extends('adminlte::passwords.reset')
--------------------------------------------------------------------------------
/resources/assets/plugins/iCheck/square/blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/plugins/iCheck/square/blue.png
--------------------------------------------------------------------------------
/resources/assets/plugins/iCheck/square/blue@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/plugins/iCheck/square/blue@2x.png
--------------------------------------------------------------------------------
/resources/assets/vendor/Ionicons/fonts/ionicons.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/Ionicons/fonts/ionicons.eot
--------------------------------------------------------------------------------
/resources/assets/vendor/Ionicons/fonts/ionicons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/Ionicons/fonts/ionicons.ttf
--------------------------------------------------------------------------------
/resources/assets/vendor/Ionicons/fonts/ionicons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/Ionicons/fonts/ionicons.woff
--------------------------------------------------------------------------------
/resources/assets/vendor/font-awesome/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/font-awesome/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/resources/assets/vendor/font-awesome/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/font-awesome/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/resources/assets/vendor/font-awesome/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/font-awesome/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/resources/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/resources/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/resources/assets/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/resources/assets/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/resources/assets/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/resources/assets/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marinsagovac/Laravel-AdminLTE/master/resources/assets/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
You are logged in!
11 | @stop -------------------------------------------------------------------------------- /src/Menu/Filters/FilterInterface.php: -------------------------------------------------------------------------------- 1 | menu = $menu; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | ; This file is for unifying the coding style for different editors and IDEs. 2 | ; More information at http://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | indent_size = 4 9 | indent_style = space 10 | end_of_line = lf 11 | insert_final_newline = true 12 | trim_trailing_whitespace = true 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /src/Http/ViewComposers/AdminLteComposer.php: -------------------------------------------------------------------------------- 1 | adminlte = $adminlte; 19 | } 20 | 21 | public function compose(View $view) 22 | { 23 | $view->with('adminlte', $this->adminlte); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Menu/Filters/ActiveFilter.php: -------------------------------------------------------------------------------- 1 | activeChecker = $activeChecker; 15 | } 16 | 17 | public function transform($item, Builder $builder) 18 | { 19 | if (! isset($item['header'])) { 20 | $item['active'] = $this->activeChecker->isActive($item); 21 | } 22 | 23 | return $item; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Menu/Filters/SubmenuFilter.php: -------------------------------------------------------------------------------- 1 | transformItems($item['submenu']); 13 | $item['submenu_open'] = $item['active']; 14 | $item['submenu_classes'] = $this->makeSubmenuClasses(); 15 | $item['submenu_class'] = implode(' ', $item['submenu_classes']); 16 | } 17 | 18 | return $item; 19 | } 20 | 21 | protected function makeSubmenuClasses() 22 | { 23 | $classes = ['treeview-menu']; 24 | 25 | return $classes; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /resources/lang/cn/adminlte.php: -------------------------------------------------------------------------------- 1 | '姓名', 6 | 'email' => '邮箱', 7 | 'password' => '密码', 8 | 'retype_password' => '重输密码', 9 | 'remember_me' => '记住我', 10 | 'register' => '注册', 11 | 'register_a_new_membership' => '注册新用户', 12 | 'i_forgot_my_password' => '忘记密码', 13 | 'i_already_have_a_membership' => '已经有账户', 14 | 'sign_in' => '登录', 15 | 'log_out' => '退出', 16 | 'toggle_navigation' => '切换导航', 17 | 'login_message' => '请先登录', 18 | 'register_message' => '注册新用户', 19 | 'password_reset_message' => '重置密码', 20 | 'reset_password' => '重置密码', 21 | 'send_password_reset_link' => '发送密码重置链接', 22 | ]; 23 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jeroennoten/laravel-adminlte", 3 | "description": "Easy AdminLTE integration with Laravel", 4 | "keywords": ["laravel", "adminlte", "admin", "administrator"], 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Jeroen Noten", 9 | "email": "jeroennoten@me.com" 10 | } 11 | ], 12 | "autoload": { 13 | "psr-4": { 14 | "JeroenNoten\\LaravelAdminLte\\": "src/" 15 | } 16 | }, 17 | "autoload-dev": { 18 | "classmap": [ 19 | "tests/TestCase.php" 20 | ] 21 | }, 22 | "extra": { 23 | "laravel": { 24 | "providers": [ 25 | "JeroenNoten\\LaravelAdminLte\\ServiceProvider" 26 | ] 27 | } 28 | }, 29 | "require": { 30 | "laravel/framework": "~5.1.12|~5.2.0|~5.3.0|~5.4.0|~5.5.0", 31 | "php": ">=5.5.9" 32 | }, 33 | "require-dev": { 34 | "phpunit/phpunit": "~4.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Menu/Filters/GateFilter.php: -------------------------------------------------------------------------------- 1 | gate = $gate; 15 | } 16 | 17 | public function transform($item, Builder $builder) 18 | { 19 | if (! $this->isVisible($item)) { 20 | return false; 21 | } 22 | 23 | return $item; 24 | } 25 | 26 | protected function isVisible($item) 27 | { 28 | if (! isset($item['can'])) { 29 | return true; 30 | } 31 | 32 | if (isset($item['model'])) { 33 | return $this->gate->allows($item['can'], $item['model']); 34 | } 35 | 36 | return $this->gate->allows($item['can']); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Menu/Filters/HrefFilter.php: -------------------------------------------------------------------------------- 1 | urlGenerator = $urlGenerator; 15 | } 16 | 17 | public function transform($item, Builder $builder) 18 | { 19 | if (! isset($item['header'])) { 20 | $item['href'] = $this->makeHref($item); 21 | } 22 | 23 | return $item; 24 | } 25 | 26 | protected function makeHref($item) 27 | { 28 | if (isset($item['url'])) { 29 | return $this->urlGenerator->to($item['url']); 30 | } 31 | 32 | if (isset($item['route'])) { 33 | return $this->urlGenerator->route($item['route']); 34 | } 35 | 36 | return '#'; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /resources/lang/hr/adminlte.php: -------------------------------------------------------------------------------- 1 | 'Ime', 6 | 'email' => 'Email', 7 | 'password' => 'Lozinka', 8 | 'retype_password' => 'Ponovljena lozinka', 9 | 'remember_me' => 'Zapamti me', 10 | 'register' => 'Novi korisnik', 11 | 'register_a_new_membership' => 'Registracija', 12 | 'i_forgot_my_password' => 'Zaboravljena zaporka', 13 | 'i_already_have_a_membership' => 'Već imam korisnički račun', 14 | 'sign_in' => 'Prijava', 15 | 'log_out' => 'Odjava', 16 | 'toggle_navigation' => 'Pregled navigacije', 17 | 'login_message' => 'Prijava', 18 | 'register_message' => 'Registracija', 19 | 'password_reset_message' => 'Nova lozinka', 20 | 'reset_password' => 'Nova lozinka', 21 | 'send_password_reset_link' => 'Pošalji novi zahtjev lozinke', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Menu/Filters/ClassesFilter.php: -------------------------------------------------------------------------------- 1 | makeClasses($item); 13 | $item['class'] = implode(' ', $item['classes']); 14 | $item['top_nav_classes'] = $this->makeClasses($item, true); 15 | $item['top_nav_class'] = implode(' ', $item['top_nav_classes']); 16 | } 17 | 18 | return $item; 19 | } 20 | 21 | protected function makeClasses($item, $topNav = false) 22 | { 23 | $classes = []; 24 | 25 | if ($item['active']) { 26 | $classes[] = 'active'; 27 | } 28 | 29 | if (isset($item['submenu'])) { 30 | $classes[] = $topNav ? 'dropdown' : 'treeview'; 31 | } 32 | 33 | return $classes; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /resources/lang/en/adminlte.php: -------------------------------------------------------------------------------- 1 | 'Full name', 6 | 'email' => 'Email', 7 | 'password' => 'Password', 8 | 'retype_password' => 'Retype password', 9 | 'remember_me' => 'Remember Me', 10 | 'register' => 'Register', 11 | 'register_a_new_membership' => 'Register a new membership', 12 | 'i_forgot_my_password' => 'I forgot my password', 13 | 'i_already_have_a_membership' => 'I already have a membership', 14 | 'sign_in' => 'Sign In', 15 | 'log_out' => 'Log Out', 16 | 'toggle_navigation' => 'Toggle navigation', 17 | 'login_message' => 'Sign in to start your session', 18 | 'register_message' => 'Register a new membership', 19 | 'password_reset_message' => 'Reset Password', 20 | 'reset_password' => 'Reset Password', 21 | 'send_password_reset_link' => 'Send Password Reset Link', 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/lang/pt-br/adminlte.php: -------------------------------------------------------------------------------- 1 | 'Nome completo', 6 | 'email' => 'Email', 7 | 'password' => 'Senha', 8 | 'retype_password' => 'Repita a senha', 9 | 'remember_me' => 'Lembrar-me', 10 | 'register' => 'Registrar', 11 | 'register_a_new_membership' => 'Registrar um novo membro', 12 | 'i_forgot_my_password' => 'Esqueci minha senha', 13 | 'i_already_have_a_membership' => 'Já sou um membro', 14 | 'sign_in' => 'Assinar', 15 | 'log_out' => 'Sair', 16 | 'toggle_navigation' => 'Trocar navegação', 17 | 'login_message' => 'Entre para iniciar uma nova sessão', 18 | 'register_message' => 'Registrar um novo membro', 19 | 'password_reset_message' => 'Recuperar senha', 20 | 'reset_password' => 'Recuperar senha', 21 | 'send_password_reset_link' => 'Enviar link de recuperação de senha', 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/lang/ar/adminlte.php: -------------------------------------------------------------------------------- 1 | 'الاسم الثلاثي', 5 | 'email' => 'البريد الإلكتروني', 6 | 'password' => 'كلمة السر', 7 | 'retype_password' => 'أعد إدخال كلمة السر', 8 | 'remember_me' => 'ذكرني', 9 | 'register' => 'تسجيل جديد', 10 | 'register_a_new_membership' => 'تسجيل عضوية جديدة', 11 | 'i_forgot_my_password' => 'نسيت كلمة السر؟', 12 | 'i_already_have_a_membership' => 'هذا الحساب لديه عضوية سابقة', 13 | 'sign_in' => 'تسجيل الدخول', 14 | 'log_out' => 'تسجيل خروج', 15 | 'toggle_navigation' => 'القائمة الجانبية', 16 | 'login_message' => 'يجب تسجيل الدخول', 17 | 'register_message' => 'تم تسجيل العضوية الجديدة ', 18 | 'password_reset_message' => 'تم إعادة تعيين كلمة المرور', 19 | 'reset_password' => 'إعادة تعيين كلمة السر', 20 | 'send_password_reset_link' => 'إرسال رابط إعادة تعيين كلمة السر', 21 | ]; 22 | -------------------------------------------------------------------------------- /src/Menu/Builder.php: -------------------------------------------------------------------------------- 1 | filters = $filters; 17 | } 18 | 19 | public function add() 20 | { 21 | $items = $this->transformItems(func_get_args()); 22 | 23 | foreach ($items as $item) { 24 | array_push($this->menu, $item); 25 | } 26 | } 27 | 28 | public function transformItems($items) 29 | { 30 | return array_filter(array_map([$this, 'applyFilters'], $items)); 31 | } 32 | 33 | protected function applyFilters($item) 34 | { 35 | if (is_string($item)) { 36 | return $item; 37 | } 38 | 39 | foreach ($this->filters as $filter) { 40 | $item = $filter->transform($item, $this); 41 | } 42 | 43 | if (isset($item['header'])) { 44 | $item = $item['header']; 45 | } 46 | 47 | return $item; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /resources/lang/es/adminlte.php: -------------------------------------------------------------------------------- 1 | 'Nombre completo', 6 | 'email' => 'Email', 7 | 'password' => 'Contraseña', 8 | 'retype_password' => 'Vuelva la contraseña', 9 | 'remember_me' => 'Recuérdame', 10 | 'register' => 'Registre', 11 | 'register_a_new_membership' => 'Registre una nueva cuenta', 12 | 'i_forgot_my_password' => 'Olvidé mi contraseña', 13 | 'i_already_have_a_membership' => 'Ya tengo una cuenta', 14 | 'sign_in' => 'Registrarse', 15 | 'log_out' => 'Cerrar', 16 | 'toggle_navigation' => 'Navegación de palanca', 17 | 'login_message' => 'Autenticarse para iniciar la sesión', 18 | 'register_message' => 'Registre una nueva cuenta', 19 | 'password_reset_message' => 'Restablecer la contraseña', 20 | 'reset_password' => 'Restablecer la contraseña', 21 | 'send_password_reset_link' => 'Enviar link de restablecimiento de contraseña', 22 | ]; 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Jeroen Noten 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /resources/lang/nl/adminlte.php: -------------------------------------------------------------------------------- 1 | 'Volledige naam', 6 | 'email' => 'E-mailadres', 7 | 'password' => 'Wachtwoord', 8 | 'retype_password' => 'Wachtwoord nogmaals invoeren', 9 | 'remember_me' => 'Ingelogd blijven', 10 | 'register' => 'Registreren', 11 | 'register_a_new_membership' => 'Registreer een nieuw lidmaatschap', 12 | 'i_forgot_my_password' => 'Ik ben mijn wachtwoord vergeten', 13 | 'i_already_have_a_membership' => 'Ik heb al een lidmaatschap', 14 | 'sign_in' => 'Inloggen', 15 | 'log_out' => 'Uitloggen', 16 | 'toggle_navigation' => 'Schakel navigatie', 17 | 'login_message' => 'Log in om je sessie te starten', 18 | 'register_message' => 'Registreer een nieuw lidmaatschap', 19 | 'password_reset_message' => 'Wachtwoord herstellen', 20 | 'reset_password' => 'Wachtwoord herstellen', 21 | 'send_password_reset_link' => 'Verzend link voor wachtwoordherstel', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Console/AdminLteMakeCommand.php: -------------------------------------------------------------------------------- 1 | 'auth/login.blade.php', 15 | 'auth/register.stub' => 'auth/register.blade.php', 16 | 'auth/passwords/email.stub' => 'auth/passwords/email.blade.php', 17 | 'auth/passwords/reset.stub' => 'auth/passwords/reset.blade.php', 18 | 'home.stub' => 'home.blade.php', 19 | ]; 20 | 21 | protected function exportViews() 22 | { 23 | parent::exportViews(); 24 | 25 | foreach ($this->adminLteViews as $key => $value) { 26 | copy(__DIR__.'/stubs/make/views/'.$key, 27 | base_path('resources/views/'.$value)); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Console/MakeAdminLteCommand.php: -------------------------------------------------------------------------------- 1 | 'auth/login.blade.php', 15 | 'auth/register.stub' => 'auth/register.blade.php', 16 | 'auth/passwords/email.stub' => 'auth/passwords/email.blade.php', 17 | 'auth/passwords/reset.stub' => 'auth/passwords/reset.blade.php', 18 | 'home.stub' => 'home.blade.php', 19 | ]; 20 | 21 | protected function exportViews() 22 | { 23 | parent::exportViews(); 24 | 25 | foreach ($this->adminLteViews as $key => $value) { 26 | copy(__DIR__.'/stubs/make/views/'.$key, 27 | base_path('resources/views/'.$value)); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /resources/lang/fr/adminlte.php: -------------------------------------------------------------------------------- 1 | 'Nom', 6 | 'email' => 'Email', 7 | 'password' => 'Mot de passe', 8 | 'retype_password' => 'Entrez à nouveau le mot de passe', 9 | 'remember_me' => 'Se souvenir de moi', 10 | 'register' => 'Enregistrement', 11 | 'register_a_new_membership' => 'Enregistrer un nouveau membre', 12 | 'i_forgot_my_password' => 'J\'ai oublié mon mot de passe', 13 | 'i_already_have_a_membership' => 'J\'ai déjà un compte', 14 | 'sign_in' => 'Connexion', 15 | 'log_out' => 'Déconnexion', 16 | 'toggle_navigation' => 'Basculer la navigation', 17 | 'login_message' => 'Connectez-vous pour commencer une session', 18 | 'register_message' => 'Enregistrement d\'un nouveau membre', 19 | 'password_reset_message' => 'Réinitialisation du mot de passe', 20 | 'reset_password' => 'Réinitialisation du mot de passe', 21 | 'send_password_reset_link' => 'Envoi de la réinitialisation du mot de passe', 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/views/partials/menu-item.blade.php: -------------------------------------------------------------------------------- 1 | @if (is_string($item)) 2 |{{ trans('adminlte::adminlte.password_reset_message') }}
18 | @if (session('status')) 19 |{{ trans('adminlte::adminlte.password_reset_message') }}
18 | 57 |{{ trans('adminlte::adminlte.register_message') }}
18 | 65 | 69 |{{ trans('adminlte::adminlte.login_message') }}
19 | 58 |Welcome to this beautiful admin panel.
88 | @stop 89 | 90 | @section('css') 91 | 92 | @stop 93 | 94 | @section('js') 95 | 96 | @stop 97 | ``` 98 | 99 | Note that in Laravel 5.2 or higher you can also use `@stack` directive for `css` and `javascript`: 100 | 101 | ```html 102 | {{-- resources/views/admin/dashboard.blade.php --}} 103 | 104 | @push('css') 105 | 106 | @push('js') 107 | ``` 108 | 109 | You now just return this view from your controller, as usual. Check out [AdminLTE](https://almsaeedstudio.com) to find out how to build beautiful content for your admin panel. 110 | 111 | ## 4. The `make:adminlte` artisan command 112 | 113 | > Note: only for Laravel 5.2 and higher 114 | 115 | This package ships with a `make:adminlte` command that behaves exactly like `make:auth` (introduced in Laravel 5.2) but replaces the authentication views with AdminLTE style views. 116 | 117 | ``` 118 | php artisan make:adminlte 119 | ``` 120 | 121 | This command should be used on fresh applications, just like the `make:auth` command 122 | 123 | ### 4.1 Using the authentication views without the `make:adminlte` command 124 | 125 | If you want to use the included authentication related views manually, you can create the following files and only add one line to each file: 126 | 127 | - `resources/views/auth/login.blade.php`: 128 | ``` 129 | @extends('adminlte::login') 130 | ``` 131 | - `resources/views/auth/register.blade.php` 132 | ``` 133 | @extends('adminlte::register') 134 | ``` 135 | - `resources/views/auth/passwords/email.blade.php` 136 | ``` 137 | @extends('adminlte::passwords.email') 138 | ``` 139 | - `resources/views/auth/passwords/reset.blade.php` 140 | ``` 141 | @extends('adminlte::passwords.reset') 142 | ``` 143 | 144 | By default, the login form contains a link to the registration form. 145 | If you don't want a registration form, set the `register_url` setting to `null` and the link will not be displayed. 146 | 147 | ## 5. Configuration 148 | 149 | First, publish the configuration file: 150 | 151 | ``` 152 | php artisan vendor:publish --provider="JeroenNoten\LaravelAdminLte\ServiceProvider" --tag=config 153 | ``` 154 | 155 | Now, edit `config/adminlte.php` to configure the title, skin, menu, URLs etc. All configuration options are explained in the comments. However, I want to shed some light on the `menu` configuration. 156 | 157 | ### 5.1 Menu 158 | 159 | You can configure your menu as follows: 160 | 161 | ```php 162 | 'menu' => [ 163 | 'MAIN NAVIGATION', 164 | [ 165 | 'text' => 'Blog', 166 | 'url' => 'admin/blog', 167 | ], 168 | [ 169 | 'text' => 'Pages', 170 | 'url' => 'admin/pages', 171 | 'icon' => 'file' 172 | ], 173 | [ 174 | 'text' => 'Show my website', 175 | 'url' => '/', 176 | 'target' => '_blank' 177 | ], 178 | 'ACCOUNT SETTINGS', 179 | [ 180 | 'text' => 'Profile', 181 | 'route' => 'admin.profile', 182 | 'icon' => 'user' 183 | ], 184 | [ 185 | 'text' => 'Change Password', 186 | 'route' => 'admin.password', 187 | 'icon' => 'lock' 188 | ], 189 | ], 190 | ``` 191 | 192 | With a single string, you specify a menu header item to separate the items. 193 | With an array, you specify a menu item. `text` and `url` or `route` are required attributes. 194 | The `icon` is optional, you get an [open circle](http://fontawesome.io/icon/circle-o/) if you leave it out. 195 | The available icons that you can use are those from [Font Awesome](http://fontawesome.io/icons/). 196 | Just specify the name of the icon and it will appear in front of your menu item. 197 | 198 | Use the `can` option if you want conditionally show the menu item. This integrates with Laravel's `Gate` functionality. If you need to conditionally show headers as well, you need to wrap it in an array like other menu items, using the `header` option: 199 | 200 | ```php 201 | [ 202 | [ 203 | 'header' => 'BLOG', 204 | 'can' => 'manage-blog' 205 | ], 206 | [ 207 | 'text' => 'Add new post', 208 | 'url' => 'admin/blog/new', 209 | 'can' => 'add-blog-post' 210 | ], 211 | ] 212 | ``` 213 | 214 | #### Custom Menu Filters 215 | 216 | If you need custom filters, you can easily add your own menu filters to this package. This can be useful when you are using a third-party package for authorization (instead of Laravel's `Gate` functionality). 217 | 218 | For example with Laratrust: 219 | 220 | ```php 221 | [ 246 | JeroenNoten\LaravelAdminLte\Menu\Filters\ActiveFilter::class, 247 | JeroenNoten\LaravelAdminLte\Menu\Filters\HrefFilter::class, 248 | JeroenNoten\LaravelAdminLte\Menu\Filters\SubmenuFilter::class, 249 | JeroenNoten\LaravelAdminLte\Menu\Filters\ClassesFilter::class, 250 | //JeroenNoten\LaravelAdminLte\Menu\Filters\GateFilter::class, Comment this line out 251 | MyApp\MyMenuFilter::class, 252 | ] 253 | ``` 254 | 255 | #### Menu configuration at runtime 256 | 257 | It is also possible to configure the menu at runtime, e.g. in the boot of any service provider. 258 | Use this if your menu is not static, for example when it depends on your database or the locale. 259 | It is also possible to combine both approaches. The menus will simply be concatenated and the order of service providers 260 | determines the order in the menu. 261 | 262 | To configure the menu at runtime, register a handler or callback for the `MenuBuilding` event, for example in the `boot()` method of a service provider: 263 | 264 | ```php 265 | use Illuminate\Contracts\Events\Dispatcher; 266 | use JeroenNoten\LaravelAdminLte\Events\BuildingMenu; 267 | 268 | class AppServiceProvider extends ServiceProvider 269 | { 270 | 271 | public function boot(Dispatcher $events) 272 | { 273 | $events->listen(BuildingMenu::class, function (BuildingMenu $event) { 274 | $event->menu->add('MAIN NAVIGATION'); 275 | $event->menu->add([ 276 | 'text' => 'Blog', 277 | 'url' => 'admin/blog', 278 | ]); 279 | }); 280 | } 281 | 282 | } 283 | ``` 284 | The configuration options are the same as in the static configuration files. 285 | 286 | A more practical example that actually uses translations and the database: 287 | 288 | ```php 289 | public function boot(Dispatcher $events) 290 | { 291 | $events->listen(BuildingMenu::class, function (BuildingMenu $event) { 292 | $event->menu->add(trans('menu.pages')); 293 | 294 | $items = Page::all()->map(function (Page $page) { 295 | return [ 296 | 'text' => $page['title'], 297 | 'url' => route('admin.pages.edit', $page) 298 | ]; 299 | }); 300 | 301 | $event->menu->add(...$items); 302 | }); 303 | } 304 | ``` 305 | 306 | This event-based approach is used to make sure that your code that builds the menu runs only when the admin panel is actually displayed and not on every request. 307 | 308 | #### Active menu items 309 | 310 | By default, a menu item is considered active if any of the following holds: 311 | - The current path matches the `url` parameter 312 | - The current path is a sub-path of the `url` parameter 313 | - If it has a submenu containing an active menu item 314 | 315 | To override this behavior, you can specify an `active` parameter with an array of active URLs, asterisks and regular expressions are supported. Example: 316 | 317 | ```php 318 | [ 319 | 'text' => 'Pages' 320 | 'url' => 'pages', 321 | 'active' => ['pages', 'content', 'content/*'] 322 | ] 323 | ``` 324 | 325 | ### 5.2 Plugins 326 | 327 | By default the [DataTables](https://datatables.net/) plugin is supported. If set to `true`, the necessary javascript CDN script tags will automatically be injected into the `adminlte::page.blade` file. 328 | 329 | ```php 330 | 'plugins' => [ 331 | 'datatables' => true, 332 | ] 333 | ``` 334 | 335 | Also the [Select2](https://select2.github.io/) plugin is supported. If set to `true`, the necessary javascript CDN script tags will automatically be injected into the `adminlte::page.blade` file. 336 | 337 | ```php 338 | 'plugins' => [ 339 | 'datatables' => true, 340 | 'select2' => true, 341 | ] 342 | ``` 343 | 344 | Also the [ChartJS](https://www.chartjs.org/) plugin is supported. If set to `true`, the necessary javascript CDN script tags will automatically be injected into the `adminlte::page.blade` file. 345 | 346 | ```php 347 | 'plugins' => [ 348 | 'datatables' => true, 349 | 'chartjs' => true, 350 | ] 351 | ``` 352 | 353 | 354 | ## 6. Translations 355 | 356 | At the moment, English, German, French, Dutch, Portuguese and Spanish translations are available out of the box. 357 | Just specifiy the language in `config/app.php`. 358 | If you need to modify the texts or add other languages, you can publish the language files: 359 | 360 | ``` 361 | php artisan vendor:publish --provider="JeroenNoten\LaravelAdminLte\ServiceProvider" --tag=translations 362 | ``` 363 | 364 | Now, you can edit translations or add languages in `resources/lang/vendor/adminlte`. 365 | 366 | ## 7. Customize views 367 | 368 | If you need full control over the provided views, you can publish them: 369 | 370 | ``` 371 | php artisan vendor:publish --provider="JeroenNoten\LaravelAdminLte\ServiceProvider" --tag=views 372 | ``` 373 | 374 | Now, you can edit the views in `resources/views/vendor/adminlte`. 375 | 376 | ## 8. Issues, Questions and Pull Requests 377 | 378 | You can report issues and ask questions in the [issues section](https://github.com/jeroennoten/Laravel-AdminLTE/issues). Please start your issue with `ISSUE: ` and your question with `QUESTION: ` 379 | 380 | If you have a question, check the closed issues first. Over time, I've been able to answer quite a few. 381 | 382 | To submit a Pull Request, please fork this repository, create a new branch and commit your new/updated code in there. Then open a Pull Request from your new branch. Refer to [this guide](https://help.github.com/articles/about-pull-requests/) for more info. 383 | 384 | -------------------------------------------------------------------------------- /resources/assets/plugins/iCheck/icheck.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * iCheck v1.0.1, http://git.io/arlzeA 3 | * ================================= 4 | * Powerful jQuery and Zepto plugin for checkboxes and radio buttons customization 5 | * 6 | * (c) 2013 Damir Sultanov, http://fronteed.com 7 | * MIT Licensed 8 | */ 9 | 10 | (function($) { 11 | 12 | // Cached vars 13 | var _iCheck = 'iCheck', 14 | _iCheckHelper = _iCheck + '-helper', 15 | _checkbox = 'checkbox', 16 | _radio = 'radio', 17 | _checked = 'checked', 18 | _unchecked = 'un' + _checked, 19 | _disabled = 'disabled', 20 | _determinate = 'determinate', 21 | _indeterminate = 'in' + _determinate, 22 | _update = 'update', 23 | _type = 'type', 24 | _click = 'click', 25 | _touch = 'touchbegin.i touchend.i', 26 | _add = 'addClass', 27 | _remove = 'removeClass', 28 | _callback = 'trigger', 29 | _label = 'label', 30 | _cursor = 'cursor', 31 | _mobile = /ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent); 32 | 33 | // Plugin init 34 | $.fn[_iCheck] = function(options, fire) { 35 | 36 | // Walker 37 | var handle = 'input[type="' + _checkbox + '"], input[type="' + _radio + '"]', 38 | stack = $(), 39 | walker = function(object) { 40 | object.each(function() { 41 | var self = $(this); 42 | 43 | if (self.is(handle)) { 44 | stack = stack.add(self); 45 | } else { 46 | stack = stack.add(self.find(handle)); 47 | } 48 | }); 49 | }; 50 | 51 | // Check if we should operate with some method 52 | if (/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(options)) { 53 | 54 | // Normalize method's name 55 | options = options.toLowerCase(); 56 | 57 | // Find checkboxes and radio buttons 58 | walker(this); 59 | 60 | return stack.each(function() { 61 | var self = $(this); 62 | 63 | if (options == 'destroy') { 64 | tidy(self, 'ifDestroyed'); 65 | } else { 66 | operate(self, true, options); 67 | } 68 | // Fire method's callback 69 | if ($.isFunction(fire)) { 70 | fire(); 71 | } 72 | }); 73 | 74 | // Customization 75 | } else if (typeof options == 'object' || !options) { 76 | 77 | // Check if any options were passed 78 | var settings = $.extend({ 79 | checkedClass: _checked, 80 | disabledClass: _disabled, 81 | indeterminateClass: _indeterminate, 82 | labelHover: true, 83 | aria: false 84 | }, options), 85 | 86 | selector = settings.handle, 87 | hoverClass = settings.hoverClass || 'hover', 88 | focusClass = settings.focusClass || 'focus', 89 | activeClass = settings.activeClass || 'active', 90 | labelHover = !!settings.labelHover, 91 | labelHoverClass = settings.labelHoverClass || 'hover', 92 | 93 | // Setup clickable area 94 | area = ('' + settings.increaseArea).replace('%', '') | 0; 95 | 96 | // Selector limit 97 | if (selector == _checkbox || selector == _radio) { 98 | handle = 'input[type="' + selector + '"]'; 99 | } 100 | // Clickable area limit 101 | if (area < -50) { 102 | area = -50; 103 | } 104 | // Walk around the selector 105 | walker(this); 106 | 107 | return stack.each(function() { 108 | var self = $(this); 109 | 110 | // If already customized 111 | tidy(self); 112 | 113 | var node = this, 114 | id = node.id, 115 | 116 | // Layer styles 117 | offset = -area + '%', 118 | size = 100 + (area * 2) + '%', 119 | layer = { 120 | position: 'absolute', 121 | top: offset, 122 | left: offset, 123 | display: 'block', 124 | width: size, 125 | height: size, 126 | margin: 0, 127 | padding: 0, 128 | background: '#fff', 129 | border: 0, 130 | opacity: 0 131 | }, 132 | 133 | // Choose how to hide input 134 | hide = _mobile ? { 135 | position: 'absolute', 136 | visibility: 'hidden' 137 | } : area ? layer : { 138 | position: 'absolute', 139 | opacity: 0 140 | }, 141 | 142 | // Get proper class 143 | className = node[_type] == _checkbox ? settings.checkboxClass || 'i' + _checkbox : settings.radioClass || 'i' + _radio, 144 | 145 | // Find assigned labels 146 | label = $(_label + '[for="' + id + '"]').add(self.closest(_label)), 147 | 148 | // Check ARIA option 149 | aria = !!settings.aria, 150 | 151 | // Set ARIA placeholder 152 | ariaID = _iCheck + '-' + Math.random().toString(36).replace('0.', ''), 153 | 154 | // Parent & helper 155 | parent = '')[_callback]('ifCreated').parent().append(settings.insert); 175 | 176 | // Layer addition 177 | helper = $('').css(layer).appendTo(parent); 178 | 179 | // Finalize customization 180 | self.data(_iCheck, {o: settings, s: self.attr('style')}).css(hide); 181 | !!settings.inheritClass && parent[_add](node.className || ''); 182 | !!settings.inheritID && id && parent.attr('id', _iCheck + '-' + id); 183 | parent.css('position') == 'static' && parent.css('position', 'relative'); 184 | operate(self, true, _update); 185 | 186 | // Label events 187 | if (label.length) { 188 | label.on(_click + '.i mouseover.i mouseout.i ' + _touch, function(event) { 189 | var type = event[_type], 190 | item = $(this); 191 | 192 | // Do nothing if input is disabled 193 | if (!node[_disabled]) { 194 | 195 | // Click 196 | if (type == _click) { 197 | if ($(event.target).is('a')) { 198 | return; 199 | } 200 | operate(self, false, true); 201 | 202 | // Hover state 203 | } else if (labelHover) { 204 | 205 | // mouseout|touchend 206 | if (/ut|nd/.test(type)) { 207 | parent[_remove](hoverClass); 208 | item[_remove](labelHoverClass); 209 | } else { 210 | parent[_add](hoverClass); 211 | item[_add](labelHoverClass); 212 | } 213 | } 214 | if (_mobile) { 215 | event.stopPropagation(); 216 | } else { 217 | return false; 218 | } 219 | } 220 | }); 221 | } 222 | // Input events 223 | self.on(_click + '.i focus.i blur.i keyup.i keydown.i keypress.i', function(event) { 224 | var type = event[_type], 225 | key = event.keyCode; 226 | 227 | // Click 228 | if (type == _click) { 229 | return false; 230 | 231 | // Keydown 232 | } else if (type == 'keydown' && key == 32) { 233 | if (!(node[_type] == _radio && node[_checked])) { 234 | if (node[_checked]) { 235 | off(self, _checked); 236 | } else { 237 | on(self, _checked); 238 | } 239 | } 240 | return false; 241 | 242 | // Keyup 243 | } else if (type == 'keyup' && node[_type] == _radio) { 244 | !node[_checked] && on(self, _checked); 245 | 246 | // Focus/blur 247 | } else if (/us|ur/.test(type)) { 248 | parent[type == 'blur' ? _remove : _add](focusClass); 249 | } 250 | }); 251 | 252 | // Helper events 253 | helper.on(_click + ' mousedown mouseup mouseover mouseout ' + _touch, function(event) { 254 | var type = event[_type], 255 | 256 | // mousedown|mouseup 257 | toggle = /wn|up/.test(type) ? activeClass : hoverClass; 258 | 259 | // Do nothing if input is disabled 260 | if (!node[_disabled]) { 261 | 262 | // Click 263 | if (type == _click) { 264 | operate(self, false, true); 265 | 266 | // Active and hover states 267 | } else { 268 | 269 | // State is on 270 | if (/wn|er|in/.test(type)) { 271 | 272 | // mousedown|mouseover|touchbegin 273 | parent[_add](toggle); 274 | 275 | // State is off 276 | } else { 277 | parent[_remove](toggle + ' ' + activeClass); 278 | } 279 | // Label hover 280 | if (label.length && labelHover && toggle == hoverClass) { 281 | 282 | // mouseout|touchend 283 | label[/ut|nd/.test(type) ? _remove : _add](labelHoverClass); 284 | } 285 | } 286 | if (_mobile) { 287 | event.stopPropagation(); 288 | } else { 289 | return false; 290 | } 291 | } 292 | }); 293 | }); 294 | } else { 295 | return this; 296 | } 297 | }; 298 | 299 | // Do something with inputs 300 | function operate(input, direct, method) { 301 | var node = input[0], 302 | state = /er/.test(method) ? _indeterminate : /bl/.test(method) ? _disabled : _checked, 303 | active = method == _update ? { 304 | checked: node[_checked], 305 | disabled: node[_disabled], 306 | indeterminate: input.attr(_indeterminate) == 'true' || input.attr(_determinate) == 'false' 307 | } : node[state]; 308 | 309 | // Check, disable or indeterminate 310 | if (/^(ch|di|in)/.test(method) && !active) { 311 | on(input, state); 312 | 313 | // Uncheck, enable or determinate 314 | } else if (/^(un|en|de)/.test(method) && active) { 315 | off(input, state); 316 | 317 | // Update 318 | } else if (method == _update) { 319 | 320 | // Handle states 321 | for (var state in active) { 322 | if (active[state]) { 323 | on(input, state, true); 324 | } else { 325 | off(input, state, true); 326 | } 327 | } 328 | } else if (!direct || method == 'toggle') { 329 | 330 | // Helper or label was clicked 331 | if (!direct) { 332 | input[_callback]('ifClicked'); 333 | } 334 | // Toggle checked state 335 | if (active) { 336 | if (node[_type] !== _radio) { 337 | off(input, state); 338 | } 339 | } else { 340 | on(input, state); 341 | } 342 | } 343 | } 344 | // Add checked, disabled or indeterminate state 345 | function on(input, state, keep) { 346 | var node = input[0], 347 | parent = input.parent(), 348 | checked = state == _checked, 349 | indeterminate = state == _indeterminate, 350 | disabled = state == _disabled, 351 | callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled', 352 | regular = option(input, callback + capitalize(node[_type])), 353 | specific = option(input, state + capitalize(node[_type])); 354 | 355 | // Prevent unnecessary actions 356 | if (node[state] !== true) { 357 | 358 | // Toggle assigned radio buttons 359 | if (!keep && state == _checked && node[_type] == _radio && node.name) { 360 | var form = input.closest('form'), 361 | inputs = 'input[name="' + node.name + '"]'; 362 | 363 | inputs = form.length ? form.find(inputs) : $(inputs); 364 | 365 | inputs.each(function() { 366 | if (this !== node && $(this).data(_iCheck)) { 367 | off($(this), state); 368 | } 369 | }); 370 | } 371 | // Indeterminate state 372 | if (indeterminate) { 373 | 374 | // Add indeterminate state 375 | node[state] = true; 376 | 377 | // Remove checked state 378 | if (node[_checked]) { 379 | off(input, _checked, 'force'); 380 | } 381 | // Checked or disabled state 382 | } else { 383 | 384 | // Add checked or disabled state 385 | if (!keep) { 386 | node[state] = true; 387 | } 388 | // Remove indeterminate state 389 | if (checked && node[_indeterminate]) { 390 | off(input, _indeterminate, false); 391 | } 392 | } 393 | // Trigger callbacks 394 | callbacks(input, checked, state, keep); 395 | } 396 | // Add proper cursor 397 | if (node[_disabled] && !!option(input, _cursor, true)) { 398 | parent.find('.' + _iCheckHelper).css(_cursor, 'default'); 399 | } 400 | // Add state class 401 | parent[_add](specific || option(input, state) || ''); 402 | 403 | // Set ARIA attribute 404 | disabled ? parent.attr('aria-disabled', 'true') : parent.attr('aria-checked', indeterminate ? 'mixed' : 'true'); 405 | 406 | // Remove regular state class 407 | parent[_remove](regular || option(input, callback) || ''); 408 | } 409 | // Remove checked, disabled or indeterminate state 410 | function off(input, state, keep) { 411 | var node = input[0], 412 | parent = input.parent(), 413 | checked = state == _checked, 414 | indeterminate = state == _indeterminate, 415 | disabled = state == _disabled, 416 | callback = indeterminate ? _determinate : checked ? _unchecked : 'enabled', 417 | regular = option(input, callback + capitalize(node[_type])), 418 | specific = option(input, state + capitalize(node[_type])); 419 | 420 | // Prevent unnecessary actions 421 | if (node[state] !== false) { 422 | 423 | // Toggle state 424 | if (indeterminate || !keep || keep == 'force') { 425 | node[state] = false; 426 | } 427 | // Trigger callbacks 428 | callbacks(input, checked, callback, keep); 429 | } 430 | // Add proper cursor 431 | if (!node[_disabled] && !!option(input, _cursor, true)) { 432 | parent.find('.' + _iCheckHelper).css(_cursor, 'pointer'); 433 | } 434 | // Remove state class 435 | parent[_remove](specific || option(input, state) || ''); 436 | 437 | // Set ARIA attribute 438 | disabled ? parent.attr('aria-disabled', 'false') : parent.attr('aria-checked', 'false'); 439 | 440 | // Add regular state class 441 | parent[_add](regular || option(input, callback) || ''); 442 | } 443 | // Remove all traces 444 | function tidy(input, callback) { 445 | if (input.data(_iCheck)) { 446 | 447 | // Remove everything except input 448 | input.parent().html(input.attr('style', input.data(_iCheck).s || '')); 449 | 450 | // Callback 451 | if (callback) { 452 | input[_callback](callback); 453 | } 454 | // Unbind events 455 | input.off('.i').unwrap(); 456 | $(_label + '[for="' + input[0].id + '"]').add(input.closest(_label)).off('.i'); 457 | } 458 | } 459 | // Get some option 460 | function option(input, state, regular) { 461 | if (input.data(_iCheck)) { 462 | return input.data(_iCheck).o[state + (regular ? '' : 'Class')]; 463 | } 464 | } 465 | // Capitalize some string 466 | function capitalize(string) { 467 | return string.charAt(0).toUpperCase() + string.slice(1); 468 | } 469 | // Executable handlers 470 | function callbacks(input, checked, callback, keep) { 471 | if (!keep) { 472 | if (checked) { 473 | input[_callback]('ifToggled'); 474 | } 475 | input[_callback]('ifChanged')[_callback]('if' + capitalize(callback)); 476 | } 477 | } 478 | })(window.jQuery || window.Zepto); 479 | --------------------------------------------------------------------------------