个人主页
This commit is contained in:
parent
7518cdcc9d
commit
b7c4449f4b
|
@ -129,7 +129,7 @@ class UsersController < ApplicationController
|
|||
|
||||
limit = 10;
|
||||
query = Project.joins("join members m on #{Project.table_name}.id=m.project_id")
|
||||
query = query.where("m.user_id = ?",@user.id)
|
||||
query = query.where("m.user_id = ? and #{Project.table_name}.project_type=?",@user.id,Project::ProjectType_project)
|
||||
if(params[:status] == '1')
|
||||
query = query.where("#{Project.table_name}.user_id = ?",@user.id);
|
||||
elsif(params[:status] == '2')
|
||||
|
@ -465,7 +465,7 @@ class UsersController < ApplicationController
|
|||
def user_projects4show
|
||||
|
||||
query = Project.joins("join members m on #{Project.table_name}.id=m.project_id")
|
||||
query = query.where("m.user_id = ?",@user.id)
|
||||
query = query.where("m.user_id = ? and #{Project.table_name}.project_type=?",@user.id,Project::ProjectType_project)
|
||||
if User.current == @user #看自己
|
||||
else
|
||||
query = query.where(Project.table_name+".is_public = 1")
|
||||
|
|
|
@ -322,6 +322,35 @@ module UsersHelper
|
|||
return [count,list];
|
||||
end
|
||||
|
||||
def get_create_course_count(user)
|
||||
return Course.where("tea_id = ?",user.id).count()
|
||||
end
|
||||
def get_join_course_count(user)
|
||||
return user.coursememberships.count() - get_create_course_count(user)
|
||||
end
|
||||
def get_homework_commons_count(user)
|
||||
return HomeworkCommon.where("user_id = ?",user.id).count()
|
||||
end
|
||||
def get_projectandcourse_attachment_count(user)
|
||||
return Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count()
|
||||
end
|
||||
def get_create_project_count(user)
|
||||
return Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count()
|
||||
end
|
||||
def get_join_project_count(user)
|
||||
return user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user)
|
||||
end
|
||||
def get_create_issue_count(user)
|
||||
return Issue.where("author_id = ?",user.id).count()
|
||||
end
|
||||
def get_resolve_issue_count(user)
|
||||
return Issue.where("assigned_to_id = ? and status_id=3",user.id).count()
|
||||
end
|
||||
def get_anonymous_evaluation_count(user)
|
||||
return StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count()
|
||||
end
|
||||
|
||||
|
||||
def query_activities(query,type)
|
||||
query_rec_count = 50
|
||||
query = query.where("act_type not in ('Contest','Contestnotifications','Principal')")
|
||||
|
|
|
@ -197,37 +197,35 @@ $(".subNav").click(function(){
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<!--<div class="leftbox mt10">-->
|
||||
<!--<ul class="leftbox_ul_left">-->
|
||||
<!--<li>创建课程 :</li>-->
|
||||
<!--<li>发布作业 :</li>-->
|
||||
<!--<li>发布资源 :</li>-->
|
||||
<!--<li>创建项目 :</li>-->
|
||||
<!--<li>解决缺陷 :</li>-->
|
||||
|
||||
<!--<li>加入课程 :</li>-->
|
||||
<!--<li>发布作品 :</li>-->
|
||||
<!--<li>参加匿评 :</li>-->
|
||||
<!--<li>加入项目 :</li>-->
|
||||
<!--<li>发布缺陷 :</li>-->
|
||||
<!--<li>解决缺陷 :</li>-->
|
||||
<!--</ul>-->
|
||||
<!--<ul class="leftbox_ul_right c_dgrey">-->
|
||||
<!--<li>10</li>-->
|
||||
<!--<li>506</li>-->
|
||||
<!--<li>50</li>-->
|
||||
<!--<li>15</li>-->
|
||||
<!--<li>1000</li>-->
|
||||
|
||||
<!--<li>10</li>-->
|
||||
<!--<li>506</li>-->
|
||||
<!--<li>50</li>-->
|
||||
<!--<li>15</li>-->
|
||||
<!--<li>1000</li>-->
|
||||
<!--<li>1000</li>-->
|
||||
<!--</ul>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<!--</div>-->
|
||||
<div class="leftbox mt10">
|
||||
<ul class="leftbox_ul_left">
|
||||
<% if !@user.user_extensions.nil? && @user.user_extensions.identity == 0 %>
|
||||
<li>创建课程 :</li>
|
||||
<li>发布作业 :</li>
|
||||
<% end %>
|
||||
<li>加入课程 :</li>
|
||||
<li>参加匿评 :</li>
|
||||
<li>发布资源 :</li>
|
||||
<li>创建项目 :</li>
|
||||
<li>加入项目 :</li>
|
||||
<li>发布缺陷 :</li>
|
||||
<li>解决缺陷 :</li>
|
||||
</ul>
|
||||
<ul class="leftbox_ul_right c_dgrey">
|
||||
<% if !@user.user_extensions.nil? && @user.user_extensions.identity == 0 %>
|
||||
<li><%= get_create_course_count(@user) %></li>
|
||||
<li><%= get_homework_commons_count(@user) %></li>
|
||||
<% end %>
|
||||
<li><%= get_join_course_count(@user) %></li>
|
||||
<li><%= get_anonymous_evaluation_count(@user) %></li>
|
||||
<li><%= get_projectandcourse_attachment_count(@user) %></li>
|
||||
<li><%= get_create_project_count(@user) %></li>
|
||||
<li><%= get_join_project_count(@user) %></li>
|
||||
<li><%= get_create_issue_count(@user) %></li>
|
||||
<li><%= get_resolve_issue_count(@user) %></li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<% if @center_flag %>
|
||||
<div class="subNavBox ">
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<div id="RSide" class="fl">
|
||||
<%= render_flash_messages %>
|
||||
<div id="users_setting">
|
||||
<div id="users_tb_" class="users_tb_">
|
||||
<ul>
|
||||
|
@ -11,6 +10,10 @@
|
|||
<div class="users_ctt">
|
||||
<%= labelled_form_for :user, @user, :url => {:action => "account"}, :html => {:id => 'my_account_form', :method => :post} do |f| %>
|
||||
<div class="users_dis" id="users_tbc_01">
|
||||
<% if( @act.nil? || @act != 'password') %>
|
||||
<%= render_flash_messages %>
|
||||
<%= error_messages_for 'user' %>
|
||||
<% end %>
|
||||
<ul class="setting_left">
|
||||
<li>登录名 : </li>
|
||||
<li>邮箱 : </li>
|
||||
|
@ -137,7 +140,8 @@
|
|||
<li style="height:auto;"><textarea name="description" class="w450 h200"><%= (@user.user_extensions.nil?) ? '' : @user.user_extensions.description %></textarea></li>
|
||||
<li style="display:none;"><%= f.select :language, :Chinese => :zh, :English => :en %></li>
|
||||
<li class="ml2">
|
||||
<a href="javascript:$('#my_account_form').submit();" class="blue_btn fl">确认</a>
|
||||
<a href="javascript:$('#my_account_form_btn').click();" class="blue_btn fl">确认</a>
|
||||
<input type="submit" id="my_account_form_btn" style="display:none;"/>
|
||||
<!--<a href="javascript:void(0);" class="grey_btn ml10 fl">取消</a>-->
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -146,17 +150,22 @@
|
|||
<% end %>
|
||||
<%= form_tag({:action => "password"},:id => 'my_password_form') do %>
|
||||
<div class="users_undis" id="users_tbc_02">
|
||||
<% if( !@act.nil? && @act == 'password') %>
|
||||
<%= render_flash_messages %>
|
||||
<%= error_messages_for 'user' %>
|
||||
<% end %>
|
||||
<ul class="setting_left">
|
||||
<li>原始密码 : </li>
|
||||
<li>新密码 : </li>
|
||||
<li>确认密码 : </li>
|
||||
</ul>
|
||||
<ul class="setting_right ">
|
||||
<li><input id="password" name="password" class="w210" type="password"></li>
|
||||
<li><input id="new_password" name="new_password" class="w210" type="password"><span class="c_red ml5">请输入6-12个字符</span></li>
|
||||
<li><input id="new_password_confirmation" name="new_password_confirmation" class="w210" type="password"></li>
|
||||
<li><input id="password" name="password" class="w210" type="password" required="true"></li>
|
||||
<li><input id="new_password" name="new_password" class="w210" type="password" required="true"><span class="c_red ml5">请输入6-12个字符</span></li>
|
||||
<li><input id="new_password_confirmation" name="new_password_confirmation" class="w210" type="password" required="true"></li>
|
||||
<li class="ml2">
|
||||
<a href="javascript:$('#my_password_form').submit();" class="blue_btn fl">确认</a>
|
||||
<a href="javascript:$('#my_password_form_btn').click();" class="blue_btn fl">确认</a>
|
||||
<input type="submit" id="my_password_form_btn" style="display:none;"/>
|
||||
<!--<a href="javascript:void(0);" class="grey_btn ml10 fl">取消</a>-->
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
div.ke-toolbar .ke-outline{border:none;}
|
||||
</style>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
|
||||
<% @center_flag = (User.current == @user) %>
|
||||
<% if @center_flag %>
|
||||
<div class="top_new">
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class AddDescriptionToUserExtensions < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :user_extensions, :description, :string, default: ''
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :user_extensions, :description
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue