This commit is contained in:
parent
6ab3e2b22b
commit
3228553be5
@ -33,6 +33,13 @@ Application::Application(const Wt::WEnvironment &env, bool embedded) : Wt::WAppl
|
|||||||
setTheme(std::make_shared<BulmaTheme>("bulma", !embedded));
|
setTheme(std::make_shared<BulmaTheme>("bulma", !embedded));
|
||||||
if (!embedded) {
|
if (!embedded) {
|
||||||
m_navigationBar = root()->addNew<NavigationBar>();
|
m_navigationBar = root()->addNew<NavigationBar>();
|
||||||
|
m_navigationBar->registerClicked.connect([this](){
|
||||||
|
if(m_loginPage){
|
||||||
|
m_loginPage->registerNewUser();
|
||||||
|
} else if(m_loginPageRef){
|
||||||
|
m_loginPageRef->registerNewUser();
|
||||||
|
}
|
||||||
|
});
|
||||||
m_root = root()->addNew<Wt::WContainerWidget>();
|
m_root = root()->addNew<Wt::WContainerWidget>();
|
||||||
} else {
|
} else {
|
||||||
std::unique_ptr<Wt::WContainerWidget> topPtr = std::make_unique<Wt::WContainerWidget>();
|
std::unique_ptr<Wt::WContainerWidget> topPtr = std::make_unique<Wt::WContainerWidget>();
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
LoginPage::LoginPage(const Wt::Auth::AuthService &baseAuth, Wt::Auth::AbstractUserDatabase &users, Wt::Auth::Login &login)
|
LoginPage::LoginPage(const Wt::Auth::AuthService &baseAuth, Wt::Auth::AbstractUserDatabase &users, Wt::Auth::Login &login)
|
||||||
: Wt::Auth::AuthWidget(baseAuth, users, login) {
|
: Wt::Auth::AuthWidget(baseAuth, users, login) {
|
||||||
auto app = Amass::Singleton<WebToolkit::Server>::instance();
|
auto app = Amass::Singleton<WebToolkit::Server>::instance();
|
||||||
setInternalBasePath("/wt");
|
// setInternalBasePath("/wt");
|
||||||
model()->addPasswordAuth(&app->passwordService());
|
model()->addPasswordAuth(&app->passwordService());
|
||||||
setRegistrationEnabled(true);
|
setRegistrationEnabled(true);
|
||||||
// setAttributeValue("style", "transform: translateY(-100px);");
|
// setAttributeValue("style", "transform: translateY(-100px);");
|
||||||
|
@ -27,7 +27,7 @@ constexpr auto Menu = R"(
|
|||||||
|
|
||||||
constexpr auto Template = R"(
|
constexpr auto Template = R"(
|
||||||
<div class="bulma-navbar-brand">
|
<div class="bulma-navbar-brand">
|
||||||
<a class="bulma-navbar-item" href="https://amass.fun">子非鱼</a>
|
<a class="bulma-navbar-item" href="/">子非鱼</a>
|
||||||
${navbar-burger role="button" class="bulma-navbar-burger" aria-label="menu" aria-expanded="false"}
|
${navbar-burger role="button" class="bulma-navbar-burger" aria-label="menu" aria-expanded="false"}
|
||||||
</div>
|
</div>
|
||||||
${navbar-menu class="bulma-navbar-menu"}
|
${navbar-menu class="bulma-navbar-menu"}
|
||||||
@ -77,5 +77,5 @@ void NavigationBar::createLoginButtons() {
|
|||||||
|
|
||||||
auto registerButton = loginItem->bindWidget("register-button", std::make_unique<Wt::WPushButton>("<strong>注册</strong>"));
|
auto registerButton = loginItem->bindWidget("register-button", std::make_unique<Wt::WPushButton>("<strong>注册</strong>"));
|
||||||
registerButton->setTextFormat(Wt::TextFormat::XHTML);
|
registerButton->setTextFormat(Wt::TextFormat::XHTML);
|
||||||
registerButton->clicked().connect([]() { Wt::WApplication::instance()->setInternalPath("/wt/register", true); });
|
registerButton->clicked().connect(this, [this](const Wt::WMouseEvent &e) { registerClicked.emit(); });
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ public:
|
|||||||
~NavigationBar();
|
~NavigationBar();
|
||||||
LoginPage *addLoginItem(std::unique_ptr<LoginPage> item);
|
LoginPage *addLoginItem(std::unique_ptr<LoginPage> item);
|
||||||
std::unique_ptr<LoginPage> removeLoginItem();
|
std::unique_ptr<LoginPage> removeLoginItem();
|
||||||
|
Wt::Signal<> registerClicked;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void createLoginButtons();
|
void createLoginButtons();
|
||||||
|
@ -98,4 +98,8 @@
|
|||||||
|
|
||||||
.Wt-error {
|
.Wt-error {
|
||||||
color: hsl(var(--bulma-danger-h), var(--bulma-danger-s), var(--bulma-danger-on-scheme-l));
|
color: hsl(var(--bulma-danger-h), var(--bulma-danger-s), var(--bulma-danger-on-scheme-l));
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-pointer-cursor {
|
||||||
|
cursor: pointer !important;
|
||||||
}
|
}
|
@ -72,7 +72,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="Wt-buttons">
|
<div class="Wt-buttons">
|
||||||
${lost-password} ${sep} ${register}
|
${lost-password} ${sep}
|
||||||
|
${register class="has-text-link is-pointer-cursor"}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</message>
|
</message>
|
||||||
|
Loading…
Reference in New Issue
Block a user