Merge branch 'cxt_course' into develop

Conflicts:
	db/schema.rb
This commit is contained in:
huang 2016-05-06 22:02:22 +08:00
commit 00d0bc0ce1
11 changed files with 47 additions and 33 deletions

View File

@ -406,12 +406,17 @@ class HomeworkCommonController < ApplicationController
unless homeworks.nil? unless homeworks.nil?
homeworks.each do |h| homeworks.each do |h|
if h.homework_type == 3 if h.homework_type == 3
student_works = h.student_works.where("project_id != 0") student_works = h.student_work_projects.where("is_leader = 1")
time = h.updated_at time = h.updated_at
unless student_works.nil? unless student_works.nil?
student_works.each do |s| student_works.each do |s|
project = Project.find s.project_id project = Project.find s.project_id
unless project.nil? && project.gpid.nil? unless project.nil? && project.gpid.nil?
project_time=project.updated_on
project_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last
if time < project_time
time = project_time
end
begin begin
# gitlab端获取默认分支 # gitlab端获取默认分支
g = Gitlab.client g = Gitlab.client

View File

@ -1157,7 +1157,7 @@ class StudentWorkController < ApplicationController
sheet1[count_row,3] = homework.user.user_extensions.student_id sheet1[count_row,3] = homework.user.user_extensions.student_id
sheet1[count_row,4] = homework.user.mail sheet1[count_row,4] = homework.user.mail
sheet1[count_row,5] = homework.name sheet1[count_row,5] = homework.name
sheet1[count_row,6] = homework.description sheet1[count_row,6] = strip_html homework.description
sheet1[count_row,7] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) sheet1[count_row,7] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score)
sheet1[count_row,8] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) sheet1[count_row,8] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score)
sheet1[count_row,9] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) sheet1[count_row,9] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score)

View File

@ -2959,6 +2959,14 @@ int main(int argc, char** argv){
return sort_projects return sort_projects
end end
end end
def project_sort_first projects
unless projects.empty?
project_ids = '('+projects.map{|pro|pro.project_id}.join(',')+')'
sort_projects = ForgeActivity.find_by_sql("SELECT updated_at,user_id, project_id FROM forge_activities WHERE project_id IN #{project_ids} ORDER BY updated_at DESC limit 1")
return sort_projects
end
end
end end
def user_url_in_org(user_id) def user_url_in_org(user_id)

View File

@ -15,7 +15,7 @@ class CourseMessage < ActiveRecord::Base
validates :course_id,presence: true validates :course_id,presence: true
validates :course_message_id,presence: true validates :course_message_id,presence: true
validates :course_message_type, presence: true validates :course_message_type, presence: true
validates_length_of :content, :maximum => 100 #validates_length_of :content, :maximum => 100
after_create :add_user_message after_create :add_user_message
def add_user_message def add_user_message

View File

@ -182,7 +182,8 @@
<% sort_projects = project_sort_update projects %> <% sort_projects = project_sort_update projects %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>"> <div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
<div class="mr5 fontGrey2"> <div class="mr5 fontGrey2">
#&nbsp;<%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_url_in_org(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新: <% first_pro = project_sort_first(projects).first %>
#&nbsp;<%=time_from_now first_pro.first.updated_at %><%= link_to User.find(first_pro.first.user_id).show_name, user_activities_url_in_org(first_pro.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% sort_projects.each_with_index do |pro, i| %> <% sort_projects.each_with_index do |pro, i| %>

View File

@ -5,7 +5,7 @@
<% end %> <% end %>
<script type="text/javascript"> <script type="text/javascript">
<%if @homework.homework_detail_manual.comment_status != 1%> <%if @homework.anonymous_comment == 0 && @homework.homework_detail_manual.comment_status != 1%>
$(function(){ $(function(){
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_student_work_alert') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_student_work_alert') %>');
showModal('ajax-modal', '360px'); showModal('ajax-modal', '360px');

View File

@ -1,27 +1,16 @@
<div> <div>
<div class="ni_con"> <div class="ni_con">
<h2>请求分享</h2> <%= form_tag(apply_for_homework_user_path(:id=>User.current.id,:homework_id=>homework.id), :multipart => true,:remote => true,:name=>"apply_for_homework_form",:id=>'apply_for_homework_form') do %>
<p> <h2>请求分享</h2>
请求说明(可选): <p>
<textarea type="text" id="apply_content" class="apply_content mt10" style="outline:none;"></textarea> 请求说明(可选):
</p> <textarea type="text" name="content" id="apply_content" class="apply_content mt10" style="outline:none;"></textarea>
<div class="ni_btn"> </p>
<a href="javascript:" class="tijiao" onclick="apply_to();" style="margin-bottom: 20px; margin-left: 60px; color: #fff"> <div class="ni_btn">
确&nbsp;&nbsp;定 <a href="javascript:" class="tijiao" onclick="$('#apply_for_homework_form').submit();" style="margin-bottom: 20px; margin-left: 60px; color: #fff">
</a> 确&nbsp;&nbsp;定
</div> </a>
</div>
<% end %>
</div> </div>
</div> </div>
<script>
function apply_to() {
url = '/users/<%=User.current.id %>/apply_for_homework?homework_id=<%=homework.id %>&content='+$("#apply_content").val();
$.get(
url,
{
},
function (data) {
}
);
}
</script>

View File

@ -197,7 +197,8 @@
<% sort_projects = project_sort_update projects %> <% sort_projects = project_sort_update projects %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>"> <div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
<div class="mr5 fontGrey2"> <div class="mr5 fontGrey2">
#&nbsp;<%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新: <% first_pro = project_sort_first(projects).first %>
#&nbsp;<%=time_from_now first_pro.first.updated_at %><%= link_to User.find(first_pro.first.user_id).show_name, user_activities_path(first_pro.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% sort_projects.each_with_index do |pro, i| %> <% sort_projects.each_with_index do |pro, i| %>

View File

@ -201,7 +201,8 @@
<% sort_projects = project_sort_update projects %> <% sort_projects = project_sort_update projects %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=homework_common.id %>"> <div class="mt10 relatePWrap" id="relatePWrap_<%=homework_common.id %>">
<div class="mr5 fontGrey2"> <div class="mr5 fontGrey2">
#&nbsp;<%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新: <% first_pro = project_sort_first(projects).first %>
#&nbsp;<%=time_from_now first_pro.updated_at %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% sort_projects.each_with_index do |pro, i| %> <% sort_projects.each_with_index do |pro, i| %>
@ -362,7 +363,7 @@
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>"> <div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth t_txt" id="reply_content_<%= comment.id %>">
<%= comment.notes.html_safe %></div> <%= comment.notes.html_safe %></div>
<div class="orig_reply mb10 mt-10"> <div class="orig_reply mb10 mt-10">
<div class="reply"> <div class="reply">

View File

@ -549,7 +549,7 @@ RedmineApp::Application.routes.draw do
match 'user_project_activities', :to => 'users#user_project_activities', :via => :get match 'user_project_activities', :to => 'users#user_project_activities', :via => :get
match 'user_feedback4show', :to => 'users#user_feedback4show', :via => :get match 'user_feedback4show', :to => 'users#user_feedback4show', :via => :get
match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get
match 'apply_for_homework', :to => 'users#apply_for_homework', :via => :get match 'apply_for_homework', :to => 'users#apply_for_homework', :via => :post
match 'apply_homework', :to => 'users#apply_homework', :via => :get match 'apply_homework', :to => 'users#apply_homework', :via => :get
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
match 'student_homeworks', :to => 'users#student_homeworks', :via => :get match 'student_homeworks', :to => 'users#student_homeworks', :via => :get
@ -621,6 +621,7 @@ RedmineApp::Application.routes.draw do
get 'user_homework_type' get 'user_homework_type'
get 'user_ref_homework_search' get 'user_ref_homework_search'
get 'show_homework_detail' get 'show_homework_detail'
post 'apply_for_homework'
# end # end
end end
#resources :blogs #resources :blogs

View File

@ -0,0 +1,8 @@
class ChangeCourseMessagesCloumn < ActiveRecord::Migration
def up
change_column :course_messages, :content, :text
end
def down
end
end