]> BookStack Code Mirror - bookstack/blob - resources/views/settings/index.blade.php
Update settings.php
[bookstack] / resources / views / settings / index.blade.php
1 @extends('simple-layout')
2
3 @section('body')
4     <div class="container small">
5
6         <div class="grid left-focus v-center no-row-gap">
7             <div class="py-m">
8                 @include('settings.navbar', ['selected' => 'settings'])
9             </div>
10             <div class="text-right mb-l px-m">
11                 <br>
12                 BookStack @if(strpos($version, 'v') !== 0) version @endif {{ $version }}
13             </div>
14         </div>
15
16         <div class="card content-wrap auto-height">
17             <h2 class="list-heading">{{ trans('settings.app_features_security') }}</h2>
18             <form action="{{ baseUrl("/settings") }}" method="POST">
19                 {!! csrf_field() !!}
20
21                 <div class="setting-list">
22
23
24                     <div class="grid half gap-xl">
25                         <div>
26                             <label for="setting-app-public" class="setting-list-label">{{ trans('settings.app_public_access') }}</label>
27                             <p class="small">{!! trans('settings.app_public_access_desc') !!}</p>
28                             @if(userCan('users-manage'))
29                                 <p class="small mb-none">
30                                     <a href="{{ baseUrl($guestUser->getEditUrl()) }}">{!! trans('settings.app_public_access_desc_guest') !!}</a>
31                                 </p>
32                             @endif
33                         </div>
34                         <div>
35                             @include('components.toggle-switch', [
36                                 'name' => 'setting-app-public',
37                                 'value' => setting('app-public'),
38                                 'label' => trans('settings.app_public_access_toggle'),
39                             ])
40                         </div>
41                     </div>
42
43                     <div class="grid half gap-xl">
44                         <div>
45                             <label class="setting-list-label">{{ trans('settings.app_secure_images') }}</label>
46                             <p class="small">{{ trans('settings.app_secure_images_desc') }}</p>
47                         </div>
48                         <div>
49                             @include('components.toggle-switch', [
50                                 'name' => 'setting-app-secure-images',
51                                 'value' => setting('app-secure-images'),
52                                 'label' => trans('settings.app_secure_images_toggle'),
53                             ])
54                         </div>
55                     </div>
56
57                     <div class="grid half gap-xl">
58                         <div>
59                             <label class="setting-list-label">{{ trans('settings.app_disable_comments') }}</label>
60                             <p class="small">{!! trans('settings.app_disable_comments_desc') !!}</p>
61                         </div>
62                         <div>
63                             @include('components.toggle-switch', [
64                                 'name' => 'setting-app-disable-comments',
65                                 'value' => setting('app-disable-comments'),
66                                 'label' => trans('settings.app_disable_comments_toggle'),
67                             ])
68                         </div>
69                     </div>
70
71
72                 </div>
73
74                 <div class="form-group text-right">
75                     <button type="submit" class="button primary">{{ trans('settings.settings_save') }}</button>
76                 </div>
77             </form>
78         </div>
79
80         <div class="card content-wrap auto-height">
81             <h2 class="list-heading">{{ trans('settings.app_customization') }}</h2>
82             <form action="{{ baseUrl("/settings") }}" method="POST" enctype="multipart/form-data">
83                 {!! csrf_field() !!}
84
85                 <div class="setting-list">
86
87                     <div class="grid half gap-xl">
88                         <div>
89                             <label for="setting-app-name" class="setting-list-label">{{ trans('settings.app_name') }}</label>
90                             <p class="small">{{ trans('settings.app_name_desc') }}</p>
91                         </div>
92                         <div>
93                             <input type="text" value="{{ setting('app-name', 'BookStack') }}" name="setting-app-name" id="setting-app-name">
94                             @include('components.toggle-switch', [
95                                 'name' => 'setting-app-name-header',
96                                 'value' => setting('app-name-header'),
97                                 'label' => trans('settings.app_name_header'),
98                             ])
99                         </div>
100                     </div>
101
102                     <div class="grid half gap-xl">
103                         <div>
104                             <label class="setting-list-label">{{ trans('settings.app_editor') }}</label>
105                             <p class="small">{{ trans('settings.app_editor_desc') }}</p>
106                         </div>
107                         <div>
108                             <select name="setting-app-editor" id="setting-app-editor">
109                                 <option @if(setting('app-editor') === 'wysiwyg') selected @endif value="wysiwyg">WYSIWYG</option>
110                                 <option @if(setting('app-editor') === 'markdown') selected @endif value="markdown">Markdown</option>
111                             </select>
112                         </div>
113                     </div>
114
115                     <div class="grid half gap-xl">
116                         <div>
117                             <label class="setting-list-label">{{ trans('settings.app_logo') }}</label>
118                             <p class="small">{!! trans('settings.app_logo_desc') !!}</p>
119                         </div>
120                         <div>
121                             @include('components.image-picker', [
122                                      'removeName' => 'setting-app-logo',
123                                      'removeValue' => 'none',
124                                      'defaultImage' => baseUrl('/logo.png'),
125                                      'currentImage' => setting('app-logo'),
126                                      'name' => 'app_logo',
127                                      'imageClass' => 'logo-image',
128                                  ])
129                         </div>
130                     </div>
131
132                     <div class="grid half gap-xl">
133                         <div>
134                             <label class="setting-list-label">{{ trans('settings.app_primary_color') }}</label>
135                             <p class="small">{!! trans('settings.app_primary_color_desc') !!}</p>
136                         </div>
137                         <div>
138                             <input type="text" value="{{ setting('app-color') }}" name="setting-app-color" id="setting-app-color" placeholder="#0288D1">
139                             <input type="hidden" value="{{ setting('app-color-light') }}" name="setting-app-color-light" id="setting-app-color-light">
140                         </div>
141                     </div>
142
143                     <div homepage-control id="homepage-control" class="grid half gap-xl">
144                         <div>
145                             <label for="setting-app-homepage" class="setting-list-label">{{ trans('settings.app_homepage') }}</label>
146                             <p class="small">{{ trans('settings.app_homepage_desc') }}</p>
147                         </div>
148                         <div>
149                             <select name="setting-app-homepage-type" id="setting-app-homepage-type">
150                                 <option @if(setting('app-homepage-type') === 'default') selected @endif value="default">{{ trans('common.default') }}</option>
151                                 <option @if(setting('app-homepage-type') === 'books') selected @endif value="books">{{ trans('entities.books') }}</option>
152                                 <option @if(setting('app-homepage-type') === 'bookshelves') selected @endif value="bookshelves">{{ trans('entities.shelves') }}</option>
153                                 <option @if(setting('app-homepage-type') === 'page') selected @endif value="page">{{ trans('entities.pages_specific') }}</option>
154                             </select>
155
156                             <div page-picker-container style="display: none;" class="mt-m">
157                                 @include('components.page-picker', ['name' => 'setting-app-homepage', 'placeholder' => trans('settings.app_homepage_select'), 'value' => setting('app-homepage')])
158                             </div>
159                         </div>
160                     </div>
161
162
163                     <div>
164                         <label for="setting-app-custom-head" class="setting-list-label">{{ trans('settings.app_custom_html') }}</label>
165                         <p class="small">{{ trans('settings.app_custom_html_desc') }}</p>
166                         <textarea name="setting-app-custom-head" id="setting-app-custom-head" class="simple-code-input mt-m">{{ setting('app-custom-head', '') }}</textarea>
167                     </div>
168
169
170                 </div>
171
172                 <div class="form-group text-right">
173                     <button type="submit" class="button primary">{{ trans('settings.settings_save') }}</button>
174                 </div>
175             </form>
176         </div>
177
178         <div class="card content-wrap auto-height">
179             <h2 class="list-heading">{{ trans('settings.reg_settings') }}</h2>
180             <form action="{{ baseUrl("/settings") }}" method="POST">
181                 {!! csrf_field() !!}
182
183                 <div class="setting-list">
184                     <div class="grid half gap-xl">
185                         <div>
186                             <label class="setting-list-label">{{ trans('settings.reg_enable') }}</label>
187                             <p class="small">{!! trans('settings.reg_enable_desc') !!}</p>
188                         </div>
189                         <div>
190                             @include('components.toggle-switch', [
191                                 'name' => 'setting-registration-enabled',
192                                 'value' => setting('registration-enabled'),
193                                 'label' => trans('settings.reg_enable_toggle')
194                             ])
195
196                             <label for="setting-registration-role">{{ trans('settings.reg_default_role') }}</label>
197                             <select id="setting-registration-role" name="setting-registration-role" @if($errors->has('setting-registration-role')) class="neg" @endif>
198                                 @foreach(\BookStack\Auth\Role::all() as $role)
199                                     <option value="{{$role->id}}" data-role-name="{{ $role->name }}"
200                                             @if(setting('registration-role', \BookStack\Auth\Role::first()->id) == $role->id) selected @endif
201                                     >
202                                         {{ $role->display_name }}
203                                     </option>
204                                 @endforeach
205                             </select>
206                         </div>
207                     </div>
208
209                     <div class="grid half gap-xl">
210                         <div>
211                             <label for="setting-registration-restrict" class="setting-list-label">{{ trans('settings.reg_confirm_restrict_domain') }}</label>
212                             <p class="small">{!! trans('settings.reg_confirm_restrict_domain_desc') !!}</p>
213                         </div>
214                         <div>
215                             <input type="text" id="setting-registration-restrict" name="setting-registration-restrict" placeholder="{{ trans('settings.reg_confirm_restrict_domain_placeholder') }}" value="{{ setting('registration-restrict', '') }}">
216                         </div>
217                     </div>
218
219                     <div class="grid half gap-xl">
220                         <div>
221                             <label class="setting-list-label">{{ trans('settings.reg_email_confirmation') }}</label>
222                             <p class="small">{{ trans('settings.reg_confirm_email_desc') }}</p>
223                         </div>
224                         <div>
225                             @include('components.toggle-switch', [
226                                 'name' => 'setting-registration-confirmation',
227                                 'value' => setting('registration-confirmation'),
228                                 'label' => trans('settings.reg_email_confirmation_toggle')
229                             ])
230                         </div>
231                     </div>
232
233                 </div>
234
235                 <div class="form-group text-right">
236                     <button type="submit" class="button primary">{{ trans('settings.settings_save') }}</button>
237                 </div>
238             </form>
239         </div>
240
241     </div>
242
243     @include('components.image-manager', ['imageType' => 'system'])
244     @include('components.entity-selector-popup', ['entityTypes' => 'page'])
245 @stop
246
247 @section('scripts')
248     <script src="{{ baseUrl("/libs/jq-color-picker/tiny-color-picker.min.js?version=1.0.0") }}"></script>
249     <script type="text/javascript">
250         $('#setting-app-color').colorPicker({
251             opacity: false,
252             renderCallback: function($elm, toggled) {
253                 const hexVal = '#' + this.color.colors.HEX;
254                 const rgb = this.color.colors.RND.rgb;
255                 const rgbLightVal = 'rgba('+ [rgb.r, rgb.g, rgb.b, '0.15'].join(',') +')';
256
257                 // Set textbox color to hex color code.
258                 const isEmpty = $.trim($elm.val()).length === 0;
259                 if (!isEmpty) $elm.val(hexVal);
260                 $('#setting-app-color-light').val(isEmpty ? '' : rgbLightVal);
261
262                 const customStyles = document.getElementById('custom-styles');
263                 const oldColor = customStyles.getAttribute('data-color');
264                 const oldColorLight = customStyles.getAttribute('data-color-light');
265
266                 customStyles.innerHTML = customStyles.innerHTML.split(oldColor).join(hexVal);
267                 customStyles.innerHTML = customStyles.innerHTML.split(oldColorLight).join(rgbLightVal);
268
269                 customStyles.setAttribute('data-color', hexVal);
270                 customStyles.setAttribute('data-color-light', rgbLightVal);
271             }
272         });
273     </script>
274 @stop