Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Activity;
use BookStack\Repos\EntityRepo;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Views;

Expand Down Expand Up @@ -88,6 +89,27 @@ public function getTranslations()
]);
}

/**
* Get an icon via image request.
* Can provide a 'color' parameter with hex value to color the icon.
* @param $iconName
* @param Request $request
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
*/
public function getIcon($iconName, Request $request)
{
$attrs = [];
if ($request->filled('color')) {
$attrs['fill'] = '#' . $request->get('color');
}

$icon = icon($iconName, $attrs);
return response($icon, 200, [
'Content-Type' => 'image/svg+xml',
'Cache-Control' => 'max-age=3600',
]);
}

/**
* Get custom head HTML, Used in ajax calls to show in editor.
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
Expand Down
8 changes: 8 additions & 0 deletions app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,18 @@ function theme_path($path = '')
* Get fetch an SVG icon as a string.
* Checks for icons defined within a custom theme before defaulting back
* to the 'resources/assets/icons' folder.
*
* Returns an empty string if icon file not found.
* @param $name
* @param array $attrs
* @return mixed
*/
function icon($name, $attrs = [])
{
$attrs = array_merge([
'class' => 'svg-icon',
'data-icon' => $name
], $attrs);
$attrString = ' ';
foreach ($attrs as $attrName => $attr) {
$attrString .= $attrName . '="' . $attr . '" ';
Expand All @@ -164,6 +170,8 @@ function icon($name, $attrs = [])
$themeIconPath = theme_path('icons/' . $name . '.svg');
if ($themeIconPath && file_exists($themeIconPath)) {
$iconPath = $themeIconPath;
} else if (!file_exists($iconPath)) {
return '';
}

$fileContents = file_get_contents($iconPath);
Expand Down
2 changes: 0 additions & 2 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

'env' => env('APP_ENV', 'production'),

'editor' => env('APP_EDITOR', 'html'),

'views' => [
'books' => env('APP_VIEWS_BOOKS', 'list')
],
Expand Down

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
107 changes: 0 additions & 107 deletions public/system_images/drawing.svg

This file was deleted.

2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ These are the great open-source projects used to help build BookStack:
* [Vue.js](http://vuejs.org/)
* [Axios](https://github.com/mzabriskie/axios)
* [jQuery Sortable](https://johnny.github.io/jquery-sortable/)
* [Material Design Iconic Font](http://zavoloklom.github.io/material-design-iconic-font/icons.html)
* [Google Material Icons](https://material.io/icons/)
* [Dropzone.js](http://www.dropzonejs.com/)
* [clipboard.js](https://clipboardjs.com/)
* [TinyColorPicker](http://www.dematte.at/tinyColorPicker/index.html)
Expand Down
4 changes: 4 additions & 0 deletions resources/assets/icons/add-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/assets/icons/add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/assets/icons/attach.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
4 changes: 4 additions & 0 deletions resources/assets/icons/back.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/assets/icons/book.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/assets/icons/cancel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/assets/icons/caret-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/assets/icons/caret-left-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/assets/icons/caret-right-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/assets/icons/caret-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/assets/icons/chapter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/assets/icons/check-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/assets/icons/chevron-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/assets/icons/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/assets/icons/comment.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/copy.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/danger.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/delete.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/drawing.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/edit.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/expand-text.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/export.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/file.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/folder.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/grid.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/grip.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/history.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/image.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/images.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/include.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/info-filled.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/info.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/link.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/list.svg
4 changes: 4 additions & 0 deletions resources/assets/icons/lock-open.svg
Loading