Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
57c5fb30c6 | |||
2b6a222bcf |
@ -1,6 +1,8 @@
|
|||||||
$(document).ready( ->
|
$(document).ready( ->
|
||||||
|
|
||||||
$('#nav-toggle').on('click', toggleNav)
|
$('#nav-toggle').on('click', toggleNav)
|
||||||
|
if getCookie('navCollapsed') == 'true'
|
||||||
|
$('body').addClass('collapsed')
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -8,5 +10,26 @@ toggleNav = () ->
|
|||||||
bodyElem = $('body')
|
bodyElem = $('body')
|
||||||
if bodyElem.hasClass('collapsed')
|
if bodyElem.hasClass('collapsed')
|
||||||
bodyElem.removeClass('collapsed')
|
bodyElem.removeClass('collapsed')
|
||||||
|
setCookie('navCollapsed', 'false')
|
||||||
else
|
else
|
||||||
bodyElem.addClass('collapsed')
|
bodyElem.addClass('collapsed')
|
||||||
|
setCookie('navCollapsed', 'true')
|
||||||
|
|
||||||
|
getCookie = (cName) ->
|
||||||
|
name = cName + '='
|
||||||
|
cDecoded = decodeURIComponent(document.cookie)
|
||||||
|
#to be careful
|
||||||
|
cArr = cDecoded.split('; ')
|
||||||
|
res = undefined
|
||||||
|
cArr.forEach (val) ->
|
||||||
|
if val.indexOf(name) == 0
|
||||||
|
res = val.substring(name.length)
|
||||||
|
return
|
||||||
|
res
|
||||||
|
|
||||||
|
setCookie = (cName, cValue, expDays = 30) ->
|
||||||
|
date = new Date
|
||||||
|
date.setTime date.getTime() + expDays * 24 * 60 * 60 * 1000
|
||||||
|
expires = 'expires=' + date.toUTCString()
|
||||||
|
document.cookie = cName + '=' + cValue + '; ' + expires + '; path=/'
|
||||||
|
return
|
||||||
|
@ -28,4 +28,11 @@ namespace '/ip-tracker' do
|
|||||||
redirect '/ip-tracker'
|
redirect '/ip-tracker'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get '/delete/:ip_id' do
|
||||||
|
ip = IpAddress.where(id: params[:ip_id]).first()
|
||||||
|
ip.delete()
|
||||||
|
|
||||||
|
redirect '/ip-tracker'
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<th>Address</th>
|
<th>Address</th>
|
||||||
<th>DNS Name</th>
|
<th>DNS Name</th>
|
||||||
<th>Comments</th>
|
<th>Comments</th>
|
||||||
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -16,6 +17,9 @@
|
|||||||
<td><%= ip.address %></td>
|
<td><%= ip.address %></td>
|
||||||
<td><%= ip.dns_name %></td>
|
<td><%= ip.dns_name %></td>
|
||||||
<td><%= ip.comment %></td>
|
<td><%= ip.comment %></td>
|
||||||
|
<td>
|
||||||
|
<a href="/ip-tracker/delete/<%= ip.id %>"><i class="fa-solid fa-trash"></i></a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Reference in New Issue
Block a user