From 94e0c178f03f512a84c2e75304b5ebaa8caafe6c Mon Sep 17 00:00:00 2001 From: MaxJa4 <74194322+MaxJa4@users.noreply.github.com> Date: Tue, 16 Jan 2024 20:54:49 +0100 Subject: [PATCH] Implement edit-player. Optimizations. --- .gitignore | 1 + controllers/player_controller.go | 6 +-- isc_data.db | Bin 16384 -> 0 bytes main.go | 1 + models/player.go | 1 + static/index.js | 8 ++- templates/index.html | 2 + templates/modals/add_clan.html | 7 +-- templates/modals/add_player.html | 5 +- templates/modals/delete_clan.html | 7 +-- templates/modals/delete_player.html | 7 +-- templates/modals/edit_clan.html | 13 ++--- templates/modals/edit_player.html | 75 ++++++++++++++++++++++++++++ templates/player_list_item.html | 2 +- 14 files changed, 100 insertions(+), 35 deletions(-) delete mode 100644 isc_data.db create mode 100644 templates/modals/edit_player.html diff --git a/.gitignore b/.gitignore index e4194d8..2713e6a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /isc_rest.log +/isc_data.db diff --git a/controllers/player_controller.go b/controllers/player_controller.go index eb0f95e..8940b1f 100644 --- a/controllers/player_controller.go +++ b/controllers/player_controller.go @@ -46,7 +46,7 @@ func GetPlayersByClanHTML(c *gin.Context) { var htmlOptions string for _, player := range players { - htmlOptions += fmt.Sprintf(playerItem, player.Name, player.ID) + htmlOptions += fmt.Sprintf(playerItem, player.Name, player.ID, player.ID) } c.Header("Content-Type", "text/html") @@ -124,13 +124,13 @@ func UpdatePlayerByID(c *gin.Context) { } } - msg := "Updating player '" + player.Name + "'#" + strconv.FormatUint(uint64(player.ID), 10) + msg := "Updating player '" + player.Name + "' #" + strconv.FormatUint(uint64(player.ID), 10) if player.Name != input.Name { msg += " (new: '" + input.Name + "')" } msg += " with clan #" + utils.UintToString(player.ClanID) if player.ClanID != input.ClanID { - msg += " (new: รค" + utils.UintToString(input.ClanID) + ")" + msg += " (new: #" + utils.UintToString(input.ClanID) + ")" } _, err := fmt.Fprintf(utils.GinWriter, msg+"\n") if err != nil { diff --git a/isc_data.db b/isc_data.db deleted file mode 100644 index ce19e86199a826b2198cd5b65b44a341120eeee7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI2&u<$=6vt=mwY{$Kj-6!LE}N+bwV`zzs(9Cq6ix)Ns){zWsS(O4-g)oAS@6G$Z&-k*M zxpni}b{4DT(}UeGQvs_n&e_{aF~;t}W56@Ha!@(h=97VEl=s->kAJ9wLEid?iO)q7 z3c82@5g-CYfCvx)B0vO)01+SpM1Tl9kHFo0$?-gXbR`RK@5FmM;b-wdIxdWN*So8| zuIjD6bFHiTwYI~T)Tk(Oqv3~XX>iULyzq_GUKkR*Qbq(CEch`E0{b9Hp z_f;0(%@+HEop88$!moKFS9C62;u|_}y1xTo&6{bwe;5x3@e|Gbl#nL|FJP2K@N6FC zc*$`bel*Z?V#HLxa#Q|VO8Otu$il5jMxVs--sa(66lO8t7#{A%2it=tew)KbKNAnc z18eQy{hqf-G)@GF01+SpM1Tko0U|&IhyW2F0xy8TnfU?>Tr*6gBn_h^iISEdv;w~s zVCe^QUV(X1kB4b8F|+Ed>1iN?Jb{0mUsw1Ug z8bY`z4bckxzBoU#48dFznjJrALpR*wnBRmLQL+-ID^a?#6eeQ8j$LU6?GCEecbHf| zv$sH~o*pM134mVP^H9zxt`1#o6_{=7oKVZ$Qh`aZ!8!=ihEXEkV0G7qAU? zz-C?ZPP>J|q7+oTCmk&|!1=*5u@@mn$6W4!HZU1w;0Ivp%Gdu%{jt2-MNs0INv9p) zoM2yT7MPWpSN#6Z ziQky`6JB%?0U|&IhyW2F0z`la5CI}U1c(3;AObHnfl4m#@$r#}Mw#awu8$flSH&O9 zweEBAwfIVWDUL)Yw!}x`iuhIhBp!+-;fn9YBT*M+!L7fn->qM)AFYShch>!v8V89d z0z`la5CI}U1c(3;AOb{y2oQn)AAx$qU<({}w(*87@>Za%GX`t$(SZectBN$3i*2w` zmHBa_-C0(rJcBtn((b78YX-A*U74=IX0fV@rwt}}AdAkpd=*Py+Or0Glj|M(2zKIO z&mOkaLut=EwcDzqpd{YE6T>NhL|U&*w<{IY1fy`v%Bd5LYT00t>oW_m(J!m!bhD(J yFeM%bkk#T;vp9!ZTQaQI5fSd^r?I{>S*~HS*d;3##v2_TP_Vuw$$Le6l;+ {{ template "delete_player" . }} + +{{ template "edit_player" . }} + +{{ end }} \ No newline at end of file diff --git a/templates/player_list_item.html b/templates/player_list_item.html index b06d9b3..d4db368 100644 --- a/templates/player_list_item.html +++ b/templates/player_list_item.html @@ -5,7 +5,7 @@ %s