Merge branch 'szzh' into develop

This commit is contained in:
huang 2016-01-14 18:41:04 +08:00
commit 831f678390
3 changed files with 65 additions and 63 deletions

View File

@ -1,56 +1,56 @@
<% projects.each do |project|%> <% projects.each do |project|%>
<li class="homepageLeftMenuCoursesLine pr"> <li class="homepageLeftMenuCoursesLine pr">
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %> <% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %>
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%> <%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>"> <ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
<li> <li>
<ul class="subNavMenu boxShadow"> <ul class="subNavMenu boxShadow">
<li class="subNavRow"> <li class="subNavRow">
<%=link_to "问题跟踪", project_issues_path(project), :class => 'fl fontGrey2', :target => '_blank',:style => "width:48px;" %> <%=link_to "问题跟踪", project_issues_path(project), :class => 'fl fontGrey2', :target => '_blank',:style => "width:48px;" %>
<%=link_to "+", new_project_issue_path(project), :class => 'fr fb', :target => '_blank',:style => "width:48px;", :title => '发布问题',:style =>'width:10px;' %> <%=link_to "+", new_project_issue_path(project), :class => 'fr fb', :target => '_blank',:style => "width:48px;", :title => '发布问题',:style =>'width:10px;' %>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li class="subNavRow"> <li class="subNavRow">
<%=link_to "资源", project_files_path(project),:class => 'fl fontGrey2 w48' %> <%=link_to "资源", project_files_path(project),:class => 'fl fontGrey2 w48' %>
<%=link_to "+", upload_files_menu_path(:project_id => project.id),:remote => true,:class => 'fr fb',:title => '上传资源'%> <%=link_to "+", upload_files_menu_path(:project_id => project.id),:remote => true,:class => 'fr fb',:title => '上传资源'%>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li class="subNavRow"> <li class="subNavRow">
<%=link_to "论坛", project_boards_path(project),:class => 'fl fontGrey2 w48', :target => '_blank'%> <%=link_to "论坛", project_boards_path(project),:class => 'fl fontGrey2 w48', :target => '_blank'%>
<%=link_to "+", project_boards_path(project, :flag => true),:class => 'fr fb', :target => '_blank',:title => '发布帖子'%> <%=link_to "+", project_boards_path(project, :flag => true),:class => 'fr fb', :target => '_blank',:title => '发布帖子'%>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, project)) && rep_is_gitlab?(project) %> <% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, project)) && rep_is_gitlab?(project) %>
<li class="subNavRow"> <li class="subNavRow">
<%= link_to '版本库', url_for(:controller => 'projects', :action => 'settings', :id => project.id, :tab=>'repositories') , :target => '_blank',:class => "fl w48",:title => '版本库' %> <%= link_to '版本库', url_for(:controller => 'projects', :action => 'settings', :id => project.id, :tab=>'repositories') , :target => '_blank',:class => "fl w48",:title => '版本库' %>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<% end %> <% end %>
<% if User.current == @user %> <% if User.current == @user %>
<li class="subNavRow"> <li class="subNavRow">
<% if ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %> <% if ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %>
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true %> <%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true %>
<% else %> <% else %>
<%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :project_id => project.id),:method => 'delete',:remote => true %> <%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :project_id => project.id),:method => 'delete',:remote => true %>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<% end %> <% end %>
<% if User.current.logged? && (User.current.admin? || is_project_manager?(User.current,project)) %> <% if User.current.logged? && (User.current.admin? || is_project_manager?(User.current,project)) %>
<li class="subNavRow"> <li class="subNavRow">
<%= link_to project.is_public? ? "设为私有" : "设为公开", {:controller => 'projects', :action => 'set_public_or_private', :id => project.id,:user_page => true}, <%= link_to project.is_public? ? "设为私有" : "设为公开", {:controller => 'projects', :action => 'set_public_or_private', :id => project.id,:user_page => true},
:id => 'set_project_public_'+ project.id.to_s,:method => 'post',:remote=>true,:confirm=>"您确定要设置为"+(project.is_public? ? "私有" : "公开")+"吗"%> :id => 'set_project_public_'+ project.id.to_s,:method => 'post',:remote=>true,:confirm=>"您确定要设置为"+(project.is_public? ? "私有" : "公开")+"吗"%>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<% end %> <% end %>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<% end %> <% end %>
<% if projects.size == 5%> <% if projects.size == 5%>
<li class="homepageLeftMenuMore" id="user_show_more_project"> <li class="homepageLeftMenuMore" id="user_show_more_project">
<input type="hidden" value="<%= page%>" id="project_page_num"> <input type="hidden" value="<%= page%>" id="project_page_num">
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_project('<%= user_projects4show_user_path(user.id)%>');"></a> <a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_project('<%= user_projects4show_user_path(user.id)%>');"></a>
</li> </li>
<% end%> <% end%>

View File

@ -1,5 +1,7 @@
<% if @project.is_public? %> <% if @project.is_public? %>
$("#set_project_public_<%= @project.id %>").text("设为私有"); $("#set_project_public_<%= @project.id %>").text("设为私有");
<% else %> $("#show_project_<%= @project.id %>").attr("title","公开项目:<%= @project.name %>");
$("#set_project_public_<%= @project.id %>").text("设为公开"); <% else %>
$("#set_project_public_<%= @project.id %>").text("设为公开");
$("#show_project_<%= @project.id %>").attr("title","私有项目:<%= @project.name %>");
<% end %> <% end %>

View File

@ -74,10 +74,10 @@ RedmineApp::Application.routes.draw do
end end
Organization.where("domain is not null").each do |org| Organization.where("domain is not null").each do |org|
org_domains = [] # org_domains = []
org_domains << org.domain # org_domains << org.domain
#get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: {subdomain: org.domain} get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: {subdomain: org.domain}
get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: lambda{ |request| org_domains.include?(request.remote_ip) } #get '/', to: 'organizations#show', defaults: { id: org.id }, constraints: lambda{ |request| org_domains.include?(request.remote_ip) }
end end
get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'} get '/', to: 'organizations#show', defaults: { id: 5 }, constraints: {subdomain: 'micros'}
get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'} get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'}