1、修改进入组织主页项目列表显示不正确的问题

2、admin页面增加组织列表显示
This commit is contained in:
sw 2015-03-05 17:03:44 +08:00
parent 5f8595d874
commit 3c4b502e97
5 changed files with 84 additions and 17 deletions

View File

@ -28,7 +28,7 @@ class WelcomeController < ApplicationController
# 企业版定制: params[:project]为传过来的参数
unless params[:organization].nil?
@organization = Organization.find params[:organization]
@organization_projects = Project.visible.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", 1).order("score DESC").limit(10).all
@organization_projects = Project.visible.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all
@part_projects = @organization_projects.count < 9 ? find_miracle_project( 9 - @organization_projects.count, 3,"score desc") : []
# @cur_projects = Project.find(params[:organization])
# @organization = @cur_projects.enterprise_name

View File

@ -1 +1,43 @@
111
<div class="contextual">
<%= link_to l(:label_organization_new), new_organization_path, :class => 'icon icon-add' %>
</div>
<h3>
<%=l(:label_organization_list)%>
</h3>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th>
<%=l(:label_organization)%>
</th>
<th>
<%=l(:field_created_on)%>
</th>
<th></th>
</tr>
</thead>
<tbody>
<% @organizations.each do |org|%>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align:center;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=org.name%>'>
<span>
<%= link_to org.name,home_path(:organization => org.id) %>
</span>
</td>
<td align="center">
<%= format_date(org.created_at) %>
</td>
<td class="buttons">
<%= link_to(l(:button_change), edit_organization_path(org.id), :class => 'icon icon-copy') %>
<%= link_to(l(:button_delete), organization_path(org.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %>
</td>
</tr>
<% end%>
</tbody>
</table>
</div>
<% html_title(l(:label_project_plural)) -%>

View File

@ -2,16 +2,25 @@
<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>
</div>
<h3><%=l(:label_project_plural)%></h3>
<h3>
<%=l(:label_project_plural)%>
</h3>
<%= form_tag({}, :method => :get) do %>
<fieldset><legend><%= l(:label_filter_plural) %></legend>
<label for='status'><%= l(:field_status) %> :</label>
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
<label for='name'><%= l(:label_project) %>:</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
<fieldset>
<legend>
<%= l(:label_filter_plural) %>
</legend>
<label for='status'>
<%= l(:field_status) %> :
</label>
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
<label for='name'>
<%= l(:label_project) %>:
</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
@ -19,17 +28,31 @@
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead><tr>
<th><%=l(:label_project)%></th>
<th><%=l(:field_is_public)%></th>
<th><%=l(:field_created_on)%></th>
<th>
<%=l(:label_project)%>
</th>
<th>
<%=l(:field_is_public)%>
</th>
<th>
<%=l(:field_created_on)%>
</th>
<th></th>
</tr></thead>
<tbody>
<% project_tree(@projects) do |project, level| %>
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=project.name%>'><span><%= link_to_project_settings(project, {}) %></span></td>
<td align="center"><%= checked_image project.is_public? %></td>
<td align="center"><%= format_date(project.created_on) %></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=project.name%>'>
<span>
<%= link_to_project_settings(project, {}) %>
</span>
</td>
<td align="center">
<%= checked_image project.is_public? %>
</td>
<td align="center">
<%= format_date(project.created_on) %>
</td>
<td class="buttons">
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>

View File

@ -538,7 +538,9 @@ zh:
label_project: 项目
label_activity_project: '项目: ' #added by bai
label_organization: 组织
label_organization_list: 组织列表
label_organization_new: 新建组织
label_project_plural: 项目列表
label_first_page_made: 首页定制
label_project_first_page: 项目托管平台首页

View File

@ -36,7 +36,7 @@ RedmineApp::Application.routes.draw do
resources :apply_project_masters
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
resources :organization, :only => [:index] do
resources :organization, :except => [:show] do
end