mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 23:18:10 +00:00
feat: basic support for liquid templates; liquid receipt "Day in History" added
This commit is contained in:
parent
88f90ff9ae
commit
9a9b5080d6
5 changed files with 321 additions and 1 deletions
|
|
@ -14,6 +14,7 @@
|
|||
"ext-imagick": "*",
|
||||
"bnussbau/laravel-trmnl": "^0.1.4",
|
||||
"intervention/image": "^3.11",
|
||||
"keepsuit/laravel-liquid": "^0.5.2",
|
||||
"laravel/framework": "^12.1",
|
||||
"laravel/sanctum": "^4.0",
|
||||
"laravel/tinker": "^2.10.1",
|
||||
|
|
|
|||
214
composer.lock
generated
214
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "90ca5428e48b0164301a23c8def5593a",
|
||||
"content-hash": "745994b30a60597808cac7e5e21a2a5a",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bnussbau/laravel-trmnl",
|
||||
|
|
@ -1277,6 +1277,142 @@
|
|||
],
|
||||
"time": "2025-02-27T13:08:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "keepsuit/laravel-liquid",
|
||||
"version": "v0.5.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/keepsuit/laravel-liquid.git",
|
||||
"reference": "a5eb4f8752132b1b80c80f3ca08c2da8115b6cc3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/keepsuit/laravel-liquid/zipball/a5eb4f8752132b1b80c80f3ca08c2da8115b6cc3",
|
||||
"reference": "a5eb4f8752132b1b80c80f3ca08c2da8115b6cc3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "^10.0 || ^11.0 || ^12.0",
|
||||
"keepsuit/liquid": "^0.7 || ^0.8",
|
||||
"php": "^8.1",
|
||||
"spatie/laravel-package-tools": "^1.16",
|
||||
"symfony/var-exporter": "^6.3 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"itsgoingd/clockwork": "^5.3",
|
||||
"larastan/larastan": "^3.0",
|
||||
"laravel/pint": "^1.0",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^7.8 || ^8.0 || ^9.0",
|
||||
"orchestra/testbench": "^8.14 || ^9.0 || ^10.0",
|
||||
"pestphp/pest": "^2.13 || ^3.0",
|
||||
"pestphp/pest-plugin-arch": "^2.5 || ^3.0",
|
||||
"pestphp/pest-plugin-laravel": "^2.2 || ^3.0",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan-deprecation-rules": "^2.0",
|
||||
"spatie/laravel-ray": "^1.26"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"Liquid": "Keepsuit\\LaravelLiquid\\Facades\\Liquid"
|
||||
},
|
||||
"providers": [
|
||||
"Keepsuit\\LaravelLiquid\\LiquidServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Keepsuit\\LaravelLiquid\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabio Capucci",
|
||||
"email": "f.capucci@keepsuit.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Liquid template engine for Laravel",
|
||||
"homepage": "https://github.com/keepsuit/laravel-liquid",
|
||||
"keywords": [
|
||||
"keepsuit",
|
||||
"laravel",
|
||||
"liquid"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/keepsuit/laravel-liquid/issues",
|
||||
"source": "https://github.com/keepsuit/laravel-liquid/tree/v0.5.2"
|
||||
},
|
||||
"time": "2025-03-15T13:40:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "keepsuit/liquid",
|
||||
"version": "v0.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/keepsuit/php-liquid.git",
|
||||
"reference": "50a0f1c6872821fa296c1c4564125b54b98651ef"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/keepsuit/php-liquid/zipball/50a0f1c6872821fa296c1c4564125b54b98651ef",
|
||||
"reference": "50a0f1c6872821fa296c1c4564125b54b98651ef",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
"php": "^8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/pint": "^1.2",
|
||||
"pestphp/pest": "^2.7",
|
||||
"pestphp/pest-plugin-arch": "^2.2",
|
||||
"phpbench/phpbench": "dev-master",
|
||||
"phpstan/extension-installer": "^1.3",
|
||||
"phpstan/phpstan": "^2.0",
|
||||
"phpstan/phpstan-deprecation-rules": "^2.0",
|
||||
"spatie/invade": "^2.0",
|
||||
"spatie/ray": "^1.28",
|
||||
"symfony/console": "^6.1 || ^7.0",
|
||||
"symfony/var-exporter": "^6.1 || ^7.0",
|
||||
"symfony/yaml": "^6.1 || ^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Keepsuit\\Liquid\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabio Capucci",
|
||||
"email": "f.capucci@keepsuit.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "PHP implementation of liquid markup language",
|
||||
"homepage": "https://github.com/keepsuit/php-liquid",
|
||||
"keywords": [
|
||||
"keepsuit",
|
||||
"liquid"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/keepsuit/php-liquid/issues",
|
||||
"source": "https://github.com/keepsuit/php-liquid/tree/v0.8.0"
|
||||
},
|
||||
"time": "2025-02-23T13:47:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v12.2.0",
|
||||
|
|
@ -6266,6 +6402,82 @@
|
|||
],
|
||||
"time": "2025-01-17T11:39:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/var-exporter",
|
||||
"version": "v7.2.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/var-exporter.git",
|
||||
"reference": "4ede73aa7a73d81506002d2caadbbdad1ef5b69a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/4ede73aa7a73d81506002d2caadbbdad1ef5b69a",
|
||||
"reference": "4ede73aa7a73d81506002d2caadbbdad1ef5b69a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/property-access": "^6.4|^7.0",
|
||||
"symfony/serializer": "^6.4|^7.0",
|
||||
"symfony/var-dumper": "^6.4|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\VarExporter\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Allows exporting any serializable PHP data structure to plain PHP code",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"clone",
|
||||
"construct",
|
||||
"export",
|
||||
"hydrate",
|
||||
"instantiate",
|
||||
"lazy-loading",
|
||||
"proxy",
|
||||
"serialize"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/var-exporter/tree/v7.2.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-02-13T10:27:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "tijsverkoyen/css-to-inline-styles",
|
||||
"version": "v2.3.0",
|
||||
|
|
|
|||
|
|
@ -23,9 +23,18 @@ class DatabaseSeeder extends Seeder
|
|||
'password' => bcrypt('admin@example.com'),
|
||||
]);
|
||||
|
||||
Device::factory(1)->create([
|
||||
'mac_address' => '00:00:00:00:00:00',
|
||||
'api_key' => 'test-api-key'
|
||||
]);
|
||||
|
||||
// Device::factory(5)->create();
|
||||
|
||||
// Plugin::factory(3)->create();
|
||||
|
||||
$this->call([
|
||||
ExampleReceiptsSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,5 +68,24 @@ class ExampleReceiptsSeeder extends Seeder
|
|||
'flux_icon_name' => 'chat-bubble-bottom-center',
|
||||
]
|
||||
);
|
||||
|
||||
Plugin::create(
|
||||
[
|
||||
'uuid' => '8d472959-400f-46ee-afb2-4a9f1cfd521f',
|
||||
'name' => 'This Day in History',
|
||||
'user_id' => '1',
|
||||
'data_payload' => null,
|
||||
'data_stale_minutes' => 720,
|
||||
'data_strategy' => 'polling',
|
||||
'polling_url' => 'https://raw.githubusercontent.com/jvivona/tidbyt-data/refs/heads/main/thisdayinhistwikipedia/thisdayinhist.json',
|
||||
'polling_verb' => 'get',
|
||||
'polling_header' => null,
|
||||
'render_markup' => null,
|
||||
'render_markup_view' => 'receipts.day-in-history',
|
||||
'detail_view_route' => null,
|
||||
'icon_url' => null,
|
||||
'flux_icon_name' => 'calendar',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
79
resources/views/receipts/day-in-history.liquid
Normal file
79
resources/views/receipts/day-in-history.liquid
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=Inter:300,400,500" rel="stylesheet"/>
|
||||
<link rel="stylesheet" href="https://usetrmnl.com/css/latest/plugins.css">
|
||||
<script src="https://usetrmnl.com/js/latest/plugins.js"></script>
|
||||
<title>plugin</title>
|
||||
<style>
|
||||
.trmnl .content .description {
|
||||
word-break: break-word;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="environment trmnl">
|
||||
<div class="screen">
|
||||
<div class="view view--full">
|
||||
|
||||
|
||||
<div class="layout">
|
||||
<div class="columns">
|
||||
<div class="column"
|
||||
data-list-limit="true"
|
||||
data-list-max-height="340">
|
||||
<div class="title center">Events</div>
|
||||
{% for event in data.metadata.events %}
|
||||
<div class="item ">
|
||||
<div class="meta">
|
||||
<span class="index"></span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<span class="title title--small">{{ data.events[event].year }}</span>
|
||||
<span class="description clamp--3">{{ data.events[event].text }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="column"
|
||||
data-list-limit="true"
|
||||
data-list-max-height="340">
|
||||
<div class="title center">Births</div>
|
||||
{% for birth in data.metadata.births %}
|
||||
<div class="item ">
|
||||
<div class="meta">
|
||||
<span class="index"></span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<span class="title title--small">{{ data.births[birth].year }}</span>
|
||||
<span class="description clamp--1">{{ data.births[birth].text }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="title center">Deaths</div>
|
||||
{% for death in data.metadata.deaths %}
|
||||
<div class="item ">
|
||||
<div class="meta">
|
||||
<span class="index"></span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<span class="title title--small">{{ data.deaths[death].year }}</span>
|
||||
<span class="description clamp--1">{{ data.deaths[death].text }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="title_bar">
|
||||
<img class="image"
|
||||
src="https://raw.githubusercontent.com/jvivona/tidbyt-data/refs/heads/main/thisdayinhistwikipedia/thisdayinhist_icon.svg">
|
||||
<span class="title">This Day in History (Wikipedia)</span>
|
||||
|
||||
<span class="instance">{{ data.metadata.current_date }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue