Skip to content

Commit

Permalink
Merge pull request #1904 from resolve/imajax
Browse files Browse the repository at this point in the history
When uploading images directly from /refinery/images/new redirect back to /refinery/images
  • Loading branch information
parndt committed Aug 29, 2012
2 parents 559014a + 9e0573a commit f8061d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions images/app/assets/javascript/refinery/images.js.coffee.erb
Expand Up @@ -19,7 +19,6 @@ class Images

cache_dom: ->
@error_list = $("#error_list")
@success_list = $("#flash")
@error_explanation = $("#errorExplanation")
@upload_progress = $("#upload_progress")

Expand All @@ -44,14 +43,15 @@ class Images
after_upload_all: ->
$(".save-loader").hide()
@upload_progress.hide()
@success_list.show()
if @errors.length > 0
@render_errors()
else
if getParameterByName("modal") == "true"
window.parent.document.getElementById("dialog_frame").contentDocument.location.reload(true);
else
else if getParameterByName("dialog") == "true"
window.parent.location.reload(true)
else
window.location = "<%= Refinery::Core::Engine.routes.url_helpers.admin_images_path %>"

validate: (file) ->
max_file_size = <%= Refinery::Images.max_image_size %>
Expand Down
10 changes: 4 additions & 6 deletions images/app/controllers/refinery/admin/images_controller.rb
Expand Up @@ -55,12 +55,10 @@ def create
unless params[:insert]
if @images.all?(&:valid?)
flash.notice = t('uploaded_successfully', :scope => 'refinery.admin.images.form')
if from_dialog?
@dialog_successful = true
render :nothing => true, :layout => true
else
redirect_to refinery.admin_images_path
end

@dialog_successful = true if from_dialog?

render :nothing => true, :layout => true
else
self.new # important for dialogs
render :action => 'new'
Expand Down

0 comments on commit f8061d9

Please sign in to comment.