2017-02-19 09:21:55 +08:00
|
|
|
<% project_file_num = Attachment.where(:container_type => "Project", :container_id => @project.id).count %>
|
|
|
|
<% project_issue_count = @project.issues.count %>
|
|
|
|
<% training_tasks_count = @project.training_tasks.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 %>
|
2017-02-25 11:08:37 +08:00
|
|
|
<% if @project.is_training_project? %>
|
|
|
|
<%=link_to "#{@project.owner.try(:show_name)}导师<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
|
|
|
|
<% else %>
|
|
|
|
<%=link_to "#{@project.owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
|
|
|
|
<% end %>
|
2017-02-19 09:21:55 +08:00
|
|
|
<%=link_to @project.name, project_path(@project), :class => "pro_new_username break_word" %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!--加入、退出、关注项目-->
|
2017-02-22 08:54:38 +08:00
|
|
|
<% if !@project.is_child_training_project? %>
|
2017-02-20 12:33:27 +08:00
|
|
|
<div class="fr clear mr15">
|
|
|
|
<ul><span id="join_in_project_applied"><%= render :partial => "projects/applied_status" %></span></ul>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
2017-02-19 09:21:55 +08:00
|
|
|
<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", :target => "_blank" %>
|
|
|
|
<%=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", :target => "_blank" %>
|
|
|
|
</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 %>
|
|
|
|
<!--实训任务-->
|
2017-02-24 14:46:29 +08:00
|
|
|
<% if !@project.enabled_modules.where("name = 'training_tasks'").empty? %>
|
2017-02-24 15:33:15 +08:00
|
|
|
<% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || is_project_manager?(User.current, @project.try(:forked_from_project_id)) %>
|
2017-02-24 14:46:29 +08:00
|
|
|
<li id="project_menu_011">
|
|
|
|
<%= link_to training_tasks_count > 0 ? "#{l(:project_module_training_tasks)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k training_tasks_count}</span>".html_safe : "#{l(:project_module_training_tasks)}", project_training_tasks_url(@project), :class => "pro_new_proname", :title => "#{training_tasks_count}" %>
|
|
|
|
</li>
|
|
|
|
<% end %>
|
2017-02-19 09:21:55 +08:00
|
|
|
<% 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 %>
|
|
|
|
<!--版本库-->
|
2017-02-24 10:26:22 +08:00
|
|
|
<% if !@project.enabled_modules.where("name = 'repository'").empty? && !Repository.where(:project_id => @project.id, :type => "Repository::Gitlab").first.nil? %>
|
|
|
|
<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>
|
2017-02-19 09:21:55 +08:00
|
|
|
<% 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 %>
|
|
|
|
|
2017-02-20 12:33:27 +08:00
|
|
|
<% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && !@project.is_child_training_project? %>
|
2017-02-19 09:21:55 +08:00
|
|
|
<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');
|
|
|
|
|
|
|
|
})
|
2016-10-11 10:16:17 +08:00
|
|
|
</script>
|