Browse Source

CP user settings modal

Vova Tkach 6 years ago
parent
commit
831fa8778c

+ 18 - 10
engine/backend/backend.go

@@ -19,11 +19,15 @@ type Backend struct {
 }
 
 type TmplData struct {
-	Title        string
-	UserEmail    string
-	SidebarLeft  template.HTML
-	Content      template.HTML
-	SidebarRight template.HTML
+	Title         string
+	UserId        int
+	UserFirstName string
+	UserLastName  string
+	UserEmail     string
+	UserPassword  string
+	SidebarLeft   template.HTML
+	Content       template.HTML
+	SidebarRight  template.HTML
 }
 
 func New(wrapper *wrapper.Wrapper, db *sql.DB) *Backend {
@@ -113,11 +117,15 @@ func (this *Backend) Run() bool {
 	page := this.wrapper.TmplParseToString(templates.CpBase, wrapper.TmplDataAll{
 		System: this.wrapper.TmplGetSystemData(),
 		Data: TmplData{
-			Title:        "Fave " + constants.ServerVersion,
-			UserEmail:    this.user.A_email,
-			SidebarLeft:  template.HTML(sidebar_left),
-			Content:      template.HTML("Content"),
-			SidebarRight: template.HTML("Sidebar right"),
+			Title:         "Fave " + constants.ServerVersion,
+			UserId:        this.user.A_id,
+			UserFirstName: this.user.A_first_name,
+			UserLastName:  this.user.A_last_name,
+			UserEmail:     this.user.A_email,
+			UserPassword:  "",
+			SidebarLeft:   template.HTML(sidebar_left),
+			Content:       template.HTML("Content"),
+			SidebarRight:  template.HTML("Sidebar right"),
 		},
 	})
 	(*this.wrapper.W).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")

File diff suppressed because it is too large
+ 0 - 0
engine/wrapper/resources/templates/cp.base.go


+ 2 - 2
engine/wrapper/resources/templates/cp.base.html

@@ -16,7 +16,7 @@
 				<div class="modal-content">
 					<form class="form-user-settings" action="/cp/" method="post" autocomplete="off">
 						<input type="hidden" name="action" value="usersettings">
-						<input type="hidden" name="id" value="1">
+						<input type="hidden" name="id" value="{{$.Data.UserId}}">
 						<div class="modal-header">
 							<h5 class="modal-title" id="sysModalUserSettingsLabel">Settings</h5>
 							<button type="button" class="close" data-dismiss="modal" aria-label="Close">
@@ -81,7 +81,7 @@
 							<img class="rounded-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==">{{$.Data.UserEmail}}
 						</a>
 						<div class="dropdown-menu dropdown-menu-right" aria-labelledby="nbAccountDropdown">
-							<a class="dropdown-item" href="javascript:;">Settings</a>
+							<a class="dropdown-item" href="javascript:;" data-toggle="modal" data-target="#sys-modal-user-settings">Settings</a>
 							<div class="dropdown-divider"></div>
 							<a class="dropdown-item" href="javascript:ActionSingOut();">Sing out</a>
 						</div>

Some files were not shown because too many files changed in this diff