个人主页
This commit is contained in:
parent
addf3604ec
commit
8d858cccfc
|
@ -455,7 +455,7 @@ class UsersController < ApplicationController
|
|||
query = query.where("r.role_id in(3,7,9)")
|
||||
end
|
||||
query = query.where(Course.table_name+".is_public = 1")
|
||||
# TODO or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id)
|
||||
# or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id)
|
||||
end
|
||||
|
||||
if params[:lastid]!=nil && !params[:lastid].empty?
|
||||
|
|
|
@ -46,26 +46,26 @@ module ActivitiesHelper
|
|||
def get_container_type(activity)
|
||||
#问卷
|
||||
if activity.act_type == 'Poll'
|
||||
return 'Course'
|
||||
return ['Course',activity.act.polls_group_id]
|
||||
end
|
||||
#注册
|
||||
if activity.act_type == 'Principal'
|
||||
return 'Principal'
|
||||
return ['Principal',activity.act.id]
|
||||
end
|
||||
#留言
|
||||
if activity.act_type == 'JournalsForMessage'
|
||||
return activity.act.jour.class.to_s
|
||||
return [activity.act.jour_type,activity.act.jour_id]
|
||||
end
|
||||
|
||||
# HomeworkCommon Issue Journal Message News
|
||||
if activity.act.respond_to?('course') && activity.act.course
|
||||
return 'Course'
|
||||
return ['Course',activity.act.course.id]
|
||||
end
|
||||
if activity.act.respond_to?('project') && activity.act.project
|
||||
return 'Project'
|
||||
return ['Project',activity.act.project.id]
|
||||
end
|
||||
|
||||
# Contest Contestnotification
|
||||
return 'Unknow'
|
||||
return ['Unknow',0]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,6 +13,8 @@ class Activity < ActiveRecord::Base
|
|||
#helper :activities
|
||||
include ActivitiesHelper
|
||||
def set_container_type_val
|
||||
self.activity_container_type = get_container_type(self)
|
||||
container_type,container_id =get_container_type(self)
|
||||
self.activity_container_type = container_type
|
||||
self.activity_container_id = container_id
|
||||
end
|
||||
end
|
||||
|
|
|
@ -197,6 +197,30 @@ $(".subNav").click(function(){
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<% if @center_flag %>
|
||||
<div class="subNavBox ">
|
||||
<div class="subNav "><a href="<%=url_for(:controller => 'users', :action => 'show',:id=>@user.id)%>" class=" f14 c_blue02">动态</a></div>
|
||||
<div class="subNav subNav_jiantou"><a href="<%=url_for(:controller => 'users', :action => 'user_courses',:id=>@user.id)%>" class=" f14 c_blue02">我的课程<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.courses.count%>)</span></a></div>
|
||||
<!--<ul class="navContent " >-->
|
||||
<!--<li><a href="javascirpt:void();" >大学计算机基础</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大牛软件核心知识开放课程</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大学计算机基础</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大牛软件核心知识开放课程</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大学计算机基础</a></li>-->
|
||||
<!--</ul>-->
|
||||
<div class="subNav subNav_jiantou"><a href="<%=url_for(:controller => 'users', :action => 'user_projects',:id=>@user.id)%>" class=" f14 c_blue02">我的项目<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.projects.count%>)</span></a></div>
|
||||
<!--<ul class="navContent " >-->
|
||||
<!--<li><a href="javascirpt:void();" >Trustie-Forge</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >Trustie-weekly</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大学计算机基础</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大牛软件核心知识开放课程</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大学计算机基础</a></li>-->
|
||||
<!--</ul>-->
|
||||
<div class="subNav "><a href="<%= url_for(:controller => 'my', :action => 'account') %>" class=" f14 c_blue02">编辑资料</a></div>
|
||||
</div><!--侧导航 end-->
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="leftbox mt10">
|
||||
<ul class="leftbox_ul_left">
|
||||
<% if !@user.user_extensions.nil? && @user.user_extensions.identity == 0 %>
|
||||
|
@ -227,28 +251,6 @@ $(".subNav").click(function(){
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<% if @center_flag %>
|
||||
<div class="subNavBox ">
|
||||
<div class="subNav "><a href="<%=url_for(:controller => 'users', :action => 'show',:id=>@user.id)%>" class=" f14 c_blue02">动态</a></div>
|
||||
<div class="subNav subNav_jiantou"><a href="<%=url_for(:controller => 'users', :action => 'user_courses',:id=>@user.id)%>" class=" f14 c_blue02">我的课程<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.courses.count%>)</span></a></div>
|
||||
<!--<ul class="navContent " >-->
|
||||
<!--<li><a href="javascirpt:void();" >大学计算机基础</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大牛软件核心知识开放课程</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大学计算机基础</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大牛软件核心知识开放课程</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大学计算机基础</a></li>-->
|
||||
<!--</ul>-->
|
||||
<div class="subNav subNav_jiantou"><a href="<%=url_for(:controller => 'users', :action => 'user_projects',:id=>@user.id)%>" class=" f14 c_blue02">我的项目<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=@user.projects.count%>)</span></a></div>
|
||||
<!--<ul class="navContent " >-->
|
||||
<!--<li><a href="javascirpt:void();" >Trustie-Forge</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >Trustie-weekly</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大学计算机基础</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大牛软件核心知识开放课程</a></li>-->
|
||||
<!--<li><a href="javascirpt:void();" >大学计算机基础</a></li>-->
|
||||
<!--</ul>-->
|
||||
<div class="subNav "><a href="<%= url_for(:controller => 'my', :action => 'account') %>" class=" f14 c_blue02">编辑资料</a></div>
|
||||
</div><!--侧导航 end-->
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<%= render :partial => 'layouts/user_watch_list', :locals => {:user => @user} %>
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
<td class="td_w110 "><a href="<%=url_for(:controller => 'homework_common', :action => 'index',:course=>item.id, :host=>Setting.host_course)%>"><%= item.homework_commons.count %></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>成员人数:</td>
|
||||
<td><%= item.members.count %></td>
|
||||
<td>学生人数:</td>
|
||||
<td><a href="<%= url_for(:controller => 'courses', :action=>"member", :id=>item.id,:role=>2, :host=>Setting.host_course) %>"><%= studentCount(item) %></a></td>
|
||||
<td>开课学期:</td>
|
||||
<td><%= item.time %><%= get_course_term_locales item %></td>
|
||||
</tr>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</span>
|
||||
<div class="fl c_dgrey">
|
||||
<p>主讲老师:<a href="<%= user_path(item.teacher) %>" title="<%= item.teacher.show_name %>"><%= item.teacher.show_name %></a></p>
|
||||
<p>课程作业:<a href="<%=url_for(:controller => 'homework_common', :action => 'index',:course=>item.id, :host=>Setting.host_course)%>"><%= item.homework_commons.count %></a> <span class="ml10"></span>成员:<%= item.members.count %></p>
|
||||
<p>课程作业:<a href="<%=url_for(:controller => 'homework_common', :action => 'index',:course=>item.id, :host=>Setting.host_course)%>"><%= item.homework_commons.count %></a> <span class="ml10"></span>学生:<a href="<%= url_for(:controller => 'courses', :action=>"member", :id=>item.id,:role=>2, :host=>Setting.host_course) %>"><%= studentCount(item) %></a></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
class AddActivityContainerTypeToActivities < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :activities, :activity_container_id, :int
|
||||
add_column :activities, :activity_container_type, :string, default: ''
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :activities, :activity_container_type
|
||||
remove_column :activities, :activity_container_id
|
||||
end
|
||||
end
|
|
@ -8,6 +8,6 @@ class ChangeActivitiesContainerType < ActiveRecord::Migration
|
|||
end
|
||||
|
||||
def down
|
||||
Activity.where("activity_container_type <> ''").update_all(activity_container_type: '')
|
||||
Activity.where("activity_container_type <> ''").update_all(activity_container_type: '',activity_container_id:nil)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue