Skip to content

Commit

Permalink
Update flash message after work is created, fixes #2104
Browse files Browse the repository at this point in the history
  • Loading branch information
awead committed Jun 10, 2016
1 parent 4838b47 commit 5dd66d1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
Expand Up @@ -13,13 +13,7 @@ module BatchUploadsControllerBehavior
def create
authenticate_user!
create_update_job
flash[:notice] = <<-EOS.strip_heredoc.tr("\n", ' ')
Your files are being processed by #{view_context.application_name} in
the background. The metadata and access controls you specified are being applied.
Files will be marked <span class="label label-danger" title="Private">Private</span>
until this process is complete (shouldn't take too long, hang in there!). You may need
to refresh your dashboard to see these updates.
EOS
flash[:notice] = t('sufia.generic_works.new.after_create_html', application_name: view_context.application_name)
redirect_after_update
end

Expand Down
6 changes: 1 addition & 5 deletions app/controllers/concerns/sufia/works_controller_behavior.rb
Expand Up @@ -45,11 +45,7 @@ def attributes_for_actor
def after_create_response
respond_to do |wants|
wants.html do
flash[:notice] = "Your files are being processed by #{view_context.application_name} in " \
"the background. The metadata and access controls you specified are being applied. " \
"Files will be marked <span class=\"label label-danger\" title=\"Private\">Private</span> " \
"until this process is complete (shouldn't take too long, hang in there!). You may need " \
"to refresh your dashboard to see these updates."
flash[:notice] = t('sufia.generic_works.new.after_create_html', application_name: view_context.application_name)
redirect_to [main_app, curation_concern]
end
wants.json { render :show, status: :created, location: polymorphic_path([main_app, curation_concern]) }
Expand Down
1 change: 1 addition & 0 deletions config/locales/sufia.en.yml
Expand Up @@ -208,6 +208,7 @@ en:
new:
header: Add New Work
in_collections: This Work in Collections
after_create_html: "Your files are being processed by %{application_name} in the background. The metadata and access controls you specified are being applied. Files will be marked <span class=\"label label-danger\" title=\"Private\">Private</span> until this process is complete (shouldn't take too long, hang in there!). You may need to refresh this page to see these updates."
edit:
header: Edit Work
in_collections: This Work in Collections
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/generic_works_controller_spec.rb
Expand Up @@ -106,7 +106,7 @@
post :create, generic_work: { title: ["First title"],
visibility: 'open' },
uploaded_files: ['777', '888']
expect(flash[:notice]).to eq "Your files are being processed by Sufia in the background. The metadata and access controls you specified are being applied. Files will be marked <span class=\"label label-danger\" title=\"Private\">Private</span> until this process is complete (shouldn't take too long, hang in there!). You may need to refresh your dashboard to see these updates."
expect(flash[:notice]).to eq "Your files are being processed by Sufia in the background. The metadata and access controls you specified are being applied. Files will be marked <span class=\"label label-danger\" title=\"Private\">Private</span> until this process is complete (shouldn't take too long, hang in there!). You may need to refresh this page to see these updates."
expect(response).to redirect_to main_app.curation_concerns_generic_work_path(work)
end

Expand Down Expand Up @@ -156,7 +156,7 @@
uploaded_files: uploaded_files,
parent_id: work.id,
generic_work: { title: ['First title'] }
expect(flash[:notice]).to eq "Your files are being processed by Sufia in the background. The metadata and access controls you specified are being applied. Files will be marked <span class=\"label label-danger\" title=\"Private\">Private</span> until this process is complete (shouldn't take too long, hang in there!). You may need to refresh your dashboard to see these updates."
expect(flash[:notice]).to eq "Your files are being processed by Sufia in the background. The metadata and access controls you specified are being applied. Files will be marked <span class=\"label label-danger\" title=\"Private\">Private</span> until this process is complete (shouldn't take too long, hang in there!). You may need to refresh this page to see these updates."
expect(response).to redirect_to main_app.curation_concerns_generic_work_path(work)
end
end
Expand Down

0 comments on commit 5dd66d1

Please sign in to comment.