From 2b5cb826fae8325661abd54eb6521cade1c80dba Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 18 Apr 2015 09:04:34 +0200 Subject: added master and intro templates --- CMakeLists.txt | 1 + config.js | 3 +++ src/strusCms.cpp | 16 ++++++++++++++++ src/strusCms.hpp | 3 +++ templates/intro.tmpl | 14 ++++++++++++++ templates/main.tmpl | 13 +++++++++++-- 6 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 templates/intro.tmpl 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 +#include +#include 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 StrusCms. +<% 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( ) %> + + <% include title( ) %> + -

strusCms

+

<% include title( ) %>

+
+ <% include page_content( ) %> +
<% end template %> -- cgit v1.2.3-54-g00ecf