Skip to content

Commit

Permalink
return the correct json header type
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug Youch committed Apr 6, 2011
1 parent b81073e commit 23fcf7a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/controllers/file_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ def upload
)
@processing_key = session[:upload_file_worker] = worker_key

return render :json => {:processing_key => @processing_key} if params[:format] == 'json'
if params[:format] == 'json'
set_json_content_type
return render :json => {:processing_key => @processing_key}
end

respond_to_parent do
render :action => 'upload.rjs'
Expand Down Expand Up @@ -448,6 +451,7 @@ def export_status

session[:download_worker_key] = nil if @failed

set_json_content_type
render :json => {:completed => @completed, :failed => @failed}
end

Expand All @@ -469,6 +473,8 @@ def import_status

results = Workling.return.get session[:import_worker_key]

set_json_content_type

if results
@completed = results[:processed] || results[:completed]
@failed = results[:valid] === false
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/search_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ def autocomplete

def suggestions
search = params[:search]
return render :json => [search, ['Not logged in']] unless myself.id && myself.editor?
unless myself.id && myself.editor?
set_json_content_type
return render :json => [search, ['Not logged in']]
end

case search
when /^:$/
Expand Down Expand Up @@ -186,6 +189,7 @@ def suggestions
urls.push result[:url]
end if @results

set_json_content_type
render :json => [search, suggestions, descriptions, urls]
end

Expand Down
3 changes: 3 additions & 0 deletions app/controllers/theme_builder_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

class ThemeBuilderController < CmsController
include RjsHelper

permit 'editor_design_templates'

layout 'manage'
Expand Down Expand Up @@ -52,6 +54,7 @@ def fetch_status
session.delete :theme_builder_url
end

set_json_content_type
render :json => {:processed => processed, :successful => successful, :running => ! results.empty?, :html_file_id => html_file_id}
end

Expand Down

0 comments on commit 23fcf7a

Please sign in to comment.