From 8bbf91d16267c9520c529cbb0405da544e7a62c8 Mon Sep 17 00:00:00 2001
From: Sebastian Lobinger <sebastian.lobinger@fu-berlin.de>
Date: Thu, 1 Jun 2017 11:30:11 +0200
Subject: [PATCH] add Main app and Extra app to ExampleApp

---
 ExampleApp/Extra/__init__.py          |  4 ++++
 ExampleApp/Extra/lang/en.yaml         |  2 ++
 ExampleApp/Extra/manifest.yaml        |  7 +++++++
 ExampleApp/Main/__init__.py           |  6 ++++--
 ExampleApp/Main/lang/de.yaml          |  4 +++-
 ExampleApp/Main/manifest.yaml         | 11 +++++++++--
 ExampleApp/config/config.yaml         |  3 ++-
 ExampleApp/templates/base-struct.html |  6 +++---
 ExampleApp/templates/home.html        |  2 +-
 9 files changed, 35 insertions(+), 10 deletions(-)
 create mode 100644 ExampleApp/Extra/__init__.py
 create mode 100644 ExampleApp/Extra/lang/en.yaml
 create mode 100644 ExampleApp/Extra/manifest.yaml

diff --git a/ExampleApp/Extra/__init__.py b/ExampleApp/Extra/__init__.py
new file mode 100644
index 0000000..e189702
--- /dev/null
+++ b/ExampleApp/Extra/__init__.py
@@ -0,0 +1,4 @@
+from flask import render_template
+
+def home():
+  return render_template('home.html')
\ No newline at end of file
diff --git a/ExampleApp/Extra/lang/en.yaml b/ExampleApp/Extra/lang/en.yaml
new file mode 100644
index 0000000..5fc2b43
--- /dev/null
+++ b/ExampleApp/Extra/lang/en.yaml
@@ -0,0 +1,2 @@
+hello_message: 'Hello extra page!'
+men_index: 'Extra page'
diff --git a/ExampleApp/Extra/manifest.yaml b/ExampleApp/Extra/manifest.yaml
new file mode 100644
index 0000000..1d2a4ba
--- /dev/null
+++ b/ExampleApp/Extra/manifest.yaml
@@ -0,0 +1,7 @@
+default_language: 'en'
+views:
+  - url: &index_url ''
+    function: 'home'
+menu:
+  - url: *index_url
+    name_string: men_index
\ No newline at end of file
diff --git a/ExampleApp/Main/__init__.py b/ExampleApp/Main/__init__.py
index bc2add6..e189702 100644
--- a/ExampleApp/Main/__init__.py
+++ b/ExampleApp/Main/__init__.py
@@ -1,2 +1,4 @@
-def hello_string():
-  return 'Hello'
\ No newline at end of file
+from flask import render_template
+
+def home():
+  return render_template('home.html')
\ No newline at end of file
diff --git a/ExampleApp/Main/lang/de.yaml b/ExampleApp/Main/lang/de.yaml
index 9e26dfe..543634e 100644
--- a/ExampleApp/Main/lang/de.yaml
+++ b/ExampleApp/Main/lang/de.yaml
@@ -1 +1,3 @@
-{}
\ No newline at end of file
+hello_message: 'Hello extra page!'
+men_index: 'Extra page'
+men_index_repo_link: 'Gitlab Repo'
\ No newline at end of file
diff --git a/ExampleApp/Main/manifest.yaml b/ExampleApp/Main/manifest.yaml
index e96e126..ddbe9dc 100644
--- a/ExampleApp/Main/manifest.yaml
+++ b/ExampleApp/Main/manifest.yaml
@@ -1,4 +1,11 @@
 default_language: 'de'
 views:
-  - url: 'hello_string'
-    function: 'hello_string'
\ No newline at end of file
+  - url: &index_url ''
+    function: 'home'
+menu:
+  - url: *index_url
+    name_string: men_index
+    menu:
+      - url: 'https://git.imp.fu-berlin.de/slobinger/sams-classes'
+        external: true
+        name_string: men_index_repo_link
\ No newline at end of file
diff --git a/ExampleApp/config/config.yaml b/ExampleApp/config/config.yaml
index c1d153d..5ee69e5 100644
--- a/ExampleApp/config/config.yaml
+++ b/ExampleApp/config/config.yaml
@@ -5,4 +5,5 @@ exampleApp:
   default_language: de
   main_app: 'ExampleApp.Main'
 apps:
-  - 'ExampleApp.Main'
\ No newline at end of file
+  - 'ExampleApp.Main'
+  - 'ExampleApp.Extra'
\ No newline at end of file
diff --git a/ExampleApp/templates/base-struct.html b/ExampleApp/templates/base-struct.html
index f35722e..0b5c838 100644
--- a/ExampleApp/templates/base-struct.html
+++ b/ExampleApp/templates/base-struct.html
@@ -10,10 +10,10 @@
   <div id="header">{% block header %}{% endblock %}</div>
   <div id="global_app_menu">
     <ul>
-      {% for entry in menu_list recursive%}
+      {% for entry in menu recursive%}
       <li><a href='{{ entry.url }}'>{{ entry.name }}</a></li>
-      {% if entry.subentries %}
-        <ul class="submenu">{{ loop(entry.subentries) }}</ul>
+      {% if entry.menu %}
+        <ul class="submenu">{{ loop(entry.menu) }}</ul>
       {% endif %}
       {% endfor %}
     </ul>
diff --git a/ExampleApp/templates/home.html b/ExampleApp/templates/home.html
index 6107666..88b80f8 100644
--- a/ExampleApp/templates/home.html
+++ b/ExampleApp/templates/home.html
@@ -3,6 +3,6 @@
 {% block head %} {{ super() }} {% endblock %}
 {% block content %}
     <h1>Home</h1>
-    <p>samsHub Startseite: {{ hub_lang['home_wellcome_message']|safe }}</p>
+    <p>samsHub Startseite: {{ app_lang['hello_message'] }}</p>
 {% endblock %}
 {% block header %}samsHUB -{% endblock %}
\ No newline at end of file
-- 
GitLab