This commit is contained in:
Bartosz Wieczorek 2018-01-26 07:10:02 +01:00
parent 7a540334bd
commit c26dc93f2c
6 changed files with 19 additions and 16 deletions

6
docker/start_postrges.sh Executable file
View File

@ -0,0 +1,6 @@
docker run --detach\
-p 5432:5432\
--name eedb-postrgesql\
-e POSTGRES_PASSWORD=postgres\
-e POSTGRES_DB=eedb\
postgres:9.5-alpine

View File

@ -1,12 +1,10 @@
#include <eedb/EEDB.hpp>
#include <eedb/WebSession.hpp>
#include <eedb/WebSession.hpp>
#include <eedb/auth/PgUserAuth.hpp>
#include <eedb/auth/Services.hpp>
#include <eedb/db/config.hpp>
#include <eedb/db/connection.hpp>
#include <eedb/widgets/BootstrapTheme.hpp>
#include <eedb/widgets/DefaultAuthPage.hpp>
#include <eedb/widgets/DefaultHomePage.hpp>
@ -19,6 +17,8 @@
#include <sqlpp11/postgresql/exception.h>
#include <spdlog/spdlog.h>
class ErrorWindow : public Wt::WApplication {
public:
ErrorWindow(const Wt::WEnvironment & env);

View File

@ -1,9 +1,10 @@
#include "EEDB.hpp"
#include <eedb/EEDB.hpp>
#include <eedb/Session.hpp>
#include <eedb/auth/PgUserAuth.hpp>
#include <eedb/db/connection.hpp>
#include <eedb/widgets/AuthPage.hpp>
#include <eedb/widgets/BootstrapTheme.hpp>
#include <eedb/widgets/HomePage.hpp>
#include <eedb/widgets/Theme.hpp>
@ -21,11 +22,10 @@
#include <Wt/WStackedWidget.h>
#include <Wt/WText.h>
#include <Wt/WTextArea.h>
#include <eedb/widgets/BootstrapTheme.hpp>
#include <Wt/Auth/AuthWidget.h>
#include <spdlog/spdlog.h>
using std::move;
namespace eedb {
@ -33,13 +33,13 @@ namespace eedb {
EEDB::EEDB(std::unique_ptr< Session > session, AuthPageFactory authPageFactory, HomePageFactory homePageFactory)
: Wt::WApplication(session->enviroment()),
_session(move(session)),
_theme(std::make_unique< eedb::BootstrapTheme >()),
_theme(eedb::BootstrapTheme{}.create()),
_authPageFactory(move(authPageFactory)),
_homePageFactory(move(homePageFactory)) {
root()->addStyleClass("container");
useStyleSheet("/resources/style.css");
setTheme(_theme->create());
setTheme(_theme);
_authPage = _authPageFactory();
_authPage->registerOnNeedVerification([] {});
@ -57,7 +57,7 @@ void EEDB::authEventLogin(EEDB::LoginState state) {
_homePage = _homePageFactory();
_homePage->attachTo(root());
Wt::log("notice") << "Clearing root and creating widgets";
// Wt::log("notice") << "Clearing root and creating widgets";
// // new eedb::Home(container, &_authWidget->login());
}

View File

@ -5,13 +5,13 @@
namespace Wt {
class WContainerWidget;
class WTheme;
}
namespace eedb {
class AuthPage;
class HomePage;
class Session;
class Theme;
using AuthPageFactory = std::function< std::unique_ptr< AuthPage >() >;
using HomePageFactory = std::function< std::unique_ptr< HomePage >() >;
@ -27,7 +27,7 @@ class EEDB : public Wt::WApplication {
private:
std::unique_ptr< eedb::Session > _session;
std::unique_ptr< eedb::Theme > _theme;
std::shared_ptr< Wt::WTheme > _theme;
AuthPageFactory _authPageFactory;
std::unique_ptr< eedb::AuthPage > _authPage;

View File

@ -9,7 +9,7 @@ BootstrapTheme::~BootstrapTheme() = default;
std::shared_ptr< Wt::WTheme > BootstrapTheme::create() const {
auto theme = std::make_shared< Wt::WBootstrapTheme >();
theme->setVersion(Wt::WBootstrapTheme::Version::v3);
// theme->setResponsive(true);
theme->setResponsive(true);
return theme;
}
} // namespace eedb

View File

@ -6,9 +6,6 @@ namespace eedb {
class BootstrapTheme final : public Theme {
public:
~BootstrapTheme() override;
BootstrapTheme() = default;
explicit BootstrapTheme(Theme &&) {}
explicit BootstrapTheme(const Theme &) {}
std::shared_ptr< Wt::WTheme > create() const override;
};