首页左侧栏

cxt_course
cxt 9 years ago
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 %>

File diff suppressed because it is too large Load Diff

@ -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…
Cancel
Save