Merge branch 'cxt_course' into develop
This commit is contained in:
commit
bca0a4bf39
|
@ -63,6 +63,33 @@ class AdminController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#精品课程下的全部课程
|
||||
def excellent_all_courses
|
||||
@name = params[:name]
|
||||
@courses = Course.like(@name).order('created_at desc')
|
||||
@courses = paginateHelper @courses,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#设为精品
|
||||
def set_excellent_course
|
||||
@course = Course.find params[:id]
|
||||
unless @course.nil?
|
||||
if @course.is_excellent == 1 || @course.excellent_option == 1
|
||||
@course.update_column('is_excellent', 0)
|
||||
@course.update_column('excellent_option', 0)
|
||||
else
|
||||
@course.update_column('is_excellent', 1)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#管理员界面课程资源列表
|
||||
def course_resource_list
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ class CoursesController < ApplicationController
|
|||
|
||||
def export_course_member_excel
|
||||
@all_members = student_homework_score(0,0,0,"desc")
|
||||
@homeworks = @course.homework_commons.order("created_at desc")
|
||||
@homeworks = @course.homework_commons.order("created_at asc")
|
||||
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
|
||||
|
||||
respond_to do |format|
|
||||
|
|
|
@ -18,10 +18,10 @@ class HomeworkCommonController < ApplicationController
|
|||
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
|
||||
if @is_teacher
|
||||
@homeworks = @course.homework_commons.order("updated_at desc").limit(10).offset(@page * 10)
|
||||
@homework_commons = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
|
||||
@homework_commons = @course.homework_commons.order("created_at desc")
|
||||
else
|
||||
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("updated_at desc").limit(10).offset(@page * 10)
|
||||
@homework_commons = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
|
||||
@homework_commons = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
end
|
||||
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
|
||||
@is_new = params[:is_new]
|
||||
|
|
|
@ -145,7 +145,7 @@ class Member < ActiveRecord::Base
|
|||
|
||||
#当前课程的作业列表
|
||||
def homework_common_list
|
||||
HomeworkCommon.where(:course_id => self.course_id)
|
||||
HomeworkCommon.where("course_id = ? and publish_time is not null and publish_time <= '#{Date.today}'", self.course_id)
|
||||
end
|
||||
|
||||
#当前学生在指定作业内的得分
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<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>
|
||||
<td class="buttons">
|
||||
<%= link_to( course.is_excellent == 1 || course.excellent_option == 1 ? "取消精品" : "设为精品", { :controller => 'admin', :action => 'set_excellent_course', :id => course.id },:remote=>true, :class => 'icon-del') %>
|
||||
</td>
|
|
@ -0,0 +1,7 @@
|
|||
<div class="tabs">
|
||||
<ul>
|
||||
<li><%= link_to '精品课程', {:action => 'excellent_courses'}, class: "#{current_page?(excellent_courses_path)? 'selected' : nil }" %></li>
|
||||
<li><%= link_to '全部课程', {:action => 'excellent_all_courses'}, class: "#{current_page?(excellent_all_courses_path)? 'selected' : nil }" %></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
|
@ -13,9 +13,7 @@
|
|||
</label>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '课程名称' %>
|
||||
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||
<a class="icon icon-reload" onclick="$('#name').val('')" style="cursor: pointer;text-decoration: none;">
|
||||
<%= l(:button_clear)%>
|
||||
</a>
|
||||
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'courses'},:remote => true, :class => 'icon icon-reload' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
|
||||
<h3>
|
||||
精品课程列表
|
||||
</h3>
|
||||
<%= render 'tab_excellent_courses' %>
|
||||
|
||||
<h3>
|
||||
全部课程列表
|
||||
</h3>
|
||||
|
||||
<%= form_tag({}, :method => :get) do %>
|
||||
<fieldset>
|
||||
<label for='name'>
|
||||
课程:
|
||||
</label>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '课程名称' %>
|
||||
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'excellent_all_courses'}, :class => 'icon icon-reload' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
<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: 50px;">
|
||||
帖子数
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
动态数
|
||||
</th>
|
||||
<th style="width: 40px;">
|
||||
</tr>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @courses.each do |course| %>
|
||||
<tr class="<%= cycle("odd", "even") %>" id="tr_<%= course.id %>">
|
||||
<%= render :partial => 'course_detail_tr', :locals => {:course => course} %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_excellent_courses_list)) -%>
|
|
@ -1,3 +1,9 @@
|
|||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
|
||||
<h3>
|
||||
<%=l(:label_excellent_courses_list)%>
|
||||
</h3>
|
||||
<%= render 'tab_excellent_courses' %>
|
||||
|
||||
<h3>
|
||||
<%=l(:label_excellent_courses_list)%>
|
||||
</h3>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#tr_<%=@course.id %>").html("<%=escape_javascript(render :partial => 'course_detail_tr', :locals => {:course => @course}) %>");
|
|
@ -28,7 +28,7 @@
|
|||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<li><span class="c_blue03 w280">作业积分(总分)</span><span class="c_red w70"><%= (@member_score.student_work_score_sum).first.score %></span></li>
|
||||
<li><span class="c_blue03 w280">作业积分(总分)</span><span class="c_red w70"><%= format("%0.2f",(@member_score.student_work_score_sum).first.score) %></span></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
<div id="menu_r" class="NewsBannerName" style="margin-bottom: -10px;">
|
||||
<ul class="menu_r b_w" style="padding-left: 0px; margin-top: -5px;">
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="parent" style="font-size:16px; color:#4b4b4b; font-weight: normal; padding-left: 0px;">作业</a>
|
||||
<ul>
|
||||
<a href="javascript:void(0);" class="menu_arrow" style="font-size:16px; color:#4b4b4b; font-weight: normal; padding-left: 0px;">作业</a>
|
||||
<ul style="max-height:240px; overflow-y:auto; overflow-x:hidden;">
|
||||
<% @homework_commons.each_with_index do |homework_common,index |%>
|
||||
<li class="pr10">
|
||||
<%= link_to "作业#{@homework_commons.count - index}:#{homework_common.name}",student_work_index_path(:homework => homework_common.id)%>
|
||||
|
|
|
@ -952,7 +952,9 @@ RedmineApp::Application.routes.draw do
|
|||
match 'admin', :to => 'admin#index', :via => :get
|
||||
match 'admin/projects', :via => :get
|
||||
get 'admin/courses'
|
||||
get 'admin/excellent_courses'
|
||||
get 'admin/excellent_courses', as: :excellent_courses
|
||||
get 'admin/excellent_all_courses', as: :excellent_all_courses
|
||||
match 'admin/set_excellent_course/:id', :to => 'admin#set_excellent_course'
|
||||
get 'admin/course_resource_list'
|
||||
get 'admin/project_resource_list'
|
||||
match 'admin/users', :via => :get
|
||||
|
|
|
@ -737,6 +737,8 @@ div#menu_r ul a.parent {background: url(../images/item.png) -30px -30px no-rep
|
|||
div#menu_r ul a.parent:hover {background: url(../images/item.png) -30px -60px no-repeat;}
|
||||
div#menu_r ul ul a.parent {background: url(../images/item.png) -20px 6px no-repeat;}
|
||||
div#menu_r ul ul a.parent:hover {background: url(../images/item.png) -20px -11px no-repeat;}
|
||||
.menu_arrow {background: url(../images/sort_desc.png) 40px 17px no-repeat; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
|
||||
.menu_arrow:hover {background: url(../images/sort_asc.png) 40px 17px no-repeat;}
|
||||
/* menu::level1 */
|
||||
div#menu_r a { padding: 5px 12px 0 10px;line-height: 30px; color: #fff;}
|
||||
/*div#menu_r li { background: url(images/main-delimiter.png) 98% 4px no-repeat; }*/
|
||||
|
|
Loading…
Reference in New Issue