Split team management into tabs

Check for field changes before changing tabs
or uploading screenshots
This commit is contained in:
Brian Buller 2017-07-25 10:49:26 -05:00
parent ce650132c0
commit 487273231a
7 changed files with 407 additions and 152 deletions

View File

@ -41,19 +41,19 @@ func handleAdminGames(w http.ResponseWriter, req *http.Request, page *pageData)
} else {
page.session.setFlashMessage("Team game updated", "success")
}
redirect("/admin/teams/"+teamId, w, req)
redirect("/admin/teams/"+teamId+"#game", w, req)
}
case "screenshotupload":
if err := saveScreenshots(teamId, req); err != nil {
page.session.setFlashMessage("Error updating game: "+err.Error(), "error")
}
redirect("/admin/teams/"+teamId, w, req)
redirect("/admin/teams/"+teamId+"#game", w, req)
case "screenshotdelete":
ssid := vars["subid"]
if err := dbDeleteTeamGameScreenshot(teamId, ssid); err != nil {
page.session.setFlashMessage("Error deleting screenshot: "+err.Error(), "error")
}
redirect("/admin/teams/"+teamId, w, req)
redirect("/admin/teams/"+teamId+"#game", w, req)
}
}
}

View File

@ -75,7 +75,7 @@ func handleAdminTeams(w http.ResponseWriter, req *http.Request, page *pageData)
page.session.setFlashMessage(mbrName+" added to team!", "success")
}
refreshTeamsInMemory()
redirect("/admin/teams/"+teamId, w, req)
redirect("/admin/teams/"+teamId+"#members", w, req)
case "deletemember":
mbrId := req.FormValue("memberid")
m, _ := dbGetTeamMember(teamId, mbrId)
@ -85,7 +85,7 @@ func handleAdminTeams(w http.ResponseWriter, req *http.Request, page *pageData)
page.session.setFlashMessage(m.Name+" deleted from team", "success")
}
refreshTeamsInMemory()
redirect("/admin/teams/"+teamId, w, req)
redirect("/admin/teams/"+teamId+"#members", w, req)
default:
page.SubTitle = "Edit Team"
t := dbGetTeam(teamId)

198
assets.go
View File

@ -200,29 +200,30 @@ SExORVYLEQephirOzE3XK8kozU3KS8zMAatMLi0qzi+yUijIzwRaVQRSBQgAAP//D/6XxHkAAAA=
"/assets/css/gjvote.css": {
local: "assets/css/gjvote.css",
size: 4090,
modtime: 1500473492,
size: 4130,
modtime: 1500995462,
compressed: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ztNwIUiEAAA
`,
},
@ -318,7 +319,7 @@ H4sIAAAJbogA/wEAAP//AAAAAAAAAAA=
"/assets/js/gjvote.js": {
local: "assets/js/gjvote.js",
size: 3561,
modtime: 1500039735,
modtime: 1500995424,
compressed: `
H4sIAAAJbogA/6xXX2/jNgx/z6fQcg920NRwBgwDmuUOt9sNG9DeDWjfij4oNpNoVSTPktML2nz3UbL8
N3LSbteH2hZ/5E8iKZJZFSLRTAqi5XrN4WO6ZeIvKoCHE/I8ImRHc7IFUZAFSWVS4KuO/ikg398Ch0TL
@ -11952,42 +11953,51 @@ gXNZg01WlzwTO4QO8+DQa0kXLC/+GGcx3uzdZBOZuF7yMjkoIN5n+kVS9TMAAP//58Xge8kCAAA=
"/templates/admin-editteam.html": {
local: "templates/admin-editteam.html",
size: 7798,
modtime: 1500467841,
size: 13520,
modtime: 1500997714,
compressed: `
H4sIAAAJbogA/9RYW4/buhF+z68ghACy0bWVtufkwWu7J8kmxQJJWnS9T0EeaJGW2KUuEClv3IX/e4ek
LqQutnfRBOg+eKXhcIYz882FenpCr8uSEbRYofmGJjnHkt5gief397c36Hh8tSRsj0KOhVh5IU0lLbz1
K4RsMqc7qYlA3mVFUtPzsqAzTWieZpizKKXEQziULEtXXoBJwtJAUpyIoDnO8RgIvKceSqiMM7Ly/vmP
u02lA7TEf11vYAO6oRIzLpYBEOq1HaOcCCprQv+saMuimchxSL2WyWXTBw6zVBYZn0VFVuYOKzBzvKW8
cUzFqYkeAktXnrIoxQno0Ef9Co/LQDN0JLE0LyVixNqC1K/9vse8BAL4x42SkgrO8hCQQhpnnFBQ3Sh0
7QvAQMsrndeT1qOCgktnecm5KxOjuKA7N4xeK4eDT5THtbcNDLallFlqP8/g8Cz11h9wGlK+DLCjoeKX
hxwcIMptwqSroGBRfFZDwRJcHLz1fU7Ad0h5aBmYxXFt5sXTsdnK9IZyKqna+vwD0KLIIHOMiBH1TkSW
gQtkeIf8qZ7jAgU6C82OgXzsYfzFmRkBji7PzIHswxW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BAAD//4ZNd/nQNAAA
`,
},
@ -12163,39 +12173,47 @@ AAAA//9ablv2IQMAAA==
"/templates/public-teammgmt.html": {
local: "templates/public-teammgmt.html",
size: 6401,
modtime: 1500470615,
size: 10204,
modtime: 1500997713,
compressed: `
H4sIAAAJbogA/7xYS2/buBbe51cQRAHbuLHde2/bhWMbnTbtIEDbGUwSzKLoghZpiRPqAZJymgn83+eQ
1IOSaMctpu2ikQ4Pz/M7D/nxET0rS07RYoVmNywtBNHskmgyu729ukT7/dmS8h2KBFFqhSOWaSbx+gwh
nyzYVlsikJP/rx8fu5I+kZTt98s5HFU8Es2tjDkIWZ8FpKENj6eqIBGr5W5zmdYcRSnZ1BKapykRPM4Y
xYhEmufZCs81I+m88W+/nyuyYzHYglHKdJLTFf79t+ubSoFRwZmgiumaACSCMriwwu7a3DsBZ25AAfoV
TlrX7JHni7UvyjMtczGNZV4WuGUEVkE2TDTRrfgsESNwyyk2JuC1UYQ+WW2WoSOHZ0WpEafeBc9y974j
ogQCRKSbHiPY5ghihBHQI5bkgjLQ3uj0rK6S9sO8FTy7q7z9k20U1yc4bO94Drv3ow5/AJYDDn+wFvw0
hylTEV5fwv+SFwa7IX81+6qJZKRx2d7yXHbvHWc8kbPZDK/DgfC4kKnSWtN3BgBJBiU0LUohurEgKJFs
G6hL3AoTEB1T/bbyXXFvSq3BMu95Cg7wDK/fkixiYjknHTUVv34oIDCq3KRcdxVIHidPapA8JfIBr28L
CsGqitwdHojLct5tH/AObal6Pg0yx+Cyvo4kY5lKcq16+Bg2aGiGAiW55H+DDCKmkOAcKDop001GuLD6
IYbQyi2eQge1dEgU36Is1yHseEaZUeHlWukHAQmAKMY8m+q8WLx4Xny9wAFDn0pChZu/yI44pC50HseC
3RYiJ/T6+j3EeTy5MMkyBNQa5WED3GBCMd9KIEmSxQw94+fo2W44AY+6yNMYATbI1MDZBLGDaHuiVE3f
1dO08b8JOQwsoWuubi1ipGS0wkbWAkIRM6gaYHrPBTPw3u8vNkSxVy/O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n1+51
At+gfAvRrxKi7lc/f7Ag/QxBdClOPzUPBIM0EFGfFKHhoK+CFCKwcTEy2WGxQ0uotX+2NAcl9jpgdbpa
TMvrt/8FAAD//x6rSUXcJwAA
`,
},

View File

@ -183,7 +183,7 @@ table tfoot {
}
.pure-button-toggle-middle {
border-radius: 0px;
margin-left: -1px;
margin-left: -5px;
border-left: 1px solid #CCC;
}
.pure-button-toggle-last {
@ -198,6 +198,10 @@ table tfoot {
color: #999;
}
#modal-body {
margin-bottom: 15px;
}
#modal-overlay {
visibility: hidden;
position: absolute;

View File

@ -141,7 +141,7 @@ func handleTeamMgmtRequest(w http.ResponseWriter, req *http.Request) {
page.session.setFlashMessage(mbrName+" added to team!", "success")
}
refreshTeamsInMemory()
redirect("/team/"+teamId, w, req)
redirect("/team/"+teamId+"#members", w, req)
case "deletemember":
mbrId := req.FormValue("memberid")
m, _ := dbGetTeamMember(teamId, mbrId)

View File

@ -1,6 +1,12 @@
{{ $uuid := .TemplateData.UUID }}
<div class="center">
<div class="left">
<div>
<h3>Team Management</h3>
<button id="edit-team-button" onclick="javascript:gotoTeamTab();" class="pure-button-toggle-first pure-button pure-button-primary">Team Details</button>
<button id="edit-game-button" onclick="javascript:gotoTeamGameTab();" class="pure-button-toggle-middle pure-button">Game Details</button>
<button id="edit-team-members-button" onclick="javascript:gotoTeamMemberTab();" class="pure-button-toggle-last pure-button">Team Members</button>
</div>
<div id="edit-team-tab" class="left">
<form class="pure-form pure-form-aligned" action="/admin/teams/{{ $uuid }}/save" method="POST">
<h3>Team Details</h3>
<fieldset>
@ -17,10 +23,9 @@
</div>
</fieldset>
</form>
<hr />
</div>
<div class="left big-space">
<div id="edit-game-tab" class="left big-space hidden">
<form class="pure-form pure-form-aligned" action="/admin/games/{{ $uuid }}/save" method="POST">
<fieldset>
<a name="game" />
@ -62,8 +67,7 @@
</div>
</div>
<hr />
<div class="left">
<div id="edit-team-members-tab" class="left hidden">
<h3>Team Members</h3>
<table class="center padding hide">
<thead>
@ -109,9 +113,6 @@
</tbody>
</table>
</div>
<div class="pure-control-group reset-pull">
<a href="/admin/teams" class="pull-left space pure-button pure-button-plain">Cancel</a>
</div>
</div>
<div id="uploadscreenshotform" style="display:none;">
<h3>Upload Screenshot</h3>
@ -162,16 +163,9 @@
);
function showEditScreenShotModal(img) {
var newImg = img.cloneNode();
var editSSForm = document.getElementById('editscreenshotform');
var cont = document.getElementById('editss-container');
while(cont.hasChildNodes()) {
cont.removeChild(cont.lastChild);
}
cont.appendChild(newImg);
showModal({
title: 'Edit Screenshot',
bodyNode: editSSForm,
bodyNode: img.cloneNode(true),
buttons: [
{ title: 'Delete', class: 'pure-button-error', position: 'right',
click: function() {
@ -181,18 +175,162 @@
{ title: 'Cancel', class: 'pure-button', position: 'right', click: hideModal }
]
});
editSSForm.style.display="block";
editSSForm.style.height="200px";
}
function toggleUploadSSForm() {
var uploadForm = document.getElementById('uploadscreenshotform');
showModal({
title: 'Upload Screenshot',
subtitle: '({{ .TemplateData.Name }})',
bodyNode: uploadForm
});
uploadForm.style.display="block";
document.getElementById('modal-body').style.height='165px';
if(valuesChanged()) {
showModal({
title: 'Unsaved Changes',
subtitle: '',
body: "You've made some changes, but haven't saved them yet, if you continue they will be lost.",
buttons: [{
title: 'Cancel Changes',
class: 'pure-button-error',
click: function() {
revertChanges();
toggleUploadSSForm();
hideModal();
}
},{
title: 'Go Back',
class: 'pure-button-primary',
click: hideModal
}]
});
} else {
var uploadForm = document.getElementById('uploadscreenshotform');
showModal({
title: 'Upload Screenshot',
subtitle: '({{ .TemplateData.Name }})',
bodyNode: uploadForm
});
uploadForm.style.display="block";
document.getElementById('modal-body').style.height='165px';
}
}
function valuesChanged() {
// Check if Team Name changed
if(document.getElementById('teamname').value != '{{ .TemplateData.Name }}') { return true; }
// Check if Game Details changed
if(document.getElementById('gamename').value != '{{ .TemplateData.Game.Name }}') { return true; }
if(document.getElementById('gamelink').value != '{{ .TemplateData.Game.Link }}') { return true; }
if(document.getElementById('gamedesc').value != '{{ .TemplateData.Game.Description }}') { return true; }
// Check if new member details have been entered
if(document.getElementById('newmembername').value != '') { return true; }
if(document.getElementById('newmemberslackid').value != '') { return true; }
if(document.getElementById('newmembertwitter').value != '') { return true; }
if(document.getElementById('newmemberemail').value != '') { return true; }
return false;
}
function revertChanges() {
// Reset Team Name
document.getElementById('teamname').value = '{{ .TemplateData.Name }}';
// Reset Game Details
document.getElementById('gamename').value = '{{ .TemplateData.Game.Name }}';
document.getElementById('gamelink').value = '{{ .TemplateData.Game.Link }}';
document.getElementById('gamedesc').value = '{{ .TemplateData.Game.Description }}';
// Reset new member fields
document.getElementById('newmembername').value = '';
document.getElementById('newmemberslackid').value = '';
document.getElementById('newmembertwitter').value = '';
document.getElementById('newmemberemail').value = '';
}
function gotoTeamTab() {
if(valuesChanged()) {
showModal({
title: 'Unsaved Changes',
subtitle: '',
body: "You've made some changes, but haven't saved them yet, if you continue they will be lost.",
buttons: [{
title: 'Cancel Changes',
class: 'pure-button-error',
click: function() {
revertChanges();
gotoTeamTab();
hideModal();
}
},{
title: 'Go Back',
class: 'pure-button-primary',
click: hideModal
}]
});
} else {
document.getElementById('edit-team-button').classList.add('pure-button-primary');
document.getElementById('edit-game-button').classList.remove('pure-button-primary');
document.getElementById('edit-team-members-button').classList.remove('pure-button-primary');
document.getElementById('edit-team-tab').classList.remove('hidden');
document.getElementById('edit-game-tab').classList.add('hidden');
document.getElementById('edit-team-members-tab').classList.add('hidden');
}
}
function gotoTeamGameTab() {
if(valuesChanged()) {
showModal({
title: 'Unsaved Changes',
subtitle: '',
body: "You've made some changes, but haven't saved them yet, if you continue they will be lost.",
buttons: [{
title: 'Cancel Changes',
class: 'pure-button-error',
click: function() {
revertChanges();
gotoTeamGameTab();
hideModal();
}
},{
title: 'Go Back',
class: 'pure-button-primary',
click: hideModal
}]
});
} else {
document.getElementById('edit-team-button').classList.remove('pure-button-primary');
document.getElementById('edit-game-button').classList.add('pure-button-primary');
document.getElementById('edit-team-members-button').classList.remove('pure-button-primary');
document.getElementById('edit-team-tab').classList.add('hidden');
document.getElementById('edit-game-tab').classList.remove('hidden');
document.getElementById('edit-team-members-tab').classList.add('hidden');
}
}
function gotoTeamMemberTab() {
if(valuesChanged()) {
showModal({
title: 'Unsaved Changes',
subtitle: '',
body: "You've made some changes, but haven't saved them yet, if you continue they will be lost.",
buttons: [{
title: 'Cancel Changes',
class: 'pure-button-error',
click: function() {
revertChanges();
gotoTeamMemberTab();
hideModal();
}
},{
title: 'Go Back',
class: 'pure-button-primary',
click: hideModal
}]
});
} else {
document.getElementById('edit-team-button').classList.remove('pure-button-primary');
document.getElementById('edit-game-button').classList.remove('pure-button-primary');
document.getElementById('edit-team-members-button').classList.add('pure-button-primary');
document.getElementById('edit-team-tab').classList.add('hidden');
document.getElementById('edit-game-tab').classList.add('hidden');
document.getElementById('edit-team-members-tab').classList.remove('hidden');
}
}
if(window.location.hash == '#game') {
gotoTeamGameTab();
} else if(window.location.hash == '#members') {
gotoTeamMemberTab();
}
</script>

View File

@ -5,7 +5,12 @@
<hr />
</div>
<div class="left big-space">
<div>
<button id="edit-game-button" onclick="javascript:gotoTeamGameTab();" class="pure-button-toggle-first pure-button pure-button-primary">Game Details</button>
<button id="edit-team-members-button" onclick="javascript:gotoTeamMemberTab();" class="pure-button-toggle-last pure-button">Team Members</button>
</div>
<div id="edit-game-tab" class="left big-space">
<form class="pure-form pure-form-aligned" action="/team/{{ $uuid }}/savegame" method="POST">
<fieldset>
<a name="game" />
@ -47,8 +52,7 @@
</div>
</div>
<hr />
<div class="left">
<div id="edit-team-members-tab" class="left hidden">
<h3>Team Members</h3>
<table class="center padding hide">
<thead>
@ -94,9 +98,6 @@
</tbody>
</table>
</div>
<div class="pure-control-group reset-pull">
<a href="/team/{{ $uuid }}" class="pull-left space pure-button pure-button-plain">Cancel</a>
</div>
</div>
<div id="uploadscreenshotform" style="display:none;">
<h3>Upload Screenshot</h3>
@ -104,17 +105,16 @@
<div class="pure-control-group" style="margin-bottom:50px;">
<input class="file" type="file" name="newssfile" multiple>
</div>
<a href="javascript:hideModal();" class="pull-left space-sides pure-button">Cancel</a>
<button type="submit" class="pull-right space-sides pure-button pure-button-primary">Add</button>
<button type="button" onclick="hideModal();" class="pull-right space-sides pure-button pure-button">Cancel</button>
</form>
</div>
<div id="editscreenshotform" style="display:none;">
<div id="editss-container" class="pure-control-group" style="margin-bottom:50px;">
</div>
<div id="editss-container" class="pure-control-group" style="margin-bottom:50px;"></div>
</div>
<script>
snack.listener(
{
snack.listener({
node:document.getElementById('thumbnail-container'),
event:'click',
delegate: function(node) {
@ -127,16 +127,9 @@
);
function showEditScreenShotModal(img) {
var newImg = img.cloneNode();
var editSSForm = document.getElementById('editscreenshotform');
var cont = document.getElementById('editss-container');
while(cont.hasChildNodes()) {
cont.removeChild(cont.lastChild);
}
cont.appendChild(newImg);
showModal({
title: 'Edit Screenshot',
bodyNode: editSSForm,
bodyNode: img.cloneNode(true),
buttons: [
{ title: 'Delete', class: 'pure-button-error', position: 'right',
click: function() {
@ -146,18 +139,120 @@
{ title: 'Cancel', class: 'pure-button', position: 'right', click: hideModal }
]
});
editSSForm.style.display="block";
editSSForm.style.height="200px";
}
function toggleUploadSSForm() {
var uploadForm = document.getElementById('uploadscreenshotform');
showModal({
title: 'Upload Screenshot',
subtitle: '({{ .TemplateData.Name }})',
bodyNode: uploadForm
});
uploadForm.style.display="block";
document.getElementById('modal-body').style.height='165px';
if(valuesChanged()) {
showModal({
title: 'Unsaved Changes',
subtitle: '',
body: "You've made some changes, but haven't saved them yet, if you continue they will be lost.",
buttons: [{
title: 'Cancel Changes',
class: 'pure-button-error',
click: function() {
revertChanges();
toggleUploadSSForm();
hideModal();
}
},{
title: 'Go Back',
class: 'pure-button-primary',
click: hideModal
}]
});
} else {
var uploadForm = document.getElementById('uploadscreenshotform').cloneNode(true);
showModal({
title: 'Upload Screenshot',
subtitle: '({{ .TemplateData.Name }})',
bodyNode: uploadForm
});
uploadForm.style.display="block";
document.getElementById('modal-body').style.height='165px';
}
}
function valuesChanged() {
// Check if game details have changed
if(document.getElementById('gamename').value != '{{ .TemplateData.Game.Name }}') { return true; }
if(document.getElementById('gamelink').value != '{{ .TemplateData.Game.Link }}') { return true; }
if(document.getElementById('gamedesc').value != '{{ .TemplateData.Game.Description }}') { return true; }
// Check if new member details have been entered
if(document.getElementById('newmembername').value != '') { return true; }
if(document.getElementById('newmemberslackid').value != '') { return true; }
if(document.getElementById('newmembertwitter').value != '') { return true; }
if(document.getElementById('newmemberemail').value != '') { return true; }
return false;
}
function revertChanges() {
// Reset game details
document.getElementById('gamename').value = '{{ .TemplateData.Game.Name }}';
document.getElementById('gamelink').value = '{{ .TemplateData.Game.Link }}';
document.getElementById('gamedesc').value = '{{ .TemplateData.Game.Description }}';
// Reset new member fields
document.getElementById('newmembername').value = '';
document.getElementById('newmemberslackid').value = '';
document.getElementById('newmembertwitter').value = '';
document.getElementById('newmemberemail').value = '';
}
function gotoTeamGameTab() {
if(valuesChanged()) {
showModal({
title: 'Unsaved Changes',
body: "You've made some changes, but haven't saved them yet, if you continue they will be lost.",
buttons: [{
title: 'Cancel Changes',
class: 'pure-button-error',
click: function() {
revertChanges();
gotoTeamGameTab();
hideModal();
}
},{
title: 'Go Back',
class: 'pure-button-primary',
click: hideModal
}]
});
} else {
document.getElementById('edit-game-button').classList.add('pure-button-primary');
document.getElementById('edit-team-members-button').classList.remove('pure-button-primary');
document.getElementById('edit-game-tab').classList.remove('hidden');
document.getElementById('edit-team-members-tab').classList.add('hidden');
}
}
function gotoTeamMemberTab() {
if(valuesChanged()) {
showModal({
title: 'Unsaved Changes',
body: "You've made some changes, but haven't saved them yet, if you continue they will be lost.",
buttons: [{
title: 'Cancel Changes',
class: 'pure-button-error',
click: function() {
revertChanges();
gotoTeamMemberTab();
hideModal();
}
},{
title: 'Go Back',
class: 'pure-button-primary',
click: hideModal
}]
});
} else {
document.getElementById('edit-game-button').classList.remove('pure-button-primary');
document.getElementById('edit-team-members-button').classList.add('pure-button-primary');
document.getElementById('edit-game-tab').classList.add('hidden');
document.getElementById('edit-team-members-tab').classList.remove('hidden');
}
}
if(window.location.hash == '#members') {
gotoTeamMemberTab();
}
</script>