socialforge/app/views/layouts/_base_project_top.html.erb

97 lines
5.8 KiB
Plaintext

<% 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 %>
<% raodmaps = Version.where("project_id = ?", @project.id).count %>
<% project_score = @project.project_score %>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @project %>
<div class="pro_new_top clear mb10">
<div class="fl pro_new_name ml15 clear">
<% unless @project.is_public? %><span class="icons_newpro_lock fl "></span><% end %>
<%=link_to "#{@project.owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
<%=link_to @project.name, project_path(@project), :class => "pro_new_username break_word" %>
</div>
<!--加入、退出、关注项目-->
<div class="fr clear mr15">
<ul><span id="join_in_project_applied"><%= render :partial => "projects/applied_status" %></span></ul>
</div>
<div class="cl"></div>
<% unless @project.forked_from_project_id.nil? %>
<div class="fl pro_new_name ml15 clear mt5">
<span class="vl_fork fl mr5 mt2">forked from</span> <%=link_to "#{get_fork_from_project(@project.forked_from_project_id).owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(get_fork_from_project(@project.forked_from_project_id).owner), :class => "pro_new_username_fork fl" %>
<%=link_to get_fork_from_project(@project.forked_from_project_id).name, project_path(get_fork_from_project(@project.forked_from_project_id)), :class => "pro_new_username_fork fl" %>
</div>
<div class="cl"></div>
<% end %>
<div class="pro_new_topnav mt8">
<ul>
<li id="project_menu_01">
<%= link_to "#{l(:label_activity)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k(project_acts)}</span>".html_safe, {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "pro_new_proname", :title => "#{project_acts}" %>
</li>
<!--问题跟踪-->
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<li id="project_menu_02">
<%= link_to project_issue_count > 0 ? "#{l(:label_issue_tracking)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_issue_count}</span>".html_safe : "#{l(:label_issue_tracking)}", project_issues_path(@project, :remote => true), :class => "pro_new_proname", :title => "#{project_issue_count}" %>
</li>
<% end %>
<!--讨论区-->
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
<li id="project_menu_03">
<%= link_to project_score.board_num > 0 ? "#{l(:project_module_boards)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.board_num}</span>".html_safe : "#{l(:project_module_boards)}", project_boards_path(@project), :class => "pro_new_proname", :title => "#{project_score.board_num}" %>
</li>
<% end %>
<!--资源库-->
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
<li id="project_menu_04">
<%= link_to project_file_num > 0 ? "#{l(:project_module_files)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_file_num}</span>".html_safe : l(:project_module_files), project_files_path(@project), :class => "pro_new_proname", :title => "#{project_file_num}" %>
<% end %>
<!--版本库-->
<% if visible_repository?(@project) %>
<li id="project_menu_05"><%= link_to @project.project_score.changeset_num.to_i > 0 ? "#{l(:project_module_repository)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.changeset_num}</span>".html_safe : "#{l(:project_module_repository)}",({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "pro_new_proname", :title => "#{project_score.changeset_num}" %>
</li>
<% end %>
<!--Pull Request-->
<% unless @project.gpid.nil? %>
<li id="project_menu_06">
<%= link_to project_score.pull_request_num >0 ? "Pull Requests <span class='issues_nav_tag ml5'>#{switch_integer_into_k project_score.pull_request_num}</span>".html_safe : "Pull Requests", project_pull_requests_path(@project), :class => "pro_new_proname", :title => "#{project_score.pull_request_num}" %>
<% if project_score.pull_request_num >0 %>
<% end %>
</li>
<% end %>
<!--里程碑-->
<li id="project_menu_07">
<%= link_to @project.versions.count >0 ? "#{l(:label_roadmap)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k @project.versions.count}</span>".html_safe : l(:label_roadmap) ,project_roadmap_path(@project), :class => "pro_new_proname", :title => "#{@project.versions.count}" %>
</li>
<!--日历-->
<% unless @project.enabled_modules.where("name = 'calendar'").empty? %>
<li id="project_menu_08">
<%= link_to l(:project_module_calendar),project_calendar_path(@project) %>
</li>
<% end %>
<!--甘特图-->
<% unless @project.enabled_modules.where("name = 'gantt'").empty? %>
<li id="project_menu_09">
<%= link_to l(:project_module_gantt) ,project_gantt_path(@project) %>
</li>
<% end %>
<% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %>
<li id="project_menu_010">
<%= link_to "#{l(:button_configure)}", settings_project_path(@project), :class => "pro_new_proname" %>
</li>
<% end %>
</ul>
</div>
</div>
<!--新版项目头部结束-->
<script>
$(function(){
$("#project_menu_0<%= @project_menu_type %>").addClass('pro_new_topnav_active');
})
</script>