admin界面添加精品课程页面,目前该页面中的精品课程是固定的
This commit is contained in:
parent
81f54e44b4
commit
bb8a6af13e
|
@ -49,6 +49,13 @@ class AdminController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def excellent_courses
|
||||
@courses = Course.where("is_excellent =? or excellent_option =?", 1, 1 )
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def users
|
||||
sort_init 'login', 'asc'
|
||||
sort_update %w(login firstname lastname mail admin created_on last_login_on)
|
||||
|
|
|
@ -71,6 +71,11 @@ module CoursesHelper
|
|||
project.members.count
|
||||
end
|
||||
|
||||
# 统计课程中作品的数量
|
||||
def student_works_num course
|
||||
StudentWork.find_by_sql("SELECT * FROM student_works WHERE homework_common_id IN (SELECT id FROM homework_commons WHERE course_id = '#{course.id}')").count
|
||||
end
|
||||
|
||||
# 返回教师数量,即roles表中定义的Manager
|
||||
def teacherCount project
|
||||
project ? project.members.count - studentCount(project).to_i : 0
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
<h3>
|
||||
<%=l(:label_excellent_courses_list)%>
|
||||
</h3>
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 25px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
课程名
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
主讲老师
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
学生数
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
作业数
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
作品数
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
资源数
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
帖子数
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
动态数
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @courses.each do |course| %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= course.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
|
||||
<span>
|
||||
<%= link_to(course.name, course_path(course.id)) %>
|
||||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= studentCount(course) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.homework_commons.count%>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= student_works_num(course) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= visable_attachemnts_incourse(course).count%>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", course.boards.first.id, nil).count %>
|
||||
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.course_activities.count%>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -1520,6 +1520,7 @@ en:
|
|||
label_submit_comments: Submit_comments
|
||||
label_course_empty_select: You have not selected course!
|
||||
label_enterprise_page_made: enterprise_page
|
||||
label_excellent_courses_list: excellent_courses
|
||||
|
||||
#api
|
||||
label_recently_updated_notification: Recently updated notification
|
||||
|
|
|
@ -483,6 +483,7 @@ zh:
|
|||
label_requirement: 需求
|
||||
label_new_course: 课程列表
|
||||
label_course_all: 课程列表
|
||||
label_excellent_courses_list: 精品课程列表
|
||||
label_teacher_all: 所有教师
|
||||
label_requirement_enterprise_list: 众包列表
|
||||
label_new_homework: 作业
|
||||
|
|
|
@ -933,6 +933,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'admin', :to => 'admin#index', :via => :get
|
||||
match 'admin/projects', :via => :get
|
||||
get 'admin/courses'
|
||||
get 'admin/excellent_courses'
|
||||
match 'admin/users', :via => :get
|
||||
match 'admin/messages', :via => :get
|
||||
match 'admin/first_page_made', as: :first_page_made
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160224074034) do
|
||||
ActiveRecord::Schema.define(:version => 20160225031230) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -2013,6 +2013,11 @@ ActiveRecord::Schema.define(:version => 20160224074034) do
|
|||
|
||||
add_index "wikis", ["project_id"], :name => "wikis_project_id"
|
||||
|
||||
create_table "wlcs", :force => true do |t|
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "workflows", :force => true do |t|
|
||||
t.integer "tracker_id", :default => 0, :null => false
|
||||
t.integer "old_status_id", :default => 0, :null => false
|
||||
|
|
|
@ -391,6 +391,7 @@ Redmine::MenuManager.map :admin_menu do |menu|
|
|||
menu.push :messages_list, {:controller => 'admin', :action => 'messages_list'}, :caption => :label_message_plural
|
||||
menu.push :notices, {:controller => 'admin', :action => 'notices'}, :caption => :label_notification_list
|
||||
menu.push :latest_login_users, {:controller => 'admin', :action => 'latest_login_users'}, :caption => :label_latest_login_user_list
|
||||
menu.push :excellent_courses, {:controller => 'admin', :action => 'excellent_courses'}, :caption => :label_excellent_courses_list
|
||||
menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue