feat(#29): mashup

* update templates to be more responsive
This commit is contained in:
Benjamin Nussbaum 2025-06-06 23:06:31 +02:00
parent ed9d03d0b8
commit 56638b26e8
28 changed files with 1067 additions and 346 deletions

View file

@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Str;
@ -65,4 +66,38 @@ class Plugin extends Model
]);
}
}
/**
* Render the plugin's markup
*/
public function render(string $size = 'full', bool $standalone = true): string
{
if ($this->render_markup) {
if ($standalone) {
return view('trmnl-layouts.single', [
'slot' => Blade::render($this->render_markup, ['size' => $size, 'data' => $this->data_payload]),
])->render();
}
return Blade::render($this->render_markup, ['size' => $size, 'data' => $this->data_payload]);
}
if ($this->render_markup_view) {
if ($standalone) {
return view('trmnl-layouts.single', [
'slot' => view($this->render_markup_view, [
'size' => $size,
'data' => $this->data_payload,
])->render(),
])->render();
} else {
return view($this->render_markup_view, [
'size' => $size,
'data' => $this->data_payload,
])->render();
}
}
return '<p>No render markup yet defined for this plugin.</p>';
}
}