10
10
<div class =" card-body" >
11
11
<div class =" row" >
12
12
<div class =" col-sm-12" >
13
-
13
+
14
14
@foreach ($pages as $page )
15
15
16
16
<section class =' text-gray-400' >
17
17
<h3 class =" mb-4 card-header" ><i class =" bi bi-brush" > Select a theme</i ></h3 >
18
18
<div >
19
19
20
+ <button type =" button" class =" btn btn-primary mb-5" data-bs-toggle =" modal" data-bs-target =" #exampleModal" >
21
+ Select theme
22
+ </button >
23
+
20
24
<section class =" text-gray-400" ></section >
21
25
<div >
22
- <form action =" {{ route (' editTheme' ) } }" enctype =" multipart/form-data" method =" post" >
23
- @csrf
24
-
25
- <div class =" form-group row" >
26
-
27
- <div class =" col-8 col-md-4" >
28
- <select id =" theme-select" style =" margin-left : 15px ; margin-bottom : 20px ;" class =" form-control" name =" theme" data-base-url =" {{ url (' ' ) } } /@<?= Auth:: user ()-> littlelink_name ? >" >
29
- <?php
30
- if ($handle = opendir (' themes' )) {
31
- while (false !== ($entry = readdir ($handle ))) {
32
- if ($entry != " ." && $entry != " .." ) {
33
- if (file_exists (base_path (' themes' ) . ' /' . $entry . ' /readme.md' )){
34
- $text = file_get_contents (base_path (' themes' ) . ' /' . $entry . ' /readme.md' );
35
- $pattern = '/ Theme Name:.* /' ;
36
- preg_match ($pattern , $text , $matches , PREG_OFFSET_CAPTURE );
37
- if (sizeof ($matches ) > 0 ) {
38
- $themeName = substr ($matches [0 ][0 ],12 );
39
- }
40
- }
41
- if ($page -> theme != $entry and isset ($themeName )){
42
- echo ' <option value="' . $entry . ' " data-image="' . url (' themes/' . $entry . ' /screenshot.png' ). ' ">' . $themeName . ' </option>' ;
43
- }
44
- }
45
- }
46
- }
47
-
48
- if ($page -> theme != " default" and $page -> theme != " " ){
49
- if (file_exists (base_path (' themes' ) . ' /' . $page -> theme . ' /readme.md' )){
50
- $text = file_get_contents (base_path (' themes' ) . ' /' . $page -> theme . ' /readme.md' );
51
- $pattern = '/ Theme Name:.* /' ;
52
- preg_match ($pattern , $text , $matches , PREG_OFFSET_CAPTURE );
53
- $themeName = substr ($matches [0 ][0 ],12 );
54
- }
55
- echo ' <option value="' . $page -> theme . ' " data-image="' . url (' themes/' . $page -> theme . ' /screenshot.png' ). ' " selected>' . $themeName . ' </option>' ;
56
- }
57
-
58
- echo ' <option value="default" data-image="' . url (' themes/default/screenshot.png' ). ' "' ;
59
- if ($page -> theme == " default" or $page -> theme == " " ){
60
- echo ' selected' ;
61
- }
62
- echo ' >Default</option>' ;
63
- ? >
64
- </select >
65
- </div >
66
- <div class =" col" >
67
- <button type =" submit" class =" btn btn-primary" >Apply</button >
68
- </div >
69
- </div >
70
26
71
27
<div style =" max-width :1000px " class =" col-md-12" >
72
28
<div class =" card rounded shadow-lg bg-light aos-init aos-animate" data-aos =" fade-up" data-aos-delay =" 800" >
84
40
</div >
85
41
</div >
86
42
</div >
87
-
88
- </form >
89
- </details >
90
43
91
44
</div >
92
45
</div >
214
167
</script >
215
168
<script type =" text/javascript" >$ (" iframe" ).load (function () { $ (" iframe" ).contents ().find (" a" ).each (function (index ) { $ (this ).on (" click" , function (event ) { event .preventDefault (); event .stopPropagation (); }); }); }); </script >
216
169
170
+ @push (' sidebar-scripts' )
171
+ <div class =" modal fade" id =" exampleModal" tabindex =" -1" aria-labelledby =" exampleModalLabel" aria-hidden =" true" >
172
+ <div class =" modal-dialog modal-fullscreen" >
173
+ <div class =" modal-content" >
174
+ <div class =" modal-header" >
175
+ <h5 class =" modal-title" id =" exampleModalLabel" >Select a theme</h5 >
176
+ <button type =" button" class =" btn-close" data-bs-dismiss =" modal" aria-label =" Close" ></button >
177
+ </div >
178
+ <div class =" modal-body" >
179
+
180
+ <form action =" {{ route (' editTheme' ) } }" enctype =" multipart/form-data" method =" post" >
181
+ @csrf
182
+ <select id =" theme-select" style =" display :none ;" name =" theme" data-base-url =" {{ url (' ' ) } } /@<?= Auth:: user ()-> littlelink_name ? >" ><option value =" default" selected ></option ></select >
183
+ <div class =" row" >
184
+ <?php
185
+ if ($handle = opendir (' themes' )) {
186
+ while (false !== ($entry = readdir ($handle ))) {
187
+ if ($entry != " ." && $entry != " .." ) {
188
+ if (file_exists (base_path (' themes' ) . ' /' . $entry . ' /readme.md' )){
189
+ $text = file_get_contents (base_path (' themes' ) . ' /' . $entry . ' /readme.md' );
190
+ $pattern = '/ Theme Name:.* /' ;
191
+ preg_match ($pattern , $text , $matches , PREG_OFFSET_CAPTURE );
192
+ if (sizeof ($matches ) > 0 ) {
193
+ $themeName = substr ($matches [0 ][0 ],12 );
194
+ }
195
+ }
196
+ if ($page -> theme != $entry and isset ($themeName )){
197
+ ? >
198
+
199
+ <div class =" col-lg-3" >
200
+ <div class =" card" >
201
+ <div class =" card-body" >
202
+ <a style =" cursor :pointer ;" onclick =" setTheme('{{ $entry } } ')" >
203
+ <div class =" d-flex justify-content-between" >
204
+ <div >
205
+ <center ><img class =" bd-placeholder-img bd-placeholder-img-lg img-fluid" src =" {{ url (' themes/' . $entry . ' /preview.png' )} }" ></center >
206
+ </div >
207
+ </div >
208
+ <div class =" text-center" >
209
+ <h2 class =" counter" >{{ $themeName } } </h2 >
210
+ <div >
211
+ </div >
212
+ </div >
213
+ </a >
214
+ </div >
215
+ </div >
216
+ </div >
217
+
218
+ <?php
219
+ }
220
+ }
221
+ }
222
+ }
223
+ ? >
224
+ </div >
225
+ </form >
226
+
227
+ </div >
228
+ <div class =" modal-footer" >
229
+ <button type =" button" class =" btn btn-secondary" data-bs-dismiss =" modal" >Close</button >
230
+ </div >
231
+ </div >
232
+ </div >
233
+ </div >
234
+ <script >
235
+ function setTheme (themeName ) {
236
+ const selectElement = document .getElementById (' theme-select' );
237
+ selectElement .querySelector (' option' ).value = themeName;
238
+ selectElement .form .submit ();
239
+ }
240
+ </script >
241
+ @endpush
242
+
217
243
@endsection
0 commit comments