diff --git a/EVENT.MD b/EVENT.MD deleted file mode 100644 index 4a62495..0000000 --- a/EVENT.MD +++ /dev/null @@ -1 +0,0 @@ -# Event Dokumentation \ No newline at end of file diff --git a/README.MD b/README.MD index 0bdf7ee..7edd811 100644 --- a/README.MD +++ b/README.MD @@ -1,34 +1,29 @@ # README -## Inhaltsverzeichnis -0. [README](https://git.ctdo.de/xoy/ctdo.de/src/branch/master/README.MD) - Übersicht -1. [SCRUMBOARD](https://git.ctdo.de/xoy/ctdo.de/src/branch/master/SCRUMBOARD.MD) - Entwicklungsplan +## Projektstruktur ---- +| Name | Pfad | +| --------------------------------- | ---------------- | +| Templates | /templates/ | +| Seiten / Seiteninhalte | /pages/ | +| Events | /events/ | +| Bilder | /images/ | +| Post Bilder | /images/posts/ | +| Post Bilder | /images/events/ | +| CSS | /css/ | +| PHP Scripts | /php/ | -## Struktur - -| Name | Pfad | -| --------------------------------- | --------------- | -| Templates | /templates/ | -| Seiten / Seiteninhalte | /pages/ | -| Events | /events/ | -| Bilder | /images/ | -| Post Bilder | /images/posts/ | -| CSS | /css/ | -| PHP Scripts | /php/ | - -## Erstellen neuer Events +## Erstellen neuer Events / Blog Posts Datei im Eventverzeichnis Anlegen: - Nummerierung beachten! - *.md* Dateierweiterung verwenden! ``` -Blogpost Titel -Blogpost Beschreibung -Blogpost Datum -Blogpost Autor +Titel +Beschreibung +Datum +Autor ------------------------ # Content here! ``` @@ -37,10 +32,10 @@ Strukturierung: - Header ``` -Blogpost Titel -Blogpost Beschreibung -Blogpost Datum -Blogpost Autor +Titel +Beschreibung +Datum +Autor ``` - Trenner zwischen Header und Content @@ -57,4 +52,4 @@ Unter dem Trenner kann Markdown verwendet werden. Bilder für Posts kommen in das Verzeichnis */images/posts/* -[Event Dokumentation](https://git.ctdo.de/xoy/ctdo.de/src/branch/master/EVENT.MD) \ No newline at end of file +Bilder für Events kommen in das Verzeichnis */images/events/* \ No newline at end of file diff --git a/css/main.css b/css/main.css index b82cad1..6f78fb9 100644 --- a/css/main.css +++ b/css/main.css @@ -6,6 +6,7 @@ } * { + box-sizing: border-box; word-wrap: break-word; } diff --git a/index.php b/index.php index a5c32e6..27dc1f1 100644 --- a/index.php +++ b/index.php @@ -15,10 +15,8 @@ $converter = new CommonMarkConverter([ 'allow_unsafe_links' => false, ]); -//$pageloader = new FilesystemLoader(__DIR__ . '/pages'); $templateloader = new FilesystemLoader(__DIR__ . '/templates'); -//$twig_pages = new Environment($pageloader); $twig_templates = new Environment($templateloader); $title = ''; @@ -56,78 +54,96 @@ if(isset($_GET['page'])) { switch ($page) { case 'index': $content = $converter->convert(file_get_contents(__DIR__ . '/pages/index.md')); + $content = $twig_templates->render('index.twig', ['content' => $content, 'topic' => $topic, 'treff' => $treff, 'repaircafe' => $repaircafe, 'brunch' => $brunch, 'events' => generate_event_list() ]); + $filetoedit = "pages/index.md"; $css[] = 'home'; $css[] = 'events'; break; case 'about': $content = $converter->convert(file_get_contents(__DIR__ . '/pages/about.md')); + $filetoedit = "pages/about.md"; $css[] = 'about'; break; case 'treff': $content = $converter->convert(file_get_contents(__DIR__ . '/pages/treff.md')); + $filetoedit = "pages/treff.md"; break; case 'blog': if(!isset($_GET['id'])) { $content = $twig_templates->render('blog.twig', [ 'posts' => generate_post_list() ]); + $filetoedit = "templates/blog.twig"; $css[] = 'events'; } else { $content = $converter->convert(get_post_content($_GET['id'])); + $filetoedit = "posts/".$_GET['id'].".md"; $css[] = 'event'; } break; case 'events': if(!isset($_GET['id'])) { $content = $twig_templates->render('events.twig', [ 'topic' => $topic, 'treff' => $treff, 'repaircafe' => $repaircafe, 'brunch' => $brunch, 'events' => generate_event_list() ]); + $filetoedit = "templates/events.twig"; $css[] = 'events'; } else { $content = str_mass_replace(array('{{ topicdatum }}', 'Chaostreff Dortmund e.V.', '{{ treffdatum }}', '{{ repaircafedatum }}', '{{ brunchdatum }}'), array(get_next_topic()->date, html_link('/?page=treff', '', 'Chaostreff Dortmund e.V.', FALSE), get_next_treff()->date, get_next_repaircafe()->date, get_next_brunch()->date), $converter->convert(get_event_content($_GET['id']))); + $filetoedit = "events/".$_GET['id'].".md"; $css[] = 'event'; } break; case 'kontakt': $content = $twig_templates->render('kontakt.twig'); + $filetoedit = "templates/kontakt.twig"; $css[] = 'kontakt'; break; case 'adresse': $content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/adresse.md')).''; + $filetoedit = "pages/kontakt/adresse.md"; break; case 'irc': $content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/irc.md')); + $filetoedit = "pages/kontakt/irc.md"; break; case 'mail': $content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/mail.md')); + $filetoedit = "pages/kontakt/mail.md"; break; case 'tel': $content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/tel.md')); + $filetoedit = "pages/kontakt/tel.md"; break; case 'support': $content = $converter->convert(file_get_contents(__DIR__ . '/pages/support.md')); + $filetoedit = "pages/kontakt/support.md"; break; case 'verein': $content = $converter->convert(file_get_contents(__DIR__ . '/pages/verein.md')); + $filetoedit = "pages/verein.md"; break; case 'impressum': $title = 'impressum'; $content = $converter->convert(file_get_contents(__DIR__ . '/pages/impressum.md')); + $filetoedit = "pages/impressum.md"; break; case 'datenschutz': $title = 'datenschutz'; $content = $converter->convert(file_get_contents(__DIR__ . '/pages/datenschutz.md')); + $filetoedit = "pages/datenschutz.md"; break; default: - $content = $twig_pages->render('404.twig', ['page' => $_GET['page']]); + $content = $twig_templates->render('404.twig', ['page' => $_GET['page']]); + $filetoedit = "templates/404.twig"; break; } } else { $active_page = 'index'; $title = $active_page; - //$content = $twig_pages->render('index.twig', [ 'posts' => generate_post_list(4) ]); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/index.md')); + $content = $twig_templates->render('index.twig', ['content' => $content, 'topic' => $topic, 'treff' => $treff, 'repaircafe' => $repaircafe, 'brunch' => $brunch, 'events' => generate_event_list() ]); $css[] = 'home'; $css[] = 'events'; } $nav = generate_nav($active_page, $pages, $page_names); -echo $twig_templates->render('default.twig', ['title' => $title, 'css' => $css, 'nav' => $nav, 'raumstatus' => $raumstatus, 'main' => $content]); +echo $twig_templates->render('default.twig', ['title' => $title, 'css' => $css, 'nav' => $nav, 'raumstatus' => $raumstatus, 'main' => $content, 'file_to_edit' => $filetoedit]); ?> diff --git a/templates/default.twig b/templates/default.twig index f8ff45f..e100944 100644 --- a/templates/default.twig +++ b/templates/default.twig @@ -42,6 +42,7 @@ diff --git a/templates/events.twig b/templates/events.twig index ad3e3dd..f415331 100644 --- a/templates/events.twig +++ b/templates/events.twig @@ -5,7 +5,7 @@ {% elseif topic.days == 1 %}

Der nächste Topictreff findet morgen [{{ topic.date }}] statt!

{% else %} -

Der nächste Topictreff findet in {{ topic.days }} [{{ topic.date }}] statt!

+

Der nächste Topictreff findet in {{ topic.days }} Tagen [{{ topic.date }}] statt!

{% endif %} {% if treff.days == 0 %} @@ -13,7 +13,7 @@ {% elseif treff.days == 1 %}

Der nächste Treff findet morgen [{{ treff.date }}] statt!

{% else %} -

Der nächste Treff findet in {{ treff.days }} [{{ treff.date }}] statt!

+

Der nächste Treff findet in {{ treff.days }} Tagen [{{ treff.date }}] statt!

{% endif %} {% if repaircafe.days == 0 %} @@ -21,7 +21,7 @@ {% elseif repaircafe.days == 1 %}

Das nächste RepairCafe findet morgen [{{ repaircafe.date }}] statt!

{% else %} -

Das nächste RepairCafe findet in {{ repaircafe.days }} [{{ repaircafe.date }}] statt!

+

Das nächste RepairCafe findet in Tagen {{ repaircafe.days }} [{{ repaircafe.date }}] statt!

{% endif %} {% if brunch.days == 0 %} @@ -29,7 +29,7 @@ {% elseif brunch.days == 1 %}

Der nächste Brunch findet morgen [{{ brunch.date }}] statt!

{% else %} -

Der nächste Brunch findet in {{ brunch.days }} [{{ brunch.date }}] statt!

+

Der nächste Brunch findet in {{ brunch.days }} Tagen [{{ brunch.date }}] statt!

{% endif %} {{ events | raw }} \ No newline at end of file diff --git a/templates/index.twig b/templates/index.twig index dcb3fb1..b7d44f3 100644 --- a/templates/index.twig +++ b/templates/index.twig @@ -1,5 +1,37 @@ {{ content | raw }}

Die nächsten Events:

-{{ topic | raw }} -{{ posts | raw }} \ No newline at end of file + +{% if topic.days == 0 %} +

Der nächste Topictreff findet heute [{{ topic.date }}] statt!

+{% elseif topic.days == 1 %} +

Der nächste Topictreff findet morgen [{{ topic.date }}] statt!

+{% else %} +

Der nächste Topictreff findet in {{ topic.days }} Tagen [{{ topic.date }}] statt!

+{% endif %} + +{% if treff.days == 0 %} +

Der nächste Treff findet heute [{{ treff.date }}] statt!

+{% elseif treff.days == 1 %} +

Der nächste Treff findet morgen [{{ treff.date }}] statt!

+{% else %} +

Der nächste Treff findet in {{ treff.days }} Tagen [{{ treff.date }}] statt!

+{% endif %} + +{% if repaircafe.days == 0 %} +

Das nächste RepairCafe findet heute [{{ repaircafe.date }}] statt!

+{% elseif repaircafe.days == 1 %} +

Das nächste RepairCafe findet morgen [{{ repaircafe.date }}] statt!

+{% else %} +

Das nächste RepairCafe findet in Tagen {{ repaircafe.days }} [{{ repaircafe.date }}] statt!

+{% endif %} + +{% if brunch.days == 0 %} +

Der nächste Brunch findet heute [{{ brunch.date }}] statt!

+{% elseif brunch.days == 1 %} +

Der nächste Brunch findet morgen [{{ brunch.date }}] statt!

+{% else %} +

Der nächste Brunch findet in {{ brunch.days }} Tagen [{{ brunch.date }}] statt!

+{% endif %} + +{{ events | raw }} \ No newline at end of file diff --git a/tester.php b/tester.php deleted file mode 100644 index 2861601..0000000 --- a/tester.php +++ /dev/null @@ -1,7 +0,0 @@ -get_next_brunch()); \ No newline at end of file