diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-06-26 13:05:08 -0700 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-06-26 13:05:08 -0700 |
commit | 27d6ad899f594bd9b79e54cdc5a3c17110f3b26c (patch) | |
tree | b75973ee4325bd11f27220e38d1e899076948c78 /app/controllers/general_controller.rb | |
parent | 9bbc93bfd8ba8aaaf9bd1ad9031368b7faad8239 (diff) | |
parent | 3194a7801684d010dac94c26cf39bb780bfcd17e (diff) |
Merge branch 'release/0.12'0.12
Conflicts:
locale/he_IL/app.po
locale/hr_HR/app.po
locale/nb_NO/app.po
locale/uk/app.po
Diffstat (limited to 'app/controllers/general_controller.rb')
-rw-r--r-- | app/controllers/general_controller.rb | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 9d0f91dda..939dd1739 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -153,7 +153,7 @@ class GeneralController < ApplicationController # structured query which should show newest first, rather than a free text search # where we want most relevant as default. begin - dummy_query = ::ActsAsXapian::Search.new([InfoRequestEvent], @query, :limit => 1) + dummy_query = ActsAsXapian::Search.new([InfoRequestEvent], @query, :limit => 1) rescue => e flash[:error] = "Your query was not quite right. " + CGI.escapeHTML(e.to_str) redirect_to search_url("") @@ -169,10 +169,8 @@ class GeneralController < ApplicationController # Query each type separately for separate display (XXX we are calling # perform_search multiple times and it clobbers per_page for each one, # so set as separate var) - requests_per_page = 25 - if params[:requests_per_page] - requests_per_page = params[:requests_per_page].to_i - end + requests_per_page = params[:requests_per_page] ? params[:requests_per_page].to_i : 25 + @this_page_hits = @total_hits = @xapian_requests_hits = @xapian_bodies_hits = @xapian_users_hits = 0 if @requests @xapian_requests = perform_search([InfoRequestEvent], @query, @sortby, 'request_collapse', requests_per_page) @@ -211,22 +209,19 @@ class GeneralController < ApplicationController @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ] end - # Jump to a random request - def random_request - info_request = InfoRequest.random - redirect_to request_url(info_request) - end - - def custom_css - long_cache - @locale = self.locale_from_params() - render(:layout => false, :content_type => 'text/css') - end - # Handle requests for non-existent URLs - will be handled by ApplicationController::render_exception def not_found raise RouteNotFound end + def version + respond_to do |format| + format.json { render :json => { + :alaveteli_git_commit => alaveteli_git_commit, + :alaveteli_version => ALAVETELI_VERSION, + :ruby_version => RUBY_VERSION + }} + end + end end |