summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-04-18 13:14:32 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2015-04-18 13:14:32 +0200
commitde50c30a936b87d79f816790230856347b0dff7e (patch)
treead53a7fb53eb125761345e3012d9c89cabce74f4
parentdc080f8fe2697569923ed326f8080cb0baedc46b (diff)
downloadaCms-de50c30a936b87d79f816790230856347b0dff7e.tar.gz
aCms-de50c30a936b87d79f816790230856347b0dff7e.tar.bz2
introduced a sub-app for intro page
-rw-r--r--src/intro.cpp24
-rw-r--r--src/intro.hpp9
-rw-r--r--src/intro_content.hpp2
-rw-r--r--src/master.cpp2
-rw-r--r--src/master.hpp2
-rw-r--r--src/strusCms.cpp16
-rw-r--r--src/strusCms.hpp7
7 files changed, 42 insertions, 20 deletions
diff --git a/src/intro.cpp b/src/intro.cpp
index e69de29..bf0331d 100644
--- a/src/intro.cpp
+++ b/src/intro.cpp
@@ -0,0 +1,24 @@
+#include "content.hpp"
+#include "intro.hpp"
+#include "strusCms.hpp"
+
+#include <cppcms/url_dispatcher.h>
+#include <cppcms/url_mapper.h>
+
+namespace apps {
+
+intro::intro( strusCms &cms )
+ : master( cms )
+{
+ cms.dispatcher( ).assign( "", &intro::show, this );
+ cms.mapper( ).assign( "" );
+}
+
+void intro::show( )
+{
+ content::intro c;
+ c.title = "strusCms";
+ render( "intro", c );
+}
+
+}
diff --git a/src/intro.hpp b/src/intro.hpp
index 8a9f2a0..0f70ed8 100644
--- a/src/intro.hpp
+++ b/src/intro.hpp
@@ -1,11 +1,16 @@
-#ifndef iNTRO_CONTENT_HPP
-#define INTRO_CONTENT_HPP
+#ifndef INTRO_HPP
+#define INTRO_HPP
#include "master.hpp"
namespace apps {
class intro : public master {
+ public:
+ intro( strusCms &cms );
+
+ private:
+ void show( );
};
}
diff --git a/src/intro_content.hpp b/src/intro_content.hpp
index ab508ec..16bd601 100644
--- a/src/intro_content.hpp
+++ b/src/intro_content.hpp
@@ -1,7 +1,7 @@
#ifndef INTRO_CONTENT_HPP
#define INTRO_CONTENT_HPP
-#include "master.hpp"
+#include "master_content.hpp"
namespace content {
diff --git a/src/master.cpp b/src/master.cpp
index 3243bf6..f05b79a 100644
--- a/src/master.cpp
+++ b/src/master.cpp
@@ -6,7 +6,7 @@
namespace apps {
master::master( strusCms &cms )
- : m_cms( cms ),
+ : cms( cms ),
application( cms.service( ) )
{
}
diff --git a/src/master.hpp b/src/master.hpp
index 75f4eb1..9da1605 100644
--- a/src/master.hpp
+++ b/src/master.hpp
@@ -9,7 +9,7 @@ class strusCms;
class master : public cppcms::application {
protected:
- strusCms &m_cms;
+ strusCms &cms;
public:
master( strusCms &cms );
diff --git a/src/strusCms.cpp b/src/strusCms.cpp
index 9190cc3..64cc235 100644
--- a/src/strusCms.cpp
+++ b/src/strusCms.cpp
@@ -1,20 +1,19 @@
#include "strusCms.hpp"
-#include "content.hpp"
-#include <cppcms/url_dispatcher.h>
#include <cppcms/url_mapper.h>
#include <cppcms/http_response.h>
#include <cppcms/json.h>
namespace apps {
-strusCms::strusCms( cppcms::service &srv ) : cppcms::application( srv )
+strusCms::strusCms( cppcms::service &srv )
+ : cppcms::application( srv ),
+ intro( *this )
{
locale_name = "en";
script = settings( ).get<std::string>( "strusCms.script" );
- dispatcher( ).assign( "", &strusCms::intro, this );
- mapper( ).assign( "" );
+ add( intro );
mapper( ).root( "/strusCms" );
}
@@ -25,11 +24,4 @@ std::string strusCms::root( std::string l )
return script + "/" + l;
}
-void strusCms::intro( )
-{
- content::intro c;
- c.title = "strusCms";
- render( "intro", c );
-}
-
}
diff --git a/src/strusCms.hpp b/src/strusCms.hpp
index 5d4af13..db7f0d9 100644
--- a/src/strusCms.hpp
+++ b/src/strusCms.hpp
@@ -3,6 +3,8 @@
#include <cppcms/application.h>
+#include "intro.hpp"
+
namespace apps {
class strusCms : public cppcms::application {
@@ -11,11 +13,10 @@ class strusCms : public cppcms::application {
std::string root( std::string locale_name = "" );
private:
- void intro( );
-
- private:
std::string script;
std::string locale_name;
+
+ apps::intro intro;
};
}