Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-09-11 16:46:20 +08:00
commit 6c06dfeb3d
5 changed files with 3428 additions and 1726 deletions

View File

@ -468,13 +468,17 @@ class CoursesController < ApplicationController
end end
def new def new
@course_type = params[:course_type] ||= params[:course] if User.current.login?
@issue_custom_fields = IssueCustomField.sorted.all @course_type = params[:course_type] ||= params[:course]
@trackers = Tracker.sorted.all @issue_custom_fields = IssueCustomField.sorted.all
@course = Course.new @trackers = Tracker.sorted.all
@course.safe_attributes = params[:course] @course = Course.new
# month = Time.now.month @course.safe_attributes = params[:course]
render :layout => 'new_base' # month = Time.now.month
render :layout => 'new_base'
else
redirect_to signin_url
end
end end
def desc_sort_course_by_avtivity(activity_count, courses) def desc_sort_course_by_avtivity(activity_count, courses)

View File

@ -14,13 +14,19 @@ class CourseActivity < ActiveRecord::Base
if user_activity if user_activity
user_activity.save user_activity.save
else else
user_activity = UserActivity.new if self.course_act_type == 'Message' && !self.course_act.parent_id.nil?
user_activity.act_id = self.course_act_id user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.course_act.parent.id}").first
user_activity.act_type = self.course_act_type user_activity.created_at = self.created_at
user_activity.container_type = "Course" user_activity.save
user_activity.container_id = self.course_id else
user_activity.user_id = self.user_id user_activity = UserActivity.new
user_activity.save user_activity.act_id = self.course_act_id
user_activity.act_type = self.course_act_type
user_activity.container_type = "Course"
user_activity.container_id = self.course_id
user_activity.user_id = self.user_id
user_activity.save
end
end end
end end

View File

@ -29,12 +29,19 @@ class ForgeActivity < ActiveRecord::Base
if user_activity if user_activity
user_activity.save user_activity.save
else else
user_activity = UserActivity.new if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
user_activity.act_id = self.forge_act_id user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.forge_act.parent.id}").first
user_activity.act_type = self.forge_act_type user_activity.created_at = self.created_at
user_activity.container_type = "Project" user_activity.save
user_activity.container_id = self.project_id else
user_activity.save user_activity = UserActivity.new
user_activity.act_id = self.forge_act_id
user_activity.act_type = self.forge_act_type
user_activity.container_type = "Project"
user_activity.container_id = self.project_id
user_activity.user_id = self.user_id
user_activity.save
end
end end
end end

View File

@ -77,7 +77,7 @@
<% if is_teacher%> <% if is_teacher%>
<%= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %> <%= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %>
<%= set_course_time @course%> <%= set_course_time @course%>
<%= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %> <%#= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
<% else%> <% else%>
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div> <div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
<% end%> <% end%>

File diff suppressed because it is too large Load Diff