Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
b22d3c9882
|
@ -45,12 +45,12 @@ class SyllabusMemberController < ApplicationController
|
|||
member = SyllabusMember.find(params[:id])
|
||||
@syllabus = member.syllabus
|
||||
members = @syllabus.syllabus_members
|
||||
if params[:opr] == 'up' && member.rank > 2
|
||||
if params[:opr] == 'up' && member.rank > 1
|
||||
before_mem = members.where("rank = #{member.rank - 1}").first
|
||||
if before_mem && member.update_attribute('rank', member.rank - 1)
|
||||
before_mem.update_attribute('rank', before_mem.rank + 1)
|
||||
end
|
||||
elsif params[:opr] == 'down' && member.rank > 1 && member.rank < members.count
|
||||
elsif params[:opr] == 'down' && member.rank < members.count
|
||||
after_mem = members.where("rank = #{member.rank + 1}").first
|
||||
if after_mem && member.update_attribute('rank', member.rank + 1)
|
||||
after_mem.update_attribute('rank', after_mem.rank - 1)
|
||||
|
|
|
@ -33,6 +33,8 @@ class SyllabusesController < ApplicationController
|
|||
@syllabus.user_id = User.current.id
|
||||
@syllabus.description = Message.where("id = 19412").first.nil? ? '' : Message.where("id = 19412").first.content
|
||||
if @syllabus && @syllabus.save
|
||||
member = SyllabusMember.create(:user_id => @syllabus.user_id, :rank => 1)
|
||||
@syllabus.syllabus_members << member
|
||||
respond_to do |format|
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
format.html {redirect_to syllabus_path(@syllabus)}
|
||||
|
|
|
@ -3578,7 +3578,9 @@ def get_group_member_names work
|
|||
end
|
||||
|
||||
def course_syllabus_option user = User.current
|
||||
syllabuses = user.syllabuses
|
||||
syllabus_members = SyllabusMember.where("user_id = #{user.id}")
|
||||
syllabus_ids = syllabus_members.empty? ? "(-1)" : "(" + syllabus_members.map{|mem| mem.syllabus_id}.join(',') + ")"
|
||||
syllabuses = Syllabus.where("id in #{syllabus_ids}")
|
||||
type = []
|
||||
option1 = []
|
||||
option1 << "请选择课程"
|
||||
|
|
|
@ -853,6 +853,13 @@ class User < Principal
|
|||
OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count > 0
|
||||
end
|
||||
|
||||
def member_of_syl?(syllabus)
|
||||
if !self.logged?
|
||||
return false
|
||||
end
|
||||
SyllabusMember.where("user_id =? and syllabus_id =?", self.id, syllabus.id).count > 0
|
||||
end
|
||||
|
||||
def admin_of_org?(org)
|
||||
if self.admin?
|
||||
return true
|
||||
|
|
|
@ -32,8 +32,9 @@
|
|||
</li>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
||||
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
|
||||
<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>
|
||||
<span><%=@course.syllabus.title %></span>
|
||||
<%#= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
|
||||
<!--<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%#=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>-->
|
||||
</li>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<%= render :partial => "evaluation_work", :locals => {:student_work => student_work, :index => i}%>
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
<div id="about_hwork_<%= student_work.id%>">
|
||||
<div id="about_hwork_<%= student_work.id%>" class="about_hwork">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<div class="syllabus_courses_box">
|
||||
<% @stundet_works.each_with_index do |student_work, i| %>
|
||||
<div class="syllabus_courses_list" id="student_work_<%= student_work.id%>" style="cursor: default;">
|
||||
<div class="syllabus_courses_list" id="student_work_<%= student_work.id%>" style="cursor: default; background-color:#f6f6f6;">
|
||||
<%= render :partial => 'evaluation_un_group_work', :locals => {:student_work => student_work} %>
|
||||
</div>
|
||||
<div id="about_hwork_<%= student_work.id %>"></div>
|
||||
<div id="about_hwork_<%= student_work.id %>" class="about_hwork"></div>
|
||||
|
||||
<div id="group_member_work_<%= student_work.id%>">
|
||||
<%= render :partial => 'group_member_work', :locals => {:student_work => student_work} %>
|
||||
|
|
|
@ -4,22 +4,22 @@
|
|||
<div class="syllabus_class_w fontGrey3 student_work_<%= st.id%>" style="<%=!is_expand ? '' : 'cursor: pointer;' %>" <%= !is_expand ? '' : "onclick = "+"show_student_work('"+"#{student_work_path(st)}"+"')" %>>
|
||||
<%= link_to(image_tag(url_to_avatar(st.user),:width =>"40",:height => "40", :style => "display:block;"),user_activities_path(st.user), :class => "fl") %>
|
||||
<% if !is_expand %>
|
||||
<span class="fl student_work_<%= st.id%>" style="width:135px;">
|
||||
<span class="fl hidden ml5" style="max-width:90px;"><%= st.user.show_name %></span>
|
||||
<span class="fl student_work_<%= st.id%>" style="width:105px;">
|
||||
<span class="fl hidden ml5" style="max-width:60px;"><%= st.user.show_name %></span>
|
||||
<span class="fl">(组长)</span>
|
||||
</span>
|
||||
<span class="fl mr15 hidden student_work_<%= st.id%>" style="width:90px;">
|
||||
<span class="fl hidden student_work_<%= st.id%>" style="width:90px; margin-right:3px;">
|
||||
<span class="fontGrey2">学号</span>:<%= st.user.user_extensions.nil? ? "--" : st.user.user_extensions.student_id%>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="fl student_work_<%= st.id%>" style="width:135px;">
|
||||
<span class="fl hidden ml5" style="max-width:90px;"><%= st.user.show_name %></span>
|
||||
<span class="fl student_work_<%= st.id%>" style="width:105px;">
|
||||
<span class="fl hidden ml5" style="max-width:60px;"><%= st.user.show_name %></span>
|
||||
</span>
|
||||
<span class="fl student_work_<%= st.id%> mr15 hidden" style="width:90px;">
|
||||
<span class="fl student_work_<%= st.id%> hidden" style="width:90px; margin-right:3px;">
|
||||
<span class="fontGrey2">学号</span>:<%= st.user.user_extensions.nil? ? "--" : st.user.user_extensions.student_id%>
|
||||
</span>
|
||||
<% end %>
|
||||
<div class="flex-container fl" style="width:365px;">
|
||||
<div class="flex-container fl" style="width:376px;">
|
||||
<div class="flex-cell"><span class="<%= score_color st.teacher_score%> ml35"><%= st.teacher_score.nil? ? "--" : format("%.1f",st.teacher_score)%></span></div>
|
||||
<div class="flex-cell"><span class="<%= score_color st.teaching_asistant_score%> ml35"><%= st.teaching_asistant_score.nil? ? "--" : format("%.1f",st.teaching_asistant_score)%></span></div>
|
||||
<% if @homework.anonymous_comment == 0 %>
|
||||
|
@ -47,9 +47,6 @@
|
|||
<div class="flex-cell">
|
||||
<% score = st.work_score %>
|
||||
<div class="<%= score_color score%> student_final_scor_info ml35 pr" style="display: inline">
|
||||
<% if is_expand %>
|
||||
<span style="position: absolute;top: -33px; color: #3b94d6; white-space:nowrap;" onclick = "show_student_work(<%= student_work_path(st)%>)">评分</span>
|
||||
<% end %>
|
||||
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
|
||||
<% unless score.nil?%>
|
||||
<div class="g_infoNi none width180" style="line-height: 18px;">
|
||||
|
@ -70,6 +67,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if is_expand %>
|
||||
<div class="fr ml5" style="width:25px; color: #3b94d6; white-space:nowrap; text-align:right; margin-right:5px;" onclick = "show_student_work(<%= student_work_path(st)%>)">评分</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="hworkTip" style="display: none; left:700px; top:20px; white-space:nowrap; right:auto;" id="work_click_<%= st.id%>"><em></em><span></span><font class="fontGrey2"><%= !st.student_work_projects.empty? ? '大作品评分即组长的评分' : '点击进行评分' %></font></div>
|
||||
</li>
|
||||
|
@ -83,4 +83,11 @@
|
|||
}).mouseleave(function(){
|
||||
$("#work_click_<%= st.id%>").hide();
|
||||
}).mouse;
|
||||
|
||||
$(".syllabus_class_list").mouseenter(function(){
|
||||
$(this).css("background-color","#f6fafd");
|
||||
});
|
||||
$(".syllabus_class_list").mouseleave(function(){
|
||||
$(this).css("background-color","#fff");
|
||||
});
|
||||
</script>
|
|
@ -1,7 +1,7 @@
|
|||
<div class="sy_courses_open f14 fontGrey3">
|
||||
<span class="icons_sy_open fl mr5" title="点击展开/收起详情" style="cursor: pointer;"></span>
|
||||
<span class="fl" style="width:280px;">
|
||||
<span class="hidden fl" style="max-width:240px;"><%=student_work.name %></span>
|
||||
<span class="hidden fl" style="max-width:220px;"><%=student_work.name %></span>
|
||||
<span class="fontGrey2 ml5 fl">
|
||||
<% if student_work.work_status%>
|
||||
<%=get_status student_work.work_status %>
|
||||
|
@ -9,19 +9,18 @@
|
|||
</span>
|
||||
</span>
|
||||
<% if @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<span class="ml15 fl">关联项目:</span>
|
||||
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
|
||||
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "width:200px;", :title => "项目名称"%>
|
||||
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fr hidden', :style => "max-width:200px;", :title => "项目名称"%>
|
||||
<% else %>
|
||||
<span class="fontBlue fl hidden" style="width:200px;" title="该项目是私有的"><%= student_work.project.name %></span>
|
||||
<span class="fontBlue fr hidden" style="max-width:200px;" title="该项目是私有的"><%= student_work.project.name %></span>
|
||||
<% end %>
|
||||
<span class="fr">关联项目:</span>
|
||||
<% end %>
|
||||
<a href="javascript:void(0)" onclick="show_student_work('<%= student_work_path(student_work)%>');" class="link-blue fr">评分</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="fl sy_p_grey">
|
||||
<span class="fl" style="width:296px;">提交时间:<%=format_date(student_work.commit_time) %></span>
|
||||
<div class="flex-container fl" style="width:368px;">
|
||||
<span class="fl" style="width:255px;">提交时间:<%=format_date(student_work.commit_time) %></span>
|
||||
<div class="flex-container fl" style="width:376px;">
|
||||
<div class="flex-cell">教师:<span class="<%= score_color student_work.teacher_score%>"><%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%></span></div>
|
||||
<div class="flex-cell">助教:<span class="<%= score_color student_work.teaching_asistant_score%>"><%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%></span></div>
|
||||
<% if @homework.anonymous_comment == 0 %>
|
||||
|
@ -69,5 +68,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="javascript:void(0)" onclick="show_student_work('<%= student_work_path(student_work)%>');" class="link-blue fr ml5" style="width:28px; text-align:right;">评分</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -78,7 +78,7 @@
|
|||
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work, :index => i} %>
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
<div id="about_hwork_<%= student_work.id %>">
|
||||
<div id="about_hwork_<%= student_work.id %>" class="about_hwork">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<% student_work_groups = @homework.student_works.where("user_id in #{user_ids}").order("created_at asc") %>
|
||||
<% anon_count = student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>
|
||||
<% student_work_groups.each_with_index do |st, j| %>
|
||||
<div class="syllabus_class_box" id="student_work_<%= st.id%>">
|
||||
<div class="syllabus_class_box" id="student_work_<%= st.id%>" style="background-color:#fff;">
|
||||
<%= render :partial => 'evaluation_un_group_member_work', :locals => {:st => st, :anon_count => anon_count} %>
|
||||
</div>
|
||||
<% if j != 0 %>
|
||||
<div id="about_hwork_<%= st.id %>"></div>
|
||||
<div id="about_hwork_<%= st.id %>" class="about_hwork"></div>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -2,6 +2,7 @@ if($("#about_hwork_<%= @work.id%>").children().length > 0){
|
|||
$("#about_hwork_<%= @work.id%>").html("");
|
||||
}
|
||||
else{
|
||||
$(".about_hwork").html("");
|
||||
<% if @homework.homework_type == 2%>
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
|
||||
|
||||
|
|
|
@ -75,9 +75,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
|
||||
<% if User.current == @syllabus.user %>
|
||||
<p class="sy_tab_con_p">您建立的课程还未创建班级,请
|
||||
<div class="icons_tishi"><img src="/images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
|
||||
<% if User.current.member_of_syl?(@syllabus) %>
|
||||
<p class="sy_tab_con_p">该课程还未创建班级,请
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "sy_corange", :target => '_blank'%>
|
||||
,谢谢啦!</p>
|
||||
<% else %>
|
||||
|
|
|
@ -13,13 +13,14 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% count = @members.count %>
|
||||
<% @members.each_with_index do |member, i| %>
|
||||
<% user = member.user %>
|
||||
<% allow_delete = @syllabus.courses.where(:tea_id => member.user_id).empty? && i != 0 %>
|
||||
<% allow_delete = is_admin && @syllabus.courses.where(:tea_id => member.user_id).empty? %>
|
||||
<tr>
|
||||
<td><%= member.rank %></td>
|
||||
<td>
|
||||
<% if member.rank == 1 %>
|
||||
<% if user == @syllabus.user %>
|
||||
<div style="display: inline-block"><span class="sy_new_name fl"><%= user.show_name %></span><span class="sy_new_orange ml5 fl mt12">创建者</span></div>
|
||||
<% else %>
|
||||
<span class="sy_new_long_name"><%= user.show_name %></span>
|
||||
|
@ -35,23 +36,20 @@
|
|||
<td><%= courses.where("tea_id != #{user.id}").count %></td>
|
||||
<% if is_admin %>
|
||||
<td>
|
||||
<% if i == 0 %>
|
||||
|
||||
<% if user == @syllabus.user %>
|
||||
<% elsif allow_delete %>
|
||||
<%= link_to('删除', {:controller => 'syllabus_member', :action => 'destroy', :id => member.id, :syllabus => @syllabus.id},:remote => true, :method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr sy_btn_grey mr5", :title => l(:button_delete)) %>
|
||||
<% else %>
|
||||
<% if allow_delete %>
|
||||
<%= link_to('删除', {:controller => 'syllabus_member', :action => 'destroy', :id => member.id, :syllabus => @syllabus.id},:remote => true, :method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr sy_btn_grey mr5", :title => l(:button_delete)) %>
|
||||
<% else %>
|
||||
<a href="javascript:void(0)" class="fr sy_btn_grey mr5" title="该老师已在本课程下创建了班级,不能删除">删除</a>
|
||||
<% end %>
|
||||
<% if i == 1 %>
|
||||
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
|
||||
<% elsif i == @members.count - 1 %>
|
||||
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
|
||||
<% else %>
|
||||
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
|
||||
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
|
||||
<% end %>
|
||||
<a href="javascript:void(0)" class="fr sy_btn_grey mr5" title="该老师已在本课程下创建了班级,不能删除">删除</a>
|
||||
<% end %>
|
||||
<% if i != 0 && i < count - 1 %>
|
||||
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
|
||||
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
|
||||
<% elsif i < count - 1 %>
|
||||
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
|
||||
<% elsif i == count - 1 %>
|
||||
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
$(function() {
|
||||
sd_create_editor_from_data(<%= @syllabus.id %>, null, "100%", "<%= @syllabus.class.to_s %>");
|
||||
showNormalImage('syllabus_description_<%= @syllabus.id %>');
|
||||
autoUrl('syllabus_description_<%= @syllabus.id %>');
|
||||
});
|
||||
</script>
|
||||
<ul id="sy_tab_nav">
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
class AddSyllabusMembers < ActiveRecord::Migration
|
||||
def up
|
||||
Syllabus.all.each do |syllabus|
|
||||
if syllabus.syllabus_members.empty?
|
||||
member = SyllabusMember.create(:user_id => syllabus.user_id, :rank => 1)
|
||||
syllabus.syllabus_members << member
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue