Closed BinaryFissionGames closed 6 years ago
Works 90% of the way I can't get the admin row to to show anything but undefined I even tried changing the data type in the mysql code to BOOL but even though it now shows readable characters in the database it's not retrieving them properly. Once this is fixed there may be another couple small bugs but it seems to mostly work correctly.
Everything works I'd like to be able to update the admin status on click so you don't have to reload the page to see the change. The only problem is that I'm not sure how to reference that cell.
function UpdateAdminStatus(user_id){
var cell = ??? //Idk how to get the correct cell here?
cell.innerHTML = (cell == 1 ? '0' : '1');
//Also don't think I'm referring to the number in cell here which is a problem too
}
This is essentially what I want to do but there are some obvious problems...
So, I changed the CreateTableRow function to allow for an id to be added for each row. You can get the row by user id now (row = getElementById('user_table_' + user_id)
). I guess the admin cell would be var cell = row.children[1]
? That might be your best bet on getting the cell itself.
On another note, it looks like this is toggling the admin status; which is fine, but the name of the function should probably be ToggleAdminStatus. For getting the number in the cell, use Number(cell.innerHTML)
.
The ID doesn't seem to be getting added on mine getElementById is returning NULL and I can't see it when I inspect elements. In other news what ever you did seems to have removed the color css from the rows
Uhh, so, I fixed the issue, things are now getting IDs. But the CSS broke. I'm looking into that right now. There's some really weird stuff going on here?
Figured it out, it was an if statement above without a body, Whoops.
There needs to be some mechanism where an existing admin can create other admins. I'm guessing we'll have this on the same page where we can remove users, just add an extra column to the table for 'adminifying' users.