diff --git a/app/Console/Commands/Database/MigrateLibraryItemSlugs.php b/app/Console/Commands/Database/MigrateLibraryItemSlugs.php
new file mode 100644
index 00000000..4575a899
--- /dev/null
+++ b/app/Console/Commands/Database/MigrateLibraryItemSlugs.php
@@ -0,0 +1,38 @@
+slug = str($item->name)->slug('-', 'de');
+ $item->save();
+ }
+
+ return Command::SUCCESS;
+ }
+}
diff --git a/app/Http/Livewire/News/ArticleOverview.php b/app/Http/Livewire/News/ArticleOverview.php
new file mode 100644
index 00000000..f93df79c
--- /dev/null
+++ b/app/Http/Livewire/News/ArticleOverview.php
@@ -0,0 +1,32 @@
+ LibraryItem::query()
+ ->with([
+ 'createdBy.roles',
+ 'lecturer',
+ 'tags',
+ ])
+ ->where('type', 'markdown_article')
+ ->whereHas('createdBy.roles',
+ fn($query) => $query->where('roles.name', 'news-editor'))
+ ->get(),
+ ])->layout('layouts.app', [
+ 'SEOData' => new SEOData(
+ title: __('News'),
+ description: __('Here we post important news that is relevant for everyone.'),
+ image: asset('img/einundzwanzig-wallpaper-benrath.png'),
+ )
+ ]);
+ }
+}
diff --git a/app/Http/Livewire/News/InternArticleView.php b/app/Http/Livewire/News/InternArticleView.php
new file mode 100644
index 00000000..7afd1b93
--- /dev/null
+++ b/app/Http/Livewire/News/InternArticleView.php
@@ -0,0 +1,27 @@
+layout('layouts.app', [
+ 'SEOData' => new SEOData(
+ title: $this->libraryItem->name,
+ description: $this->libraryItem->excerpt ?? __('Here we post important news that is relevant for everyone.'),
+ author: $this->libraryItem->lecturer->name,
+ image: asset('img/einundzwanzig-wallpaper-benrath.png'),
+ published_time: Carbon::parse($this->libraryItem->created_at),
+ type: 'article',
+ )
+ ]);
+ }
+}
diff --git a/app/Models/City.php b/app/Models/City.php
index 2f0f9cb3..576af044 100644
--- a/app/Models/City.php
+++ b/app/Models/City.php
@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
+use Illuminate\Support\Facades\Cookie;
use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;
@@ -48,7 +49,7 @@ class City extends Model
return SlugOptions::create()
->generateSlugsFrom(['country.code', 'name'])
->saveSlugsTo('slug')
- ->usingLanguage('de');
+ ->usingLanguage(Cookie::get('lang', config('app.locale')));
}
public function createdBy(): BelongsTo
diff --git a/app/Models/Lecturer.php b/app/Models/Lecturer.php
index 1c57e361..8a8fdc85 100644
--- a/app/Models/Lecturer.php
+++ b/app/Models/Lecturer.php
@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
+use Illuminate\Support\Facades\Cookie;
use Spatie\Image\Manipulations;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
@@ -76,7 +77,7 @@ class Lecturer extends Model implements HasMedia
return SlugOptions::create()
->generateSlugsFrom(['name'])
->saveSlugsTo('slug')
- ->usingLanguage('de');
+ ->usingLanguage(Cookie::get('lang', config('app.locale')));
}
public function createdBy(): BelongsTo
diff --git a/app/Models/LibraryItem.php b/app/Models/LibraryItem.php
index de9d7cd5..5e3a7e0e 100644
--- a/app/Models/LibraryItem.php
+++ b/app/Models/LibraryItem.php
@@ -5,6 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
+use Illuminate\Support\Facades\Cookie;
use Spatie\EloquentSortable\Sortable;
use Spatie\EloquentSortable\SortableTrait;
use Spatie\Image\Manipulations;
@@ -12,6 +13,8 @@ use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\ModelStatus\HasStatuses;
+use Spatie\Sluggable\HasSlug;
+use Spatie\Sluggable\SlugOptions;
use Spatie\Tags\HasTags;
class LibraryItem extends Model implements HasMedia, Sortable
@@ -20,6 +23,7 @@ class LibraryItem extends Model implements HasMedia, Sortable
use HasTags;
use SortableTrait;
use HasStatuses;
+ use HasSlug;
/**
* The attributes that aren't mass assignable.
@@ -37,6 +41,14 @@ class LibraryItem extends Model implements HasMedia, Sortable
'library_id' => 'integer',
];
+ public function getSlugOptions(): SlugOptions
+ {
+ return SlugOptions::create()
+ ->generateSlugsFrom(['name'])
+ ->saveSlugsTo('slug')
+ ->usingLanguage(Cookie::get('lang', config('app.locale')));
+ }
+
protected static function booted()
{
static::creating(function ($model) {
diff --git a/app/Models/Meetup.php b/app/Models/Meetup.php
index 358dfea1..5f5dd6a4 100644
--- a/app/Models/Meetup.php
+++ b/app/Models/Meetup.php
@@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
+use Illuminate\Support\Facades\Cookie;
use Spatie\Image\Manipulations;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
@@ -48,7 +49,7 @@ class Meetup extends Model implements HasMedia
return SlugOptions::create()
->generateSlugsFrom(['name'])
->saveSlugsTo('slug')
- ->usingLanguage('de');
+ ->usingLanguage(Cookie::get('lang', config('app.locale')));
}
public function registerMediaConversions(Media $media = null): void
diff --git a/app/Models/Venue.php b/app/Models/Venue.php
index 44337846..9b867c51 100644
--- a/app/Models/Venue.php
+++ b/app/Models/Venue.php
@@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
+use Illuminate\Support\Facades\Cookie;
use Spatie\Image\Manipulations;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
@@ -71,7 +72,7 @@ class Venue extends Model implements HasMedia
return SlugOptions::create()
->generateSlugsFrom(['city.slug', 'name',])
->saveSlugsTo('slug')
- ->usingLanguage('de');
+ ->usingLanguage(Cookie::get('lang', config('app.locale')));
}
public function createdBy(): BelongsTo
diff --git a/app/Nova/LibraryItem.php b/app/Nova/LibraryItem.php
index 50400a38..604ac884 100644
--- a/app/Nova/LibraryItem.php
+++ b/app/Nova/LibraryItem.php
@@ -13,6 +13,7 @@ use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\BelongsToMany;
use Laravel\Nova\Fields\Code;
use Laravel\Nova\Fields\ID;
+use Laravel\Nova\Fields\Number;
use Laravel\Nova\Fields\Select;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
@@ -112,7 +113,8 @@ class LibraryItem extends Resource
->options(
config('languages.languages')
)
- ->rules('required', 'string')->searchable(),
+ ->rules('required', 'string')
+ ->searchable(),
Tags::make('Tags')
->type('library_item')
@@ -121,6 +123,19 @@ class LibraryItem extends Resource
Text::make('Name')
->rules('required', 'string'),
+ Text::make(__('Subtitle'), 'subtitle')
+ ->rules('nullable', 'string'),
+
+ Text::make(__('Excerpt'), 'excerpt')
+ ->rules('nullable', 'string')->help(__('This is the excerpt that is shown in the overview.')),
+
+ Text::make(__('Main image caption'), 'main_image_caption')
+ ->rules('nullable', 'string'),
+
+ Number::make(__('Time to read'), 'read_time')
+ ->rules('nullable', 'numeric')
+ ->help(__('How many minutes to read?')),
+
Select::make(__('Type'), 'type')
->options(
Options::forEnum(LibraryItemType::class)
@@ -132,7 +147,9 @@ class LibraryItem extends Resource
->rules('nullable', 'string')
->help('Please paste the URL to the video here, or the link to the blog article, or the link to the book, or the Markdown itself.'),
- BelongsTo::make(__('Lecturer/Content Creator'), 'lecturer', Lecturer::class)->searchable()->withSubtitles(),
+ BelongsTo::make(__('Lecturer/Content Creator'), 'lecturer', Lecturer::class)
+ ->searchable()
+ ->withSubtitles(),
BelongsTo::make(__('Episode'), 'episode', Episode::class)
->nullable()
@@ -145,7 +162,8 @@ class LibraryItem extends Resource
return $request->user()
->hasRole('super-admin');
})
- ->searchable()->withSubtitles(),
+ ->searchable()
+ ->withSubtitles(),
];
}
diff --git a/database/migrations/2023_01_20_121955_add_slug_field_to_library_items_table.php b/database/migrations/2023_01_20_121955_add_slug_field_to_library_items_table.php
new file mode 100644
index 00000000..0c77c104
--- /dev/null
+++ b/database/migrations/2023_01_20_121955_add_slug_field_to_library_items_table.php
@@ -0,0 +1,32 @@
+string('slug')
+ ->unique()
+ ->nullable()
+ ->after('id');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('library_items', function (Blueprint $table) {
+ //
+ });
+ }
+};
diff --git a/database/migrations/2023_01_20_125736_add_meta_fields_to_library_items_table.php b/database/migrations/2023_01_20_125736_add_meta_fields_to_library_items_table.php
new file mode 100644
index 00000000..7f55a03b
--- /dev/null
+++ b/database/migrations/2023_01_20_125736_add_meta_fields_to_library_items_table.php
@@ -0,0 +1,36 @@
+text('subtitle')
+ ->nullable();
+ $table->text('excerpt')
+ ->nullable();
+ $table->string('main_image_caption')
+ ->nullable();
+ $table->string('read_time')
+ ->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('library_items', function (Blueprint $table) {
+ //
+ });
+ }
+};
diff --git a/public/img/einundzwanzig-wallpaper-benrath.png b/public/img/einundzwanzig-wallpaper-benrath.png
new file mode 100644
index 00000000..8d22b534
Binary files /dev/null and b/public/img/einundzwanzig-wallpaper-benrath.png differ
diff --git a/resources/lang/de.json b/resources/lang/de.json
index 88974c66..53b24b25 100644
--- a/resources/lang/de.json
+++ b/resources/lang/de.json
@@ -672,5 +672,15 @@
"PlebChat": "",
"Close panel": "Schließe Panel",
"This chat is limited by 21 messages.": "Dieser Chat ist auf 21 Nachrichten begrenzt. Die ältesten Nachrichten werden gelöscht und die Nachrichten werden nicht gespeichert. (nur im RAM des Servers)",
- "Send": "Senden"
-}
+ "Send": "Senden",
+ "Excerpt": "",
+ "This is the excerpt that is shown in the overview.": "",
+ "Main image caption": "",
+ "Time to read": "",
+ "How many minutes to read?": "",
+ "Read": "",
+ "News": "",
+ "Dezentral News": "",
+ "min read": "",
+ "Here we post important news that is relevant for everyone.": ""
+}
\ No newline at end of file
diff --git a/resources/lang/en.json b/resources/lang/en.json
index 8e666f7b..81372d8d 100644
--- a/resources/lang/en.json
+++ b/resources/lang/en.json
@@ -666,5 +666,15 @@
"PlebChat": "",
"Close panel": "",
"This chat is limited by 21 messages.": "",
- "Send": ""
-}
+ "Send": "",
+ "Main image caption": "",
+ "Excerpt": "",
+ "This is the excerpt that is shown in the overview.": "",
+ "Time to read": "",
+ "How many minutes to read?": "",
+ "Read": "",
+ "News": "",
+ "Dezentral News": "",
+ "min read": "",
+ "Here we post important news that is relevant for everyone.": ""
+}
\ No newline at end of file
diff --git a/resources/lang/es.json b/resources/lang/es.json
index 87687d64..672b3f1b 100644
--- a/resources/lang/es.json
+++ b/resources/lang/es.json
@@ -659,5 +659,22 @@
"Lightning Address": "",
"LNURL": "",
"Node Id": "",
- "Scan this code or copy & paste it to your lightning wallet. Or click to login with your wallet.": ""
-}
+ "Scan this code or copy & paste it to your lightning wallet. Or click to login with your wallet.": "",
+ "Parent": "",
+ "Excerpt": "",
+ "This is the excerpt that is shown in the overview.": "",
+ "Main image caption": "",
+ "Time to read": "",
+ "How many minutes to read?": "",
+ "Read": "",
+ "PlebChat": "",
+ "Close panel": "",
+ "This chat is limited by 21 messages.": "",
+ "Send": "",
+ "News": "",
+ "Entries": "",
+ "Dezentral News": "",
+ "min read": "",
+ "Payment Required": "",
+ "Here we post important news that is relevant for everyone.": ""
+}
\ No newline at end of file
diff --git a/resources/lang/fr.json b/resources/lang/fr.json
index b00544c6..b1565997 100644
--- a/resources/lang/fr.json
+++ b/resources/lang/fr.json
@@ -667,5 +667,15 @@
"Close panel": "",
"This chat is limited by 100 messages.": "",
"Send": "",
- "This chat is limited by 21 messages.": ""
+ "This chat is limited by 21 messages.": "",
+ "Excerpt": "",
+ "This is the excerpt that is shown in the overview.": "",
+ "Main image caption": "",
+ "Time to read": "",
+ "How many minutes to read?": "",
+ "Read": "",
+ "News": "",
+ "Dezentral News": "",
+ "min read": "",
+ "Here we post important news that is relevant for everyone.": ""
}
\ No newline at end of file
diff --git a/resources/lang/hr.json b/resources/lang/hr.json
index 307b1230..b52255bf 100644
--- a/resources/lang/hr.json
+++ b/resources/lang/hr.json
@@ -667,5 +667,15 @@
"Close panel": "",
"This chat is limited by 100 messages.": "",
"Send": "",
- "This chat is limited by 21 messages.": ""
+ "This chat is limited by 21 messages.": "",
+ "Excerpt": "",
+ "This is the excerpt that is shown in the overview.": "",
+ "Main image caption": "",
+ "Time to read": "",
+ "How many minutes to read?": "",
+ "Read": "",
+ "News": "",
+ "Dezentral News": "",
+ "min read": "",
+ "Here we post important news that is relevant for everyone.": ""
}
\ No newline at end of file
diff --git a/resources/lang/it.json b/resources/lang/it.json
index 2fad5de3..216628f7 100644
--- a/resources/lang/it.json
+++ b/resources/lang/it.json
@@ -667,5 +667,15 @@
"Close panel": "",
"This chat is limited by 100 messages.": "",
"Send": "",
- "This chat is limited by 21 messages.": ""
+ "This chat is limited by 21 messages.": "",
+ "Excerpt": "",
+ "This is the excerpt that is shown in the overview.": "",
+ "Main image caption": "",
+ "Time to read": "",
+ "How many minutes to read?": "",
+ "Read": "",
+ "News": "",
+ "Dezentral News": "",
+ "min read": "",
+ "Here we post important news that is relevant for everyone.": ""
}
\ No newline at end of file
diff --git a/resources/lang/mk.json b/resources/lang/mk.json
index aa105cda..e5946332 100644
--- a/resources/lang/mk.json
+++ b/resources/lang/mk.json
@@ -667,5 +667,15 @@
"Close panel": "",
"This chat is limited by 100 messages.": "",
"Send": "",
- "This chat is limited by 21 messages.": ""
+ "This chat is limited by 21 messages.": "",
+ "Excerpt": "",
+ "This is the excerpt that is shown in the overview.": "",
+ "Main image caption": "",
+ "Time to read": "",
+ "How many minutes to read?": "",
+ "Read": "",
+ "News": "",
+ "Dezentral News": "",
+ "min read": "",
+ "Here we post important news that is relevant for everyone.": ""
}
\ No newline at end of file
diff --git a/resources/lang/pl.json b/resources/lang/pl.json
index 8c7ae881..bfb9212a 100644
--- a/resources/lang/pl.json
+++ b/resources/lang/pl.json
@@ -667,5 +667,15 @@
"Close panel": "",
"This chat is limited by 100 messages.": "",
"Send": "",
- "This chat is limited by 21 messages.": ""
+ "This chat is limited by 21 messages.": "",
+ "Excerpt": "",
+ "This is the excerpt that is shown in the overview.": "",
+ "Main image caption": "",
+ "Time to read": "",
+ "How many minutes to read?": "",
+ "Read": "",
+ "News": "",
+ "Dezentral News": "",
+ "min read": "",
+ "Here we post important news that is relevant for everyone.": ""
}
\ No newline at end of file
diff --git a/resources/lang/pt.json b/resources/lang/pt.json
index a70315d4..4dfba73a 100644
--- a/resources/lang/pt.json
+++ b/resources/lang/pt.json
@@ -667,5 +667,15 @@
"Close panel": "",
"This chat is limited by 100 messages.": "",
"Send": "",
- "This chat is limited by 21 messages.": ""
+ "This chat is limited by 21 messages.": "",
+ "Excerpt": "",
+ "This is the excerpt that is shown in the overview.": "",
+ "Main image caption": "",
+ "Time to read": "",
+ "How many minutes to read?": "",
+ "Read": "",
+ "News": "",
+ "Dezentral News": "",
+ "min read": "",
+ "Here we post important news that is relevant for everyone.": ""
}
\ No newline at end of file
diff --git a/resources/lang/tr.json b/resources/lang/tr.json
index 4305bbb7..0e8e62d4 100644
--- a/resources/lang/tr.json
+++ b/resources/lang/tr.json
@@ -641,5 +641,15 @@
"Close panel": "",
"This chat is limited by 100 messages.": "",
"Send": "",
- "This chat is limited by 21 messages.": ""
+ "This chat is limited by 21 messages.": "",
+ "Excerpt": "",
+ "This is the excerpt that is shown in the overview.": "",
+ "Main image caption": "",
+ "Time to read": "",
+ "How many minutes to read?": "",
+ "Read": "",
+ "News": "",
+ "Dezentral News": "",
+ "min read": "",
+ "Here we post important news that is relevant for everyone.": ""
}
\ No newline at end of file
diff --git a/resources/views/columns/library_items/action.blade.php b/resources/views/columns/library_items/action.blade.php
index d04a2aa9..1b1df482 100644
--- a/resources/views/columns/library_items/action.blade.php
+++ b/resources/views/columns/library_items/action.blade.php
@@ -17,14 +17,32 @@
{{ __('Listen') }}
@endif
+ @if($row->type === 'markdown_article')
+
{{ '' }}
++
{{ $libraryItem->name }}
+{{ $libraryItem->excerpt }}
+ ++
{{ $libraryItem->subtitle }}
+