项目资源统计代码优化
This commit is contained in:
parent
1919292c58
commit
5af284e8a4
|
@ -130,7 +130,7 @@ class IssuesController < ApplicationController
|
||||||
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
|
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
|
||||||
@available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
|
@available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|``
|
||||||
format.html {
|
format.html {
|
||||||
retrieve_previous_and_next_issue_ids
|
retrieve_previous_and_next_issue_ids
|
||||||
render :template => 'issues/show', :layout => @project_base_tag#by young
|
render :template => 'issues/show', :layout => @project_base_tag#by young
|
||||||
|
|
|
@ -18,54 +18,7 @@
|
||||||
<!-- page specific tags -->
|
<!-- page specific tags -->
|
||||||
<%= yield :header_tags -%>
|
<%= yield :header_tags -%>
|
||||||
|
|
||||||
<!--项目的三种类型-->
|
|
||||||
<script type="text/javascript">
|
|
||||||
function click_ok(url)
|
|
||||||
{
|
|
||||||
$('#light').css('display','none');
|
|
||||||
$('#fade').css('display','none');
|
|
||||||
//ajax处理请求
|
|
||||||
var project_type;
|
|
||||||
if($("#development_group").attr("checked") == "checked"){
|
|
||||||
project_type = 1;
|
|
||||||
}
|
|
||||||
else if($("#research_group").attr("checked") == "checked"){
|
|
||||||
project_type = 2;
|
|
||||||
|
|
||||||
}
|
|
||||||
else if($("#friend_organization").attr("checked") == "checked"){
|
|
||||||
project_type = 3;
|
|
||||||
}
|
|
||||||
$.get(
|
|
||||||
url,
|
|
||||||
{ project_type: project_type},
|
|
||||||
function (data) {
|
|
||||||
if(data == 1)
|
|
||||||
{
|
|
||||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>");
|
|
||||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group')) %>');
|
|
||||||
$("#close_light").attr("onClick","close_window('development_group');");
|
|
||||||
}
|
|
||||||
else if(data == 2)
|
|
||||||
{
|
|
||||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>");
|
|
||||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team')) %>');
|
|
||||||
$("#close_light").attr("onClick","close_window('research_group');");
|
|
||||||
}
|
|
||||||
else if(data == 3)
|
|
||||||
{
|
|
||||||
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>");
|
|
||||||
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group')) %>');
|
|
||||||
$("#close_light").attr("onClick","close_window('friend_organization');");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
alert("服务器异常,请与管理员联系");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<!--add by huang-->
|
<!--add by huang-->
|
||||||
<body>
|
<body>
|
||||||
|
@ -83,13 +36,7 @@
|
||||||
</h2>
|
</h2>
|
||||||
<p class="hidden">
|
<p class="hidden">
|
||||||
<%= l(:label_user_location) %> :
|
<%= l(:label_user_location) %> :
|
||||||
<%= link_to l(:field_homepage), home_path %>
|
<%= link_to l(:field_homepage), home_path %> > <a href="http://<%= Setting.host_name %>"><%=l(:label_project_hosting_platform) %> </a>><%= link_to @project.name, project_path(@project.id) %>
|
||||||
>
|
|
||||||
<a href="http://<%= Setting.host_name %>">
|
|
||||||
<%=l(:label_project_hosting_platform) %>
|
|
||||||
</a>
|
|
||||||
>
|
|
||||||
<%= link_to @project.name, project_path(@project.id) %>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="search fl">
|
<div class="search fl">
|
||||||
|
@ -144,10 +91,11 @@
|
||||||
<%= l(:label_member) %>(<%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue' %>)
|
<%= l(:label_member) %>(<%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue' %>)
|
||||||
<span>| </span>
|
<span>| </span>
|
||||||
<%= l(:label_user_watcher) %>(<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>)
|
<%= l(:label_user_watcher) %>(<%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>)
|
||||||
|
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
||||||
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
<% unless @project.enabled_modules.where("name = 'files'").empty? %>
|
||||||
<span>| </span>
|
<span>| </span>
|
||||||
<%= l(:project_module_attachments) %>(
|
<%= l(:project_module_attachments) %>(
|
||||||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
<% attaments_num %>
|
||||||
<%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue' %></span>)
|
<%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue' %></span>)
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -166,14 +114,14 @@
|
||||||
</ul>
|
</ul>
|
||||||
<% end %><!--end-->
|
<% end %><!--end-->
|
||||||
<!--menu 左侧工具栏 -->
|
<!--menu 左侧工具栏 -->
|
||||||
<!--project_new_type: 1为开发组;2为科研组;3为朋友圈子-->
|
<%#--project_new_type: 1为开发组;2为科研组;3为朋友圈子--%>
|
||||||
<div id="project_memu_list">
|
<div id="project_memu_list">
|
||||||
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
|
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
|
||||||
<%= render :partial => 'projects/development_group', :locals => {:project => @project}%>
|
<%= render :partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
|
||||||
<% elsif @project.project_new_type == 2 %>
|
<% elsif @project.project_new_type == 2 %>
|
||||||
<%= render :partial => 'projects/research_team', :locals => {:project => @project}%>
|
<%= render :partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num} %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render :partial => 'projects/friend_group', :locals => {:project => @project}%>
|
<%= render :partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<!-- end -->
|
<!-- end -->
|
||||||
|
@ -232,8 +180,55 @@
|
||||||
<li><input type="radio" name="project_type" <%= @project.project_new_type == 3 ? 'checked' : ''%> id="friend_organization"/><label class="f14"> 圈子模式:<span class="f12 ml5 c_grey">为朋友圈提供简洁的交流和分享工具。</span></label></li>
|
<li><input type="radio" name="project_type" <%= @project.project_new_type == 3 ? 'checked' : ''%> id="friend_organization"/><label class="f14"> 圈子模式:<span class="f12 ml5 c_grey">为朋友圈提供简洁的交流和分享工具。</span></label></li>
|
||||||
</ul>
|
</ul>
|
||||||
<a href="javascript:void(0)" class="orange_btn" onclick="click_ok('<%= change_project_type_project_path @project%>');" >确定</a>
|
<a href="javascript:void(0)" class="orange_btn" onclick="click_ok('<%= change_project_type_project_path @project%>');" >确定</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!--项目的三种类型-->
|
||||||
|
<script type="text/javascript">
|
||||||
|
function click_ok(url)
|
||||||
|
{
|
||||||
|
$('#light').css('display','none');
|
||||||
|
$('#fade').css('display','none');
|
||||||
|
//ajax处理请求
|
||||||
|
var project_type;
|
||||||
|
if($("#development_group").attr("checked") == "checked"){
|
||||||
|
project_type = 1;
|
||||||
|
}
|
||||||
|
else if($("#research_group").attr("checked") == "checked"){
|
||||||
|
project_type = 2;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if($("#friend_organization").attr("checked") == "checked"){
|
||||||
|
project_type = 3;
|
||||||
|
}
|
||||||
|
$.get(
|
||||||
|
url,
|
||||||
|
{ project_type: project_type},
|
||||||
|
function (data) {
|
||||||
|
if(data == 1)
|
||||||
|
{
|
||||||
|
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>");
|
||||||
|
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
|
||||||
|
$("#close_light").attr("onClick","close_window('development_group');");
|
||||||
|
}
|
||||||
|
else if(data == 2)
|
||||||
|
{
|
||||||
|
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>");
|
||||||
|
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
|
||||||
|
$("#close_light").attr("onClick","close_window('research_group');");
|
||||||
|
}
|
||||||
|
else if(data == 3)
|
||||||
|
{
|
||||||
|
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>");
|
||||||
|
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num})) %>');
|
||||||
|
$("#close_light").attr("onClick","close_window('friend_organization');");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alert("服务器异常,请与管理员联系");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<div id="fade" class="black_overlay">123</div>
|
<div id="fade" class="black_overlay">123</div>
|
||||||
<%= render :partial => 'layouts/new_feedback' %>
|
<%= render :partial => 'layouts/new_feedback' %>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
|
||||||
<div class="subNav">
|
<div class="subNav">
|
||||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
|
||||||
<div class="subNav">
|
<div class="subNav">
|
||||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<% attaments_num = @project.attachments.count+Attachment.where(["`container_type` = 'Version' and `container_id` in (?)",@project.versions.map{ |v| v.id}]).all.count %>
|
|
||||||
<div class="subNav">
|
<div class="subNav">
|
||||||
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||||
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %>
|
||||||
|
|
Loading…
Reference in New Issue