Skip to content

Commit 9c2a91e

Browse files
committed
Added new block "Text"
1 parent 414a3fa commit 9c2a91e

File tree

8 files changed

+92
-23
lines changed

8 files changed

+92
-23
lines changed

app/Http/Controllers/UserController.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ public function AddUpdateLink($id = 0)
135135
$data['linkTypeID'] = "3";
136136
} elseif ($bid == 43) {
137137
$data['linkTypeID'] = "4";
138+
} elseif ($bid == 93) {
139+
$data['linkTypeID'] = "5";
138140
} else {
139141
$data['linkTypeID'] = "1";
140142
}
@@ -242,6 +244,11 @@ public function saveLink(request $request)
242244
'title' => $LinkTitle,
243245
'button_id' => "42",
244246
]);
247+
}elseif($linkType->typename == "text"){
248+
$OrigLink->update([
249+
'button_id' => "93",
250+
'title' => $request->text,
251+
]);
245252
}else{
246253
$OrigLink->update([
247254
'link' => $LinkURL,
@@ -273,6 +280,9 @@ public function saveLink(request $request)
273280
$links->button_id = "43";
274281
}elseif($linkType->typename == "heading"){
275282
$links->button_id = "42";
283+
}elseif($linkType->typename == "text"){
284+
$links->button_id = "93";
285+
$links->title = $request->text;
276286
}else{
277287
$links->button_id = $button?->id;
278288
}

database/migrations/2022_09_22_123137_link-type.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -165,22 +165,22 @@ public function SeedLinkTypes() {
165165
// ]'
166166
// ]);
167167

168-
// DB::table($this->TableName)->updateOrInsert([
169-
// 'typename' => 'text',
170-
// 'title' => 'Text',
171-
// 'icon' => 'bi bi-fonts',
172-
// 'description' => 'Add static text to your page that is not clickable.',
173-
// 'params' => '[{
174-
// "tag": "textarea",
175-
// "id": "static-text",
176-
// "for": "static_text",
177-
// "label": "Text",
178-
// "name": "static_text",
179-
// "class": "form-control"
180-
// }
181-
// ]'
182-
183-
// ]);
168+
DB::table($this->TableName)->updateOrInsert([
169+
'typename' => 'text',
170+
'title' => 'Text',
171+
'icon' => 'bi bi-fonts',
172+
'description' => 'Add static text to your page that is not clickable.',
173+
'params' => '[{
174+
"tag": "textarea",
175+
"id": "static-text",
176+
"for": "static_text",
177+
"label": "Text",
178+
"name": "static_text",
179+
"class": "form-control"
180+
}
181+
]'
182+
183+
]);
184184
}
185185

186186
}

database/seeders/ButtonSeeder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,10 @@ public function run()
387387
'name' => 'all-inkl'
388388
],
389389

390+
[
391+
'name' => 'text'
392+
],
393+
390394
];
391395

392396
Button::insert($buttons);

resources/views/components/pageitems/predefined-form.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<select name='button' class='form-control'>
55
@if($buttonName != 0)<option value='{{$buttonName}}'>{{ucfirst($buttonName)}}</option>@endif
66
@foreach ($buttons as $b)
7-
@if(!in_array($b["name"], ["custom_website", "custom", $buttonName]))
7+
@if(!in_array($b["name"], ["custom_website", "custom", "custom", "heading", "space", "text", $buttonName]))
88
<option class='button button-{{$b["name"]}}' value='{{$b["name"]}}' {{ $b["selected"] == true ? "selected" : ""}}>{{$b["title"]}}</option>
99
@endif
1010
@endforeach
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
<div class='button-text'> {{$params->text}}</div>
2+
<div class='button-text'> {{$link_title}}</div>
33

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,53 @@
11
<label for='text' class='form-label'>Text to display</label>
2-
<textarea name='text' class='form-control'>{{$params->text ?? ''}}
3-
</textarea>
2+
<textarea class="form-control @if(env('ALLOW_USER_HTML') === true) ckeditor @endif" name="text" rows="6">{{ $link_title ?? '' }}</textarea>
3+
@if(env('ALLOW_USER_HTML') === true)
4+
<script src="{{ asset('studio/external-dependencies/ckeditor.js') }}"></script>
5+
<script>
6+
ClassicEditor
7+
.create(document.querySelector('.ckeditor'), {
8+
9+
toolbar: {
10+
items: [
11+
'exportPDF', 'exportWord', '|'
12+
, 'findAndReplace', 'selectAll', '|'
13+
, 'heading', '|'
14+
, 'bold', 'italic', 'strikethrough', 'underline', 'code', 'subscript', 'superscript', 'removeFormat', '|'
15+
, 'bulletedList', 'numberedList', 'todoList', '|'
16+
, 'outdent', 'indent', '|'
17+
, 'undo', 'redo'
18+
19+
, 'fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor', 'highlight', '|'
20+
, 'alignment', '|'
21+
, 'link', 'blockQuote', '|'
22+
, 'specialCharacters', 'horizontalLine', '|'
23+
, 'textPartLanguage', '|'
24+
]
25+
, shouldNotGroupWhenFull: true
26+
}
27+
, fontFamily: {
28+
options: [
29+
'default'
30+
, 'Arial, Helvetica, sans-serif'
31+
, 'Courier New, Courier, monospace'
32+
, 'Georgia, serif'
33+
, 'Lucida Sans Unicode, Lucida Grande, sans-serif'
34+
, 'Tahoma, Geneva, sans-serif'
35+
, 'Times New Roman, Times, serif'
36+
, 'Trebuchet MS, Helvetica, sans-serif'
37+
, 'Verdana, Geneva, sans-serif'
38+
]
39+
, supportAllValues: true
40+
},
41+
fontSize: {
42+
options: [ 10, 12, 14, 'default', 18, 20, 22 ],
43+
supportAllValues: true
44+
},
45+
46+
})
47+
.catch(error => {
48+
console.error(error);
49+
});
50+
51+
</script>
52+
53+
@endif

resources/views/littlelink.blade.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ function themeAsset($path){
125125
<link rel="stylesheet" href="{{ asset('littlelink/css/skeleton-auto.css') }}">
126126
@endif
127127
@endif
128+
<style>.container{word-break:break-all;}</style>
128129
</head>
129130
<body>
130131

@@ -257,7 +258,7 @@ function get_operating_system() {
257258
<h1 class="fadein">{{ $info->name }}</h1>
258259

259260
<!-- Short Bio -->
260-
<center><p style="width: 50%; min-width: 300px;" class="fadein">@if(env('ALLOW_USER_HTML') === true){!! $info->littlelink_description !!}@else{{ $info->littlelink_description }}@endif</p></center>
261+
<center><p style="width:50%;min-width:300px;" class="fadein">@if(env('ALLOW_USER_HTML') === true){!! $info->littlelink_description !!}@else{{ $info->littlelink_description }}@endif</p></center>
261262

262263
@endforeach
263264
<!-- Buttons -->
@@ -292,6 +293,8 @@ function get_operating_system() {
292293
?>
293294
@elseif($link->name === "heading")
294295
<h2>{{ $link->title }}</h2>
296+
@elseif($link->name === "text")
297+
<span style="">@if(env('ALLOW_USER_HTML') === true){!! $link->title !!}@else{{ $link->title }}@endif</span>
295298
@else
296299
<?php include base_path('config/button-names.php'); $newLinkName = $linkName; $isNewName = "false"; foreach($buttonNames as $key => $value) { if($newLinkName == $key) { $newLinkName = $value; $isNewName = "true"; } } ?>
297300
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-{{ $link->name }} button button-hover icon-hover" rel="noopener noreferrer nofollow" href="{{ route('clickNumber') . '/' . $link->id }}" @if(theme('open_links_in_same_tab') != "true")target="_blank"@endif ><img alt="button-icon" class="icon hvr-icon" src="@if(theme('use_custom_icons') == "true"){{ url('themes/' . $GLOBALS['themeName'] . '/extra/custom-icons')}}/{{$linkName}}{{theme('custom_icon_extension')}} @else{{ asset('\/littlelink/icons\/') . $linkName }}.svg @endif">@if($isNewName == "true"){{ $newLinkName }}@else{{ ucfirst($newLinkName) }}@endif</a></div>

resources/views/studio/links.blade.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<div class='col border-left h-100'>
6868

6969
<div class='row h-100'>
70-
<div class='col-12 p-2' title="{{ $link->title }}">
70+
<div class='col-12 p-2' style="max-width:300px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="{{ $link->title }}">
7171
<span class='h6'>
7272
<?php $button = Button::find($link->button_id); if(isset($button->name)){$buttonName = $button->name;}else{$buttonName = 0;} ?>
7373
@if($button->name == "custom_website")
@@ -76,13 +76,15 @@
7676
<span style="border: 1px solid #d0d4d7 !important;border-radius:5px;background-color:#6c757d;width:25px!important;height:25px!important;"><i style="margin-left:2.83px;margin-right:-1px;color:#fff;" class='bi bi-distribute-vertical'>&nbsp;</i></span>
7777
@elseif($button->name == "heading")
7878
<span style="border: 1px solid #d0d4d7 !important;border-radius:5px;background-color:#6c757d;width:25px!important;height:25px!important;"><i style="margin-left:2.83px;margin-right:-1px;color:#fff;" class='bi bi-card-heading'>&nbsp;</i></span>
79+
@elseif($button->name == "text")
80+
<span style="border: 1px solid #d0d4d7 !important;border-radius:5px;background-color:#6c757d;width:25px!important;height:25px!important;"><i style="margin-left:2.83px;margin-right:-1px;color:#fff;" class='bi bi-fonts'>&nbsp;</i></span>
7981
@elseif($button->name == "buy me a coffee")
8082
<span style="border: 1px solid #d0d4d7 !important;border-radius:5px;background-color:#6c757d;width:25px!important;height:25px!important;"><img style="margin-left:6px!important;margin-right:6px!important;" alt="button-icon" height="15" class="m-1 " src="{{ asset('\/littlelink/icons\/') . "coffee" }}.svg "></span>
8183
@else
8284
<span style="border: 1px solid #d0d4d7 !important;border-radius:5px;background-color:#6c757d;width:25px!important;height:25px!important;"><img style="max-width:15px !important;" alt="button-icon" height="15" class="m-1 " src="{{ asset('\/littlelink/icons\/') . $buttonName }}.svg "></span>
8385
@endif
8486

85-
{{$link->title}}</span>
87+
{{strip_tags($link->title,'')}}</span>
8688

8789
@if(!empty($link->link))
8890
<br /><a title='{{$link->link}}' href="{{ $link->link}}" target="_blank" class="ml-4 text-muted small">{{Str::limit($link->link, 75 )}}</a>

0 commit comments

Comments
 (0)