diff --git a/app/assets/javascripts/system_log.js.coffee b/app/assets/javascripts/system_log.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/system_log.js.coffee @@ -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/ diff --git a/app/assets/stylesheets/system_log.css.scss b/app/assets/stylesheets/system_log.css.scss new file mode 100644 index 000000000..aa1f18587 --- /dev/null +++ b/app/assets/stylesheets/system_log.css.scss @@ -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/ diff --git a/app/controllers/system_log_controller.rb b/app/controllers/system_log_controller.rb new file mode 100644 index 000000000..9e3d208b0 --- /dev/null +++ b/app/controllers/system_log_controller.rb @@ -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 diff --git a/app/views/layouts/system_log.html.erb b/app/views/layouts/system_log.html.erb new file mode 100644 index 000000000..ba1fe1ad1 --- /dev/null +++ b/app/views/layouts/system_log.html.erb @@ -0,0 +1,54 @@ +<%# +# To change this template, choose Tools | Templates +# and open the template in the editor. +%> + + + + + System Log + + + + + <%= yield %> + + \ No newline at end of file diff --git a/app/views/system_log/index.html.erb b/app/views/system_log/index.html.erb new file mode 100644 index 000000000..f5316c26b --- /dev/null +++ b/app/views/system_log/index.html.erb @@ -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%> +

日志

+ +
+
+ + +
+ +
+ <%=link_to '所有日志', :action=>:index %> | + <%=link_to '清空日志', {:action=>:clear}, {:confirm => '确认清除所有日志?'} %> | + <%=link_to_function '刷新', 'window.location.reload();' %> +
+
+
  
+<%= paginate @logs %>
+ +<% @logs.each do |log| %> + <% unless log.blank? %> +

<%= raw log %>


+ <% end %> +<%end %> + +<%= paginate @logs %> \ No newline at end of file diff --git a/test/functional/system_log_controller_test.rb b/test/functional/system_log_controller_test.rb new file mode 100644 index 000000000..0d8f6a181 --- /dev/null +++ b/test/functional/system_log_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SystemLogControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/system_log_helper_test.rb b/test/unit/helpers/system_log_helper_test.rb new file mode 100644 index 000000000..7cf025d9d --- /dev/null +++ b/test/unit/helpers/system_log_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SystemLogHelperTest < ActionView::TestCase +end