Skip to content

Add feature to be able to upload a file to an issue

Created by: tudorpavel

The idea of this feature is to have the possibility of uploading a file to an issue, not just to comments. This implementation works just for the simpler case of only one file per issue.

Feature requests:

User Interface

The implementation consists of:

  • a slightly modified add/edit issue form
  • a slightly modified show issue page
Add/Edit Form

Before: edit_page_before_issue_file_upload

After, without any attachment: edit_page_after_issue_file_upload

After, with image attachment: edit_page_after_issue_file_upload_with_img_attachment

After, with non-image file attachment: edit_page_after_issue_file_upload_with_attachment

Show page

Before: show_page_before_issue_file_upload

After, with image attachment: show_page_after_issue_file_upload_with_img_attachment

After, with non-image file attachment: show_page_after_issue_file_upload_with_attachment

Implementation

  • migration to add attachment column to the issues table
  • modify Issue model to add CarrierWave attachment the same way it's done for Note
  • add issue :delete_attachment route
  • add attachment code and style in views so it looks and works very similar to the notes attachment
  • had to generalize FilesController#download to work with any model

Merge request reports

Loading