Commit 8bf75114c07289cadf0ebadbfbe5ea5e1252693e
1 parent
fae9f463
Exists in
master
and in
29 other branches
[media-panel-improvements] Multiple files upload
Showing
2 changed files
with
2 additions
and
5 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
@@ -320,9 +320,8 @@ class CmsController < MyProfileController | @@ -320,9 +320,8 @@ class CmsController < MyProfileController | ||
320 | def media_upload | 320 | def media_upload |
321 | files_uploaded = [] | 321 | files_uploaded = [] |
322 | parent = check_parent(params[:parent_id]) | 322 | parent = check_parent(params[:parent_id]) |
323 | - files = [:file1,:file2, :file3].map { |f| params[f] }.compact | ||
324 | if request.post? | 323 | if request.post? |
325 | - files.each do |file| | 324 | + params[:images].each do |file| |
326 | files_uploaded << UploadedFile.create(:uploaded_data => file, :profile => profile, :parent => parent) unless file == '' | 325 | files_uploaded << UploadedFile.create(:uploaded_data => file, :profile => profile, :parent => parent) unless file == '' |
327 | end | 326 | end |
328 | end | 327 | end |
app/views/cms/_text_editor_sidebar.html.erb
@@ -16,9 +16,7 @@ | @@ -16,9 +16,7 @@ | ||
16 | "type='Folder' or type='Gallery'" | 16 | "type='Folder' or type='Gallery'" |
17 | ) %> | 17 | ) %> |
18 | </div> | 18 | </div> |
19 | - <p><%= file_field_tag('file1') %></p> | ||
20 | - <p><%= file_field_tag('file2') %></p> | ||
21 | - <p><%= file_field_tag('file3') %></p> | 19 | + <p><%= file_field_tag('images[]', :multiple => true) %></p> |
22 | <% button_bar do %> | 20 | <% button_bar do %> |
23 | <%= submit_button(:save, _('Upload')) %> | 21 | <%= submit_button(:save, _('Upload')) %> |
24 | <% end %> | 22 | <% end %> |