diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 02:39:55 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 02:39:55 +0200 |
| commit | b4f850e97aeb12369399d8e1ab354f66d3b88e40 (patch) | |
| tree | a4936218a3e8df5525150d12ed4b94c077befd6f /app | |
| parent | e7d5d0b2c32b172ecdaa80555bf5804043fd87a0 (diff) | |
Stage 6 click-testing fixes and production setup
- file_attachment.rb: delete old upload directory before writing replacement
files; fixes orphaned variants when filename or mime type changes
- assets/edit.html.erb: add file upload field and current file display;
the form was previously empty and non-functional
- admin.css: fix button_to hover styling; buttons now show orange hover
to signal interactivity
- test/controllers/users_controller_test.rb: assert input[type=submit]
not anchor tag for destroy action (button_to change)
- test/test_helper.rb: add I18n.locale reset in setup block
- doc/rc.d_cccms: fix cccms_chdir, add start_precmd for log/pid dirs,
PATH export for bash wrapper, user/pid/tcp_nopush unicorn fixes
- doc/INSTALL.md: new installation guide covering all non-obvious steps
- Remove parked search migration from doc/ (now in db/migrate/)
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/concerns/file_attachment.rb | 3 | ||||
| -rw-r--r-- | app/views/assets/edit.html.erb | 18 |
2 files changed, 18 insertions, 3 deletions
diff --git a/app/models/concerns/file_attachment.rb b/app/models/concerns/file_attachment.rb index 5483de5..e9acda6 100644 --- a/app/models/concerns/file_attachment.rb +++ b/app/models/concerns/file_attachment.rb | |||
| @@ -60,6 +60,9 @@ module FileAttachment | |||
| 60 | uploaded_file = @pending_upload | 60 | uploaded_file = @pending_upload |
| 61 | @pending_upload = nil | 61 | @pending_upload = nil |
| 62 | 62 | ||
| 63 | old_dir = Rails.root.join("public", "system", "uploads", id.to_s) | ||
| 64 | FileUtils.rm_rf(old_dir) if Dir.exist?(old_dir) | ||
| 65 | |||
| 63 | original_path = file_path(:original) | 66 | original_path = file_path(:original) |
| 64 | FileUtils.mkdir_p(File.dirname(original_path)) | 67 | FileUtils.mkdir_p(File.dirname(original_path)) |
| 65 | FileUtils.cp(uploaded_file.tempfile.path, original_path) | 68 | FileUtils.cp(uploaded_file.tempfile.path, original_path) |
diff --git a/app/views/assets/edit.html.erb b/app/views/assets/edit.html.erb index e65d600..f198600 100644 --- a/app/views/assets/edit.html.erb +++ b/app/views/assets/edit.html.erb | |||
| @@ -1,12 +1,24 @@ | |||
| 1 | <h1>Editing asset</h1> | 1 | <h1>Editing asset</h1> |
| 2 | 2 | ||
| 3 | <%= form_for(@asset) do |f| %> | 3 | <%= form_for(@asset, html: { multipart: true }) do |f| %> |
| 4 | <%= form_error_messages(f) %> | 4 | <%= form_error_messages(f) %> |
| 5 | 5 | ||
| 6 | <% if @asset.upload.present? %> | ||
| 7 | <p> | ||
| 8 | <strong>Current file:</strong> | ||
| 9 | <%= @asset.upload.url %> | ||
| 10 | (<%= number_to_human_size(@asset.upload.size) %>) | ||
| 11 | </p> | ||
| 12 | <% end %> | ||
| 13 | |||
| 14 | <p> | ||
| 15 | <label>Replace file:</label><br> | ||
| 16 | <%= f.file_field :upload %> | ||
| 17 | </p> | ||
| 18 | |||
| 6 | <p> | 19 | <p> |
| 7 | <%= f.submit 'Update' %> | 20 | <%= f.submit 'Update' %> |
| 8 | </p> | 21 | </p> |
| 9 | <% end %> | 22 | <% end %> |
| 10 | 23 | ||
| 11 | <%= link_to 'Show', @asset %> | | 24 | <%= link_to 'Show', @asset %> | <%= link_to 'Back', assets_path %> |
| 12 | <%= link_to 'Back', assets_path %> | ||
