Basic browser for audit logs added
This commit is contained in:
parent
1c2bfb87d3
commit
d41220c5fd
4 changed files with 59 additions and 0 deletions
|
|
@ -2,6 +2,12 @@
|
||||||
class MyController < ApplicationController
|
class MyController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
|
||||||
|
# Show audit logs
|
||||||
|
def logs
|
||||||
|
@logs = Log.paginate(page: params[:page], per_page: 6)
|
||||||
|
render :logs
|
||||||
|
end
|
||||||
|
|
||||||
# def profile
|
# def profile
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@
|
||||||
li class=('active' if action_name=='moderate_list')
|
li class=('active' if action_name=='moderate_list')
|
||||||
= link_to moderate_list_path
|
= link_to moderate_list_path
|
||||||
= fa_icon 'check 2x', text: 'Moderate'
|
= fa_icon 'check 2x', text: 'Moderate'
|
||||||
|
- if can? :view, Log
|
||||||
|
li class=('active' if action_name=='logs')
|
||||||
|
= link_to logs_path
|
||||||
|
= fa_icon 'book 2x', text: 'Logs'
|
||||||
|
|
||||||
// Add link if user has uploaded screenshots
|
// Add link if user has uploaded screenshots
|
||||||
/ - if @current_users_screenshots and @current_users_screenshots.any?
|
/ - if @current_users_screenshots and @current_users_screenshots.any?
|
||||||
/ li class=('active' if controller_name=='my' and action_name=='uploads')
|
/ li class=('active' if controller_name=='my' and action_name=='uploads')
|
||||||
|
|
|
||||||
47
app/views/my/logs.slim
Normal file
47
app/views/my/logs.slim
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
= render partial: 'menu'
|
||||||
|
|
||||||
|
// Paginator and search bar
|
||||||
|
.grid-x
|
||||||
|
.small-6.medium-8.large-9.cell
|
||||||
|
// Paginator
|
||||||
|
= render(partial: 'packages/paginator', locals: {items: @logs})
|
||||||
|
|
||||||
|
.small-6.medium-4.large-3.cell
|
||||||
|
// Search form
|
||||||
|
= render 'packages/searchfield'
|
||||||
|
|
||||||
|
- if @logs
|
||||||
|
table
|
||||||
|
thead
|
||||||
|
tr
|
||||||
|
th Message
|
||||||
|
th Level
|
||||||
|
th Section
|
||||||
|
th IP
|
||||||
|
tbody
|
||||||
|
- @logs.each do |log|
|
||||||
|
tr
|
||||||
|
td #{log.message }
|
||||||
|
td #{log.level }
|
||||||
|
td #{log.section }
|
||||||
|
td #{log.ip_address}
|
||||||
|
|
||||||
|
- else
|
||||||
|
p Nothing here.
|
||||||
|
|
||||||
|
/ // Grid view of packages
|
||||||
|
/ .grid-x
|
||||||
|
/ .small-9.large-10.cell
|
||||||
|
/ - if @packages.any?
|
||||||
|
/ - if @view_style==:grid
|
||||||
|
/ .grid-x.grid-margin-x.small-up-1.medium-up-2.large-up-3 data-equalizer=true data-equalize-on="medium"
|
||||||
|
/ - @packages.all.each do |pkg|
|
||||||
|
/ .cell.pkgcard data-equalizer-watch=true
|
||||||
|
/ a.black href=package_path(name: pkg.name)
|
||||||
|
/ .image
|
||||||
|
/ / This leads to an N+1 SQL query for each image. Ideas for optimization welcome.
|
||||||
|
/ = small_img(pkg.screenshots.accessible_by(current_ability, :view).first, cls: '')
|
||||||
|
/ .text.pkgname
|
||||||
|
/ = pkg.name
|
||||||
|
/ .text
|
||||||
|
/ = pkg.description
|
||||||
|
|
@ -24,6 +24,7 @@ Rails.application.routes.draw do
|
||||||
get 'my/uploads'
|
get 'my/uploads'
|
||||||
get 'my/welcome'
|
get 'my/welcome'
|
||||||
get 'my/moderate_list', as: :moderate_list
|
get 'my/moderate_list', as: :moderate_list
|
||||||
|
get 'my/logs', as: :logs
|
||||||
get 'package/:name' => 'packages#details', as: :package, name: /[^\/]+/
|
get 'package/:name' => 'packages#details', as: :package, name: /[^\/]+/
|
||||||
# get 'package_reviews/:name' => 'packages#reviews', as: :package_reviews, name: /[^\/]+/
|
# get 'package_reviews/:name' => 'packages#reviews', as: :package_reviews, name: /[^\/]+/
|
||||||
get 'upload', to: redirect('/packages'), as: :upload_legacy # legacy upload form
|
get 'upload', to: redirect('/packages'), as: :upload_legacy # legacy upload form
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue