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

104 lines
4.9 KiB
Plaintext
Raw Normal View History

2016-10-10 10:41:41 +08:00
<% 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 %>
2016-10-11 09:31:17 +08:00
<% raodmaps = Version.where("project_id = ?", @project.id).count %>
2016-10-14 17:23:51 +08:00
<% project_score = @project.project_score %>
<% project_modules = @project.enabled_modules.where("name = 'issue_tracking'") %>
2016-10-11 10:16:17 +08:00
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @project %>
2016-10-10 10:41:41 +08:00
2016-10-09 17:24:37 +08:00
<div class="pro_new_top clear mb10">
<div class="fl pro_new_name ml15">
<span class="icons_newpro_lock"></span>
<%=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_proname" %>
</div>
2016-10-11 09:31:17 +08:00
2016-10-14 17:23:51 +08:00
<!--加入、退出、关注项目-->
<div class="fr clear mr15">
<ul><span id="join_in_project_applied"><%= render :partial => "projects/applied_status" %></span></ul>
2016-10-09 17:24:37 +08:00
</div>
2016-10-14 17:23:51 +08:00
2016-10-09 17:24:37 +08:00
<div class="cl"></div>
<div class="pro_new_topnav mt15">
<ul>
2016-10-10 10:41:41 +08:00
<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 %>
2016-10-19 16:35:26 +08:00
<span class="issues_nav_tag ml5"><%= switch_integer_into_k(project_acts) %></span>
2016-10-10 10:41:41 +08:00
<% end %>
</li>
<!--问题跟踪-->
2016-10-11 09:31:17 +08:00
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<li id="project_menu_02">
2016-10-10 10:41:41 +08:00
<%= link_to l(:label_issue_tracking), project_issues_path(@project, :remote => true), :class => "pro_new_proname" %>
<% if project_issue_count > 0 %>
2016-10-19 16:35:26 +08:00
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_issue_count %></span>
2016-10-10 10:41:41 +08:00
<% end %>
2016-10-11 09:31:17 +08:00
</li>
<% end %>
<!--讨论区-->
2016-10-11 09:31:17 +08:00
<% unless @project.enabled_modules.where("name = 'boards'").empty? %>
<li id="project_menu_03">
2016-10-10 10:41:41 +08:00
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "pro_new_proname" %>
2016-10-14 17:23:51 +08:00
<% unless project_score.board_num == 0 %>
2016-10-19 16:35:26 +08:00
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.board_num %></span>
2016-10-10 10:41:41 +08:00
<% end %>
2016-10-11 09:31:17 +08:00
</li>
<% end %>
<!--资源库-->
2016-10-11 09:31:17 +08:00
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
<li id="project_menu_04">
2016-10-10 10:41:41 +08:00
<%= link_to l(:project_module_files), project_files_path(@project), :class => "pro_new_proname" %>
<% unless project_file_num == 0 %>
2016-10-19 16:35:26 +08:00
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_file_num %></span>
2016-10-10 10:41:41 +08:00
<% end %>
2016-10-11 09:31:17 +08:00
</li>
<% end %>
<!--版本库-->
<% if visible_repository?(@project) %>
2016-10-14 09:01:25 +08:00
<li id="project_menu_05"><%= link_to l(:project_module_repository),({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier)}), :class => "pro_new_proname" %>
<% unless @project.project_score.changeset_num == 0 %>
2016-10-19 16:35:26 +08:00
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.changeset_num %></span>
<% end %>
</li>
<% end %>
<!--Pull Request-->
2016-10-14 17:23:51 +08:00
<li id="project_menu_06">
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "pro_new_proname" %>
2016-10-19 16:35:26 +08:00
<span class="issues_nav_tag ml5"><%= switch_integer_into_k project_score.pull_request_num %></span>
2016-10-14 17:23:51 +08:00
</li>
<!--里程碑-->
2016-10-10 10:41:41 +08:00
<li id="project_menu_07">
<%= link_to l(:label_roadmap) ,project_roadmap_path(@project), :class => "pro_new_proname" %>
2016-10-19 16:35:26 +08:00
<span class="issues_nav_tag ml5"><%= switch_integer_into_k @project.versions.count %></span>
2016-10-10 10:41:41 +08:00
</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 %>
2016-10-11 09:31:17 +08:00
<% if User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) %>
2016-10-19 10:01:14 +08:00
<li id="project_menu_010">
2016-10-10 10:41:41 +08:00
<%= link_to "#{l(:button_configure)}", settings_project_path(@project), :class => "pro_new_proname" %>
2016-10-11 09:31:17 +08:00
</li>
<% end %>
2016-10-09 17:24:37 +08:00
</ul>
</div>
</div>
<!--新版项目头部结束-->
2016-10-10 10:41:41 +08:00
<script>
$(function(){
2016-10-19 10:01:14 +08:00
2016-10-10 10:41:41 +08:00
$("#project_menu_0<%= @project_menu_type %>").addClass('pro_new_topnav_active');
2016-10-19 10:01:14 +08:00
2016-10-10 10:41:41 +08:00
})
2016-10-11 10:16:17 +08:00
</script>