Browse Source

Add modal dialog to templates

Vova Tkach 6 years ago
parent
commit
9f3d26b982

+ 1 - 1
engine/wrapper/resources/templates/cp.login.go

@@ -1,3 +1,3 @@
 package templates
 
-var CpLogin = []byte(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="theme-color" content="#205081" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Please login</title><link rel="stylesheet" href="{{$.System.PathCssBootstrap}}"><link rel="stylesheet" href="{{$.System.PathCssCpStyles}}"><link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" /><style type="text/css">html{height:100%;}</style></head><body class="cp-login text-center"><form class="form-signin" action="/cp/" method="post"><input type="hidden" name="action" value="signin"><h1 class="h3 mb-3 font-weight-normal">Please login</h1><label for="login" class="sr-only">Email address</label><input type="email" id="login" name="login" class="form-control" placeholder="Login" required autofocus><label for="password" class="sr-only">Password</label><input type="password" id="password" name="password" class="form-control mb-3" placeholder="Password" required><button class="btn btn-lg btn-primary btn-block" type="submit">Login</button></form><script src="{{$.System.PathJsJquery}}"></script><script src="{{$.System.PathJsPopper}}"></script><script src="{{$.System.PathJsBootstrap}}"></script><script src="{{$.System.PathJsCpScripts}}"></script></body></html>`)
+var CpLogin = []byte(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="theme-color" content="#205081" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Please login</title><link rel="stylesheet" href="{{$.System.PathCssBootstrap}}"><link rel="stylesheet" href="{{$.System.PathCssCpStyles}}"><link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" /><style type="text/css">html{height:100%;}</style></head><body class="cp-login text-center">{{$.System.BlockModalSysMsg}}<form class="form-signin" action="/cp/" method="post"><input type="hidden" name="action" value="signin"><h1 class="h3 mb-3 font-weight-normal">Please login</h1><label for="login" class="sr-only">Email address</label><input type="email" id="login" name="login" class="form-control" placeholder="Login" required autofocus><label for="password" class="sr-only">Password</label><input type="password" id="password" name="password" class="form-control mb-3" placeholder="Password" required><button class="btn btn-lg btn-primary btn-block" type="submit">Login</button></form><script src="{{$.System.PathJsJquery}}"></script><script src="{{$.System.PathJsPopper}}"></script><script src="{{$.System.PathJsBootstrap}}"></script><script src="{{$.System.PathJsCpScripts}}"></script></body></html>`)

+ 1 - 0
engine/wrapper/resources/templates/cp.login.html

@@ -11,6 +11,7 @@
 		<style type="text/css">html{height:100%;}</style>
 	</head>
 	<body class="cp-login text-center">
+		{{$.System.BlockModalSysMsg}}
 		<form class="form-signin" action="/cp/" method="post">
 			<input type="hidden" name="action" value="signin">
 			<h1 class="h3 mb-3 font-weight-normal">Please login</h1>

+ 1 - 1
engine/wrapper/resources/templates/cp.mysql.go

@@ -1,3 +1,3 @@
 package templates
 
-var CpMySQL = []byte(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="theme-color" content="#205081" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Configure MySQL</title><link rel="stylesheet" href="{{$.System.PathCssBootstrap}}"><link rel="stylesheet" href="{{$.System.PathCssCpStyles}}"><link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" /><style type="text/css">html{height:100%;}</style></head><body class="cp-mysql text-center"><form class="form-signin" action="/cp/" method="post"><input type="hidden" name="action" value="mysql"><h1 class="h3 mb-3 font-weight-normal">Configure MySQL</h1><label for="host" class="sr-only">Host</label><input type="text" id="host" name="host" class="form-control mb-3" placeholder="Host" value="localhost" required><label for="name" class="sr-only">Name</label><input type="text" id="name" name="name" class="form-control mb-3" placeholder="Name" required autofocus><label for="user" class="sr-only">User</label><input type="text" id="user" name="user" class="form-control mb-3" placeholder="User" required><label for="password" class="sr-only">Password</label><input type="password" id="password" name="password" class="form-control mb-3" placeholder="Password"><button class="btn btn-lg btn-primary btn-block" type="submit">Configure</button></form><script src="{{$.System.PathJsJquery}}"></script><script src="{{$.System.PathJsPopper}}"></script><script src="{{$.System.PathJsBootstrap}}"></script><script src="{{$.System.PathJsCpScripts}}"></script></body></html>`)
+var CpMySQL = []byte(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="theme-color" content="#205081" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Configure MySQL</title><link rel="stylesheet" href="{{$.System.PathCssBootstrap}}"><link rel="stylesheet" href="{{$.System.PathCssCpStyles}}"><link rel="shortcut icon" href="{{$.System.PathIcoFav}}" type="image/x-icon" /><style type="text/css">html{height:100%;}</style></head><body class="cp-mysql text-center">{{$.System.BlockModalSysMsg}}<form class="form-signin" action="/cp/" method="post"><input type="hidden" name="action" value="mysql"><h1 class="h3 mb-3 font-weight-normal">Configure MySQL</h1><label for="host" class="sr-only">Host</label><input type="text" id="host" name="host" class="form-control mb-3" placeholder="Host" value="localhost" required><label for="name" class="sr-only">Name</label><input type="text" id="name" name="name" class="form-control mb-3" placeholder="Name" required autofocus><label for="user" class="sr-only">User</label><input type="text" id="user" name="user" class="form-control mb-3" placeholder="User" required><label for="password" class="sr-only">Password</label><input type="password" id="password" name="password" class="form-control mb-3" placeholder="Password"><button class="btn btn-lg btn-primary btn-block" type="submit">Configure</button></form><script src="{{$.System.PathJsJquery}}"></script><script src="{{$.System.PathJsPopper}}"></script><script src="{{$.System.PathJsBootstrap}}"></script><script src="{{$.System.PathJsCpScripts}}"></script></body></html>`)

+ 1 - 0
engine/wrapper/resources/templates/cp.mysql.html

@@ -11,6 +11,7 @@
 		<style type="text/css">html{height:100%;}</style>
 	</head>
 	<body class="cp-mysql text-center">
+		{{$.System.BlockModalSysMsg}}
 		<form class="form-signin" action="/cp/" method="post">
 			<input type="hidden" name="action" value="mysql">
 			<h1 class="h3 mb-3 font-weight-normal">Configure MySQL</h1>

+ 3 - 0
engine/wrapper/wrapper.go

@@ -10,6 +10,7 @@ import (
 
 	"golang-fave/engine/actions"
 	"golang-fave/engine/sessions"
+	Templates "golang-fave/engine/wrapper/resources/templates"
 )
 
 const C_AssetsVersion = "2"
@@ -26,6 +27,7 @@ type tmplDataSystem struct {
 	PathJsPopper     string
 	PathJsBootstrap  string
 	PathJsCpScripts  string
+	BlockModalSysMsg template.HTML
 }
 
 type tmplDataAll struct {
@@ -60,6 +62,7 @@ func (e *Wrapper) tmplGetSystemData() tmplDataSystem {
 		PathJsPopper:     e.R.URL.Scheme + "://" + e.R.Host + "/assets/sys/popper.js" + version,
 		PathJsBootstrap:  e.R.URL.Scheme + "://" + e.R.Host + "/assets/sys/bootstrap.js" + version,
 		PathJsCpScripts:  e.R.URL.Scheme + "://" + e.R.Host + "/assets/cp/scripts.js" + version,
+		BlockModalSysMsg: template.HTML(Templates.BlockModalSysMsg),
 	}
 }