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

View File

@ -13,6 +13,11 @@ class CourseActivity < ActiveRecord::Base
user_activity = UserActivity.where("act_type = '#{self.course_act_type.to_s}' and act_id = '#{self.course_act_id}'").first
if user_activity
user_activity.save
else
if self.course_act_type == 'Message' && !self.course_act.parent_id.nil?
user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.course_act.parent.id}").first
user_activity.created_at = self.created_at
user_activity.save
else
user_activity = UserActivity.new
user_activity.act_id = self.course_act_id
@ -23,6 +28,7 @@ class CourseActivity < ActiveRecord::Base
user_activity.save
end
end
end
def destroy_user_activity
user_activity = UserActivity.where("act_type = '#{self.course_act_type.to_s}' and act_id = '#{self.course_act_id}'")

View File

@ -28,15 +28,22 @@ class ForgeActivity < ActiveRecord::Base
user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'").first
if user_activity
user_activity.save
else
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.forge_act.parent.id}").first
user_activity.created_at = self.created_at
user_activity.save
else
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
def destroy_user_activity
user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'")

View File

@ -77,7 +77,7 @@
<% 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" %>
<%= 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%>
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
<% end%>

File diff suppressed because it is too large Load Diff