Merge branch 'cxt_course' into szzh
This commit is contained in:
commit
cdcdd96180
|
@ -509,7 +509,7 @@ module CoursesHelper
|
|||
type = []
|
||||
month = Time.now.month
|
||||
now_year = year.nil? ? Time.now.year : (Time.now.year <= year ? Time.now.year : year)
|
||||
year = month < 3 ? now_year - 1 : now_year
|
||||
year = month < 3 && now_year >=Time.now.year ? now_year - 1 : now_year
|
||||
for i in (year..year + 10)
|
||||
option = []
|
||||
option << i
|
||||
|
|
|
@ -254,6 +254,8 @@ class CoursesService
|
|||
#course.safe_attributes = params[:course]
|
||||
course.time = params[:time]
|
||||
course.term = params[:term]
|
||||
course.end_time = params[:end_time]
|
||||
course.end_term = params[:end_term]
|
||||
course.class_period = params[:class_period].to_i
|
||||
params[:course][:is_public] ? course.is_public = 1 : course.is_public = 0
|
||||
params[:course][:open_student] ? course.open_student = 1 : course.open_student = 0
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<% if options[:length] %>
|
||||
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%>
|
||||
<% else %>
|
||||
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true -%>
|
||||
<%= link_to_short_attachment attachment, :length=> 58,:class => 'hidden link_file_a fl newsBlue mw400', :download => true -%>
|
||||
<% end %>
|
||||
</span>
|
||||
<%if is_float%>
|
||||
|
|
|
@ -46,14 +46,15 @@
|
|||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_course_term)%> :</label>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"time_selected"} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term_selected"} %>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"time"} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term"} %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> 结束学期 :</label>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time_selected"} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term_selected"} %>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time"} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term"} %>
|
||||
<span class="c_red" id="course_time_term_notice"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
|
@ -138,8 +139,6 @@
|
|||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
$("#time_selected").click(select);
|
||||
$("#term_selected").click(select);
|
||||
$("#end_time_selected").click(select);
|
||||
$("#end_term_selected").click(select);
|
||||
$("#time").click(select);
|
||||
$("#term").click(select);
|
||||
</script>
|
||||
|
|
|
@ -84,8 +84,8 @@
|
|||
<%= @topic.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course @topic, :author => false %>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @topic} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -113,8 +113,8 @@
|
|||
<%= @topic.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course @topic, :author => false %>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @topic} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -139,8 +139,8 @@
|
|||
<%= @topic.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course @topic, :author => false %>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @topic} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -89,8 +89,8 @@
|
|||
<%= @news.description.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course @news, :author => false %>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @news} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -79,8 +79,8 @@
|
|||
<%= @news.description.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course @news, :author => false %>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @news} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -89,8 +89,8 @@
|
|||
<%= @news.description.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course @news, :author => false %>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @news} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
<%= @document.content.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course @document, :author => false %>
|
||||
<div class=" fl">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @document} %>
|
||||
<%#= link_to_attachments_course @document, :author => false %>
|
||||
</div>
|
||||
<!-- <%# if defined?(home_id) %>
|
||||
<div style="float:right;">最后编辑:<%#= User.find() %></div>
|
||||
|
|
|
@ -155,7 +155,9 @@
|
|||
<% break %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
||||
<% 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 %>
|
||||
|
@ -188,10 +190,11 @@
|
|||
<% else %>
|
||||
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
|
||||
<% end %>
|
||||
<% com_time = project.project_score.commit_time %>
|
||||
<% time=project.updated_on %>
|
||||
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
||||
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
||||
<p class="mh18"><%=time_from_now time %> <%= project.project_score.changeset_num %>提交</p>
|
||||
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %> <%= project.project_score.changeset_num %>提交</p>
|
||||
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
|
||||
项目名称:<%=project.name %><br />
|
||||
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%= user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
|
@ -92,7 +92,7 @@
|
|||
<%= format_time(comment.created_on) %>
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<% if comment.author == User.current %>
|
||||
<span class="fr likeButton"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
<%= document.content.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course document, :author => false %>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => document} %>
|
||||
</div>
|
||||
<!-- <%# if defined?(home_id) %>
|
||||
<div style="float:right;">最后编辑:<%#= User.find() %></div>
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
<% attachments.each_with_index do |attachment,i| %>
|
||||
<div id="attachment_<%= attachment.id%>">
|
||||
<%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%>
|
||||
<span class="fl">
|
||||
<span title="<%= attachment.filename %>">
|
||||
<%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%>
|
||||
</span>
|
||||
</span>
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) if attachment.id && User.current == attachment.author && status != 2 %>
|
||||
<span class="ml5 fl">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||
<span class="postAttSize">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||
<span class="author" title="<%= attachment.author%>">
|
||||
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>,
|
||||
<%= format_time(attachment.created_on) %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end -%>
|
|
@ -166,7 +166,7 @@
|
|||
<div id="homeworkDetailHide" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %>
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @homework} %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
|
|
|
@ -134,7 +134,6 @@
|
|||
<% if activity.student_works.count != 0 %>
|
||||
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
|
||||
<% 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") %>
|
||||
<%# 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">
|
||||
|
@ -155,7 +154,9 @@
|
|||
<% break %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
||||
<% 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 %>
|
||||
|
@ -188,10 +189,11 @@
|
|||
<% else %>
|
||||
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
|
||||
<% end %>
|
||||
<% com_time = project.project_score.commit_time %>
|
||||
<% time=project.updated_on %>
|
||||
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
||||
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
||||
<p class="mh18"><%=time_from_now time %> <%= project.project_score.changeset_num %>提交</p>
|
||||
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %> <%= project.project_score.changeset_num %>提交</p>
|
||||
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
|
||||
项目名称:<%=project.name %><br />
|
||||
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
||||
|
|
|
@ -156,7 +156,9 @@
|
|||
<% break %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= link_to "更多>>", student_work_index_path(:homework => homework_common.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
|
||||
<% 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 %>
|
||||
|
@ -189,10 +191,11 @@
|
|||
<% else %>
|
||||
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+homework_common.id.to_s,:alt =>"项目头像") %>
|
||||
<% end %>
|
||||
<% com_time = project.project_score.commit_time %>
|
||||
<% time=project.updated_on %>
|
||||
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
|
||||
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
|
||||
<p class="mh18"><%=time_from_now time %> <%= project.project_score.changeset_num %>提交</p>
|
||||
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %> <%= project.project_score.changeset_num %>提交</p>
|
||||
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=homework_common.id %>">
|
||||
项目名称:<%=project.name %><br />
|
||||
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
class AddCommitTime < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :project_scores, :commit_time, :datetime, :default => nil
|
||||
count = ProjectScore.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
ProjectScore.page(i).per(30).each do |ps|
|
||||
unless ps.project.nil?
|
||||
unless ps.project.gpid.nil?
|
||||
g = Gitlab.client
|
||||
begin
|
||||
changesets = g.commits(ps.project.gpid)
|
||||
ps.commit_time = changesets[0].created_at
|
||||
ps.save
|
||||
rescue
|
||||
logger.error("The project's rep is not exit!")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -193,7 +193,7 @@ function submit_new_course()
|
|||
|
||||
function submit_edit_course(id)
|
||||
{
|
||||
if(regex_course_name()&®ex_course_class_period()&®ex_course_password())
|
||||
if(regex_course_name()&®ex_course_class_period()&®ex_time_term()&®ex_course_password())
|
||||
{
|
||||
$("#edit_course_"+id).submit();
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re
|
|||
.mt-2 {margin-top:-2px;}
|
||||
.homeworkInfo {background:#F6F6F6; padding:10px; margin-bottom:10px;}
|
||||
.homeworkDetail {line-height:18px; font-size:12px; color:#484848; overflow:hidden;}
|
||||
.homeworkDetail p,.homeworkDetail div,.homeworkDetail em, .homeworkDetail span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;}
|
||||
.max_h54 {max-height:54px; }
|
||||
.homeworkState {padding:3px 5px; background-color:#28be6c; border-radius:3px; float:left; margin-left:15px; color:#ffffff;}
|
||||
.homeworkClose {padding:3px 5px; background-color:#b2b2b2; border-radius:3px; float:left; margin-left:15px; color:#ffffff;}
|
||||
|
|
|
@ -170,6 +170,7 @@ h4{ font-size:14px; color:#3b3b3b;}
|
|||
.h70{ height:70px;}
|
||||
.h150{ height:150px;}
|
||||
.p10 {padding-left:10px; padding-right:10px;}
|
||||
.mw360 {max-width: 360px !important;}
|
||||
.mw400 {max-width: 400px !important;}
|
||||
.mh18 {max-height: 18px;}
|
||||
|
||||
|
|
Loading…
Reference in New Issue