diff options
Diffstat (limited to 'app/views/finger/index.html.erb')
| -rw-r--r-- | app/views/finger/index.html.erb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/views/finger/index.html.erb b/app/views/finger/index.html.erb new file mode 100644 index 0000000..a1a2f32 --- /dev/null +++ b/app/views/finger/index.html.erb @@ -0,0 +1,38 @@ +<style> +td,th { min-width: 100px; text-align: left } +tr[data-banned=true], tr.banned { background: red; color: white; } +</style> +<table cellspacing=0> + <tr> + <td></td> + <th>id</th> + <th>nick</th> + <th>hash</th> + <th>ip</th> + </tr> +<% @fingers.each do |finger| %> + <tr data-id="<%= finger.id %>" data-banned="<%= finger.banned %>"> + <td><button><%= finger.banned ? "BANNED" : "BAN?" %></button></td> + <td><%= finger.id %></td> + <td><%= finger.nick %></td> + <td><%= finger.token %></td> + <td><%= finger.remote_addr %></td> + </tr> +<% end %> + +</table> + +<script> +$("button").click(function(){ + var $tr = $(this).closest("tr") + var data = $tr.data() + data.banned = ! data.banned + $tr.data("banned", data.banned) + $tr.toggleClass("banned", data.banned) + $tr.attr("data-banned", null) + $(this).html( data.banned ? "BANNED" : "BAN?" ) + $.post("/finger/ban", data, function(){ + console.log("ok") + }) +}) +</script>
\ No newline at end of file |
