diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 40a1eef3d..118271f51 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -17,6 +17,10 @@ class AppServiceProvider extends ServiceProvider $imageMimes = ['image/png', 'image/bmp', 'image/gif', 'image/jpeg', 'image/jpg', 'image/tiff', 'image/webp']; return in_array($value->getMimeType(), $imageMimes); }); + + \Blade::directive('icon', function($expression) { + return ""; + }); } /** diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 3802f20c0..d82a560f9 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -4,6 +4,7 @@ namespace BookStack\Providers; use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; +use SocialiteProviders\Manager\SocialiteWasCalled; class EventServiceProvider extends ServiceProvider { @@ -13,8 +14,8 @@ class EventServiceProvider extends ServiceProvider * @var array */ protected $listen = [ - 'BookStack\Events\SomeEvent' => [ - 'BookStack\Listeners\EventListener', + SocialiteWasCalled::class => [ + 'SocialiteProviders\Slack\SlackExtendSocialite@handle', ], ]; diff --git a/app/Providers/SocialiteServiceProvider.php b/app/Providers/SocialiteServiceProvider.php deleted file mode 100644 index f7fb30f81..000000000 --- a/app/Providers/SocialiteServiceProvider.php +++ /dev/null @@ -1,36 +0,0 @@ -app->bindShared('Laravel\Socialite\Contracts\Factory', function ($app) { - return new SocialiteManager($app); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return ['Laravel\Socialite\Contracts\Factory']; - } -} \ No newline at end of file diff --git a/app/Repos/EntityRepo.php b/app/Repos/EntityRepo.php index f1428735c..8a8740d76 100644 --- a/app/Repos/EntityRepo.php +++ b/app/Repos/EntityRepo.php @@ -332,12 +332,12 @@ class EntityRepo $parents[$key] = $entities[$index]; $parents[$key]->setAttribute('pages', collect()); } - if ($entities[$index]->chapter_id === 0) $tree[] = $entities[$index]; + if ($entities[$index]->chapter_id === 0 || $entities[$index]->chapter_id === '0') $tree[] = $entities[$index]; $entities[$index]->book = $book; } foreach ($entities as $entity) { - if ($entity->chapter_id === 0) continue; + if ($entity->chapter_id === 0 || $entity->chapter_id === '0') continue; $parentKey = 'BookStack\\Chapter:' . $entity->chapter_id; $chapter = $parents[$parentKey]; $chapter->pages->push($entity); diff --git a/app/Services/SocialAuthService.php b/app/Services/SocialAuthService.php index 5edd4cad7..710f95696 100644 --- a/app/Services/SocialAuthService.php +++ b/app/Services/SocialAuthService.php @@ -14,7 +14,7 @@ class SocialAuthService protected $socialite; protected $socialAccount; - protected $validSocialDrivers = ['google', 'github']; + protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter']; /** * SocialAuthService constructor. @@ -211,7 +211,6 @@ class SocialAuthService */ public function detachSocialAccount($socialDriver) { - session(); user()->socialAccounts()->where('driver', '=', $socialDriver)->delete(); session()->flash('success', trans('settings.users_social_disconnected', ['socialAccount' => title_case($socialDriver)])); return redirect(user()->getEditUrl()); diff --git a/app/User.php b/app/User.php index afcd9af70..8033557e4 100644 --- a/app/User.php +++ b/app/User.php @@ -165,7 +165,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon if ($imageId === 0 || $imageId === '0' || $imageId === null) return $default; try { - $avatar = baseUrl($this->avatar->getThumb($size, $size, false)); + $avatar = $this->avatar ? baseUrl($this->avatar->getThumb($size, $size, false)) : $default; } catch (\Exception $err) { $avatar = $default; } diff --git a/app/helpers.php b/app/helpers.php index 6decb08e9..8103ad1ff 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -117,6 +117,16 @@ function redirect($to = null, $status = 302, $headers = [], $secure = null) return app('redirect')->to($to, $status, $headers, $secure); } +function icon($name, $attrs = []) { + $iconPath = resource_path('assets/icons/' . $name . '.svg'); + $attrString = ' '; + foreach ($attrs as $attrName => $attr) { + $attrString .= $attrName . '="' . $attr . '" '; + } + $fileContents = file_get_contents($iconPath); + return str_replace(' env('APP_URL') . '/login/service/google/callback', ], + 'slack' => [ + 'client_id' => env('SLACK_APP_ID', false), + 'client_secret' => env('SLACK_APP_SECRET', false), + 'redirect' => env('APP_URL') . '/login/service/slack/callback', + ], + + 'facebook' => [ + 'client_id' => env('FACEBOOK_APP_ID', false), + 'client_secret' => env('FACEBOOK_APP_SECRET', false), + 'redirect' => env('APP_URL') . '/login/service/facebook/callback', + ], + + 'twitter' => [ + 'client_id' => env('TWITTER_APP_ID', false), + 'client_secret' => env('TWITTER_APP_SECRET', false), + 'redirect' => env('APP_URL') . '/login/service/twitter/callback', + ], + 'ldap' => [ 'server' => env('LDAP_SERVER', false), 'dn' => env('LDAP_DN', false), diff --git a/readme.md b/readme.md index 63d43e4b7..65dcbe7b1 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ # BookStack -[![GitHub release](https://img.shields.io/github/release/ssddanbrown/BookStack.svg?maxAge=2592000)](https://github.com/ssddanbrown/BookStack/releases/latest) -[![license](https://img.shields.io/github/license/ssddanbrown/BookStack.svg?maxAge=2592000)](https://github.com/ssddanbrown/BookStack/blob/master/LICENSE) +[![GitHub release](https://img.shields.io/github/release/BookStackApp/BookStack.svg?maxAge=2592000)](https://github.com/BookStackApp/BookStack/releases/latest) +[![license](https://img.shields.io/github/license/BookStackApp/BookStack.svg?maxAge=2592000)](https://github.com/BookStackApp/BookStack/blob/master/LICENSE) [![Build Status](https://travis-ci.org/BookStackApp/BookStack.svg)](https://travis-ci.org/BookStackApp/BookStack) A platform for storing and organising information and documentation. General information and documentation for BookStack can be found at https://www.bookstackapp.com/. @@ -45,6 +45,12 @@ Once done you can run `phpunit` in the application root directory to run all tes As part of BookStack v0.14 support for translations has been built in. All text strings can be found in the `resources/lang` folder where each language option has its own folder. To add a new language you should copy the `en` folder to an new folder (eg. `fr` for french) then go through and translate all text strings in those files, leaving the keys and file-names intact. If a language string is missing then the `en` translation will be used. To show the language option in the user preferences language drop-down you will need to add your language to the options found at the bottom of the `resources/lang/en/settings.php` file. A system-wide language can also be set in the `.env` file like so: `APP_LANG=en`. Some strings have colon-prefixed variables in such as `:userName`. Leave these values as they are as they will be replaced at run-time. + +## Contributing + +Feel free to create issues to request new features or to report bugs and problems. Just please follow the template given when creating the issue. + +Pull requests are very welcome. If the scope of your pull request is very large it may be best to open the pull request early or create an issue for it to discuss how it will fit in to the project and plan out the merge. ## Website, Docs & Blog diff --git a/resources/assets/icons/facebook.svg b/resources/assets/icons/facebook.svg new file mode 100644 index 000000000..7bfafd226 --- /dev/null +++ b/resources/assets/icons/facebook.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/assets/icons/github.svg b/resources/assets/icons/github.svg new file mode 100644 index 000000000..ae6dc6f7f --- /dev/null +++ b/resources/assets/icons/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/assets/icons/google.svg b/resources/assets/icons/google.svg new file mode 100644 index 000000000..34ed1603b --- /dev/null +++ b/resources/assets/icons/google.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/assets/icons/slack.svg b/resources/assets/icons/slack.svg new file mode 100644 index 000000000..5280f971f --- /dev/null +++ b/resources/assets/icons/slack.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/assets/icons/twitter.svg b/resources/assets/icons/twitter.svg new file mode 100644 index 000000000..fa4d59efd --- /dev/null +++ b/resources/assets/icons/twitter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/assets/sass/_text.scss b/resources/assets/sass/_text.scss index 74eb6875a..79d3c3a92 100644 --- a/resources/assets/sass/_text.scss +++ b/resources/assets/sass/_text.scss @@ -16,7 +16,7 @@ h2 { } h3 { font-size: 2.333em; - line-height: 1.571428572em; + line-height: 1.221428572em; margin-top: 0.78571429em; margin-bottom: 0.43137255em; } @@ -71,6 +71,13 @@ a, .link { padding-right: 0; padding-left: $-s; } + &.icon { + display: inline-block; + } + svg { + position: relative; + display: inline-block; + } } /* @@ -84,7 +91,6 @@ p, ul, ol, pre, table, blockquote { hr { border: 0; height: 1px; - border: 0; background: #EAEAEA; margin-bottom: $-l; &.faded { @@ -119,6 +125,11 @@ sup, .superscript { font-size: 0.8em; } +sub, .subscript { + vertical-align: sub; + font-size: 0.8em; +} + pre { font-family: monospace; white-space:pre; diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 928565156..6c8b1720c 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -33,12 +33,10 @@ @if(count($socialDrivers) > 0)

{{ trans('auth.social_login') }}

- @if(isset($socialDrivers['google'])) - - @endif - @if(isset($socialDrivers['github'])) - - @endif + @foreach($socialDrivers as $driver => $enabled) + @icon($driver, ['width' => 56]) +   + @endforeach @endif diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 7a119ddba..860508df0 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -37,12 +37,10 @@

{{ trans('auth.social_registration') }}

{{ trans('auth.social_registration_text') }}

- @if(isset($socialDrivers['google'])) - - @endif - @if(isset($socialDrivers['github'])) - - @endif + @foreach($socialDrivers as $driver => $enabled) + @icon($driver, ['width' => 56]) +   + @endforeach @endif diff --git a/resources/views/public.blade.php b/resources/views/public.blade.php index 05cf043fd..ea2069b86 100644 --- a/resources/views/public.blade.php +++ b/resources/views/public.blade.php @@ -30,7 +30,7 @@