From 5b63080f8c9857e87b913d6aaebcd93d105b23b0 Mon Sep 17 00:00:00 2001 From: Julian Prieber <60265788+JulianPrieber@users.noreply.github.com> Date: Fri, 6 May 2022 15:26:39 +0200 Subject: [PATCH] Added custom spaces and headings Added custom spaces and headings users can add like buttons to their littlelink pages to divide button sections into groups. Spaces can be changed via the number in the title, and one space equals one "
". The maximum spaces that can be added with one space 'button' is capped at 10. The 'Space' button will be replaced with an empty space, so buttons could be visually separated into groups. Entering a number between 1-10 in the title section will change the empty space's distance. The 'Heading' button will be replaced with a sub-heading, where the title defines the text on that heading. --- app/Http/Controllers/UserController.php | 7 +++++++ database/seeders/ButtonSeeder.php | 8 ++++++++ resources/views/littlelink.blade.php | 11 +++++++++++ resources/views/studio/add-link.blade.php | 3 +++ 4 files changed, 29 insertions(+) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 0ced0bf..91921f5 100755 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -92,6 +92,13 @@ class UserController extends Controller //Save add link public function addLink(request $request) { + if ($request->button == 'heading' or $request->button == 'space') + $request->validate([ + 'link' => '', + 'title' => '', + 'button' => 'required' + ]); + else $request->validate([ 'link' => 'required', 'title' => '', diff --git a/database/seeders/ButtonSeeder.php b/database/seeders/ButtonSeeder.php index e611a33..fdd53b6 100755 --- a/database/seeders/ButtonSeeder.php +++ b/database/seeders/ButtonSeeder.php @@ -179,6 +179,14 @@ class ButtonSeeder extends Seeder [ 'name' => 'website' ], + + [ + 'name' => 'header' + ], + + [ + 'name' => 'space' + ], ]; Button::insert($buttons); diff --git a/resources/views/littlelink.blade.php b/resources/views/littlelink.blade.php index c325281..b088892 100644 --- a/resources/views/littlelink.blade.php +++ b/resources/views/littlelink.blade.php @@ -208,6 +208,17 @@ function get_operating_system() {
{{ $link->title }}
@elseif($link->name === "custom_website" and $link->custom_css != "")
{{ $link->title }}
+ @elseif($link->name === "space") + title) and $link->title < 10) + echo str_repeat("
",$link->title); + elseif (is_numeric($link->title) and $link->title >= 10) + echo str_repeat("
",10); + else + echo "


" + ?> + @elseif($link->name === "heading") +

{{ $link->title }}

@else
{{ ucfirst($linkName) }}
@endif diff --git a/resources/views/studio/add-link.blade.php b/resources/views/studio/add-link.blade.php index ae2b01c..18e56cb 100755 --- a/resources/views/studio/add-link.blade.php +++ b/resources/views/studio/add-link.blade.php @@ -32,6 +32,9 @@
 The 'Custom' button allows you to add a custom link, where the text on the button is determined with the link title set above.
 The 'Custom_website' button functions similar to the Custom button, with the addition of a function that requests the favicon from the chosen URL and uses it as the button icon.
+
+The 'Space' button will be replaced with an empty space, so buttons could be visually separated into groups. Entering a number between 1-10 in the title section will change the empty space's distance.
+The 'Heading' button will be replaced with a sub-heading, where the title defines the text on that heading.