summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-04-18 09:04:34 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2015-04-18 09:04:34 +0200
commit2b5cb826fae8325661abd54eb6521cade1c80dba (patch)
tree15518de974c9d43b1605adc7d218aea9fc87d366
parentd4c3033adcfa359ae0c82a0d3b1bee6a96245ba1 (diff)
downloadaCms-2b5cb826fae8325661abd54eb6521cade1c80dba.tar.gz
aCms-2b5cb826fae8325661abd54eb6521cade1c80dba.tar.bz2
added master and intro templates
-rw-r--r--CMakeLists.txt1
-rw-r--r--config.js3
-rw-r--r--src/strusCms.cpp16
-rw-r--r--src/strusCms.hpp3
-rw-r--r--templates/intro.tmpl14
-rw-r--r--templates/main.tmpl13
6 files changed, 48 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54df7bb..375bbba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,7 @@ find_program(MSGMERGE msgmerge)
set(TEMPLATES
${CMAKE_CURRENT_SOURCE_DIR}/templates/main.tmpl
+ ${CMAKE_CURRENT_SOURCE_DIR}/templates/intro.tmpl
)
set(SRC
diff --git a/config.js b/config.js
index 8f605bd..6673811 100644
--- a/config.js
+++ b/config.js
@@ -6,6 +6,9 @@
"api" : "http",
"port" : 8080
},
+ "http" : {
+ "script" : "/strusCms"
+ },
"views" : {
"paths" : [ "." ],
"skins" : [ "view" ]
diff --git a/src/strusCms.cpp b/src/strusCms.cpp
index da535ef..9c59adf 100644
--- a/src/strusCms.cpp
+++ b/src/strusCms.cpp
@@ -1,5 +1,21 @@
#include "strusCms.hpp"
+#include "content.hpp"
+
+#include <cppcms/url_dispatcher.h>
+#include <cppcms/url_mapper.h>
+#include <cppcms/http_response.h>
strusCms::strusCms( cppcms::service &srv ) : cppcms::application( srv )
{
+ dispatcher( ).assign( "", &strusCms::intro, this );
+ mapper( ).assign( "" );
+
+ mapper( ).root( "/strusCms" );
+}
+
+void strusCms::intro( )
+{
+ content::master c;
+ c.title = "strusCms";
+ render( "intro", c );
}
diff --git a/src/strusCms.hpp b/src/strusCms.hpp
index 6dff31f..6c152d0 100644
--- a/src/strusCms.hpp
+++ b/src/strusCms.hpp
@@ -6,6 +6,9 @@
class strusCms : public cppcms::application {
public:
strusCms( cppcms::service &srv );
+
+ private:
+ void intro( );
};
#endif
diff --git a/templates/intro.tmpl b/templates/intro.tmpl
new file mode 100644
index 0000000..b99ea06
--- /dev/null
+++ b/templates/intro.tmpl
@@ -0,0 +1,14 @@
+<% c++ #include "content.hpp" %>
+<% skin view %>
+<% view intro uses content::master extends master %>
+
+<% template title() %>
+ <% include master::title() %> :: Intro
+<% end %>
+
+<% template page_content() %>
+ Welcome to <b>StrusCms</b>.
+<% end template %>
+
+<% end view %>
+<% end skin %>
diff --git a/templates/main.tmpl b/templates/main.tmpl
index 8b5238a..8e4592f 100644
--- a/templates/main.tmpl
+++ b/templates/main.tmpl
@@ -2,10 +2,19 @@
<% skin view %>
<% view master uses content::master %>
-<% template render() %>
+<% template title( ) %><%= title %><% end %>
+<% template page_content( ) %>Override Me<% end %>
+
+<% template render( ) %>
<html>
+ <head>
+ <title><% include title( ) %></title>
+ </head>
<body>
- <p>strusCms</p>
+ <h1><% include title( ) %></h1>
+ <div id="content">
+ <% include page_content( ) %>
+ </div>
</body>
</html>
<% end template %>