neocities/views/admin/site.erb
2015-12-29 22:48:46 -06:00

80 lines
3.1 KiB
Text

<div class="header-Outro">
<div class="row content single-Col">
<h1>Site Inspector</h1>
<h2 class="subtitle"><%= @site.username %></h2>
</div>
</div>
<div class="content misc-page single-Col txt-Center" style="padding-top: 20px;">
<div style="float: left;">
<form action="/admin/banhammer" target="_blank" method="POST">
<%== csrf_token_input_html %>
<input type="hidden" name="username" value="<%= @site.username %>">
<p><input class="btn-Action" type="submit" value="Ban"></p>
</form>
<form action="/admin/mark_nsfw" method="POST">
<%== csrf_token_input_html %>
<input type="hidden" name="username" value="<%= @site.username %>">
<p><input class="btn-Action" type="submit" value="Mark NSFW"></p>
</form>
</div>
<div style="float: right;">
<form method="GET" onsubmit="window.location.href = '/admin/site/'+$('#sitename').val(); return false">
<input id="sitename" type="text" placeholder="sitename" autocomplete="off"><br>
<input type="submit" class="btn-Action" value="Lookup">
</form>
</div>
<div style="clear: both"></div>
<h3>Site Pages</h3>
<table>
<% @site.site_files_dataset.where(path: /\.html/).all.each do |site_file| %>
<tr style="outline: thin solid black;">
<td><img src="<%= @site.screenshot_url(site_file.path, '210x158') %>"></td>
<td>
<p><strong><a href="<%= @site.uri + '/' + site_file.path %>"><%= site_file.path %></a></strong></p>
<% if !site_file.classifier.blank? %>
<p>
<% if site_file.classifier == 'ham' %>
<span style="color: green"><%= site_file.classifier %></span>
<% else %>
<span style="color: red"><strong><%= site_file.classifier %></strong></span>
<% end %>
</p>
<% else %>
<p>Not Classified</p>
<% end %>
<form action="/admin/site_files/train" target="_blank" method="POST">
<%== csrf_token_input_html %>
<input type="hidden" name="site_id" value="<%= @site.id %>">
<input type="hidden" name="path" value="<%= site_file.path %>">
<input type="hidden" name="classifier" value="ham">
<button>Ham</button>
</form>
<form action="/admin/site_files/train" target="_blank" method="POST">
<%== csrf_token_input_html %>
<input type="hidden" name="site_id" value="<%= @site.id %>">
<input type="hidden" name="path" value="<%= site_file.path %>">
<input type="hidden" name="classifier" value="spam">
<button>Spam</button>
</form>
<form action="/admin/site_files/train" target="_blank" method="POST">
<%== csrf_token_input_html %>
<input type="hidden" name="site_id" value="<%= @site.id %>">
<input type="hidden" name="path" value="<%= site_file.path %>">
<input type="hidden" name="classifier" value="phishing">
<button>Phishing</button>
</form>
</td>
</tr>
<% end %>
</table>
</div>