项目menu导航

This commit is contained in:
huang 2016-10-10 10:41:41 +08:00
parent bd29a637b6
commit 17743457e1
8 changed files with 82 additions and 10 deletions

View File

@ -67,6 +67,8 @@ class BoardsController < ApplicationController
end
def show
# 顶部导航
@project_menu_type = 3
# 讨论区消息状态更新(已读和未读)
@order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1

View File

@ -266,6 +266,9 @@ class FilesController < ApplicationController
end
def index
# 顶部导航
@project_menu_type = 4
@flag = params[:flag] || false
sort = ""
@sort = ""

View File

@ -58,6 +58,8 @@ class IssuesController < ApplicationController
include ApplicationHelper
def index
# 顶部导航
@project_menu_type = 2
# 为了性能所有用了两种模式issue的@query查询所有的没有优势
# 但是对过滤条件很有有时
if params[:set_filter] != "1"

View File

@ -297,6 +297,8 @@ class ProjectsController < ApplicationController
# Author lizanle
# Description 项目动态展示方法,删除了不必要的代码
def show
# 顶部导航
@project_menu_type = 1
# 更新消息为已读
update_message_status(User.current, @project)
# over
@ -355,6 +357,9 @@ class ProjectsController < ApplicationController
end
def settings
# 顶部导航
@project_menu_type = 9
# 修改查看消息状态
applied_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =? and viewed =?", User.current.id, @project, "AppliedProject", 0)
applied_messages.each do |applied_message|

View File

@ -11,6 +11,9 @@ class PullRequestsController < ApplicationController
# 返回json格式
def index
# 顶部导航
@project_menu_type = 6
type = params[:type]
case type
when nil, "1"

View File

@ -375,6 +375,9 @@ update
end
def show
# 顶部导航
@project_menu_type = 5
## TODO: the below will move to filter, done.
# 获取版本库目录结构

View File

@ -32,6 +32,9 @@ class VersionsController < ApplicationController
helper :project_score
def index
# 顶部导航
@project_menu_type = 7
respond_to do |format|
format.html {
@trackers = @project.trackers.sorted.all

View File

@ -1,3 +1,7 @@
<% project_file_num = Attachment.where(:container_type => "Project", :container_id => @project.id).count %>
<% project_issue_count = @project.issues.count %>
<% project_acts = ForgeActivity.where("project_id = ?", @project.id).count %>
<div class="pro_new_top clear mb10">
<div class="fl pro_new_name ml15">
<span class="icons_newpro_lock"></span>
@ -17,20 +21,67 @@
<div class="cl"></div>
<div class="pro_new_topnav mt15">
<ul>
<li ><a href="javascript:void(0);" class=" pro_new_proname"> 动态</a></li>
<li class="pro_new_topnav_active"><a href="javascript:void(0);" class=" pro_new_proname"> Issue</a><span class="issues_nav_tag ml5">25</span></li>
<li><a href="javascript:void(0);" class=" pro_new_proname"> 讨论区 </a><span class="issues_nav_tag ml5">25</span></li>
<li><a href="javascript:void(0);" class=" pro_new_proname"> 资源库</a><span class="issues_nav_tag ml5">25</span></li>
<li><a href="javascript:void(0);" class=" pro_new_proname"> 版本库</a><span class="issues_nav_tag ml5">25</span></li>
<li><a href="javascript:void(0);" class=" pro_new_proname"> 合并申请</a><span class="issues_nav_tag ml5">25</span></li>
<li><a href="javascript:void(0);" class=" pro_new_proname"> 里程碑 </a><span class="issues_nav_tag ml5">25</span></li>
<li><a href="javascript:void(0);" class=" pro_new_proname"> 更多</a></li>
<li><a href="javascript:void(0);" class=" pro_new_proname"> 设置 </a></li>
<li id="project_menu_01">
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "pro_new_proname" %>
<% if project_acts > 0 %>
<span class="issues_nav_tag ml5"><%= project_acts %></span>
<% end %>
</li>
<li id="project_menu_02">
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<%= link_to l(:label_issue_tracking), project_issues_path(@project, :remote => true), :class => "pro_new_proname" %>
<% if project_issue_count > 0 %>
<span class="issues_nav_tag ml5"><%= project_issue_count %></span>
<% end %>
<% end %>
</li>
<li id="project_menu_03">
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "pro_new_proname" %>
<% unless @project.project_score.board_num == 0 %>
<span class="issues_nav_tag ml5"><%= @project.project_score.board_num %></span>
<% end %>
<% end %>
</li>
<li id="project_menu_04">
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
<%= link_to l(:project_module_files), project_files_path(@project), :class => "pro_new_proname" %>
<% unless project_file_num == 0 %>
<span class="issues_nav_tag ml5"><%= project_file_num %></span>
<% end %>
<% end %>
</li>
<li id="project_menu_05"><a href="javascript:void(0);" class=" pro_new_proname"> 版本库</a><span class="issues_nav_tag ml5">25</span></li>
<li id="project_menu_06">
<% if allow_pull_request(@project) > 0 && allow_show_pull_request(@project) > 0 %>
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "pro_new_proname" %>
<span class="issues_nav_tag ml5"><%= pull_request_count(@project) %></span>
<% end %>
</li>
<li id="project_menu_07">
<%= link_to l(:label_roadmap) ,project_roadmap_path(@project), :class => "pro_new_proname" %>
<span class="issues_nav_tag ml5">25</span>
</li>
<li id="project_menu_08"><a href="javascript:void(0);" class=" pro_new_proname"> 更多</a></li>
<li id="project_menu_09">
<% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %>
<%= link_to "#{l(:button_configure)}", settings_project_path(@project), :class => "pro_new_proname" %>
<% end %>
</li>
</ul>
</div>
</div>
<!--新版项目头部结束-->
<script>
$(function(){
if($("#project_menu_0<%= @project_menu_type %>").length > 0){
$("#project_menu_0<%= @project_menu_type %>").addClass('pro_new_topnav_active');
} else {
$("#expand_tools_expand a").addClass('active');
$("#navContentCourse").toggle();
}
})
</script>