系统日志查看相关代码,资源

This commit is contained in:
lizanle 2015-01-19 14:07:31 +08:00
commit 49ff5659d9
7 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the system_log controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -0,0 +1,17 @@
# 显示和清理系统日志
class SystemLogController < ApplicationController
# 默认每页显示20条记录
before_filter :require_login ,:only =>:index
before_filter :require_admin ,:only =>:clear
PER_PAGE = 20
layout "base"
include SystemLogHelper
def index
@logs = SystemLog.logo_data(params[:page]||1,params[:per]||PER_PAGE,params[:search] )
end
def clear
SystemLog.clear
redirect_to :action => :index
end
end

View File

@ -0,0 +1,54 @@
<%#
# To change this template, choose Tools | Templates
# and open the template in the editor.
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>System Log</title>
<style type="text/css">
/*body {*/
/*font-size:90%;*/
/*}*/
body {
color: #333333;
font-family: lucida grande, Lucida Sans Unicode, Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 20px;
}
.search_results {
color: red;
}
/*=======分页样式========*/
.pagination ul li a, .pagination ul li span{
background-color: #FFFFFF;
border-color: #DDDDDD;
border-image: none;
border-style: solid;
border-width: 1px 1px 1px 1px;
float: left;
line-height: 20px;
padding: 4px 12px;
text-decoration: none;
}
.pagination ul a {
color: #9B9B9B;
}
.pagination ul li a:hover, .pagination ul li a:focus, .pagination ul .active a, .pagination ul .active span{
background-color: #ffc02f;
border: 1px solid #ffc02f;
}
.pagination ul li{
float: left;
margin-right: 3px;
list-style: none outside none;
}
</style>
</head>
<body onload="document.getElementById('search').focus();">
<%= yield %>
</body>
</html>

View File

@ -0,0 +1,29 @@
<% @nav_dispaly_home_path_label = 1
@nav_dispaly_main_course_label = 1
@nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_label = 1%>
<h1>日志</h1>
<div id='tool'>
<form action="/system_log/index" style="float:right" >
<input type="text" name="search" size="36" maxlength="100" />
<input type="submit" value="搜索" id="search"/>
</form>
<div id='tool-bar'>
<%=link_to '所有日志', :action=>:index %> |
<%=link_to '清空日志', {:action=>:clear}, {:confirm => '确认清除所有日志?'} %> |
<%=link_to_function '刷新', 'window.location.reload();' %>
</div>
</div>
<div>&nbsp;&nbsp;</div>
<%= paginate @logs %><br/>
<% @logs.each do |log| %>
<% unless log.blank? %>
<p><%= raw log %></p><hr/>
<% end %>
<%end %>
<%= paginate @logs %>

View File

@ -0,0 +1,7 @@
require 'test_helper'
class SystemLogControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class SystemLogHelperTest < ActionView::TestCase
end