首页左侧栏
This commit is contained in:
parent
f262447ff1
commit
6c7b53f7d4
|
@ -1451,26 +1451,14 @@ class UsersController < ApplicationController
|
|||
#显示更多用户课程
|
||||
def user_courses4show
|
||||
@page = params[:page].to_i + 1
|
||||
@type = params[:type]
|
||||
if @type == 'User'
|
||||
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5)
|
||||
@all_count = @user.courses.visible.where("is_delete =?", 0).count
|
||||
elsif @type == 'Syllabus'
|
||||
@syllabus = Syllabus.where("id = #{params[:syllabus]}").first
|
||||
if User.current == @syllabus.user || User.current.admin?
|
||||
all_courses = @syllabus.courses.where("is_delete = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc")
|
||||
else
|
||||
all_courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc")
|
||||
end
|
||||
@courses = all_courses.limit(5).offset(@page * 5)
|
||||
@all_count = all_courses.count
|
||||
end
|
||||
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10).offset(@page * 10)
|
||||
@all_count = @user.courses.visible.where("is_delete =?", 0).count
|
||||
end
|
||||
|
||||
#显示更多用户项目
|
||||
def user_projects4show
|
||||
@page = params[:page].to_i + 1
|
||||
@projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5).offset(@page * 5)
|
||||
@projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10).offset(@page * 10)
|
||||
end
|
||||
|
||||
def user_course_activities
|
||||
|
@ -3254,6 +3242,7 @@ class UsersController < ApplicationController
|
|||
@join_syllabuses = syllabus_course_list_sort @join_syllabuses
|
||||
@my_syllabuses = @my_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]}
|
||||
@join_syllabuses = @join_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]}
|
||||
@is_course = 1
|
||||
|
||||
#分页
|
||||
# @limit = 10
|
||||
|
@ -3363,6 +3352,7 @@ class UsersController < ApplicationController
|
|||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
@projects = paginateHelper @projects,@limit
|
||||
@is_project = 1
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %>
|
||||
<%= user.user_extensions.brief_introduction %>
|
||||
<% else%>
|
||||
这位童鞋很懒,什么也没有留下~
|
||||
这个小伙伴很懒,什么都没留下~
|
||||
<% end %>
|
||||
</span>
|
||||
<% if User.current == user%>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<% courses.each do |course|%>
|
||||
<li class="homepageLeftMenuCoursesLine pr">
|
||||
<li>
|
||||
<span class="user_icons_class"></span>
|
||||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
||||
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
|
||||
:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course),
|
||||
:id => "show_course_#{course.id}", :class => 'course_list_menu hidden', :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
|
||||
<% wechat_count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
|
||||
|
||||
|
@ -47,7 +48,7 @@
|
|||
<%= link_to "+",course_boards_path(course, :flag => true, :is_new => 1), :class => 'fr fb', :title => '发布帖子',:target => '_blank' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% if type=='User' && !course.syllabus.nil? %>
|
||||
<% if !course.syllabus.nil? %>
|
||||
<li class="subNavRow">
|
||||
<%= link_to "所属课程",syllabus_path(course.syllabus_id), :class => 'fl w48',:target => '_blank' %>
|
||||
<div class="cl"></div>
|
||||
|
@ -82,18 +83,18 @@
|
|||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if all_count > (page.to_i+1) * 5%>
|
||||
<li class="homepageLeftMenuMore" id="user_show_more_course">
|
||||
<input type="hidden" value="<%= page%>" id="course_page_num">
|
||||
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_course('<%= type=='User' ? user_courses4show_user_path(user.id,:type=>type) : user_courses4show_user_path(user.id,:type=>type,:syllabus=>@syllabus.id)%>');"></a>
|
||||
</li>
|
||||
<% if all_count > (page.to_i+1) * 10%>
|
||||
<li id="user_show_more_course">
|
||||
<input type="hidden" value="<%= page%>" id="course_page_num">
|
||||
<a href="javascript:void(0);" onclick="show_more_course('<%= user_courses4show_user_path(user.id)%>');"><span class="user_icons_moreclass"></span></a>
|
||||
</li>
|
||||
<% end%>
|
||||
|
||||
<script type="text/javascript">
|
||||
var coursecount = <%= all_count %>;
|
||||
var courseshowcount = document.getElementsByClassName("coursesLineGrey").length;
|
||||
var courseshowcount = document.getElementsByClassName("course_list_menu").length;
|
||||
|
||||
if((coursecount <= courseshowcount)&&(coursecount > 5) ){
|
||||
if((coursecount <= courseshowcount)&&(coursecount > 10) ){
|
||||
$("#user_show_more_course").hide();
|
||||
$('#user_hide_course').show();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<% projects.each do |project|%>
|
||||
<li class="homepageLeftMenuCoursesLine pr">
|
||||
<li>
|
||||
<span class="user_icons_class"></span>
|
||||
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %>
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "projectsLineGrey hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "course_list_menu hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
|
||||
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
|
||||
<li>
|
||||
<ul class="subNavMenu boxShadow">
|
||||
|
@ -56,7 +57,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if projects.size == 5%>
|
||||
<% if projects.size == 10%>
|
||||
<li class="homepageLeftMenuMore" id="user_show_more_project">
|
||||
<input type="hidden" value="<%= page%>" id="project_page_num">
|
||||
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_project('<%= user_projects4show_user_path(user.id)%>');"></a>
|
||||
|
@ -65,7 +66,7 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
var projectcount = <%= @user.projects.visible.count %>;
|
||||
var projectshowcount = document.getElementsByClassName("projectsLineGrey").length;
|
||||
var projectshowcount = document.getElementsByClassName("course_list_menu").length;
|
||||
|
||||
if((projectcount <= projectshowcount)&&(projectcount > 5)){
|
||||
$("#user_show_more_project").hide();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<% if User.current.logged?%>
|
||||
<% if User.current == target%>
|
||||
<%= link_to("编辑资料", my_account_path, :class => "fl UsersEditBtn")%>
|
||||
<%= link_to("编辑个人资料", my_account_path, :class => "user_editinfo")%>
|
||||
<% else%>
|
||||
<%if(target.watched_by?(User.current))%>
|
||||
<%= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "UsersApBtn", :method => "delete",:remote => "true", :title => "取消关注"%>
|
||||
<%= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "user_editinfo", :method => "delete",:remote => "true", :title => "取消关注"%>
|
||||
<% else %>
|
||||
<%= link_to "添加关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "UsersAttBtn", :method => "post",:remote => "true", :title => "添加关注"%>
|
||||
<%= link_to "添加关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "user_editinfo", :method => "post",:remote => "true", :title => "添加关注"%>
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% end %>
|
|
@ -100,207 +100,130 @@
|
|||
<!--div class="homepageRightBannerImg"></div-->
|
||||
<div class="cl"></div>
|
||||
<div class="homepageContent">
|
||||
<div class="homepageLeft" id="LSide">
|
||||
<div class="homepagePortraitContainer">
|
||||
<div class="homepagePortraitImage fl" id="homepage_portrait_image">
|
||||
<%= image_tag(url_to_avatar(@user),width:"78", height: "78", :id=>'nh_user_tx') %>
|
||||
<% if User.current.logged?%>
|
||||
<% if is_current_user%>
|
||||
<div id="edit_user_file_btn" class="none">
|
||||
<div class="homepageEditProfile">
|
||||
<a href="<%= url_for(:controller => 'my', :action => 'clear_user_avatar_temp') %>" data-remote="true" class="homepageEditProfileIcon"></a>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="fl ml10">
|
||||
<p class="homepageImageName hidden db mb5" style="margin-left:0px;margin-right:0px;">
|
||||
<%= @user.realname.blank? ? @user.login : @user.realname %>
|
||||
</p>
|
||||
<% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %>
|
||||
<span class="<%= @user.user_extensions.gender == 1 ? 'homepageImageSexWomen' : 'homepageImageSexMan' %> "></span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% if @user.user_extensions && @user.user_extensions.identity %>
|
||||
<p class="mb8 c_dark f14">
|
||||
<%= get_user_roll @user %>
|
||||
</p>
|
||||
<% end%>
|
||||
<div id="watch_user_btn_div">
|
||||
<%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %>
|
||||
<div class="homepageLeft mt10" id="LSide">
|
||||
<div class="user_leftinfo mb10">
|
||||
<% if User.current.logged?%>
|
||||
<%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_user_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%>
|
||||
<% else %>
|
||||
<img src="images/user/male.jpg" width="74" height="74" />
|
||||
<% end %>
|
||||
<% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %>
|
||||
<span class="<%= @user.user_extensions.gender == 1 ? 'user_leftinfo_female' : 'user_leftinfo_male' %> "></span>
|
||||
<% end %>
|
||||
<div class="user_info_inner">
|
||||
<div class=" user_leftinfo_namebox" >
|
||||
<a href="javascript:void(0);" class="user_leftinfo_name"><%=@user.show_name %></a>
|
||||
<% if @user.user_extensions && @user.user_extensions.identity %>
|
||||
<span class="user_cirbtn_yellow" ><%= get_user_roll @user %></span>
|
||||
<% end%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||
<% update_visiti_count @user %>
|
||||
<%# over %>
|
||||
|
||||
<div>
|
||||
<div class="homepageSignature break_word">
|
||||
<div id="user_brief_introduction_show">
|
||||
<div>
|
||||
<div class="user_info_intro">
|
||||
<div id="user_brief_introduction_show">
|
||||
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
|
||||
</div>
|
||||
</div>
|
||||
<textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%= edit_brief_introduction_user_path(@user.id)%>');"><%= @user.user_extensions.brief_introduction %></textarea>
|
||||
</div>
|
||||
<textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%= edit_brief_introduction_user_path(@user.id)%>');"><%= @user.user_extensions.brief_introduction %></textarea>
|
||||
<ul class="user_atten clear">
|
||||
<li>
|
||||
<a href="<%=user_blogs_path(:user_id => @user.id) %>">
|
||||
<strong>博客</strong><br />
|
||||
<span class="sy_cgrey"><%=@user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count %></span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<%=user_watchlist_user_path(@user.id) %>">
|
||||
<strong>关注</strong><br />
|
||||
<span class="sy_cgrey"><%=User.watched_by(@user.id).count %></span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<%=user_fanslist_user_path(@user.id) %>">
|
||||
<strong>粉丝</strong><br />
|
||||
<span class="sy_cgrey"><%= @user.watcher_users.count %></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<div class="homepageImageBlock">
|
||||
<div>
|
||||
<%= link_to(@user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count,
|
||||
{:controller => 'blogs', :action => 'index', :user_id => @user.id }, :class => 'homepageImageNumber',:id => 'user_score') %>
|
||||
</div>
|
||||
<div class="homepageImageText">
|
||||
|
||||
<%= link_to('博客',
|
||||
{:controller => 'blogs', :action => 'index', :user_id => @user.id }, :class => 'homepageImageNumber',:id => 'user_score') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="homepageVerDiv"></div>
|
||||
<div class="homepageImageBlock">
|
||||
<div id="watch_user_number_div">
|
||||
<%= link_to User.watched_by(@user.id).count.to_s, {:controller=>"users", :action=>"user_watchlist",:id=>@user.id},:class=>"homepageImageNumber" %>
|
||||
</div>
|
||||
<div class="homepageImageText">
|
||||
<%= link_to '关注', {:controller=>"users", :action=>"user_watchlist",:id=>@user.id},:class=>"homepageImageNumber" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="homepageVerDiv"></div>
|
||||
<div class="homepageImageBlock">
|
||||
<div id="fans_user_number_div">
|
||||
<%= link_to @user.watcher_users.count.to_s, {:controller=>"users", :action=>"user_fanslist",:id=>@user.id},:class=>"homepageImageNumber", :id => "user_fans_number"%>
|
||||
</div>
|
||||
<div class="homepageImageText">
|
||||
|
||||
<%= link_to '粉丝', {:controller=>"users", :action=>"user_fanslist",:id=>@user.id},:class=>"homepageImageNumber", :id => "user_fans_number"%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="cl"></div>
|
||||
<div id="watch_user_btn_div">
|
||||
<%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="homepageLeftMenuContainer">
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<%= link_to "动态",user_activities_path(@user.id),:class => "homepageMenuText"%>
|
||||
</div>
|
||||
|
||||
<div class="user_leftnav ">
|
||||
<% hidden_courses = Setting.find_by_name("hidden_courses") %>
|
||||
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
|
||||
<% if !unvisiable %>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :class => "homepageMenuText" %>
|
||||
|
||||
<% if is_current_user%>
|
||||
<%# if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
|
||||
<div class="courseMenu" id="courseMenu">
|
||||
<ul>
|
||||
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
|
||||
<ul class="topnav_course_menu" id="topnav_course_menu">
|
||||
<li>
|
||||
<%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :class => "menuGrey"%>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :class => "menuGrey"%>
|
||||
</li>
|
||||
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
|
||||
<li>
|
||||
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "menuGrey",:method => "post"%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%# else%>
|
||||
<%#=link_to "", join_private_courses_courses_path, :class => "homepageMenuSetting fr",:style => "margin-right:10px;", :remote => true, :title => "加入班级"%>
|
||||
<%# end%>
|
||||
<% end%>
|
||||
</div>
|
||||
<% end %>
|
||||
<%# if @user.courses.visible.count > 0
|
||||
course_order_ids = "(" +
|
||||
CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM
|
||||
(SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ")
|
||||
GROUP BY ca.course_id) AS c
|
||||
ORDER BY c.updated_at DESC limit 5").map {|c| c.course_id}.join(",") + ")"
|
||||
courses = Course.where("id in #{course_order_ids}")
|
||||
else
|
||||
courses = []
|
||||
|
||||
end
|
||||
%>
|
||||
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
|
||||
<% all_count = @user.courses.visible.where("is_delete =?", 0).count%>
|
||||
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" >
|
||||
<div class = "leftCoursesList" id="homepageLeftMenuCourses">
|
||||
<ul>
|
||||
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user,:all_count => all_count,:type =>'User',:page => 0} %>
|
||||
</ul>
|
||||
</div>
|
||||
<% if !courses.empty? %>
|
||||
<div class="homepageLeftMenuMore" id="user_hide_course">
|
||||
<a href="javascript:void(0);" class="homepageLeftMenuHideIcon" id="hide_show_courseicon" onclick="leftCourseslistChange();"></a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :class => "homepageMenuText" %>
|
||||
<% if is_current_user %>
|
||||
<div class="courseMenu" id="projectMenu">
|
||||
<ul>
|
||||
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
|
||||
<ul class="topnav_course_menu" id="topnav_project_menu">
|
||||
<li>
|
||||
<%= link_to "新建项目", new_project_path(:host=> Setting.host_name), :class => "menuGrey"%>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "加入项目", applied_join_project_path,:remote => true,:class => "menuGrey",:method => "post"%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_01" class="user_icons_course">
|
||||
<%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %>
|
||||
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
|
||||
<% all_count = @user.courses.visible.where("is_delete =?", 0).count%>
|
||||
<div class="<%= courses.empty? ? 'none' : ''%>" >
|
||||
<div id="homepageLeftMenuCourses">
|
||||
<ul class="sub-menu">
|
||||
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user,:all_count => all_count,:page => 0} %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
<%# if @user.projects.visible.count > 0
|
||||
project_order_ids = "(" +
|
||||
ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM
|
||||
(SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ")
|
||||
GROUP BY fa.project_id) AS p
|
||||
ORDER BY p.created_at DESC limit 5").map {|p| p.project_id}.join(",") + ")"
|
||||
projects = Project.where("projects.id in #{project_order_ids}")
|
||||
else
|
||||
projects = []
|
||||
end
|
||||
%>
|
||||
|
||||
<% projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
|
||||
<div class="homepageLeftMenuCourses <%= projects.empty? ? 'none' : ''%>" >
|
||||
<div class = "leftProjecsList" id="homepageLeftMenuForge">
|
||||
<ul>
|
||||
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %>
|
||||
</ul>
|
||||
</div>
|
||||
<% if !projects.empty? %>
|
||||
<div class="homepageLeftMenuMore" id="user_hide_project">
|
||||
<a href="javascript:void(0);" class="homepageLeftMenuHideIcon" id="hide_show_projecticon" onclick="leftProjectslistChange();"></a>
|
||||
</div>
|
||||
<% if !courses.empty? %>
|
||||
<div class="homepageLeftMenuMore" id="user_hide_course">
|
||||
<a href="javascript:void(0);" class="homepageLeftMenuHideIcon" id="hide_show_courseicon" onclick="leftCourseslistChange();"></a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
<% if is_current_user %>
|
||||
<li id="user_02" class="user_icons_new">
|
||||
<%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank"%>
|
||||
</li>
|
||||
<li id="user_03" class="user_icons_new">
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank"%>
|
||||
</li>
|
||||
<li id="user_04" class="user_icons_addclass">
|
||||
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true, :method => "post"%>
|
||||
</li>
|
||||
<li id="user_05" class="user_icons_myhw"> <a href="#user_05" >我的作业</a></li>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<!--<a href="javascript:void(0);" class="homepageMenuText">留言</a>-->
|
||||
<%= link_to '留言',feedback_path(@user, :host=> Setting.host_user),:class=>'homepageMenuText'%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="homepageLeftLabelContainer">
|
||||
<div class="project_Label_New">
|
||||
<span class="homepageLabelText">标签</span>
|
||||
<div class="tag_h ml10" >
|
||||
<%= render :partial => 'tags/user_tag', :locals => {:obj => @user,:object_flag => "1"}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_06" class="user_icons_project">
|
||||
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :id => 'user_project_list'%>
|
||||
<% projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%>
|
||||
<div class="<%= projects.empty? ? 'none' : ''%>" >
|
||||
<div id="homepageLeftMenuForge">
|
||||
<ul class="sub-menu">
|
||||
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %>
|
||||
</ul>
|
||||
</div>
|
||||
<% if !projects.empty? %>
|
||||
<div class="homepageLeftMenuMore" id="user_hide_project">
|
||||
<a href="javascript:void(0);" class="homepageLeftMenuHideIcon" id="hide_show_projecticon" onclick="leftProjectslistChange();"></a>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
<% if is_current_user %>
|
||||
<li id="user_07" class="user_icons_new">
|
||||
<%= link_to "新建项目", new_project_path(:host=> Setting.host_name), :target => "_blank"%>
|
||||
</li>
|
||||
<li id="user_08" class="user_icons_addproject">
|
||||
<%= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post"%>
|
||||
</li>
|
||||
<!--<li id="user_09" class="user_icons_myissues">-->
|
||||
<!--<a href="#user_09" >我的任务</a>-->
|
||||
<!--</li>-->
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_10" class="user_icons_mes">
|
||||
<%= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!--sy_class_leftnav end-->
|
||||
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> (自2016年5月)</div>
|
||||
</div>
|
||||
<div class="homepageRight">
|
||||
|
@ -367,6 +290,11 @@
|
|||
$('#user_hide_course').hide();
|
||||
$('#user_hide_project').hide();
|
||||
autoUrl("user_brief_introduction_show");
|
||||
if(<%= @is_course == 1 %>) {
|
||||
$("#user_course_list").addClass('active');
|
||||
} else if(<%= @is_project == 1 %>) {
|
||||
$("#user_project_list").addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
$("#courseMenu").mouseenter(function(){
|
||||
|
@ -391,9 +319,7 @@
|
|||
$('#homepageLeftMenuForge').slideToggle();
|
||||
$('#hide_show_projecticon').toggleClass("homepageLeftMenuHideIcon");
|
||||
$('#hide_show_projecticon').toggleClass("homepageLeftMenuMoreIcon");
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1 +1 @@
|
|||
$("#user_show_more_course").replaceWith("<%= escape_javascript( render :partial => 'layouts/user_courses',:locals => {:courses => @courses,:user => @user,:type=>@type,:page => @page, :all_count => @all_count} )%>");
|
||||
$("#user_show_more_course").replaceWith("<%= escape_javascript( render :partial => 'layouts/user_courses',:locals => {:courses => @courses,:user => @user,:page => @page, :all_count => @all_count} )%>");
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
|
@ -477,3 +477,150 @@ a.f_grey:hover {color:#000000;}
|
|||
.shadowbox_news_list li:hover{ background-color:#eee;}
|
||||
span.shadowbox_news_user{ color:#3b94d6;}
|
||||
a.shadowbox_news_all{ display:block; width:305px; height:40px; line-height:40px; color:#3b94d6; text-align:center;border-top:1px solid #eee;}
|
||||
|
||||
/* 个人主页左侧信息 */
|
||||
.user_leftinfo{ width:238px;border:1px solid #e5e5e5; background:#fff url(/images/user/user_bg_info.jpg) 0 0 no-repeat; position:relative; }
|
||||
a.user_leftinfo_img { display:block; width:80px; height:80px; margin:15px auto;}
|
||||
.user_leftinfo_img img{ width:74px; height:74px;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px; border:3px solid #dcdcdc; }
|
||||
.user_leftinfo_female{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) 5px -378px no-repeat; position:absolute; top:80px; left:160px;}
|
||||
.user_leftinfo_male{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) -25px -378px no-repeat; position:absolute; top:80px; left:160px;}
|
||||
.user_leftinfo_namebox{ text-align:center; height:16px; line-height:16px; }
|
||||
.user_leftinfo_name{ display: inline-block; max-width:160px; font-size:14px; font-weight:bold; overflow:hidden;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
|
||||
.user_leftinfo_namebox a{ color: #333;}
|
||||
.user_leftinfo_namebox a:hover{ color:#3b94d6;}
|
||||
.user_cirbtn_yellow{ color:#fff; background:#ffb400; padding:0 5px;-webkit-border-radius:10px;-moz-border-radius:10px;-o-border-radius:10px;border-radius:10px; line-height:16px; }
|
||||
.user_info_inner{ width:210px; margin:0 15px 15px;}
|
||||
.user_atten li{ width:68px; float:left; border-right:1px solid #e5e5e5; text-align:center; font-size:14px;}
|
||||
.user_atten li:last-child{ border:none;}
|
||||
.user_info_intro{ margin:10px auto; width:210px; color:#888;}
|
||||
.user_atten li a{ color:#333;}
|
||||
.user_atten li a:hover{ color:#3b94d6;}
|
||||
|
||||
/* 个人主页左侧导航 */
|
||||
.user_leftnav{ width:240px;}
|
||||
.users_accordion li > a {
|
||||
display: block;
|
||||
padding: 0 10px 0 32px;
|
||||
height:49px;
|
||||
line-height:49px;
|
||||
color: #333;
|
||||
font-size:16px;
|
||||
background: #f8f8f8;
|
||||
border:1px solid #e5e5e5;
|
||||
border-bottom:none;
|
||||
}
|
||||
.users_accordion > li:hover > a{
|
||||
color: #3b94d6;
|
||||
background: #fff;
|
||||
}
|
||||
.users_accordion > li:target > a,
|
||||
.users_accordion > li > a.active {
|
||||
color: #3b94d6;
|
||||
background: #fff;
|
||||
border:1px solid #e5e5e5;
|
||||
border-left:3px solid #3b94d6;
|
||||
border-bottom:none;
|
||||
}
|
||||
.users_accordion li{ position:relative;}
|
||||
|
||||
.users_accordion li > a span {
|
||||
margin-top:15px;
|
||||
font-size:12px;
|
||||
padding: 0 10px;
|
||||
background: #dbdbdb;
|
||||
-webkit-border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
border-radius: 15px;
|
||||
margin-left:10px;
|
||||
color: #333;
|
||||
}
|
||||
.users_accordion > li:hover > a span,
|
||||
.users_accordion > li:target > a span,
|
||||
.users_accordion > li > a.active span {
|
||||
margin-left:10px;
|
||||
color: #333;
|
||||
background: #dbdbdb;
|
||||
}
|
||||
/* Images */
|
||||
.users_accordion > li > a:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
content: '';
|
||||
width: 24px;
|
||||
height: 50px;
|
||||
margin: 4px 8px;
|
||||
background-repeat: no-repeat;
|
||||
background-image:url(/images/user/icons_user_leftnav.png);
|
||||
background-position: 5px 15px;
|
||||
}
|
||||
.users_accordion li.user_icons_course > a:before { background-position: 5px 15px; }
|
||||
.users_accordion li.user_icons_course:hover > a:before,
|
||||
.users_accordion li.user_icons_course:target > a:before,
|
||||
.users_accordion li.user_icons_course > a.active:before { background-position: -25px 15px; }
|
||||
.users_accordion li.user_icons_new > a:before { background-position: 5px -48px; }
|
||||
.users_accordion li.user_icons_new:hover > a:before,
|
||||
.users_accordion li.user_icons_new:target > a:before,
|
||||
.users_accordion li.user_icons_new > a.active:before { background-position: -25px -48px; }
|
||||
.users_accordion li.user_icons_addclass > a:before { background-position: 5px -87px; }
|
||||
.users_accordion li.user_icons_addclass:hover > a:before,
|
||||
.users_accordion li.user_icons_addclass:target > a:before,
|
||||
.users_accordion li.user_icons_addclass > a.active:before { background-position: -25px -87px; }
|
||||
.users_accordion li.user_icons_myhw > a:before { background-position: 5px -124px; }
|
||||
.users_accordion li.user_icons_myhw:hover > a:before,
|
||||
.users_accordion li.user_icons_myhw:target > a:before,
|
||||
.users_accordion li.user_icons_myhw > a.active:before { background-position: -25px -124px; }
|
||||
.users_accordion li.user_icons_project > a:before { background-position: 5px -167px; }
|
||||
.users_accordion li.user_icons_project:hover > a:before,
|
||||
.users_accordion li.user_icons_project:target > a:before,
|
||||
.users_accordion li.user_icons_project > a.active:before { background-position: -25px -167px; }
|
||||
.users_accordion li.user_icons_addproject > a:before { background-position: 5px -205px; }
|
||||
.users_accordion li.user_icons_addproject:hover > a:before,
|
||||
.users_accordion li.user_icons_addproject:target > a:before,
|
||||
.users_accordion li.user_icons_addproject > a.active:before { background-position: -25px -205px; }
|
||||
.users_accordion li.user_icons_myissues > a:before { background-position: 5px -246px; }
|
||||
.users_accordion li.user_icons_myissues:hover > a:before,
|
||||
.users_accordion li.user_icons_myissues:target > a:before,
|
||||
.users_accordion li.user_icons_myissues > a.active:before { background-position: -25px -246px; }
|
||||
.users_accordion li.user_icons_mes > a:before { background-position: 5px -289px; }
|
||||
.users_accordion li.user_icons_mes:hover > a:before,
|
||||
.users_accordion li.user_icons_mes:target > a:before,
|
||||
.users_accordion li.user_icons_mes > a.active:before { background-position: -25px -289px; }
|
||||
/* Sub Menu */
|
||||
.sub-menu li a {
|
||||
color: #797979;
|
||||
background: #f8f8f8;
|
||||
height:39px;
|
||||
line-height:39px;
|
||||
font-size:14px;
|
||||
}
|
||||
.sub-menu li a:hover,.sub-menu li a:target { background:#fff; color:#3b94d6;}
|
||||
.sub-menu li:last-child a { }
|
||||
.users_accordion li > .sub-menu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.users_accordion li:target > .sub-menu {
|
||||
display: block;
|
||||
}
|
||||
.sub-menu > li > span.user_icons_class {
|
||||
padding:0;
|
||||
border:none;
|
||||
display:block;
|
||||
position: absolute;
|
||||
top:18px;
|
||||
left:10px;
|
||||
width:20px;
|
||||
height:20px;
|
||||
background:url(/images/user/icons_user_leftnav.png) 0px -34px no-repeat;
|
||||
}
|
||||
.sub-menu > li > a > span.user_icons_moreclass{
|
||||
display:block;
|
||||
position: absolute;
|
||||
top:3px;
|
||||
left:96px;
|
||||
width:20px;
|
||||
height:10px;
|
||||
background:url(/images/user/icons_user_leftnav.png) 5px -347px no-repeat;
|
||||
}
|
||||
a.user_editinfo{border-top:1px solid #e5e5e5; height:30px; line-height:30px; text-align:center; color:#3b94d6; width:100%; display:inline-block;}
|
Loading…
Reference in New Issue