新版首页架构

This commit is contained in:
cxt 2016-12-07 15:15:00 +08:00
parent 35fdf9a8a7
commit 27d800a94a
9 changed files with 254 additions and 86 deletions

View File

@ -50,10 +50,10 @@ gem 'elasticsearch-model'
gem 'elasticsearch-rails'
#rails 3.2.22.2 bug
# gem "test-unit", "~>3.0"
gem "test-unit", "~>3.0"
### profile
# gem 'oneapm_rpm'
gem 'oneapm_rpm'
group :development do
gem 'grape-swagger'

View File

@ -42,7 +42,7 @@ class UsersController < ApplicationController
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues]
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community]
before_filter :auth_user_extension, only: :show
#before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects
@ -1812,6 +1812,12 @@ class UsersController < ApplicationController
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
join_course_messages.update_all(:viewed => true)
end
# 访问自己的主页
#if @user == User.current
#else
# 访问他人主页 显示对当前用户可见的动态
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
@page = params[:page] ? params[:page].to_i + 1 : 0
@ -1896,12 +1902,29 @@ class UsersController < ApplicationController
@user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
@type = params[:type]
#end
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
end
end
# 课程社区
def course_community
respond_to do |format|
format.js
format.html {render :layout => 'base_course_community'}
end
end
# 项目社区
def project_community
respond_to do |format|
format.js
format.html {render :layout => 'base_project_community'}
end
end
def show_old
pre_count = 10 #limit
# Time 2015-02-04 11:46:34

View File

@ -11,10 +11,10 @@
<%#= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10" %>
</li>-->
<li class="navHomepageMenu fl">
<a href="javascript:void(0);" title="" class="c_white f16 db p10">课程</a>
<%= link_to "课程", user_course_community_path(User.current), :class => "c_white f16 db p10" %>
</li>
<li class="navHomepageMenu fl">
<a href="javascript:void(0);" title="" class="c_white f16 db p10">项目</a>
<%= link_to "项目", user_project_community_path(User.current), :class => "c_white f16 db p10" %>
</li>
<% if hidden_unproject_infos %>
<!-- <li class="navHomepageMenu fl">

View File

@ -0,0 +1,69 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel', 'css/user', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<body onload="prettyPrint();">
<div class="navContainer">
<% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<div class="cl"></div>
<div class="homepageContentContainer">
<!--div class="homepageRightBannerImg"></div-->
<div class="cl"></div>
<div class="homepageContent">
<div class="homepageLeft mt10" id="LSide">
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @user %>
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> 自2016年5月</div>
</div>
<div class="homepageRight">
<%= yield %>
</div>
</div>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
</div>
</body>
</html>

View File

@ -0,0 +1,69 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel', 'css/user', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<body onload="prettyPrint();">
<div class="navContainer">
<% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<div class="cl"></div>
<div class="homepageContentContainer">
<!--div class="homepageRightBannerImg"></div-->
<div class="cl"></div>
<div class="homepageContent">
<div class="homepageLeft mt10" id="LSide">
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @user %>
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> 自2016年5月</div>
</div>
<div class="homepageRight">
<%= yield %>
</div>
</div>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
</div>
</body>
</html>

View File

@ -160,7 +160,9 @@
</div>
<div class="home-user-leftnav">
<h3 >课程社区</h3>
<h3>
<%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" %>
</h3>
<% if hidden_unproject_infos %>
<ul>
<li class="home-user-leftnav-li icons-class clear">
@ -200,7 +202,9 @@
</div>
<% end %>
<div class="home-user-leftnav">
<h3 >项目社区</h3>
<h3 >
<%= link_to "项目社区", user_project_community_path(User.current), :class => "fl" %>
</h3>
<ul>
<li class="home-user-leftnav-li icons-project clear">
<%= link_to "项目<span class='issues_nav_tag ml140'>#{@my_project_count}</span>".html_safe, {:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list', :class => "fl" %>

View File

@ -564,6 +564,9 @@ RedmineApp::Application.routes.draw do
match 'courses/:course_id/news/new', :to => 'news#new', :via => [:get, :post]
match 'users/:user_id/homepage/articles/:id', :to => 'article_homepages#show', :as => "user_homepage_show"
match 'users/:id/courses', :to => 'users#course_community', :as => "user_course_community"
match 'users/:id/projects', :to => 'users#project_community', :as => "user_project_community"
scope ":username" do
resources :posts
end