Compare commits

..

No commits in common. "1b071ef37e06129207467b170475d9ee1276cabf" and "898e932ceb0303fa896d47b5bb2d59e0a7629409" have entirely different histories.

12 changed files with 129 additions and 83 deletions

View File

@ -80,7 +80,7 @@ class Plugin extends PluginBase
return [
'settings' => [
'label' => 'Adrema',
'description' => 'silva.adrema::lang.setting_description',
'description' => 'setting_description',
'category' => 'CATEGORY_CMS',
'icon' => 'icon-cog',
'class' => Settings::class,

View File

@ -26,8 +26,8 @@ abstract class EventManager extends ComponentBase
$componentName = str(class_basename(static::class))->snake();
return [
'name' => __("silva.adrema::lang.{$componentName}_component_name"),
'description' => __("silva.adrema::lang.{$componentName}_component_description"),
'name' => __("{$componentName}_component_name"),
'description' => __("{$componentName}_component_description"),
];
}
@ -68,22 +68,22 @@ abstract class EventManager extends ComponentBase
{
return [
'indexPage' => [
'title' => __('silva.adrema::lang.properties.index_page_title'),
'title' => __('properties.index_page_title'),
'type' => 'dropdown',
'default' => null,
],
'singlePage' => [
'title' => __('silva.adrema::lang.properties.single_page_title'),
'title' => __('properties.single_page_title'),
'type' => 'dropdown',
'default' => null,
],
'registerPage' => [
'title' => __('silva.adrema::lang.properties.register_page_title'),
'title' => __('properties.register_page_title'),
'type' => 'dropdown',
'default' => null,
],
'eventSlug' => [
'title' => __('silva.adrema::lang.properties.event_slug_title'),
'title' => __('properties.event_slug_title'),
'type' => 'text',
'default' => null,
],
@ -114,10 +114,10 @@ abstract class EventManager extends ComponentBase
private function getPageFromProperty(string $property): Page
{
throw_if(!$this->property('indexPage') || !$this->property('singlePage') || !$this->property('registerPage'), ComponentException::class, 'silva.adrema::lang.not_all_pages_set');
throw_if(!$this->property('indexPage') || !$this->property('singlePage') || !$this->property('registerPage'), ComponentException::class, 'not_all_pages_set');
$page = Page::find($this->property($property));
throw_if($page === null, ComponentException::class, 'silva.adrema::lang.page_not_found');
throw_if($page === null, ComponentException::class, 'page_not_found');
return $page;
}
@ -131,8 +131,8 @@ abstract class EventManager extends ComponentBase
$singlePage = $this->getPageFromProperty('singlePage');
$registerPage = $this->getPageFromProperty('registerPage');
throw_if(!str($singlePage->url)->contains(':slug'), ComponentException::class, 'silva.adrema::lang.slug_not_found');
throw_if(!str($registerPage->url)->contains(':slug'), ComponentException::class, 'silva.adrema::lang.slug_not_found');
throw_if(!str($singlePage->url)->contains(':slug'), ComponentException::class, 'slug_not_found');
throw_if(!str($registerPage->url)->contains(':slug'), ComponentException::class, 'slug_not_found');
return [
'indexUrl' => $indexPage->url,

27
lang/de.json Normal file
View File

@ -0,0 +1,27 @@
{
"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"
}

View File

@ -1,29 +0,0 @@
<?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 Normal file
View File

@ -0,0 +1,27 @@
{
"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."
}

View File

@ -1,29 +0,0 @@
<?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.'
];

23
models/Setting.php Normal file
View File

@ -0,0 +1,23 @@
<?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 = [];
}

View File

@ -2,13 +2,24 @@
namespace Silva\Adrema\Models;
use Model;
use System\Models\SettingModel;
class Settings extends Model
class Settings extends SettingModel
{
public $implement = ['System.Behaviors.SettingsModel'];
use \October\Rain\Database\Traits\Validation;
/**
* @var string table name
*/
public $settingsCode = 'silva_adrema_settings';
/**
* @var string field file
*/
public $settingsFields = 'fields.yaml';
/**
* @var array<string, string> rules for validation
*/
public $rules = [];
}

View File

@ -0,0 +1,8 @@
# ===================================
# List Column Definitions
# ===================================
columns:
id:
label: ID
searchable: true

View File

@ -0,0 +1,8 @@
# ===================================
# Form Field Definitions
# ===================================
fields:
id:
label: ID
disabled: true

View File

@ -4,25 +4,25 @@
fields:
base_url:
label: silva.adrema::lang.settings.base_url_label
comment: silva.adrema::lang.settings.base_url_comment
label: settings.base_url_label
comment: settings.base_url_comment
primary_color:
label: silva.adrema::lang.settings.primary_color_label
comment: silva.adrema::lang.settings.primary_color_comment
label: settings.primary_color_label
comment: settings.primary_color_comment
type: colorpicker
secondary_color:
label: silva.adrema::lang.settings.secondary_color_label
comment: silva.adrema::lang.settings.secondary_color_comment
label: settings.secondary_color_label
comment: settings.secondary_color_comment
type: colorpicker
font_color:
label: silva.adrema::lang.settings.font_color_label
comment: silva.adrema::lang.settings.font_color_comment
label: settings.font_color_label
comment: settings.font_color_comment
type: colorpicker
circle_color:
label: silva.adrema::lang.settings.circle_color_label
comment: silva.adrema::lang.settings.circle_color_comment
label: settings.circle_color_label
comment: settings.circle_color_comment
type: colorpicker

View File

@ -7,7 +7,7 @@ class FetchSingleEvent
public function run(string $slug): ?array
{
$events = data_get(app(FetchAllEvents::class)->run(), 'data');
throw_if(is_null($events), ComponentException::class, 'silva.adrema::lang.event_fetching_failed');
throw_if(is_null($events), ComponentException::class, 'event_fetching_failed');
return collect($events)->first(fn ($event) => $event['slug'] === $slug);
}