user tab bar

This commit is contained in:
yanxd 2014-05-29 18:34:34 +08:00
parent 4b119e2f00
commit 006e4ae45e
7 changed files with 93 additions and 38 deletions

View File

@ -69,28 +69,30 @@ module UsersHelper
# <li><%= link_to("所有反馈", {:controller => 'users', :action => 'show', :type => 2}) %></li> # <li><%= link_to("所有反馈", {:controller => 'users', :action => 'show', :type => 2}) %></li>
# </ul></div> # </ul></div>
def show_activity(state) # TODO: 待删
content = ''.html_safe # def show_activity(state)
case state # content = ''.html_safe
when 0 # case state
s = content_tag('span', l(:label_user_all_activity), :class => "current-page") # when 0
content << content_tag('li', s) # s = content_tag('span', l(:label_user_all_activity), :class => "current-page")
content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1})) # content << content_tag('li', s)
content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2})) # content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1}))
when 1 # content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2}))
s = content_tag('span', l(:label_user_activity_myself), :class => "current-page") # when 1
content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'})) # s = content_tag('span', l(:label_user_activity_myself), :class => "current-page")
content << content_tag('li', s, :class => "current-page") # content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'}))
content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2})) # content << content_tag('li', s, :class => "current-page")
when 2 # content << content_tag('li', link_to(l(:label_user_all_respond), {:controller => 'users', :action => 'show', :type => 2}))
s = content_tag('span', l(:label_user_all_respond), :class => "current-page") # when 2
content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'})) # s = content_tag('span', l(:label_user_all_respond), :class => "current-page")
content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1})) # content << content_tag('li', link_to(l(:label_user_all_activity), {:controller => 'users', :action => 'show'}))
content << content_tag('li', s, :class => "current-page") # content << content_tag('li', link_to(l(:label_user_activity_myself), {:controller => 'users', :action => 'show', :type => 1}))
end # content << content_tag('li', s, :class => "current-page")
content_tag('div', content, :class => "pagination") # end
end # content_tag('div', content, :class => "pagination")
# end
#TODO: 待删
def watch_projects(state) def watch_projects(state)
content = ''.html_safe content = ''.html_safe
case state case state

View File

@ -1,4 +1,4 @@
<div class="user_course_list"> <div class="user_course_list menu-div">
<div class="menu"> <div class="menu">
<%= link_to "#{l(:label_course_new)}", new_project_path(course: 1, project_type: 1), class: 'icon icon-add' if @user == User.current %> <%= link_to "#{l(:label_course_new)}", new_project_path(course: 1, project_type: 1), class: 'icon icon-add' if @user == User.current %>
<ul> <ul>

View File

@ -11,7 +11,7 @@
</p> </p>
<% end %> <% end %>
<% else %> <% else %>
<div class="user_course_list"> <div class="user_course_list menu-div">
<div class="menu"> <div class="menu">
<%= link_to"#{l(:label_course_view_student)}",course_path(course: 1), :class => 'icon icon-add' %> <%= link_to"#{l(:label_course_view_student)}",course_path(course: 1), :class => 'icon icon-add' %>
<ul> <ul>

View File

@ -1,5 +1,24 @@
<% if User.current.id == @user.id%> <% if User.current.id == @user.id%>
<%= show_activity @state%> <div class="menu-div">
<div class="menu">
<span style="color: #000; font-weight: ;"><%= "#{@user.name}的动态" %></span>
<ul><%#链接绑定在页面最下方的jQuery%>
<li mode='all' class="<%= "on" if @state.eql?(0)%>"><%=l :label_user_all_activity%></li>
<li mode='myself' class="<%= "on" if @state.eql?(1)%>"><%=l :label_user_activity_myself%></li>
<li mode='respond' class="<%= "on" if @state.eql?(2)%>"><%=l :label_user_all_respond%></li>
</ul>
</div>
<script type="text/javascript">
</script>
</div>
<%#= show_activity @state%>
<div style="height:20px"></div>
<%= form_tag(:controller => 'users', :action => "show") do %> <%= form_tag(:controller => 'users', :action => "show") do %>
<div class="user-search-block hidden" style="float:right;margin-top:-55px"> <div class="user-search-block hidden" style="float:right;margin-top:-55px">
<table width="100%" valign="center"> <table width="100%" valign="center">
@ -281,6 +300,9 @@
<% end %> <% end %>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
$(document).ready(function($) { $(document).ready(function($) {
$("#content .pagination:first~ div").first().find("a").attr("target", "_blank"); $("#content .menu-div:first~ div").first().find("a").attr("target", "_blank");
$('[mode=all]').click(function(event) {window.location.href='<%=user_activities_url%>'; });
$('[mode=myself]').click(function(event) {window.location.href='<%=user_activities_url(type: 1)%>'; });
$('[mode=respond]').click(function(event) {window.location.href='<%=user_activities_url(type: 2)%>'; });
}); });
</script> </script>

View File

@ -1,7 +1,18 @@
<!--add by huang--> <!--add by huang-->
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if(User.current.allowed_to?(:add_project, nil, :global => true) && @user == User.current)%>
<!--span class="font_lighter" >温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</span--> <!--span class="font_lighter" >温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</span-->
<%= watch_projects @state %> <div class="menu-div">
<div class="menu">
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if(User.current.allowed_to?(:add_project, nil, :global => true) && @user == User.current)%>
<ul><%#链接绑定在页面最下方的jQuery%>
<li mode='take' class="<%= "on" if @state.eql?(0)%>"><%=l :label_project_take%></li>
<li mode='watched' class="<%= "on" if @state.eql?(1)%>"><%=l :label_has_watched_project%></li>
</ul>
</div>
</div>
<div style="height:20px"></div>
<%#= watch_projects @state %>
<% unless @memberships.empty? %> <% unless @memberships.empty? %>
<div class="content_frame"> <div class="content_frame">
<ul class="user_project_sort"> <ul class="user_project_sort">
@ -48,5 +59,7 @@
$(document).ready(function($) { $(document).ready(function($) {
$("#content .tabs_new~").find("a").attr("target", "_blank"); $("#content .tabs_new~").find("a").attr("target", "_blank");
$("#content .tabs_new~ .pagination").find("a").removeAttr("target"); $("#content .tabs_new~ .pagination").find("a").removeAttr("target");
$('[mode=take]').click(function(event) {window.location.href='<%=user_projects_user_url%>'; });
$('[mode=watched]').click(function(event) {window.location.href='<%=watch_projects_user_url(type: 1)%>'; });
}); });
</script> </script>

View File

@ -1,6 +1,17 @@
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if(User.current.allowed_to?(:add_project, nil, :global => true) && @user == User.current)%>
<!--span class="font_lighter" >温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</span--> <!--span class="font_lighter" >温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</span-->
<%= watch_projects @state%>
<div class="menu-div">
<div class="menu">
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if(User.current.allowed_to?(:add_project, nil, :global => true) && @user == User.current)%>
<ul><%#链接绑定在页面最下方的jQuery%>
<li mode='take' class="<%= "on" if @state.eql?(0)%>"><%=l :label_project_take%></li>
<li mode='watched' class="<%= "on" if @state.eql?(1)%>"><%=l :label_has_watched_project%></li>
</ul>
</div>
</div>
<%#= watch_projects @state%>
<% if @watch_projects.count > 0 %> <% if @watch_projects.count > 0 %>
<% for watch_project in @watch_projects %> <% for watch_project in @watch_projects %>
<table width="660" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;"> <table width="660" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
@ -30,3 +41,10 @@
<% else %> <% else %>
<%= l(:label_watch_no_projects)%> <%= l(:label_watch_no_projects)%>
<% end %> <% end %>
<script type="text/javascript" language="javascript">
$(document).ready(function($) {
$('[mode=take]').click(function(event) {window.location.href='<%=user_projects_user_url%>'; });
$('[mode=watched]').click(function(event) {window.location.href='<%=watch_projects_user_url(type: 1)%>'; });
});
</script>

View File

@ -1205,14 +1205,14 @@ div.pagination {
/* user_courses /* user_courses
*******************************************************************************/ *******************************************************************************/
.user_course_list { .menu-div {
margin: 0; margin: 0;
padding: 0; padding: 0;
position: relative; position: relative;
margin-top: -15px; margin-top: -15px;
} }
.user_course_list .menu{ .menu-div .menu{
display: block; display: block;
background-color: #f9f9f9; background-color: #f9f9f9;
border-radius: 2px 2px 0 0; border-radius: 2px 2px 0 0;
@ -1225,7 +1225,7 @@ div.pagination {
padding-left: 15px; padding-left: 15px;
} }
.user_course_list .menu:after { .menu-div .menu:after {
content: "."; content: ".";
visibility: hidden; visibility: hidden;
display: block; display: block;
@ -1233,16 +1233,16 @@ div.pagination {
clear: both; clear: both;
} }
.user_course_list .menu ul { .menu-div .menu ul {
margin: 0; margin: 0;
padding: 0; padding: 0;
float: right; float: right;
margin-right: 30px; margin-right: 30px;
} }
.user_course_list .menu ul { .menu-div .menu ul {
} }
.user_course_list .menu li { .menu-div .menu li {
display: inline-block; display: inline-block;
position: relative; position: relative;
height: 40px; height: 40px;
@ -1250,17 +1250,17 @@ div.pagination {
cursor: pointer; cursor: pointer;
} }
.user_course_list .menu li:hover { .menu-div .menu li:hover {
color: #00a1d6; color: #00a1d6;
} }
.user_course_list .menu li.on { .menu-div .menu li.on {
color: #00a1d6; color: #00a1d6;
font-weight: bold; font-weight: bold;
} }
.user_course_list .list_top { .menu-div .list_top {
margin: 20px auto 0px; margin: 20px auto 0px;
} }