Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
2bdf3d573b
|
@ -58,9 +58,10 @@ class HomeworkCommonController < ApplicationController
|
|||
|
||||
def edit
|
||||
@user = User.current
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@is_in_course = params[:is_in_course]
|
||||
@is_manage = params[:is_manage]
|
||||
@course_activity = params[:course_activity].to_i
|
||||
if @is_in_course == 1 || @course_activity == 1
|
||||
if @is_in_course.to_i == 1 || @course_activity == 1
|
||||
@left_nav_type = 3
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
|
@ -144,7 +145,11 @@ class HomeworkCommonController < ApplicationController
|
|||
@homework_detail_programing.save if @homework_detail_programing
|
||||
@homework_detail_group.save if @homework_detail_group
|
||||
|
||||
if params[:is_in_course] == "1"
|
||||
if params[:is_manage] == "1"
|
||||
redirect_to manage_or_receive_homeworks_user_path(User.current.id)
|
||||
elsif params[:is_manage] == "2"
|
||||
redirect_to my_homeworks_user_path(User.current.id)
|
||||
elsif params[:is_in_course] == "1"
|
||||
redirect_to homework_common_index_path(:course => @course.id)
|
||||
elsif params[:is_in_course] == "0"
|
||||
redirect_to user_homeworks_user_path(User.current.id)
|
||||
|
|
|
@ -775,30 +775,33 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
def retry_work
|
||||
if @work.destroy
|
||||
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
|
||||
pros = @work.student_work_projects.where("is_leader = 0")
|
||||
pros.each do |pro|
|
||||
pro.destroy
|
||||
end
|
||||
project = @work.student_work_projects.where("is_leader = 1").first
|
||||
project.update_attributes(:student_work_id => nil)
|
||||
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0
|
||||
@work.student_work_projects.each do |pro2|
|
||||
pro2.destroy
|
||||
if @homework.homework_type == 3
|
||||
if @work.destroy
|
||||
if @homework.homework_detail_group.base_on_project == 1
|
||||
pros = @work.student_work_projects.where("is_leader = 0")
|
||||
pros.each do |pro|
|
||||
pro.destroy
|
||||
end
|
||||
project = @work.student_work_projects.where("is_leader = 1").first
|
||||
project.update_attributes(:student_work_id => nil)
|
||||
elsif @homework.homework_detail_group.base_on_project == 0
|
||||
@work.student_work_projects.each do |pro2|
|
||||
pro2.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
@student_work = StudentWork.new
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
elsif @homework.homework_type == 1
|
||||
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0)
|
||||
end
|
||||
@student_work = StudentWork.new
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#添加评分,已评分则为修改评分
|
||||
def add_score
|
||||
@is_last = params[:is_last] == "true"
|
||||
render_403 and return if User.current == @work.user #不可以匿评自己的作品
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
#老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分
|
||||
render_403 and return unless @is_teacher || @homework.homework_detail_manual.comment_status == 2
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#学生提交作品表
|
||||
class StudentWork < ActiveRecord::Base
|
||||
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test, :simi_id, :simi_value
|
||||
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test, :simi_id, :simi_value, :work_status
|
||||
|
||||
belongs_to :homework_common
|
||||
belongs_to :user
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script type="text/javascript">
|
||||
<% if @is_in_course == 1 || @course_activity == 1 %>
|
||||
<% if @is_in_course.to_i == 1 || @course_activity == 1 %>
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
|
@ -19,13 +19,17 @@
|
|||
$("#homework_editor").toggle();
|
||||
}
|
||||
function cancel_edit(){
|
||||
<% if @is_in_course == 1 %>
|
||||
<% if @is_manage.to_i == 1 %>
|
||||
window.location.href='<%=manage_or_receive_homeworks_user_path(User.current.id) %>';
|
||||
<% elsif @is_manage.to_i == 2 %>
|
||||
window.location.href='<%=my_homeworks_user_path(User.current.id) %>';
|
||||
<% elsif @is_in_course.to_i == 1 %>
|
||||
window.location.href='<%=homework_common_index_path(:course => @course.id) %>';
|
||||
<% elsif @is_in_course == 0 %>
|
||||
<% elsif @is_in_course.to_i == 0 %>
|
||||
window.location.href='<%=user_homeworks_user_path(User.current.id) %>';
|
||||
<% elsif @is_in_course == -1 && @course_activity == 0 %>
|
||||
<% elsif @is_in_course.to_i == -1 && @course_activity == 0 %>
|
||||
window.location.href='<%=user_path(User.current.id) %>';
|
||||
<% elsif @is_in_course == -1 && @course_activity == 1 %>
|
||||
<% elsif @is_in_course.to_i == -1 && @course_activity == 1 %>
|
||||
window.location.href='<%=course_path(@course.id) %>';
|
||||
<% end %>
|
||||
}
|
||||
|
@ -40,6 +44,7 @@
|
|||
<%= form_for @homework do |f| %>
|
||||
<input type="text" name="is_in_course" class="none" value="<%= @is_in_course%>"/>
|
||||
<input type="text" name="course_activity" class="none" value="<%= @course_activity%>"/>
|
||||
<input type="text" name="is_manage" class="none" value="<%= @is_manage%>"/>
|
||||
<div id="HomeWorkCon">
|
||||
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
|
||||
</div>
|
||||
|
|
|
@ -94,6 +94,26 @@
|
|||
<span><%= applied_project_tip_header(ma) %>以“<%= applied_project_message_type(ma.role) %>”身份加入<% project = Project.find(ma.project_id) %>
|
||||
<%= link_to project.name, project_path(ma.project_id), :class => "link-blue", :target => '_blank', :title => "#{project.name}" %>
|
||||
</span>
|
||||
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 0 %>
|
||||
<li>
|
||||
<% content = '<span class="shadowbox_news_user">'+User.where("id=?", ma.applied_user_id).first.show_name+' </span>提交了申请:添加新的单位:'+"“"+ma.name+"”" %>
|
||||
<%= link_to content.html_safe, unapplied_schools_path(:flag => 1, :applied_message_id => ma.id), :title => "#{User.where("id=?", ma.applied_user_id).first.show_name}提交了申请:添加新的单位“#{ma.name}”", :target => '_blank' %>
|
||||
</li>
|
||||
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 1 %>
|
||||
<li>
|
||||
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.name}”的申请,已通过审核。谢谢!" %>
|
||||
<%= link_to content.html_safe, { :controller=> "my",:action => "account",:flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,已通过审核。谢谢!", :target => '_blank'%>
|
||||
</li>
|
||||
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 2 %>
|
||||
<li>
|
||||
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.applied.name}”的申请,因名称不符合规范,系统已将其更改为“#{ma.name}”。谢谢!" %>
|
||||
<%= link_to content.html_safe, { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.applied.name}”的申请,因名称不符合规范,系统已将其更改为“#{ma.name}”。谢谢!", :target => '_blank'%>
|
||||
</li>
|
||||
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 3 %>
|
||||
<li>
|
||||
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!" %>
|
||||
<%= link_to content.html_safe, { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!", :target => '_blank'%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% elsif ma.class == ForgeMessage %>
|
||||
<% if ma.forge_message_type == "AppliedProject" %>
|
||||
|
@ -142,28 +162,6 @@
|
|||
<% content = '<span class="shadowbox_news_user">'+ma.author.show_name+' </span>提到了你:'+ma.subject.html_safe %>
|
||||
<li><%=link_to content.html_safe, ma.url, :title => ma.author.show_name+' 提到了你:'+ma.subject.html_safe, :target => '_blank' %></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == AppliedMessage %>
|
||||
<% if ma.applied_type == "ApplyAddSchools" && ma.status == 0 %>
|
||||
<li>
|
||||
<% content = '<span class="shadowbox_news_user">'+User.where("id=?", ma.applied_user_id).first.show_name+' </span>提交了申请:添加新的单位:'+"“"+ma.name+"”" %>
|
||||
<%= link_to content.html_safe, unapplied_schools_path(:flag => 1, :applied_message_id => ma.id), :title => "#{User.where("id=?", ma.applied_user_id).first.show_name}提交了申请:添加新的单位“#{ma.name}”", :target => '_blank' %>
|
||||
</li>
|
||||
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 1 %>
|
||||
<li>
|
||||
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.name}”的申请,已通过审核。谢谢!" %>
|
||||
<%= link_to content.html_safe, { :controller=> "my",:action => "account",:flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,已通过审核。谢谢!", :target => '_blank'%>
|
||||
</li>
|
||||
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 2 %>
|
||||
<li>
|
||||
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.applied.name}”的申请,因名称不符合规范,系统已将其更改为“#{ma.name}”。谢谢!" %>
|
||||
<%= link_to content.html_safe, { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.applied.name}”的申请,因名称不符合规范,系统已将其更改为“#{ma.name}”。谢谢!", :target => '_blank'%>
|
||||
</li>
|
||||
<% elsif ma.applied_type == "ApplyAddSchools" && ma.status == 3 %>
|
||||
<li>
|
||||
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!" %>
|
||||
<%= link_to content.html_safe, { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!", :target => '_blank'%>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<span class="fontGrey3 fb" style="font-size:13px;"><img src="/images/warning.png" width="16" class="mr5 mt2 fl"><%= @request.source_branch %>没有新内容可以合并至<%= @request.target_branch %></span><br />
|
||||
<p class="fontGrey2 mt5">请将新改动提交至源分支或者切换到其它目标分支</p>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<% if @request.state == "merged" %>
|
||||
<div class="merge-commit-option mt15">
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</p>
|
||||
</div>
|
||||
<% if homework.student_works.has_committed.count == 0 %>
|
||||
<%= link_to '编 辑'.html_safe, edit_homework_common_path(homework), :class => 'hw_btn_green fr mt5', :target => '_blank' %>
|
||||
<%= link_to '编 辑'.html_safe, edit_homework_common_path(homework, :is_manage => is_manage), :class => 'hw_btn_green fr mt5', :target => '_blank' %>
|
||||
<% else %>
|
||||
<%= link_to '评 分'.html_safe, student_work_index_path(:homework => homework.id), :class => 'hw_btn_green fr mt5', :target => '_blank' %>
|
||||
<% end %>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<span class="sy_cgrey fl"><%= @manage_pre ? '我管理的作业:' : '我收到的的作业:' %></span>
|
||||
<%= link_to '查看更多', @manage_pre ? manage_or_receive_homeworks_user_path(@user) : manage_or_receive_homeworks_user_path(@user, :type =>2), :class => 'sy_cgrey fr mr15' %>
|
||||
</div>
|
||||
<%= render :partial => "#{@manage_pre ? 'manage_homework_list' : 'receive_homework_list'}", :locals => {:homeworks => @manage_pre ? @manage_homeworks : @receive_homeworks} %>
|
||||
<%= render :partial => "#{@manage_pre ? 'manage_homework_list' : 'receive_homework_list'}", :locals => {:homeworks => @manage_pre ? @manage_homeworks : @receive_homeworks, :is_manage => 2} %>
|
||||
|
||||
<div class="hw_tab_top clear">
|
||||
<span class="sy_cgrey fl"><%= @manage_pre ? '我收到的的作业:' : '我管理的作业:' %></span>
|
||||
<%= link_to '查看更多', @manage_pre ? manage_or_receive_homeworks_user_path(@user, :type =>2) : manage_or_receive_homeworks_user_path(@user), :class => 'sy_cgrey fr mr15' %>
|
||||
</div>
|
||||
<%= render :partial => "#{@manage_pre ? 'receive_homework_list' : 'manage_homework_list'}", :locals => {:homeworks => @manage_pre ? @receive_homeworks : @manage_homeworks} %>
|
||||
<%= render :partial => "#{@manage_pre ? 'receive_homework_list' : 'manage_homework_list'}", :locals => {:homeworks => @manage_pre ? @receive_homeworks : @manage_homeworks, :is_manage => 2} %>
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
<div class="sy_classbox" style="min-height:800px;" id="my_homework_list">
|
||||
<% if @type == 1 %>
|
||||
<%= render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks} %>
|
||||
<%= render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks, :is_manage => 1} %>
|
||||
<% else %>
|
||||
<%= render :partial => "receive_homework_list", :locals => {:homeworks => @homeworks} %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if @type == 1 %>
|
||||
$("#my_homework_list").html('<%= escape_javascript(render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks})%>');
|
||||
$("#my_homework_list").html('<%= escape_javascript(render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks, :is_manage => 1})%>');
|
||||
<% else %>
|
||||
$("#my_homework_list").html('<%= escape_javascript(render :partial => "receive_homework_list", :locals => {:homeworks => @homeworks})%>');
|
||||
<% end %>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if @type == 1 %>
|
||||
$("#my_homework_list").html('<%= escape_javascript(render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks})%>');
|
||||
$("#my_homework_list").html('<%= escape_javascript(render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks, :is_manage => 1})%>');
|
||||
<% else %>
|
||||
$("#my_homework_list").html('<%= escape_javascript(render :partial => "receive_homework_list", :locals => {:homeworks => @homeworks})%>');
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue