Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When uploading images directly from /refinery/images/new redirect back t... #1904

Merged
merged 1 commit into from
Aug 29, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions images/app/assets/javascript/refinery/images.js.coffee.erb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if they're not using a dialogue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the case I was trying to fix. They'll get redirected back to /refinery/images by https://github.com/resolve/refinerycms/pull/1904/files#L0R54

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