Merge remote-tracking branch 'origin/szzh' into szzh
This commit is contained in:
commit
6c06dfeb3d
|
@ -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)
|
||||
|
|
|
@ -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}'")
|
||||
|
|
|
@ -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}'")
|
||||
|
|
|
@ -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%>
|
||||
|
|
1685
db/schema.rb
1685
db/schema.rb
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue