diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 83d5561..8ac9e16 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -135,6 +135,7 @@ class CmsController < MyProfileController def upload_files @uploaded_files = [] @article = @parent = check_parent(params[:parent_id]) + @target = @parent ? ('/%s/%s' % [profile.identifier, @parent.full_name]) : '/%s' % profile.identifier record_coming_from_public_view if @article if request.post? && params[:uploaded_files] params[:uploaded_files].each do |file| diff --git a/app/views/cms/upload_files.rhtml b/app/views/cms/upload_files.rhtml index 1de5c6e..2efc75e 100644 --- a/app/views/cms/upload_files.rhtml +++ b/app/views/cms/upload_files.rhtml @@ -10,7 +10,6 @@ <% end %> - <% end %>

<%= _('Publish media') %>

@@ -18,6 +17,8 @@

<%= _("Select the files you want to upload (max size %s):") % UploadedFile.max_size.to_humanreadable %>

<%= _('Documents, Images, Videos, Audio') %>

+
<%= _('Uploading files to %s') % content_tag('code', @target) %>
+ <% form_for('uploaded_file', :url => { :action => 'upload_files' }, :html => {:multipart => true}) do |f| %>
diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index 29572c4..4cc4a22 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -227,6 +227,19 @@ class CmsControllerTest < Test::Unit::TestCase assert_equal 'test.txt', f.children[0].name end + should 'display destination folder of files when uploading file in root folder' do + get :upload_files, :profile => profile.identifier + + assert_tag :tag => 'h5', :descendant => { :tag => 'code', :content => /\/#{profile.identifier}/ } + end + + should 'display destination folder of files when uploading file' do + f = Folder.new(:name => 'f'); profile.articles << f; f.save! + get :upload_files, :profile => profile.identifier, :parent_id => f.id + + assert_tag :tag => 'h5', :descendant => { :tag => 'code', :content => /\/#{profile.identifier}\/#{f.full_name}/} + end + should 'not crash on empty file' do assert_nothing_raised do post :upload_files, :profile => profile.identifier, :uploaded_files => [fixture_file_upload('/files/test.txt', 'text/plain'), '' ] -- libgit2 0.21.2