From be9ff9b4bbe273e72009d480d1b02561b10af081 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 30 Jan 2015 17:58:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A7=E5=88=B6=E5=99=A8?= =?UTF-8?q?=E5=90=8D=20=E8=A7=A3=E5=86=B3=E5=88=97=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E4=BC=81=E4=B8=9A=E9=87=8D=E5=90=8D=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/enterprises_controller.rb | 6 ------ app/controllers/originizations_controller.rb | 6 ++++++ app/controllers/welcome_controller.rb | 8 ++++---- ...{enterprises_helper.rb => originizations_helper.rb} | 0 .../{enterprises => originizations}/index.html.erb | 2 +- app/views/welcome/index.html.erb | 10 +++++----- config/routes.rb | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 app/controllers/enterprises_controller.rb create mode 100644 app/controllers/originizations_controller.rb rename app/helpers/{enterprises_helper.rb => originizations_helper.rb} (100%) rename app/views/{enterprises => originizations}/index.html.erb (83%) diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb deleted file mode 100644 index c15b6dc8f..000000000 --- a/app/controllers/enterprises_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -class EnterprisesController < ApplicationController - layout 'project_base' - def index - @enterprises = Project.find_by_sql("select enterprise_name from projects") - end -end diff --git a/app/controllers/originizations_controller.rb b/app/controllers/originizations_controller.rb new file mode 100644 index 000000000..033f9d8ec --- /dev/null +++ b/app/controllers/originizations_controller.rb @@ -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 diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 6c28ec502..b1138f964 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -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 diff --git a/app/helpers/enterprises_helper.rb b/app/helpers/originizations_helper.rb similarity index 100% rename from app/helpers/enterprises_helper.rb rename to app/helpers/originizations_helper.rb diff --git a/app/views/enterprises/index.html.erb b/app/views/originizations/index.html.erb similarity index 83% rename from app/views/enterprises/index.html.erb rename to app/views/originizations/index.html.erb index 9db8d99ab..002ea84f8 100644 --- a/app/views/enterprises/index.html.erb +++ b/app/views/originizations/index.html.erb @@ -10,7 +10,7 @@ <% unless enterprise.enterprise_name.blank? %> <% end %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index f29f588b0..c53377134 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -77,7 +77,7 @@
diff --git a/config/routes.rb b/config/routes.rb index aad7adcb3..1b79a737d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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