Skip to content

Commit 8ddab6d

Browse files
authored
Merge df0e410 into 83d95f0
2 parents 83d95f0 + df0e410 commit 8ddab6d

File tree

9 files changed

+123
-1
lines changed

9 files changed

+123
-1
lines changed

app/Models/LinkType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public static function get()
6363
'heading',
6464
'spacer',
6565
'text',
66+
'xmpp',
6667
];
6768

6869
$sorted = $linkTypes->sortBy(function ($item) use ($custom_order) {

assets/linkstack/icons/xmpp.svg

Lines changed: 30 additions & 0 deletions
Loading

blocks/xmpp/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
id: 6
2+
typename: xmpp
3+
icon: "fa fa-xmpp"
4+
custom_html: false

blocks/xmpp/form.blade.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php use App\Models\Button; $button = Button::find($button_id); if(isset($button->name)){$buttonName = $button->name;}else{$buttonName = 0;} ?>
2+
3+
<select style="display:none" name="button" class="form-control"><option class="button button-default email" value="default xmpp">{{__('messages.Default XMPP')}}</option></select>
4+
5+
<label for='title' class='form-label'>{{__('messages.Custom Title')}}</label>
6+
<input type='text' name='title' value='{{$title}}' class='form-control' />
7+
<span class='small text-muted'>{{__('messages.Leave blank for default title')}}</span><br>
8+
9+
<label for='link' class='form-label'>{{__('messages.XMPP address')}}</label>
10+
<input type='email' name='link' value='{{str_replace("xmpp:", "", $link)}}' class='form-control' required />
11+
<span class='small text-muted'>{{__('messages.Enter your XMPP')}}</span>
12+
13+
<script>
14+
$(document).ready(function() {
15+
$('form').on('submit', function(e) {
16+
var linkInput = $(this).find('input[name="link"]');
17+
var linkValue = linkInput.val();
18+
if (!linkValue.toLowerCase().startsWith('xmpp:')) {
19+
linkInput.val('xmpp:' + linkValue);
20+
}
21+
});
22+
});
23+
</script>

blocks/xmpp/handler.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/**
4+
* Handles the logic for "email" link type.
5+
*
6+
* @param \Illuminate\Http\Request $request The incoming request.
7+
* @param mixed $linkType The link type information.
8+
* @return array The prepared link data.
9+
*/
10+
function handleLinkType($request, $linkType) {
11+
// Prepare the link data
12+
$linkData = [
13+
'title' => $request->title,
14+
'button_id' => "6",
15+
'link' => $request->link,
16+
];
17+
18+
return $linkData;
19+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
var $TableName = 'link_types';
15+
public function up()
16+
{
17+
DB::table($this->TableName)->updateOrInsert([
18+
'typename' => 'xmpp',
19+
'title' => 'xmpp',
20+
'icon' => 'fa fa-xmpp',
21+
'description' => 'Add a xmpp address that opens a system dialog'
22+
]);
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*
28+
* @return void
29+
*/
30+
public function down()
31+
{
32+
//
33+
}
34+
};

database/seeders/ButtonSeeder.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,14 @@ public function run()
938938
"mb" => false,
939939
],
940940

941+
[
942+
"name" => "xmpp",
943+
"alt" => "XMPP",
944+
"exclude" => false,
945+
"group" => "default",
946+
"mb" => false,
947+
],
948+
941949
];
942950

943951
Button::insert($buttons);

resources/lang/en/messages.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,9 @@
896896
'block.title.text' => 'Text',
897897
'block.description.text' => 'Add static text to your page that is not clickable.',
898898

899+
'block.title.xmpp' => 'XMPP address',
900+
'block.description.xmpp' => 'Add an XMPP address that opens a system dialog.',
901+
899902

900903
/*
901904
|--------------------------------------------------------------------------

resources/views/studio/edit-link.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function submitFormWithParam(paramValue) {
7979
@foreach ($LinkTypes as $lt)
8080
@php
8181
if(block_text_translation_check($lt['title'])) {$title = bt($lt['title']);} else {$title = __('messages.block.title.'.$lt['typename']);}
82-
$description = bt($lt['description']) ?? __('messages.block.description.'.$lt['typename']);
82+
$description = bt($lt['description']) ?? __('messages.block.description.'.$lt['typename']);
8383
@endphp
8484
<a href="#" data-dismiss="modal" data-typeid="{{$lt['typename']}}" data-typename="{{$title}}" class="hvr-grow m-2 w-100 d-block doSelectLinkType">
8585
<div class="rounded mb-3 shadow-lg">

0 commit comments

Comments
 (0)