修改控制器名

解决列表中企业重名的bug
This commit is contained in:
huang 2015-01-30 17:58:41 +08:00
parent 864ed349e4
commit be9ff9b4bb
7 changed files with 18 additions and 18 deletions

View File

@ -1,6 +0,0 @@
class EnterprisesController < ApplicationController
layout 'project_base'
def index
@enterprises = Project.find_by_sql("select enterprise_name from projects")
end
end

View File

@ -0,0 +1,6 @@
class OriginizationsController < ApplicationController
layout 'project_base'
def index
@enterprises = Project.find_by_sql("select distinct(enterprise_name) from projects")
end
end

View File

@ -25,10 +25,10 @@ class WelcomeController < ApplicationController
before_filter :entry_select, :only => [:index]
def index
unless params[:enterprise].nil?
@enterprise = params[:enterprise]
@enterprise_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @enterprise])
@e_count = @enterprise_projects.count
unless params[:originization].nil?
@originization = params[:originization]
@originization_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @originization])
@e_count = @originization_projects.count
if @e_count < 10
part_count = 10 -@e_count
# @part_projects = find_all_hot_project part_count, order

View File

@ -10,7 +10,7 @@
<% unless enterprise.enterprise_name.blank? %>
<ul>
<li>
<%= link_to enterprise.enterprise_name, home_path(:enterprise => enterprise.enterprise_name) %>
<%= link_to enterprise.enterprise_name, home_path(:originization => enterprise.enterprise_name) %>
</li>
</ul>
<% end %>

View File

@ -77,7 +77,7 @@
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<!-- 如果企业版参数正确,这进入企业版页面 -->
<% if @enterprise.nil? %>
<% if @originization.nil? %>
<% @projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end; reset_cycle %>
@ -87,9 +87,9 @@
<p id="errorExplanation"><%= l(:label_enterprise_tips) %></p>
<% @projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end; reset_cycle %>
<% end %>
<% elsif @e_count < 10 %>
<% @enterprise_projects.map do |project| %>
<% @originization_projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<p id="errorExplanation"><%= l(:label_part_enterprise_tips) %></p>
@ -100,8 +100,8 @@
<% @part_projects.map do |project| %>
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %>
<% end; reset_cycle %>
<% end; reset_cycle %>
<% end %>
<% end %>
</ul>
</div>
</div>

View File

@ -26,7 +26,7 @@
# Example: :via => :get ====> :via => :get
RedmineApp::Application.routes.draw do
get "enterprises/index"
get "originizations/index"
#match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index'
@ -390,7 +390,7 @@ RedmineApp::Application.routes.draw do
match '/statistics', :to => 'projects#statistics', :as => 'statistics', :via => :get
# match '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get
match '/homework', :to => 'projects#homework', :as => 'homework', :via => :get
match 'enterprise', :to => 'enterprises#index', :as => 'index', :via => :get
match 'originizations', :to => 'originizations#index', :as => 'index', :via => :get
# match '/activity', :controller => 'activities', :action => 'index', :as => 'activity', :via => :get
# match '/repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository', :via => :get