diff --git a/controllers/tablerbase.go b/controllers/tablerbase.go index 792713c..767158e 100644 --- a/controllers/tablerbase.go +++ b/controllers/tablerbase.go @@ -225,6 +225,30 @@ func UserLock(c *core.Context) *core.Response { return c.Response.Template("apptabler_auth-lock.html", data) } +// UserSettings renders the user settings page. +func UserSettings(c *core.Context) *core.Response { + type userSettingsPageData struct { + TablerPageData + UserSettings FormtablerUserSettingsPage + } + data := userSettingsPageData{ + TablerPageData: TablerPageData{ + PageTitle: "Account Settings", + PageDescription: "User account settings", + ShowTopbar: true, + Sidebar: false, + PageHeader: "Account Settings", + PagePretitle: "User Profile", + UserName: "Jane Doe", + UserRole: "Administrator", + NavbarMenu: SampleNavbarMenu(), + Content: nil, + }, + UserSettings: SampleUserSettings(), + } + return c.Response.Template("apptabler_usersettings.html", data) +} + // TablerHome renders the homepage/dashboard layout func TablerHome(c *core.Context) *core.Response { data := TablerPageData{ diff --git a/controllers/tablerdata.go b/controllers/tablerdata.go index 0c7b12d..67c4dab 100644 --- a/controllers/tablerdata.go +++ b/controllers/tablerdata.go @@ -44,6 +44,31 @@ func SampleNavbarMenu() TablerMenu { } } +// SampleUserSettings returns sample data for the user settings page. +func SampleUserSettings() FormtablerUserSettingsPage { + return FormtablerUserSettingsPage{ + ActiveTab: "My Account", + SidebarSections: []FormtablerUserSettingsSection{ + { + Title: "Business settings", + SubItems: []FormtablerUserSettingsNavItem{ + {Title: "My Account", Link: "/user/settings", Active: true}, + {Title: "My Notifications", Link: "#"}, + {Title: "Connected Apps", Link: "#"}, + {Title: "Plans", Link: "#"}, + {Title: "Billing & Invoices", Link: "#"}, + }, + }, + { + Title: "Experience", + SubItems: []FormtablerUserSettingsNavItem{ + {Title: "Give Feedback", Link: "#"}, + }, + }, + }, + } +} + // SampleComponents returns sample data for alerts, breadcrumbs, and toasts. func SampleComponents() FormtablerComponentsPage { return FormtablerComponentsPage{ diff --git a/controllers/tablertypes.go b/controllers/tablertypes.go index 0303c40..b3d3fb7 100644 --- a/controllers/tablertypes.go +++ b/controllers/tablertypes.go @@ -481,6 +481,25 @@ type FormtablerComponentsPage struct { Toasts []FormtablerToast } +// FormtablerUserSettingsSection represents a section in the settings sidebar. +type FormtablerUserSettingsSection struct { + Title string + SubItems []FormtablerUserSettingsNavItem +} + +// FormtablerUserSettingsNavItem represents a single navigation item in the settings sidebar. +type FormtablerUserSettingsNavItem struct { + Title string + Link string + Active bool +} + +// FormtablerUserSettingsPage holds the data for the user settings page. +type FormtablerUserSettingsPage struct { + SidebarSections []FormtablerUserSettingsSection + ActiveTab string +} + // AuthLockPageData holds the data for the account lock page. type AuthLockPageData struct { PersonName string diff --git a/routes.go b/routes.go index f2f4a09..87dd158 100644 --- a/routes.go +++ b/routes.go @@ -69,14 +69,16 @@ func registerRoutes() { controller.Get("/tablerdefault", controllers.TablerDefault) controller.Get("/tablerhome", controllers.TablerHome) controller.Get("/tablernavmenu", controllers.TablerNavbar) - controller.Get("/user/login", controllers.UserSignIn) - controller.Post("/user/login", controllers.UserSignIn) - controller.Get("/user/signup", controllers.UserSignUp) - controller.Post("/user/signup", controllers.UserSignUp) - controller.Get("/user/forgot", controllers.UserForgot) - controller.Post("/user/forgot", controllers.UserForgot) - controller.Get("/user/lock", controllers.UserLock) - controller.Post("/user/lock", controllers.UserLock) + controller.Get("/user/login", controllers.UserSignIn) + controller.Post("/user/login", controllers.UserSignIn) + controller.Get("/user/signup", controllers.UserSignUp) + controller.Post("/user/signup", controllers.UserSignUp) + controller.Get("/user/forgot", controllers.UserForgot) + controller.Post("/user/forgot", controllers.UserForgot) + controller.Get("/user/lock", controllers.UserLock) + controller.Post("/user/lock", controllers.UserLock) + controller.Get("/user/settings", controllers.UserSettings) + controller.Post("/user/settings", controllers.UserSettings) controller.Get("/tablertable", controllers.TablerTables) controller.Get("/tablerformelements", controllers.TablerFormElements) diff --git a/storage/templates/tabler/app/profile/apptabler_usersettings.html b/storage/templates/tabler/app/profile/apptabler_usersettings.html new file mode 100644 index 0000000..ce9d221 --- /dev/null +++ b/storage/templates/tabler/app/profile/apptabler_usersettings.html @@ -0,0 +1,111 @@ +{{template "base_header" .}} +{{$s := .UserSettings}} +
+ {{if .ShowTopbar}} + {{template "tabler_navbar" .}} + {{end}} + +
+ {{if .PageHeader}} + + {{end}} + +
+
+
+
+
+
+ {{range $s.SidebarSections}} +

{{.Title}}

+ + {{end}} +
+
+
+
+

{{defaultVal "My Account" $s.ActiveTab}}

+ +
+
+ +
+
+
Paweł Kuna
+ Change avatar +
+
+ +

Personal Information

+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ + +
+ +

Password

+
+
+
+ + +
+
+
+
+ + +
+
+
+ + +
+
+
+
+
+
+ + {{template "tabler_footer" .}} +
+
+{{template "base_footer" .}}