Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
de1c2e18c8
|
@ -32,18 +32,20 @@ class AdminController < ApplicationController
|
|||
end
|
||||
|
||||
def projects
|
||||
=begin
|
||||
@status = params[:status] || 1
|
||||
|
||||
scope = Project.status(@status).order('id asc')
|
||||
scope = Project.status(@status)
|
||||
scope = scope.like(params[:name]) if params[:name].present?
|
||||
@projects = scope.where(project_type: Project::ProjectType_project).all
|
||||
|
||||
@projects = scope.where(project_type: Project::ProjectType_project).reorder("created_on desc").all
|
||||
=end
|
||||
@projects = Project.like(@name).order('created_on desc')
|
||||
render :action => "projects", :layout => false if request.xhr?
|
||||
end
|
||||
|
||||
def courses
|
||||
@name = params[:name]
|
||||
@courses = Course.like(@name)
|
||||
@courses = Course.like(@name).order('created_at desc')
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
|
|
|
@ -422,11 +422,12 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def choose_user_course
|
||||
homework = HomeworkCommon.find params[:homework].to_i
|
||||
if !params[:search].nil?
|
||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||
@course = @user.courses.where(" #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||
@course = @user.courses.where("#{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||
else
|
||||
@course = @user.courses.select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||
@course = @user.courses.where("#{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||
end
|
||||
@search = params[:search]
|
||||
#这里仅仅是传递需要发送的资源id
|
||||
|
@ -531,7 +532,15 @@ class UsersController < ApplicationController
|
|||
elsif params[:type] == "2" #我的题库
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
end
|
||||
if params[:property] && params[:property] == "1"
|
||||
@homeworks = @homeworks.where("homework_type = 1").reorder("created_at desc")
|
||||
elsif params[:property] && params[:property] == "2"
|
||||
@homeworks = @homeworks.where("homework_type = 2").reorder("created_at desc")
|
||||
elsif params[:property] && params[:property] == "3"
|
||||
@homeworks = @homeworks.where("homework_type = 3").reorder("created_at desc")
|
||||
end
|
||||
@type = params[:type]
|
||||
@property = params[:property]
|
||||
@limit = 15
|
||||
@is_remote = true
|
||||
@hw_count = @homeworks.count
|
||||
|
@ -559,10 +568,21 @@ class UsersController < ApplicationController
|
|||
if(params[:type].blank? || params[:type] == "1") #全部
|
||||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("created_at desc")
|
||||
all_homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'")
|
||||
all_user_ids = all_homeworks.map{|hw| hw.user_id}
|
||||
user_str_ids = search_user_by_name all_user_ids, search
|
||||
user_ids = user_str_ids.empty? ? "(-1)" : "(" + user_str_ids.join(",") + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%' or user_id in #{user_ids})").order("created_at desc")
|
||||
elsif params[:type] == "2" #课程资源
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("created_at desc")
|
||||
end
|
||||
if params[:property] && params[:property] == "1"
|
||||
@homeworks = @homeworks.where("homework_type = 1").reorder("created_at desc")
|
||||
elsif params[:property] && params[:property] == "2"
|
||||
@homeworks = @homeworks.where("homework_type = 2").reorder("created_at desc")
|
||||
elsif params[:property] && params[:property] == "3"
|
||||
@homeworks = @homeworks.where("homework_type = 3").reorder("created_at desc")
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 15
|
||||
@is_remote = true
|
||||
|
|
|
@ -661,4 +661,16 @@ module UsersHelper
|
|||
type
|
||||
end
|
||||
|
||||
#根据姓名搜索用户
|
||||
def search_user_by_name user_ids, name
|
||||
result_ids = []
|
||||
user_ids.each do |user_id|
|
||||
user = User.find user_id
|
||||
username = user.lastname.to_s.downcase + user.firstname.to_s.downcase
|
||||
if username.include?(name)
|
||||
result_ids << user_id
|
||||
end
|
||||
end
|
||||
result_ids
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% project_tree(@projects) do |project, level| %>
|
||||
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
|
||||
<% @projects.each do |project| %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= project.id %>
|
||||
</td>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">
|
||||
课程讨论区
|
||||
课程问答区
|
||||
</div>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f12 c_blue02 ml10 fn" %>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") if User.current.member_of_course?(@course) && @course.boards.first %>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show_nav?(course_feedback_count) %>
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
<div class="subNav">
|
||||
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
|
||||
<%= link_to "(#{@course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") if User.current.member_of_course?(@course) && @course.boards.first %>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless show_nav?(course_feedback_count) %>
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
<div class="cl"></div>
|
||||
<% if activity.student_works.count != 0 %>
|
||||
<% sw = activity.student_works.reorder("created_at desc").first %>
|
||||
<div class="mt10 homepagePostDeadline">
|
||||
<div class="mt10 homepagePostDeadline mb10">
|
||||
# <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -139,30 +139,36 @@
|
|||
<%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
|
||||
<% unless student_work_scores.empty? %>
|
||||
<% last_score = student_work_scores.first %>
|
||||
<div class="mt10">
|
||||
<div>
|
||||
<p class="mb10 fontGrey2"># <%=time_from_now last_score.created_at %>
|
||||
<%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
|
||||
</p>
|
||||
<% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
|
||||
<% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
|
||||
<% student_works.each_with_index do |sw, i| %>
|
||||
<div class="fl mr10 w100" style="text-align:center;">
|
||||
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
|
||||
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p>
|
||||
</a>
|
||||
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
|
||||
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score<0 ? 0 : score) %>分</span></p>
|
||||
</div>
|
||||
<% if i == 4 %>
|
||||
<% break %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if student_works.count > 5 %>
|
||||
<%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<% if activity.homework_type != 2 %>
|
||||
<% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
|
||||
<% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
|
||||
<% else %>
|
||||
<% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
|
||||
<% end %>
|
||||
<% student_works.each_with_index do |sw, i| %>
|
||||
<div class="fl mr10 w100" style="text-align:center;">
|
||||
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
|
||||
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p>
|
||||
</a>
|
||||
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
|
||||
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score<0 ? 0 : score) %>分</span></p>
|
||||
</div>
|
||||
<% if i == 4 %>
|
||||
<% break %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if student_works.count > 5 %>
|
||||
<%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
|
||||
|
@ -239,7 +245,8 @@
|
|||
<% end %>
|
||||
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
|
||||
<li>
|
||||
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
|
||||
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink",
|
||||
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品",:remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
|
||||
<% end %>
|
||||
TO
|
||||
<%= link_to activity.course.name.to_s+" | 课程讨论区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
|
||||
<%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
|
||||
</div>
|
||||
<div class="homepagePostTitle hidden m_w530 fl">
|
||||
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
|
||||
|
|
|
@ -41,12 +41,12 @@
|
|||
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %>
|
||||
<% end %>
|
||||
<div>
|
||||
<input type="text" name="student_work[name]" id="student_work_name" placeholder="请简洁的概括作品的功能或特性" class="InputBox W700" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">
|
||||
<input type="text" name="student_work[name]" id="student_work_name" placeholder="请输入作品名称" class="InputBox W700" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_name_span" class="c_red mb10"></p>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<textarea name="student_work[description]" id="student_work_description" placeholder="请介绍你的作品" class="InputBox W700 H150" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%= @work.description%></textarea>
|
||||
<textarea name="student_work[description]" id="student_work_description" placeholder="请输入作品描述" class="InputBox W700 H150" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%= @work.description%></textarea>
|
||||
<script>
|
||||
var text = document.getElementById("student_work_description");
|
||||
autoTextarea(text);// 调用
|
||||
|
|
|
@ -127,12 +127,12 @@
|
|||
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %>
|
||||
<% end %>
|
||||
<div>
|
||||
<%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %>
|
||||
<%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请输入作品名称", :onkeyup => "regexStudentWorkName();" %>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_name_span" class="c_red mb10"></p>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请介绍你的作品", :onkeyup => "regexStudentWorkDescription();"%>
|
||||
<%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请输入作品描述", :onkeyup => "regexStudentWorkDescription();"%>
|
||||
<script>
|
||||
var text = document.getElementById("student_work_description");
|
||||
autoTextarea(text);// 调用
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
<div class="cl"></div>
|
||||
<% if activity.student_works.count != 0 %>
|
||||
<% sw = activity.student_works.reorder("created_at desc").first %>
|
||||
<div class="mt10 homepagePostDeadline">
|
||||
<div class="mt10 homepagePostDeadline mb10">
|
||||
# <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -138,30 +138,36 @@
|
|||
<% student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
|
||||
<% unless student_work_scores.empty? %>
|
||||
<% last_score = student_work_scores.first %>
|
||||
<div class="mt10">
|
||||
<div>
|
||||
<p class="mb10 fontGrey2"># <%=time_from_now last_score.created_at %>
|
||||
<%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
|
||||
</p>
|
||||
<% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
|
||||
<% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
|
||||
<% student_works.each_with_index do |sw, i| %>
|
||||
<div class="fl mr10 w100" style="text-align:center;">
|
||||
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
|
||||
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p>
|
||||
</a>
|
||||
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
|
||||
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score<0 ? 0 : score) %>分</span></p>
|
||||
</div>
|
||||
<% if i == 4 %>
|
||||
<% break %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if student_works.count > 5 %>
|
||||
<%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<% if activity.homework_type != 2 %>
|
||||
<% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
|
||||
<% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
|
||||
<% else %>
|
||||
<% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
|
||||
<% end %>
|
||||
<% student_works.each_with_index do |sw, i| %>
|
||||
<div class="fl mr10 w100" style="text-align:center;">
|
||||
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
|
||||
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p>
|
||||
</a>
|
||||
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
|
||||
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score<0 ? 0 : score) %>分</span></p>
|
||||
</div>
|
||||
<% if i == 4 %>
|
||||
<% break %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if student_works.count > 5 %>
|
||||
<%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
|
||||
|
@ -238,7 +244,8 @@
|
|||
<% end %>
|
||||
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
|
||||
<li>
|
||||
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
|
||||
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink",
|
||||
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
TO
|
||||
<%= link_to activity.course.name.to_s+" | 课程讨论区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
|
||||
<%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
|
||||
</div>
|
||||
<div class="homepagePostTitle hidden m_w530 fl">
|
||||
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<div id="popbox02">
|
||||
<div class="ni_con">
|
||||
<p style="display: block;font-size: 14px;margin-left: 30px;margin-top: 20px;">
|
||||
题目已发送到目标课程的作业列表,但需要您设置发布和截止时间,以激活相应作业,谢谢!
|
||||
</p>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:void(0)" class="tijiao c_white ml45" onclick="hideModal();">
|
||||
确 定
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,29 @@
|
|||
<input type="text" name="search" placeholder="输入作业、老师姓名的关键词进行搜索" class="subject-pop-search fr" />
|
||||
<script type="text/javascript">
|
||||
var lastSearchCondition = '';
|
||||
var count = 0;
|
||||
function search_hws(e){
|
||||
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
lastSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'users', :action => 'user_search_homeworks') %>'+'?name='+ e.target.value+'&type=<%=type %>&is_import=<%=is_import %>&property=<%=property %>',
|
||||
type:'get'
|
||||
});
|
||||
}
|
||||
|
||||
function throttle(method,context,e){
|
||||
clearTimeout(method.tId);
|
||||
method.tId=setTimeout(function(){
|
||||
method.call(context,e);
|
||||
},500);
|
||||
}
|
||||
|
||||
//查询项目
|
||||
$("input[name='search']").on('input', function (e) {
|
||||
throttle(search_hws,window,e);
|
||||
});
|
||||
|
||||
</script>
|
|
@ -1,4 +1,4 @@
|
|||
<input type="text" name="search" placeholder="输入关键词进行搜索" class="subject-pop-search fr" />
|
||||
<input type="text" name="search" placeholder="输入作业、老师姓名的关键词进行搜索" class="subject-pop-search fr" />
|
||||
<script type="text/javascript">
|
||||
var lastSearchCondition = '';
|
||||
var count = 0;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<span title="<%= homework.name%>"><%= homework.name%></span>
|
||||
</label>
|
||||
</li>
|
||||
<li class="subject-pop-from fl hidden">攻城狮</li>
|
||||
<li class="subject-pop-from fl hidden"><span title="<%=homework.course.name %>(<%=current_time_and_term(homework.course) %>)"><%=homework.course.name %>(<%=current_time_and_term_short(homework.course) %>)</span></li>
|
||||
<li class="subject-pop-type fl">
|
||||
<% case homework.homework_type %>
|
||||
<% when 1 %>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<div class="w985"> <a href="javascript:void(0);" class="popup-close" onclick="hideModal()"></a>
|
||||
<div class="f16 fb fontBlue mb10">选用题库中的题目</div>
|
||||
<div class="subject-list fl mr10">
|
||||
<a href="<%= user_homework_type_user_path(@user,:is_import => 1) %>" id="public_homeworks_choose" class="subjectChoose chooseActive fl" data-remote="true">公共题库</a>
|
||||
<a href="<%= user_homework_type_user_path(@user,:type=>'2',:is_import => 1) %>" id="user_homeworks_choose" class="subjectChoose fl" data-remote="true">我的题库</a>
|
||||
<a href="<%= user_homework_type_user_path(@user,:is_import => 1) %>" id="public_homeworks_choose" class="resource-tab resource-tab-active fl" data-remote="true">公共题库</a>
|
||||
<a href="<%= user_homework_type_user_path(@user,:type=>'2',:is_import => 1) %>" id="user_homeworks_choose" class="resource-tab fl" data-remote="true">我的题库</a>
|
||||
<div id="homework_search_input">
|
||||
<%=render :partial=>'homework_search_input', :locals=>{:type => @type,:is_import => 1} %>
|
||||
</div>
|
||||
|
@ -43,11 +43,11 @@
|
|||
</div>
|
||||
<script type="text/javascript">
|
||||
$("#public_homeworks_choose").click(function(){
|
||||
$(this).toggleClass("choose-active");
|
||||
$("#user_homeworks_choose").toggleClass("choose-active");
|
||||
$(this).toggleClass("resource-tab-active");
|
||||
$("#user_homeworks_choose").toggleClass("resource-tab-active");
|
||||
});
|
||||
$("#user_homeworks_choose").click(function(){
|
||||
$(this).toggleClass("choose-active");
|
||||
$("#public_homeworks_choose").toggleClass("choose-active");
|
||||
$(this).toggleClass("resource-tab-active");
|
||||
$("#public_homeworks_choose").toggleClass("resource-tab-active");
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
<div class="cl"></div>
|
||||
<% if homework_common.student_works.count != 0 %>
|
||||
<% sw = homework_common.student_works.reorder("created_at desc").first %>
|
||||
<div class="mt10 homepagePostDeadline">
|
||||
<div class="mt10 homepagePostDeadline mb10">
|
||||
# <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -142,30 +142,36 @@
|
|||
<%# student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
|
||||
<% unless student_work_scores.empty? %>
|
||||
<% last_score = student_work_scores.first %>
|
||||
<div class="mt10">
|
||||
<div>
|
||||
<p class="mb10 fontGrey2"># <%=time_from_now last_score.created_at %>
|
||||
<%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
|
||||
</p>
|
||||
<% ids = '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
|
||||
<% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
|
||||
<% student_works.each_with_index do |sw, i| %>
|
||||
<div class="fl mr10 w100" style="text-align:center;">
|
||||
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => homework_common.id), :alt => "学生头像" %>
|
||||
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => homework_common.id)%></p>
|
||||
</a>
|
||||
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
|
||||
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score<0 ? 0 : score) %>分</span></p>
|
||||
</div>
|
||||
<% if i == 4 %>
|
||||
<% break %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if student_works.count > 5%>
|
||||
<%= link_to "更多>>", student_work_index_path(:homework => homework_common.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<% if homework_common.homework_type != 2 %>
|
||||
<% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
|
||||
<% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where("student_works.id in #{ids}").order("score desc") %>
|
||||
<% else %>
|
||||
<% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
|
||||
<% end %>
|
||||
<% student_works.each_with_index do |sw, i| %>
|
||||
<div class="fl mr10 w100" style="text-align:center;">
|
||||
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => homework_common.id), :alt => "学生头像" %>
|
||||
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => homework_common.id)%></p>
|
||||
</a>
|
||||
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
|
||||
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score<0 ? 0 : score) %>分</span></p>
|
||||
</div>
|
||||
<% if i == 4 %>
|
||||
<% break %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if student_works.count > 5%>
|
||||
<%= link_to "更多>>", student_work_index_path(:homework => homework_common.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>
|
||||
|
@ -244,7 +250,8 @@
|
|||
<% end %>
|
||||
<% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
|
||||
<li>
|
||||
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink", :remote => true)%>
|
||||
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(homework_common,:is_in_course => is_in_course),:class => "postOptionLink",
|
||||
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if (homework_common.anonymous_comment == 1 && homework_common.is_open == 0) || (homework_common.anonymous_comment == 0 && comment_status == 3 && homework_common.is_open == 0) %>
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
<div id="homework_editor" style="display: <%= edit_mode ? 'block':'none'%>">
|
||||
<div class="mt10">
|
||||
<% if edit_mode %>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='homework_textarea' name="homework_common[description]"><%=homework.description.html_safe %></textarea>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='homework_textarea' name="homework_common[description]"><%=homework.description %></textarea>
|
||||
<%#= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %>
|
||||
<% else %>
|
||||
<%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
|
||||
|
|
|
@ -1 +1,9 @@
|
|||
$("#subject_count_homework_<%=@homework.id %>").html(<%= @homework.quotes %>);
|
||||
$("#subject_count_homework_<%=@homework.id %>").html(<%= @homework.quotes %>);
|
||||
$("#ajax-modal").html("<%=escape_javascript(render :partial => 'homework_post_notice') %>");
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","50%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
|
@ -7,5 +7,9 @@ $("#homework_search_input").html("<%=escape_javascript(render :partial=>'homewor
|
|||
$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
|
||||
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
|
||||
$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type,:is_import=>@is_import}) %>");
|
||||
$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_repository_search', :locals=>{:type=>@type,:is_import=>@is_import,:property=>@property}) %>");
|
||||
$("#homework_type_all").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 0) %>');
|
||||
$("#homework_type_nor").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 1) %>');
|
||||
$("#homework_type_pro").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 2) %>');
|
||||
$("#homework_type_gro").attr('href','<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 3) %>');
|
||||
<% end %>
|
||||
|
|
|
@ -20,10 +20,11 @@
|
|||
if(check.length == 0) {
|
||||
$("#choose_homework_notice").text("请先选择一个作业");
|
||||
} else {
|
||||
var hw_id = $('input[name="checkMenu"]:checked').val();
|
||||
$("#choose_homework_notice").text("");
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/users/' + user_id + '/choose_user_course',
|
||||
url: '/users/' + user_id + '/choose_user_course?homework='+hw_id,
|
||||
data:{send_id:$('input[name="checkMenu"]:checked').val()}
|
||||
});
|
||||
}
|
||||
|
@ -45,10 +46,10 @@
|
|||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="resourcesType">
|
||||
<li> <a href="/users/8523/user_resource?type=1" class="resourcesTypeAll resourcesGrey" data-method="get" data-remote="true">全部</a> </li>
|
||||
<li> <a href="/users/8523/user_resource?type=2" class="homepagePostTypeAssignment postTypeGrey" data-method="get" data-remote="true">普通作业</a> </li>
|
||||
<li> <a href="/users/8523/user_resource?type=3" class="program-btn postTypeGrey" data-method="get" data-remote="true" style="white-space:nowrap;">编程作业</a> </li>
|
||||
<li> <a href="/users/8523/user_resource?type=5" class="group-btn resourcesGrey" data-method="get" data-remote="true">分组作业</a> </li>
|
||||
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 0) %>" id="homework_type_all" class="resourcesTypeAll resourcesGrey" data-method="get" data-remote="true">全部</a> </li>
|
||||
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 1) %>" id="homework_type_nor" class="homepagePostTypeAssignment postTypeGrey" data-method="get" data-remote="true">普通作业</a> </li>
|
||||
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 2) %>" id="homework_type_pro" class="program-btn postTypeGrey" data-method="get" data-remote="true" style="white-space:nowrap;">编程作业</a> </li>
|
||||
<li> <a href="<%= user_homework_type_user_path(@user,:type => @type,:is_import => 0,:property => 3) %>" id="homework_type_gro" class="group-btn resourcesGrey" data-method="get" data-remote="true">分组作业</a> </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -57,7 +58,7 @@
|
|||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div id="homework_search_input" class="mt10 fl">
|
||||
<%=render :partial=>'homework_search_input', :locals=>{:type => @type,:is_import => 0} %>
|
||||
<%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => @property} %>
|
||||
</div>
|
||||
<!--<form class="resourcesSearchloadBox mt10">
|
||||
<input type="text" name="serach" placeholder="输入题库关键词进行搜索" class="searchResource" />
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
|
||||
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
|
||||
/*$("#user_show_more_homework").replaceWith("<%#= escape_javascript( render :partial => 'users/user_homework_list',:locals => {:homework_commons => @homework_commons, :page => @page,:is_in_course => 0} )%>");*/
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ zh:
|
|||
label_course_new: 新建课程
|
||||
label_course_name: 课程名称
|
||||
|
||||
label_homework: 课程作业
|
||||
label_homework: 作业
|
||||
label_course_news: 课程通知
|
||||
label_course_mail_news_reply: 课程通知回复
|
||||
label_main_teacher: 主讲教师
|
||||
|
|
|
@ -614,7 +614,7 @@ zh:
|
|||
label_homework_info: 提交情况 #huang
|
||||
|
||||
label_course_news_description: '课程必须是高校正式开设的课程,或是围绕特定主题定期发布课程资料的公共开放课程;<br/>如果您想创建一个协作研究空间,请您前往“我的项目”页面创建项目,谢谢!'
|
||||
label_course_board: 讨论区
|
||||
label_course_board: 问答区
|
||||
label_version: 版本
|
||||
label_version_new: 新建版本
|
||||
|
||||
|
@ -1731,7 +1731,7 @@ zh:
|
|||
label_newbie_faq: '新手指引 & 问答'
|
||||
label_hot_project: '热门项目'
|
||||
label_borad_project: 项目讨论区
|
||||
label_borad_course: 课程讨论区
|
||||
label_borad_course: 课程问答区
|
||||
label_borad_org_subfield: 资源栏目讨论区
|
||||
view_borad_course: 课程讨论
|
||||
label_memo_create_succ: 发布成功
|
||||
|
|
|
@ -99,8 +99,6 @@ ActiveRecord::Schema.define(:version => 20160303103231) do
|
|||
t.integer "quotes"
|
||||
t.integer "version"
|
||||
t.integer "attachment_id"
|
||||
t.integer "is_publish", :default => 1
|
||||
t.date "publish_time"
|
||||
end
|
||||
|
||||
create_table "attachments", :force => true do |t|
|
||||
|
@ -1279,6 +1277,7 @@ ActiveRecord::Schema.define(:version => 20160303103231) do
|
|||
t.text "description"
|
||||
t.integer "creator_id"
|
||||
t.integer "home_id"
|
||||
t.string "domain"
|
||||
t.boolean "is_public"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
|
@ -1386,6 +1385,7 @@ ActiveRecord::Schema.define(:version => 20160303103231) do
|
|||
t.integer "changeset_num", :default => 0
|
||||
t.integer "board_message_num", :default => 0
|
||||
t.integer "board_num", :default => 0
|
||||
t.integer "act_num", :default => 0
|
||||
t.integer "attach_num", :default => 0
|
||||
t.datetime "commit_time"
|
||||
end
|
||||
|
|
|
@ -1125,3 +1125,7 @@ a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px s
|
|||
.h34 {height:34px;}
|
||||
.resource-tab {font-size:16px; color:#4d4d4d; width:70px; padding:5px 10px; display:inline-block; text-align:left; border-bottom:1px solid #ddd;}
|
||||
a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px solid #269ac9;}
|
||||
|
||||
a.group-btn{ background: url(../images/course/hwork_icon.png) -2px -58px no-repeat !important; height:20px; display:block; padding-left:23px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
|
||||
a.program-btn{background: url(../images/homepage_icon.png) -86px -393px no-repeat; width:30px; height:20px; display:block; padding-left:23px; color:#888888;}
|
||||
|
||||
|
|
Loading…
Reference in New Issue