Compare commits
5 Commits
898e932ceb
...
1b071ef37e
Author | SHA1 | Date |
---|---|---|
|
1b071ef37e | |
|
83567a4087 | |
|
9555ec0889 | |
|
4a2f3929fa | |
|
7609382f68 |
|
@ -80,7 +80,7 @@ class Plugin extends PluginBase
|
||||||
return [
|
return [
|
||||||
'settings' => [
|
'settings' => [
|
||||||
'label' => 'Adrema',
|
'label' => 'Adrema',
|
||||||
'description' => 'setting_description',
|
'description' => 'silva.adrema::lang.setting_description',
|
||||||
'category' => 'CATEGORY_CMS',
|
'category' => 'CATEGORY_CMS',
|
||||||
'icon' => 'icon-cog',
|
'icon' => 'icon-cog',
|
||||||
'class' => Settings::class,
|
'class' => Settings::class,
|
||||||
|
|
|
@ -26,8 +26,8 @@ abstract class EventManager extends ComponentBase
|
||||||
$componentName = str(class_basename(static::class))->snake();
|
$componentName = str(class_basename(static::class))->snake();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => __("{$componentName}_component_name"),
|
'name' => __("silva.adrema::lang.{$componentName}_component_name"),
|
||||||
'description' => __("{$componentName}_component_description"),
|
'description' => __("silva.adrema::lang.{$componentName}_component_description"),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,22 +68,22 @@ abstract class EventManager extends ComponentBase
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'indexPage' => [
|
'indexPage' => [
|
||||||
'title' => __('properties.index_page_title'),
|
'title' => __('silva.adrema::lang.properties.index_page_title'),
|
||||||
'type' => 'dropdown',
|
'type' => 'dropdown',
|
||||||
'default' => null,
|
'default' => null,
|
||||||
],
|
],
|
||||||
'singlePage' => [
|
'singlePage' => [
|
||||||
'title' => __('properties.single_page_title'),
|
'title' => __('silva.adrema::lang.properties.single_page_title'),
|
||||||
'type' => 'dropdown',
|
'type' => 'dropdown',
|
||||||
'default' => null,
|
'default' => null,
|
||||||
],
|
],
|
||||||
'registerPage' => [
|
'registerPage' => [
|
||||||
'title' => __('properties.register_page_title'),
|
'title' => __('silva.adrema::lang.properties.register_page_title'),
|
||||||
'type' => 'dropdown',
|
'type' => 'dropdown',
|
||||||
'default' => null,
|
'default' => null,
|
||||||
],
|
],
|
||||||
'eventSlug' => [
|
'eventSlug' => [
|
||||||
'title' => __('properties.event_slug_title'),
|
'title' => __('silva.adrema::lang.properties.event_slug_title'),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'default' => null,
|
'default' => null,
|
||||||
],
|
],
|
||||||
|
@ -114,10 +114,10 @@ abstract class EventManager extends ComponentBase
|
||||||
|
|
||||||
private function getPageFromProperty(string $property): Page
|
private function getPageFromProperty(string $property): Page
|
||||||
{
|
{
|
||||||
throw_if(!$this->property('indexPage') || !$this->property('singlePage') || !$this->property('registerPage'), ComponentException::class, 'not_all_pages_set');
|
throw_if(!$this->property('indexPage') || !$this->property('singlePage') || !$this->property('registerPage'), ComponentException::class, 'silva.adrema::lang.not_all_pages_set');
|
||||||
|
|
||||||
$page = Page::find($this->property($property));
|
$page = Page::find($this->property($property));
|
||||||
throw_if($page === null, ComponentException::class, 'page_not_found');
|
throw_if($page === null, ComponentException::class, 'silva.adrema::lang.page_not_found');
|
||||||
|
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
|
@ -131,8 +131,8 @@ abstract class EventManager extends ComponentBase
|
||||||
$singlePage = $this->getPageFromProperty('singlePage');
|
$singlePage = $this->getPageFromProperty('singlePage');
|
||||||
$registerPage = $this->getPageFromProperty('registerPage');
|
$registerPage = $this->getPageFromProperty('registerPage');
|
||||||
|
|
||||||
throw_if(!str($singlePage->url)->contains(':slug'), ComponentException::class, 'slug_not_found');
|
throw_if(!str($singlePage->url)->contains(':slug'), ComponentException::class, 'silva.adrema::lang.slug_not_found');
|
||||||
throw_if(!str($registerPage->url)->contains(':slug'), ComponentException::class, 'slug_not_found');
|
throw_if(!str($registerPage->url)->contains(':slug'), ComponentException::class, 'silva.adrema::lang.slug_not_found');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'indexUrl' => $indexPage->url,
|
'indexUrl' => $indexPage->url,
|
||||||
|
|
27
lang/de.json
27
lang/de.json
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
"setting_description": "App für DPSG-NaMi",
|
|
||||||
"settings.base_url_label": "Base-URL",
|
|
||||||
"settings.base_url_comment": "Die Domain (app_url), auf der deine Adrema läuft",
|
|
||||||
"settings.primary_color_label": "Primäre Farbe",
|
|
||||||
"settings.primary_color_comment": "Die primäre Farbe",
|
|
||||||
"settings.secondary_color_label": "Sekundäre Farbe",
|
|
||||||
"settings.secondary_color_comment": "Die sekundäre Farbe",
|
|
||||||
"settings.font_color_label": "Schriftfarbe",
|
|
||||||
"settings.font_color_comment": "Die Farbe von Schriften",
|
|
||||||
"settings.circle_color_label": "Kreisfarbe",
|
|
||||||
"settings.circle_color_comment": "Akzentfarbe für Kreise in Menüs",
|
|
||||||
"properties.index_page_title": "Seite für Übersicht",
|
|
||||||
"properties.single_page_title": "Seite für Einzelansicht",
|
|
||||||
"properties.register_page_title": "Seite zum anmelden",
|
|
||||||
"properties.event_slug_title": "Veranstaltung slug",
|
|
||||||
"event_index_component_name": "Veranstaltungs-Übersicht",
|
|
||||||
"event_index_component_description": "Übersicht aller bevorstehenden Adrema-Veranstaltungen.",
|
|
||||||
"event_register_component_name": "Veranstaltungs-Anmeldung",
|
|
||||||
"event_register_component_description": "Für einzelne Veranstaltung anmelden.",
|
|
||||||
"event_description_component_name": "Veranstaltungs-Einzelansicht",
|
|
||||||
"event_description_component_description": "Einzelne Veranstaltung anzeigen",
|
|
||||||
"errors.not_all_pages_set": "Du hast nicht alle Seiten zugewiesen. Bite bearbeite deine Komponenten.",
|
|
||||||
"errors.page_not_found": "Eine Seite kann nicht gefunden werden. Veranstaltungs-Komponente kann nicht gerendert werden.",
|
|
||||||
"errors.slug_not_found": "Du musst einen placeholder in den Seiten-URLs setzen (\":slug\")",
|
|
||||||
"errors.event_fetching_failed": "Fehler beim Abrufen von Veranstaltungen"
|
|
||||||
}
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'setting_description' => 'App für DPSG-NaMi',
|
||||||
|
'settings.base_url_label' => 'Base-URL',
|
||||||
|
'settings.base_url_comment' => 'Die Domain (app_url), auf der deine Adrema läuft',
|
||||||
|
'settings.primary_color_label' => 'Primäre Farbe',
|
||||||
|
'settings.primary_color_comment' => 'Die primäre Farbe',
|
||||||
|
'settings.secondary_color_label' => 'Sekundäre Farbe',
|
||||||
|
'settings.secondary_color_comment' => 'Die sekundäre Farbe',
|
||||||
|
'settings.font_color_label' => 'Schriftfarbe',
|
||||||
|
'settings.font_color_comment' => 'Die Farbe von Schriften',
|
||||||
|
'settings.circle_color_label' => 'Kreisfarbe',
|
||||||
|
'settings.circle_color_comment' => 'Akzentfarbe für Kreise in Menüs',
|
||||||
|
'properties.index_page_title' => 'Seite für Übersicht',
|
||||||
|
'properties.single_page_title' => 'Seite für Einzelansicht',
|
||||||
|
'properties.register_page_title' => 'Seite zum anmelden',
|
||||||
|
'properties.event_slug_title' => 'Veranstaltung slug',
|
||||||
|
'event_index_component_name' => 'Veranstaltungs-Übersicht',
|
||||||
|
'event_index_component_description' => 'Übersicht aller bevorstehenden Adrema-Veranstaltungen.',
|
||||||
|
'event_register_component_name' => 'Veranstaltungs-Anmeldung',
|
||||||
|
'event_register_component_description' => 'Für einzelne Veranstaltung anmelden.',
|
||||||
|
'event_description_component_name' => 'Veranstaltungs-Einzelansicht',
|
||||||
|
'event_description_component_description' => 'Einzelne Veranstaltung anzeigen',
|
||||||
|
'errors.not_all_pages_set' => 'Du hast nicht alle Seiten zugewiesen. Bite bearbeite deine Komponenten.',
|
||||||
|
'errors.page_not_found' => 'Eine Seite kann nicht gefunden werden. Veranstaltungs-Komponente kann nicht gerendert werden.',
|
||||||
|
'errors.slug_not_found' => 'Du musst einen placeholder in den Seiten-URLs setzen (\':slug\')',
|
||||||
|
'errors.event_fetching_failed' => 'Fehler beim Abrufen von Veranstaltungen'
|
||||||
|
];
|
27
lang/en.json
27
lang/en.json
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
"setting_description": "App for DPSG-NaMi",
|
|
||||||
"settings.base_url_label": "Base-URL",
|
|
||||||
"settings.base_url_comment": "The domain (APP_URL) of the Adrema application.",
|
|
||||||
"settings.primary_color_label": "Primary color",
|
|
||||||
"settings.primary_color_comment": "The primary color",
|
|
||||||
"settings.secondary_color_label": "Secondary color",
|
|
||||||
"settings.secondary_color_comment": "The secondary color",
|
|
||||||
"settings.font_color_label": "Font color",
|
|
||||||
"settings.font_color_comment": "The color for fonts",
|
|
||||||
"settings.circle_color_label": "Circle color",
|
|
||||||
"settings.circle_color_comment": "Accent-color for circles in menus",
|
|
||||||
"properties.index_page_title": "Page for overview",
|
|
||||||
"properties.single_page_title": "Page for single view",
|
|
||||||
"properties.register_page_title": "Page for registration",
|
|
||||||
"properties.event_slug_title": "Event slug",
|
|
||||||
"event_index_component_name": "Event overview",
|
|
||||||
"event_index_component_description": "Overview of all upcoming Adrema-Events",
|
|
||||||
"event_register_component_name": "Event-Registration",
|
|
||||||
"event_register_component_description": "Register for a single event.",
|
|
||||||
"event_description_component_name": "Event Description",
|
|
||||||
"event_description_component_description": "Displays details for a single event",
|
|
||||||
"errors.not_all_pages_set": "You didn't assign all pages. Please edit your components.",
|
|
||||||
"errors.page_not_found": "One page cannot be found. Event component cannot be rendered.",
|
|
||||||
"errors.slug_not_found": "You need to set a placeholder in page urls to set the event slug (\":slug\")",
|
|
||||||
"errors.event_fetching_failed": "Failed to fetch event."
|
|
||||||
}
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'setting_description' => 'App for DPSG-NaMi',
|
||||||
|
'settings.base_url_label' => 'Base-URL',
|
||||||
|
'settings.base_url_comment' => 'The domain (APP_URL) of the Adrema application.',
|
||||||
|
'settings.primary_color_label' => 'Primary color',
|
||||||
|
'settings.primary_color_comment' => 'The primary color',
|
||||||
|
'settings.secondary_color_label' => 'Secondary color',
|
||||||
|
'settings.secondary_color_comment' => 'The secondary color',
|
||||||
|
'settings.font_color_label' => 'Font color',
|
||||||
|
'settings.font_color_comment' => 'The color for fonts',
|
||||||
|
'settings.circle_color_label' => 'Circle color',
|
||||||
|
'settings.circle_color_comment' => 'Accent-color for circles in menus',
|
||||||
|
'properties.index_page_title' => 'Page for overview',
|
||||||
|
'properties.single_page_title' => 'Page for single view',
|
||||||
|
'properties.register_page_title' => 'Page for registration',
|
||||||
|
'properties.event_slug_title' => 'Event slug',
|
||||||
|
'event_index_component_name' => 'Event overview',
|
||||||
|
'event_index_component_description' => 'Overview of all upcoming Adrema-Events',
|
||||||
|
'event_register_component_name' => 'Event-Registration',
|
||||||
|
'event_register_component_description' => 'Register for a single event.',
|
||||||
|
'event_description_component_name' => 'Event Description',
|
||||||
|
'event_description_component_description' => 'Displays details for a single event',
|
||||||
|
'errors.not_all_pages_set' => 'You didn\'t assign all pages. Please edit your components.',
|
||||||
|
'errors.page_not_found' => 'One page cannot be found. Event component cannot be rendered.',
|
||||||
|
'errors.slug_not_found' => 'You need to set a placeholder in page urls to set the event slug (\':slug\')',
|
||||||
|
'errors.event_fetching_failed' => 'Failed to fetch event.'
|
||||||
|
];
|
|
@ -1,23 +0,0 @@
|
||||||
<?php namespace Silva\Adrema\Models;
|
|
||||||
|
|
||||||
use Model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setting Model
|
|
||||||
*
|
|
||||||
* @link https://docs.octobercms.com/3.x/extend/system/models.html
|
|
||||||
*/
|
|
||||||
class Setting extends Model
|
|
||||||
{
|
|
||||||
use \October\Rain\Database\Traits\Validation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string table name
|
|
||||||
*/
|
|
||||||
public $table = 'silva_adrema_settings';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array rules for validation
|
|
||||||
*/
|
|
||||||
public $rules = [];
|
|
||||||
}
|
|
|
@ -2,24 +2,13 @@
|
||||||
|
|
||||||
namespace Silva\Adrema\Models;
|
namespace Silva\Adrema\Models;
|
||||||
|
|
||||||
use System\Models\SettingModel;
|
use Model;
|
||||||
|
|
||||||
class Settings extends SettingModel
|
class Settings extends Model
|
||||||
{
|
{
|
||||||
use \October\Rain\Database\Traits\Validation;
|
public $implement = ['System.Behaviors.SettingsModel'];
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string table name
|
|
||||||
*/
|
|
||||||
public $settingsCode = 'silva_adrema_settings';
|
public $settingsCode = 'silva_adrema_settings';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string field file
|
|
||||||
*/
|
|
||||||
public $settingsFields = 'fields.yaml';
|
public $settingsFields = 'fields.yaml';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array<string, string> rules for validation
|
|
||||||
*/
|
|
||||||
public $rules = [];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
# ===================================
|
|
||||||
# List Column Definitions
|
|
||||||
# ===================================
|
|
||||||
|
|
||||||
columns:
|
|
||||||
id:
|
|
||||||
label: ID
|
|
||||||
searchable: true
|
|
|
@ -1,8 +0,0 @@
|
||||||
# ===================================
|
|
||||||
# Form Field Definitions
|
|
||||||
# ===================================
|
|
||||||
|
|
||||||
fields:
|
|
||||||
id:
|
|
||||||
label: ID
|
|
||||||
disabled: true
|
|
|
@ -4,25 +4,25 @@
|
||||||
|
|
||||||
fields:
|
fields:
|
||||||
base_url:
|
base_url:
|
||||||
label: settings.base_url_label
|
label: silva.adrema::lang.settings.base_url_label
|
||||||
comment: settings.base_url_comment
|
comment: silva.adrema::lang.settings.base_url_comment
|
||||||
|
|
||||||
primary_color:
|
primary_color:
|
||||||
label: settings.primary_color_label
|
label: silva.adrema::lang.settings.primary_color_label
|
||||||
comment: settings.primary_color_comment
|
comment: silva.adrema::lang.settings.primary_color_comment
|
||||||
type: colorpicker
|
type: colorpicker
|
||||||
|
|
||||||
secondary_color:
|
secondary_color:
|
||||||
label: settings.secondary_color_label
|
label: silva.adrema::lang.settings.secondary_color_label
|
||||||
comment: settings.secondary_color_comment
|
comment: silva.adrema::lang.settings.secondary_color_comment
|
||||||
type: colorpicker
|
type: colorpicker
|
||||||
|
|
||||||
font_color:
|
font_color:
|
||||||
label: settings.font_color_label
|
label: silva.adrema::lang.settings.font_color_label
|
||||||
comment: settings.font_color_comment
|
comment: silva.adrema::lang.settings.font_color_comment
|
||||||
type: colorpicker
|
type: colorpicker
|
||||||
|
|
||||||
circle_color:
|
circle_color:
|
||||||
label: settings.circle_color_label
|
label: silva.adrema::lang.settings.circle_color_label
|
||||||
comment: settings.circle_color_comment
|
comment: silva.adrema::lang.settings.circle_color_comment
|
||||||
type: colorpicker
|
type: colorpicker
|
||||||
|
|
|
@ -7,7 +7,7 @@ class FetchSingleEvent
|
||||||
public function run(string $slug): ?array
|
public function run(string $slug): ?array
|
||||||
{
|
{
|
||||||
$events = data_get(app(FetchAllEvents::class)->run(), 'data');
|
$events = data_get(app(FetchAllEvents::class)->run(), 'data');
|
||||||
throw_if(is_null($events), ComponentException::class, 'event_fetching_failed');
|
throw_if(is_null($events), ComponentException::class, 'silva.adrema::lang.event_fetching_failed');
|
||||||
|
|
||||||
return collect($events)->first(fn ($event) => $event['slug'] === $slug);
|
return collect($events)->first(fn ($event) => $event['slug'] === $slug);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue