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