Added new block "Text"

This commit is contained in:
Julian Prieber 2022-12-01 12:51:16 +01:00
parent 414a3fa8be
commit 9c2a91e0fc
8 changed files with 91 additions and 22 deletions

View File

@ -135,6 +135,8 @@ class UserController extends Controller
$data['linkTypeID'] = "3";
} elseif ($bid == 43) {
$data['linkTypeID'] = "4";
} elseif ($bid == 93) {
$data['linkTypeID'] = "5";
} else {
$data['linkTypeID'] = "1";
}
@ -242,6 +244,11 @@ class UserController extends Controller
'title' => $LinkTitle,
'button_id' => "42",
]);
}elseif($linkType->typename == "text"){
$OrigLink->update([
'button_id' => "93",
'title' => $request->text,
]);
}else{
$OrigLink->update([
'link' => $LinkURL,
@ -273,6 +280,9 @@ class UserController extends Controller
$links->button_id = "43";
}elseif($linkType->typename == "heading"){
$links->button_id = "42";
}elseif($linkType->typename == "text"){
$links->button_id = "93";
$links->title = $request->text;
}else{
$links->button_id = $button?->id;
}

View File

@ -165,22 +165,22 @@ class LinkType extends Migration
// ]'
// ]);
// DB::table($this->TableName)->updateOrInsert([
// 'typename' => 'text',
// 'title' => 'Text',
// 'icon' => 'bi bi-fonts',
// 'description' => 'Add static text to your page that is not clickable.',
// 'params' => '[{
// "tag": "textarea",
// "id": "static-text",
// "for": "static_text",
// "label": "Text",
// "name": "static_text",
// "class": "form-control"
// }
// ]'
DB::table($this->TableName)->updateOrInsert([
'typename' => 'text',
'title' => 'Text',
'icon' => 'bi bi-fonts',
'description' => 'Add static text to your page that is not clickable.',
'params' => '[{
"tag": "textarea",
"id": "static-text",
"for": "static_text",
"label": "Text",
"name": "static_text",
"class": "form-control"
}
]'
// ]);
]);
}
}

View File

@ -387,6 +387,10 @@ class ButtonSeeder extends Seeder
'name' => 'all-inkl'
],
[
'name' => 'text'
],
];
Button::insert($buttons);

View File

@ -4,7 +4,7 @@
<select name='button' class='form-control'>
@if($buttonName != 0)<option value='{{$buttonName}}'>{{ucfirst($buttonName)}}</option>@endif
@foreach ($buttons as $b)
@if(!in_array($b["name"], ["custom_website", "custom", $buttonName]))
@if(!in_array($b["name"], ["custom_website", "custom", "custom", "heading", "space", "text", $buttonName]))
<option class='button button-{{$b["name"]}}' value='{{$b["name"]}}' {{ $b["selected"] == true ? "selected" : ""}}>{{$b["title"]}}</option>
@endif
@endforeach

View File

@ -1,3 +1,3 @@
<div class='button-text'> {{$params->text}}</div>
<div class='button-text'> {{$link_title}}</div>

View File

@ -1,3 +1,53 @@
<label for='text' class='form-label'>Text to display</label>
<textarea name='text' class='form-control'>{{$params->text ?? ''}}
</textarea>
<textarea class="form-control @if(env('ALLOW_USER_HTML') === true) ckeditor @endif" name="text" rows="6">{{ $link_title ?? '' }}</textarea>
@if(env('ALLOW_USER_HTML') === true)
<script src="{{ asset('studio/external-dependencies/ckeditor.js') }}"></script>
<script>
ClassicEditor
.create(document.querySelector('.ckeditor'), {
toolbar: {
items: [
'exportPDF', 'exportWord', '|'
, 'findAndReplace', 'selectAll', '|'
, 'heading', '|'
, 'bold', 'italic', 'strikethrough', 'underline', 'code', 'subscript', 'superscript', 'removeFormat', '|'
, 'bulletedList', 'numberedList', 'todoList', '|'
, 'outdent', 'indent', '|'
, 'undo', 'redo'
, 'fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor', 'highlight', '|'
, 'alignment', '|'
, 'link', 'blockQuote', '|'
, 'specialCharacters', 'horizontalLine', '|'
, 'textPartLanguage', '|'
]
, shouldNotGroupWhenFull: true
}
, fontFamily: {
options: [
'default'
, 'Arial, Helvetica, sans-serif'
, 'Courier New, Courier, monospace'
, 'Georgia, serif'
, 'Lucida Sans Unicode, Lucida Grande, sans-serif'
, 'Tahoma, Geneva, sans-serif'
, 'Times New Roman, Times, serif'
, 'Trebuchet MS, Helvetica, sans-serif'
, 'Verdana, Geneva, sans-serif'
]
, supportAllValues: true
},
fontSize: {
options: [ 10, 12, 14, 'default', 18, 20, 22 ],
supportAllValues: true
},
})
.catch(error => {
console.error(error);
});
</script>
@endif

View File

@ -125,6 +125,7 @@ return $path;}
<link rel="stylesheet" href="{{ asset('littlelink/css/skeleton-auto.css') }}">
@endif
@endif
<style>.container{word-break:break-all;}</style>
</head>
<body>
@ -257,7 +258,7 @@ function get_operating_system() {
<h1 class="fadein">{{ $info->name }}</h1>
<!-- Short Bio -->
<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>
<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>
@endforeach
<!-- Buttons -->
@ -292,6 +293,8 @@ function get_operating_system() {
?>
@elseif($link->name === "heading")
<h2>{{ $link->title }}</h2>
@elseif($link->name === "text")
<span style="">@if(env('ALLOW_USER_HTML') === true){!! $link->title !!}@else{{ $link->title }}@endif</span>
@else
<?php include base_path('config/button-names.php'); $newLinkName = $linkName; $isNewName = "false"; foreach($buttonNames as $key => $value) { if($newLinkName == $key) { $newLinkName = $value; $isNewName = "true"; } } ?>
<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>

View File

@ -67,7 +67,7 @@
<div class='col border-left h-100'>
<div class='row h-100'>
<div class='col-12 p-2' title="{{ $link->title }}">
<div class='col-12 p-2' style="max-width:300px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="{{ $link->title }}">
<span class='h6'>
<?php $button = Button::find($link->button_id); if(isset($button->name)){$buttonName = $button->name;}else{$buttonName = 0;} ?>
@if($button->name == "custom_website")
@ -76,13 +76,15 @@
<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>
@elseif($button->name == "heading")
<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>
@elseif($button->name == "text")
<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>
@elseif($button->name == "buy me a coffee")
<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>
@else
<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>
@endif
{{$link->title}}</span>
{{strip_tags($link->title,'')}}</span>
@if(!empty($link->link))
<br /><a title='{{$link->link}}' href="{{ $link->link}}" target="_blank" class="ml-4 text-muted small">{{Str::limit($link->link, 75 )}}</a>