From 533cbf162f480da7b955688a67263b477c3a1342 Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Thu, 15 Oct 2009 14:57:00 +0000 Subject: [PATCH] cache download pages, remove unneeded .js, cleanup --- app/controllers/application_controller.rb | 1 + app/controllers/main_controller.rb | 4 ++++ app/controllers/search_controller.rb | 7 ++----- app/views/layouts/application.rhtml | 2 +- config/environment.rb | 4 ++++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index efde1bb..2b02339 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,4 +12,5 @@ class ApplicationController < ActionController::Base render :template => 'error', :layout => "application", :status => 404 end end + end diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 01d35d6..3347867 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -1,9 +1,13 @@ require 'net/http' class MainController < ApplicationController + verify :only => :ymp, :params => [:project, :repository, :arch, :binary], :redirect_to => :index + # these pages are completely static: + caches_page :index, :developer + def old_dist dist = params[:dist] diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 241fffd..943fd70 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -35,11 +35,8 @@ class SearchController < ApplicationController @current_page = 1 if @current_page == 0 return false if @query.length < 2 - if @query =~ / / - return false if @query.split(" ").select{|e| e.length < 2 }.size > 0 - - end - + return false if @query =~ / / and @query.split(" ").select{|e| e.length < 2 }.size > 0 + base = @baseproject=="ALL" ? "" : @baseproject @result = Seeker.prepare_result(CGI.escape(@query).gsub("+", " "), base) return true diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index 059ee45..3b049dc 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -12,7 +12,7 @@ - <%= javascript_include_tag 'application', 'prototype', 'effects'%> + <%= javascript_include_tag 'application', 'prototype' %> diff --git a/config/environment.rb b/config/environment.rb index 25e6ec0..6941e70 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -44,6 +44,10 @@ end # Include your application configuration below +# remove static cache files +FileUtils.rm_f "#{RAILS_ROOT}/public/index.html" +FileUtils.rm_f "#{RAILS_ROOT}/public/developer.html" + ActiveXML::Base.config do |conf| conf.setup_transport do |map| map.default_server :rest, API_HOST -- 2.1.4