Skip to content

Commit d2f6b51

Browse files
author
aguingand
authored
Merge pull request #558 from code16/refactor-embeds-templates
[9.0] Refactor embeds templates
2 parents eba29ff + f129f4a commit d2f6b51

File tree

31 files changed

+302
-260
lines changed

31 files changed

+302
-260
lines changed

demo/app/Sharp/Utils/Embeds/AuthorEmbed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function buildEmbedConfig(): void
1919
$this
2020
->configureLabel('Author')
2121
->configureTagName('x-author')
22-
->configureFormTemplatePath('sharp/templates/author_embed.vue');
22+
->configureTemplate(view('sharp.templates.author-embed'));
2323
}
2424

2525
protected function buildPageAlert(PageAlert $pageAlert): void

demo/app/Sharp/Utils/Embeds/CodeEmbed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public function buildEmbedConfig(): void
1313
$this->configureLabel('Code')
1414
->configureTagName('x-codeblock')
1515
->configureIcon('fas fa-code')
16-
->configureFormInlineTemplate('<div style="overflow:auto; max-height:100px; font-family:monospace; white-space: pre-wrap">{{ code }}</div>')
17-
->configureShowTemplatePath('sharp/templates/codeblock_show_embed.vue');
16+
->configureFormTemplate('<div style="overflow:auto; max-height:100px; font-family:monospace; white-space: pre-wrap">{{ $code }}</div>')
17+
->configureShowTemplate(view('sharp.templates.codeblock-show-embed'));
1818
}
1919

2020
public function buildFormFields(FieldsContainer $formFields): void

demo/app/Sharp/Utils/Embeds/RelatedPostEmbed.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,18 @@ public function buildEmbedConfig(): void
1515
$this
1616
->configureLabel('Related Post')
1717
->configureTagName('x-related-post')
18-
->configureFormInlineTemplate('<div><span v-if="online" style="color: blue">●</span><i v-if="!online" style="color: orange">●</i> <i class="fa fa-link"></i> <em>{{ title }}</em></div>');
18+
->configureTemplate(<<<'blade'
19+
<div style="display: flex; gap: .5rem; align-items: center">
20+
@if($online)
21+
<span style="color: blue">●</span>
22+
@else
23+
<span style="color: orange">●</span>
24+
@endif
25+
<x-fas-link style="width: 1rem; height: 1rem" />
26+
<em>{{ $title }}</em>
27+
</div>
28+
blade
29+
);
1930
}
2031

2132
public function buildFormFields(FieldsContainer $formFields): void

demo/app/Sharp/Utils/Embeds/TableOfContentsEmbed.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ public function buildEmbedConfig(): void
1111
{
1212
$this->configureLabel('Table of contents')
1313
->configureTagName('x-table-of-contents')
14-
->configureFormInlineTemplate('<em>- Table of contents -</em>');
14+
->configureTemplate('<em>- Table of contents -</em>');
1515
}
1616

1717
public function buildFormFields(FieldsContainer $formFields): void {}
1818

19-
public function updateContent(array $data = []): array {}
19+
public function updateContent(array $data = []): array {
20+
return [];
21+
}
2022
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
<div style="display: flex">
3+
@if($picture)
4+
<img src="{{ $picture['thumbnail'] }}" width="50" height="50">
5+
@endif
6+
<div style="flex: 1">
7+
<div><strong>{{ $name }}</strong></div>
8+
<div style="font-size: .875rem">
9+
{{ $slot }}
10+
</div>
11+
</div>
12+
</div>

demo/resources/views/sharp/templates/author_embed.vue

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<div style="
2+
overflow:auto; max-height:150px; font-family:monospace;
3+
white-space: pre-wrap; font-size: 12px; padding:1em;
4+
border:1px solid #aaa; background: #eee;
5+
">{{ $code }}</div>

demo/resources/views/sharp/templates/codeblock_show_embed.vue

Lines changed: 0 additions & 5 deletions
This file was deleted.

ide.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
{
66
"path": "tests/Fixtures/resources/views",
77
"namespace": "fixtures"
8+
},
9+
{
10+
"path": "demo/resources/views"
811
}
912
]
1013
}

resources/js/components/ui/dialog/DialogScrollContent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
2727
<template>
2828
<DialogPortal>
2929
<DialogOverlay
30-
class="fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
30+
class="fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
3131
>
3232
<DialogContent
3333
:class="

0 commit comments

Comments
 (0)