Merge pull request #14 from br0xen/master

Split team management into tabs
Resolves issue #4 
Resolves issue #3
This commit is contained in:
Brian Buller 2017-07-25 10:52:18 -05:00 committed by GitHub
commit 3ceab46c16
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 { } else {
page.session.setFlashMessage("Team game updated", "success") page.session.setFlashMessage("Team game updated", "success")
} }
redirect("/admin/teams/"+teamId, w, req) redirect("/admin/teams/"+teamId+"#game", w, req)
} }
case "screenshotupload": case "screenshotupload":
if err := saveScreenshots(teamId, req); err != nil { if err := saveScreenshots(teamId, req); err != nil {
page.session.setFlashMessage("Error updating game: "+err.Error(), "error") page.session.setFlashMessage("Error updating game: "+err.Error(), "error")
} }
redirect("/admin/teams/"+teamId, w, req) redirect("/admin/teams/"+teamId+"#game", w, req)
case "screenshotdelete": case "screenshotdelete":
ssid := vars["subid"] ssid := vars["subid"]
if err := dbDeleteTeamGameScreenshot(teamId, ssid); err != nil { if err := dbDeleteTeamGameScreenshot(teamId, ssid); err != nil {
page.session.setFlashMessage("Error deleting screenshot: "+err.Error(), "error") 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") page.session.setFlashMessage(mbrName+" added to team!", "success")
} }
refreshTeamsInMemory() refreshTeamsInMemory()
redirect("/admin/teams/"+teamId, w, req) redirect("/admin/teams/"+teamId+"#members", w, req)
case "deletemember": case "deletemember":
mbrId := req.FormValue("memberid") mbrId := req.FormValue("memberid")
m, _ := dbGetTeamMember(teamId, mbrId) 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") page.session.setFlashMessage(m.Name+" deleted from team", "success")
} }
refreshTeamsInMemory() refreshTeamsInMemory()
redirect("/admin/teams/"+teamId, w, req) redirect("/admin/teams/"+teamId+"#members", w, req)
default: default:
page.SubTitle = "Edit Team" page.SubTitle = "Edit Team"
t := dbGetTeam(teamId) t := dbGetTeam(teamId)

198
assets.go
View File

@ -200,29 +200,30 @@ SExORVYLEQephirOzE3XK8kozU3KS8zMAatMLi0qzi+yUijIzwRaVQRSBQgAAP//D/6XxHkAAAA=
"/assets/css/gjvote.css": { "/assets/css/gjvote.css": {
local: "assets/css/gjvote.css", local: "assets/css/gjvote.css",
size: 4090, size: 4130,
modtime: 1500473492, modtime: 1500995462,
compressed: ` compressed: `
H4sIAAAJbogA/6xX22rcOhe+z1MYhkIDv8xMmmkyEwg/pMkL9AlkS7ZFZMnI8mSaTd99L508li1Pe7FL H4sIAAAJbogA/6xX/2rjuBP/v09hCAtb+Mok3WbbpFC+0G1fYJ9AtmRbVJaMLKfZHvvuN/rlWLacPY47
A7G0Dt86fVppdMuzf26yrGUCNZTVjT5mu+32y9PN75ubQpJf9raUXKpjtnl4eHhaE8ZWUtOzRoSWUmHN bqGWRjOfmfnMjzS65dlfN1nWMoEayupGH7Pddvvl6eb3zU0hyS97W0ou1THbPDw8PK0JYyup6VkjQkup
pDhmQgpq7wk75aUUmgptJTtMCBM1WNh357TV0XHBcfk+Wmkwr6yJD0Z0c8z2HkHeUEyocvFgVYM9Tiuw sGZSHDMhBbX3hJ3yUgpNhbaSHSaEiRo07LtzWutouOC4fB+1NJhXVsUHI7o5ZnuPIG8oJlQ5f7CqQR+n
tnXXnWJwHEe03T480ofoHhW1FSnAZ63kIAhKSDPRDTqvGKdxNPmetln+nbYGPmF9x/GvY8YEZ4KigksT FWjbuutOMTiOPdpuHx7pQ3SPitqKFGCzVnIQBCWkmegGnVeM09ibfE/bLP9OWwOfsL7j+NcxY4IzQVHB
B9iWCpBCnN056yVnJNuUZeluzqhvMJ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rVWLdWIiPU3n2gAmwhPlThM0DsUoWS1LKhQTgWWwNkVxF+gOnfPKL
LNR40cnzeHd/FcW02ukIR9v5hfv/wP4R//sRmtnqh7Kkfb9u7e7ugKvDVWvR35nr+bm0nx8NLAh0Ij77 aNZDRu1W0OYeulXjRSdj9O7+KoppttMejrrzy4z4w5SI5oQvoZmufihL2vfr2u7uDrg6XNUW/R5dj8+F
Tvy2N+v7rd+zTo5NjWlY3ZBB1WUcF5Tn4cx+eafLVeJvXH6/Nw7d4WQiHv97GP8GAAD//9Q9N0n6DwAA fr40sCDARHz2TPy2N2v+rd/HTq7rGtWw4iGDqss4LijPw5n98kaXK8c/Mfn93hh0h5OKePzvYfwdAAD/
/ztNwIUiEAAA
`, `,
}, },
@ -318,7 +319,7 @@ H4sIAAAJbogA/wEAAP//AAAAAAAAAAA=
"/assets/js/gjvote.js": { "/assets/js/gjvote.js": {
local: "assets/js/gjvote.js", local: "assets/js/gjvote.js",
size: 3561, size: 3561,
modtime: 1500039735, modtime: 1500995424,
compressed: ` compressed: `
H4sIAAAJbogA/6xXX2/jNgx/z6fQcg920NRwBgwDmuUOt9sNG9DeDWjfij4oNpNoVSTPktML2nz3UbL8 H4sIAAAJbogA/6xXX2/jNgx/z6fQcg920NRwBgwDmuUOt9sNG9DeDWjfij4oNpNoVSTPktML2nz3UbL8
N3LSbteH2hZ/5E8iKZJZFSLRTAqi5XrN4WO6ZeIvKoCHE/I8ImRHc7IFUZAFSWVS4KuO/ikg398Ch0TL N3LSbteH2hZ/5E8iKZJZFSLRTAqi5XrN4WO6ZeIvKoCHE/I8ImRHc7IFUZAFSWVS4KuO/ikg398Ch0TL
@ -11952,42 +11953,51 @@ gXNZg01WlzwTO4QO8+DQa0kXLC/+GGcx3uzdZBOZuF7yMjkoIN5n+kVS9TMAAP//58Xge8kCAAA=
"/templates/admin-editteam.html": { "/templates/admin-editteam.html": {
local: "templates/admin-editteam.html", local: "templates/admin-editteam.html",
size: 7798, size: 13520,
modtime: 1500467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q2AD6eE2KMd1+ppIT6ZS12hiROyI5O5q9PcXP+w/jOr0
67K0wUMT5vkcwErCW0mC6rWqoU1UUrh76zIvcMEUJR79ZYVGXbEagc5yX5LZ+dLAzjbB/oBgsBXl+6p+
K+x3Vl2mnNMiXxYN0GJeGD1Wi3w/M0CLe/U7JLr1lQiUEDrGMidCmiMpUleMA6LtXCE4Zj7G3+b1wNMJ
NPcATydQHegHiTNNWwzprL1dNlJ4TcTf5OuwmoXPevNAi3p9zLt0Vdgs69fSotZZZl2eF+iw6CyJBgh0
CDOUL42YWNzQr+X61fpZIDFxxt5OwD9kbhPbD5nrwric6ULU+UztWyn3BUo590PBr7aG64Rj83NJAKQy
5i0coGc4ghE+myZny6Pml46O3Fy9n/oo0Z7PFj+JCoE3Xrn6Lc+DAtEUpaL7MDnNV5rn5LWrz9a3pd+y
yhfMKvUXvn+yzPIE9OxKLh+btL5UZnlEOvCmlcdlqKfLLNb34d9yyxfMLfZ3+t+yy1dUujxJAvtU2eWp
ixZ/tqqyC6SOxqX9bIf5Dq3gvPTXWB35DFa8W6pBU68UY1lLUIM/p2fLefn+8f8BAAD//4ZNd/nQNAAA
`, `,
}, },
@ -12163,39 +12173,47 @@ AAAA//9ablv2IQMAAA==
"/templates/public-teammgmt.html": { "/templates/public-teammgmt.html": {
local: "templates/public-teammgmt.html", local: "templates/public-teammgmt.html",
size: 6401, size: 10204,
modtime: 1500470615, modtime: 1500997713,
compressed: ` compressed: `
H4sIAAAJbogA/7xYS2/buBbe51cQRAHbuLHde2/bhWMbnTbtIEDbGUwSzKLoghZpiRPqAZJymgn83+eQ H4sIAAAJbogA/+xa2Y/buBl/n7+CVQPYRsf2Ft3Ngy9ss5NdBMimxc4MimKRB1qibTaUaIiUJ+7A/3s/
1IOSaMctpu2ikQ4Pz/M7D/nxET0rS07RYoVmNywtBNHskmgyu729ukT7/dmS8h2KBFFqhSOWaSbx+gwh HpJIibI1kwMoNvMyEo/v/H0HaT0+ohdFQRM0W6LJHUn3DE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1S5f4aif/NicCAoxQlBgkODH5v918r1aAckswGkIU0ajhopOhJ5rU6nR14gFXY0K4iaOYKz
GQAA GENrghgXchI5nCoMuc717R0QG52D1RMwlEMmyKWlPxzNvcngQdZb4WboDhSF1PqFo1fYyTxd+tjKEdKo
4lyzel9mnTJXmAuVUoADzpEpzkoTiJbO1BlqLgajZhaY98Fds+cII2/Yuvi0x8lRA5MmJdVaNDRGztRE
15qJrVxQXSFPfIjKdZ26p0qTseIFGhsSO6JieTn468sf9h8HdR72o7YRl9bs0ymAl8CpH4JCXQJDkdG/
BungseGUlKHdKVT5EwGIpNmgPy3R4OzPBAMQoKxWyltzi8lLXNS9fA8u9m7+uVzUVXgPLv5lWxcz18T1
WdQ39Brgh/SlTg9re0c4T8zn6Ns8nn0+gvYc9vkI6gNVL3J2aIMhwbQLWCOp1qHwm/rlwYuDq7PB2ML9
RdjPLxP0IH4R4T0IemjuC+a5bxMHuOZXivNswxBVDrsgbycan7K3Cbyn7PUxVu708dP6Lf6LdT/f+hz1
1/724f+2yekEYPMrEN3PgDBv4VQ5wQmsCMk0utgvdH284dHP9UX9J7EoP8II0jVX0s+StklSm8Kn1+51
At+gfAvRrxKi7lc/f7Ag/QxBdClOPzUPBIM0EFGfFKHhoK+CFCKwcTEy2WGxQ0uotX+2NAcl9jpgdbpa
TMvrt/8FAAD//x6rSUXcJwAA
`, `,
}, },

View File

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

View File

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

View File

@ -1,6 +1,12 @@
{{ $uuid := .TemplateData.UUID }} {{ $uuid := .TemplateData.UUID }}
<div class="center"> <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"> <form class="pure-form pure-form-aligned" action="/admin/teams/{{ $uuid }}/save" method="POST">
<h3>Team Details</h3> <h3>Team Details</h3>
<fieldset> <fieldset>
@ -17,10 +23,9 @@
</div> </div>
</fieldset> </fieldset>
</form> </form>
<hr />
</div> </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"> <form class="pure-form pure-form-aligned" action="/admin/games/{{ $uuid }}/save" method="POST">
<fieldset> <fieldset>
<a name="game" /> <a name="game" />
@ -62,8 +67,7 @@
</div> </div>
</div> </div>
<hr /> <div id="edit-team-members-tab" class="left hidden">
<div class="left">
<h3>Team Members</h3> <h3>Team Members</h3>
<table class="center padding hide"> <table class="center padding hide">
<thead> <thead>
@ -109,9 +113,6 @@
</tbody> </tbody>
</table> </table>
</div> </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>
<div id="uploadscreenshotform" style="display:none;"> <div id="uploadscreenshotform" style="display:none;">
<h3>Upload Screenshot</h3> <h3>Upload Screenshot</h3>
@ -162,16 +163,9 @@
); );
function showEditScreenShotModal(img) { 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({ showModal({
title: 'Edit Screenshot', title: 'Edit Screenshot',
bodyNode: editSSForm, bodyNode: img.cloneNode(true),
buttons: [ buttons: [
{ title: 'Delete', class: 'pure-button-error', position: 'right', { title: 'Delete', class: 'pure-button-error', position: 'right',
click: function() { click: function() {
@ -181,11 +175,29 @@
{ title: 'Cancel', class: 'pure-button', position: 'right', click: hideModal } { title: 'Cancel', class: 'pure-button', position: 'right', click: hideModal }
] ]
}); });
editSSForm.style.display="block";
editSSForm.style.height="200px";
} }
function toggleUploadSSForm() { function toggleUploadSSForm() {
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'); var uploadForm = document.getElementById('uploadscreenshotform');
showModal({ showModal({
title: 'Upload Screenshot', title: 'Upload Screenshot',
@ -195,4 +207,130 @@
uploadForm.style.display="block"; uploadForm.style.display="block";
document.getElementById('modal-body').style.height='165px'; 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> </script>

View File

@ -5,7 +5,12 @@
<hr /> <hr />
</div> </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"> <form class="pure-form pure-form-aligned" action="/team/{{ $uuid }}/savegame" method="POST">
<fieldset> <fieldset>
<a name="game" /> <a name="game" />
@ -47,8 +52,7 @@
</div> </div>
</div> </div>
<hr /> <div id="edit-team-members-tab" class="left hidden">
<div class="left">
<h3>Team Members</h3> <h3>Team Members</h3>
<table class="center padding hide"> <table class="center padding hide">
<thead> <thead>
@ -94,9 +98,6 @@
</tbody> </tbody>
</table> </table>
</div> </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>
<div id="uploadscreenshotform" style="display:none;"> <div id="uploadscreenshotform" style="display:none;">
<h3>Upload Screenshot</h3> <h3>Upload Screenshot</h3>
@ -104,17 +105,16 @@
<div class="pure-control-group" style="margin-bottom:50px;"> <div class="pure-control-group" style="margin-bottom:50px;">
<input class="file" type="file" name="newssfile" multiple> <input class="file" type="file" name="newssfile" multiple>
</div> </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="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> </form>
</div> </div>
<div id="editscreenshotform" style="display:none;"> <div id="editscreenshotform" style="display:none;">
<div id="editss-container" class="pure-control-group" style="margin-bottom:50px;"> <div id="editss-container" class="pure-control-group" style="margin-bottom:50px;"></div>
</div>
</div> </div>
<script> <script>
snack.listener( snack.listener({
{
node:document.getElementById('thumbnail-container'), node:document.getElementById('thumbnail-container'),
event:'click', event:'click',
delegate: function(node) { delegate: function(node) {
@ -127,16 +127,9 @@
); );
function showEditScreenShotModal(img) { 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({ showModal({
title: 'Edit Screenshot', title: 'Edit Screenshot',
bodyNode: editSSForm, bodyNode: img.cloneNode(true),
buttons: [ buttons: [
{ title: 'Delete', class: 'pure-button-error', position: 'right', { title: 'Delete', class: 'pure-button-error', position: 'right',
click: function() { click: function() {
@ -146,12 +139,30 @@
{ title: 'Cancel', class: 'pure-button', position: 'right', click: hideModal } { title: 'Cancel', class: 'pure-button', position: 'right', click: hideModal }
] ]
}); });
editSSForm.style.display="block";
editSSForm.style.height="200px";
} }
function toggleUploadSSForm() { function toggleUploadSSForm() {
var uploadForm = document.getElementById('uploadscreenshotform'); 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({ showModal({
title: 'Upload Screenshot', title: 'Upload Screenshot',
subtitle: '({{ .TemplateData.Name }})', subtitle: '({{ .TemplateData.Name }})',
@ -160,4 +171,88 @@
uploadForm.style.display="block"; uploadForm.style.display="block";
document.getElementById('modal-body').style.height='165px'; 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> </script>