add custom navbar.
This commit is contained in:
parent
7d87f7632e
commit
a93b2a5eca
@ -68,7 +68,7 @@ RUN cd /root \
|
|||||||
&& tar -xvf qt-everywhere-src-${QT_VERSION}.tar.xz > /dev/null \
|
&& tar -xvf qt-everywhere-src-${QT_VERSION}.tar.xz > /dev/null \
|
||||||
&& cd ./qt-everywhere-src-${QT_VERSION} \
|
&& cd ./qt-everywhere-src-${QT_VERSION} \
|
||||||
&& ./configure -prefix /opt/Qt/${QT_VERSION}/gcc_64 -opensource -debug-and-release -confirm-license -nomake examples -nomake tests -skip qtwebengine -skip qtcoap -skip qtopcua \
|
&& ./configure -prefix /opt/Qt/${QT_VERSION}/gcc_64 -opensource -debug-and-release -confirm-license -nomake examples -nomake tests -skip qtwebengine -skip qtcoap -skip qtopcua \
|
||||||
&& cmake --build . --parallel \
|
&& cmake --build . --parallel > /dev/null \
|
||||||
&& ninja install \
|
&& ninja install \
|
||||||
&& rm -fr /root/qt-everywhere-src-${QT_VERSION}* \
|
&& rm -fr /root/qt-everywhere-src-${QT_VERSION}* \
|
||||||
&& echo 'export PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:$PATH' >> /etc/profile \
|
&& echo 'export PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:$PATH' >> /etc/profile \
|
||||||
|
@ -159,7 +159,7 @@ Application::Application(const std::string &path)
|
|||||||
url = root["url"].as_string();
|
url = root["url"].as_string();
|
||||||
}
|
}
|
||||||
auto database = Database::session();
|
auto database = Database::session();
|
||||||
if (std::filesystem::exists("amass_blog" + url) && url.find("/我的博客/page") != 0) {
|
if (std::filesystem::exists("amass_blog" + url) && (url.find("/我的博客/page") != 0) && (url.find("/wt") != 0)) {
|
||||||
if (url.size() > 1 && url.back() == '/') {
|
if (url.size() > 1 && url.back() == '/') {
|
||||||
url.pop_back();
|
url.pop_back();
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,16 @@ void BulmaTheme::apply(Wt::WWidget *widget, Wt::WWidget *child, int widgetRole)
|
|||||||
child->addStyleClass("bulma-delete");
|
child->addStyleClass("bulma-delete");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case NavbarBtn: {
|
||||||
|
child->addStyleClass("bulma-navbar-burger");
|
||||||
|
child->setAttributeValue("aria-label", "menu");
|
||||||
|
child->setAttributeValue("aria-expanded", "false");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NavBrand: {
|
||||||
|
child->addStyleClass("bulma-navbar-brand");
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ add_library(WebApplication
|
|||||||
BulmaTheme.h BulmaTheme.cpp
|
BulmaTheme.h BulmaTheme.cpp
|
||||||
HomePage.h HomePage.cpp
|
HomePage.h HomePage.cpp
|
||||||
LoginPage.h LoginPage.cpp
|
LoginPage.h LoginPage.cpp
|
||||||
|
NavigationBar.h NavigationBar.cpp
|
||||||
VisitorRecordsPage.h VisitorRecordsPage.cpp
|
VisitorRecordsPage.h VisitorRecordsPage.cpp
|
||||||
VisitorRecordTableModel.h VisitorRecordTableModel.cpp
|
VisitorRecordTableModel.h VisitorRecordTableModel.cpp
|
||||||
Restful.h Restful.cpp
|
Restful.h Restful.cpp
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
#include "HomePage.h"
|
#include "HomePage.h"
|
||||||
#include "Dialog.h"
|
#include "Dialog.h"
|
||||||
|
#include "NavigationBar.h"
|
||||||
#include <Wt/WApplication.h>
|
#include <Wt/WApplication.h>
|
||||||
#include <Wt/WLineEdit.h>
|
#include <Wt/WLineEdit.h>
|
||||||
#include <Wt/WNavigationBar.h>
|
|
||||||
#include <Wt/WPushButton.h>
|
#include <Wt/WPushButton.h>
|
||||||
|
|
||||||
HomePage::HomePage() {
|
HomePage::HomePage() {
|
||||||
auto navigation = addNew<Wt::WNavigationBar>();
|
auto navigation = addNew<NavigationBar>();
|
||||||
navigation->setResponsive(true);
|
|
||||||
navigation->setTitle("子非鱼", "https://amass.fun");
|
|
||||||
|
|
||||||
addStyleClass("bulma-content");
|
addStyleClass("bulma-content");
|
||||||
auto p = addWidget(std::make_unique<Wt::WText>("这是一个结合 C++ Web Toolkit 和 CSS Bulma 框架的前后端一体应用程序。"));
|
auto p = addWidget(std::make_unique<Wt::WText>("这是一个结合 C++ Web Toolkit 和 CSS Bulma 框架的前后端一体应用程序。"));
|
||||||
|
23
WebApplication/NavigationBar.cpp
Normal file
23
WebApplication/NavigationBar.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include "NavigationBar.h"
|
||||||
|
|
||||||
|
constexpr auto Template = R"(
|
||||||
|
<nav class="bulma-navbar" role="navigation" aria-label="main navigation">
|
||||||
|
<div class="bulma-navbar-brand">
|
||||||
|
<a class="bulma-navbar-item" href="https://amass.fun">子非鱼</a>
|
||||||
|
<a role="button" class="bulma-navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="navbarBasicExample" class="bulma-navbar-menu">
|
||||||
|
<div></div>
|
||||||
|
<div></div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
)";
|
||||||
|
|
||||||
|
NavigationBar::NavigationBar() : Wt::WTemplate(Template) {
|
||||||
|
}
|
11
WebApplication/NavigationBar.h
Normal file
11
WebApplication/NavigationBar.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef __NAVIGATIONBAR_H__
|
||||||
|
#define __NAVIGATIONBAR_H__
|
||||||
|
|
||||||
|
#include <Wt/WTemplate.h>
|
||||||
|
|
||||||
|
class NavigationBar: public Wt::WTemplate {
|
||||||
|
public:
|
||||||
|
NavigationBar();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __NAVIGATIONBAR_H__
|
@ -24,9 +24,6 @@ function build() {
|
|||||||
# docker run -it --rm --user 1000:1000 -v $(pwd):$(pwd) -w $(pwd) registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:22.04 resources/build.sh
|
# docker run -it --rm --user 1000:1000 -v $(pwd):$(pwd) -w $(pwd) registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:22.04 resources/build.sh
|
||||||
# reset
|
# reset
|
||||||
# pkill -9 HttpServer
|
# pkill -9 HttpServer
|
||||||
# cp -r /mnt/e/Lifestyle/static/resources/themes/bulma resources/themes/
|
|
||||||
# cp -r /opt/Libraries/wt-4.11.1/share/Wt/resources ./build/
|
|
||||||
# cp -r resources/themes resources/icons resources/*.css build/resources/
|
|
||||||
|
|
||||||
if [ ! -f "${build_path}/CMakeCache.txt" ]; then
|
if [ ! -f "${build_path}/CMakeCache.txt" ]; then
|
||||||
cmake_scan
|
cmake_scan
|
||||||
@ -38,6 +35,14 @@ function build() {
|
|||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if [ ! -d ${base_path}/resources/themes/bulma ]; then
|
||||||
|
# mkdir -p ${base_path}/resources/themes/bulma
|
||||||
|
# fi
|
||||||
|
# cp -r /mnt/e/Lifestyle/static/resources/themes/bulma resources/themes
|
||||||
|
# cp -r /opt/Libraries/wt-4.11.1/share/Wt/resources build/
|
||||||
|
# cp -r resources/themes resources/icons resources/fontawesome resources/*.css build/resources/
|
||||||
|
|
||||||
build/UnitTest/UnitTest
|
build/UnitTest/UnitTest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user