Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

tudorpavel
Copy link

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

@dosire
Copy link
Member

dosire commented Mar 5, 2014

@tudorpavel Thanks! Can you please add tests for this?

@tudorpavel
Copy link
Author

@dosire Sure. Spinach (feature) tests?

@dosire
Copy link
Member

dosire commented Mar 5, 2014

@tudorpavel Yes please

@jvanbaarsen
Copy link
Contributor

@tudorpavel Thanks! Was missing this feature :D

@tudorpavel
Copy link
Author

@jvanbaarsen Don't mention it! Indeed, it was about time... 😁

@dosire Feature tests added.

@dosire
Copy link
Member

dosire commented Mar 7, 2014

@randx Can you review this?

@dzaporozhets
Copy link
Member

I think it makes sense to implement multiple image attachment. Now you already can attach single image to comment.
If I want to add more then one image (ex. screenshot before and after) this feature wont help.
So I propose to implement multiple image attach at once

@rspeicher
Copy link
Contributor

Also I think it should support dropping an image on the page to upload, a la GitHub or Imgur.

@kemenaran
Copy link
Contributor

+1, would love to have this. A single attachment seems a good start to me — multiple attachments can be added later.

@tudorpavel
Copy link
Author

@randx Multiple attachments would be quite more complex. I thought about it and decided I should do just one attachment first.

Also, a UX has to be decided upon:

  • are the images displayed inline with the description using drag&drop?
  • or multiple file upload and display them underneath the description one after the other?

@dzaporozhets
Copy link
Member

@tudorpavel I see. But implementing single attachment and then implementing multiple attachments is rewriting same code twice. Thats why I consider doing multiple attachments at once. I'm for drag&drop too

@tudorpavel tudorpavel closed this Mar 16, 2014
@tudorpavel tudorpavel reopened this Mar 16, 2014
@tudorpavel
Copy link
Author

@randx So the GitHub style of adding images inline with the help of Markdown seems ok, right?

I'm not sure how or if I should model multiple attachments with CarrierWave.
Any suggestions will be helpful.

@dzaporozhets
Copy link
Member

@tudorpavel yeap. Github style is ok

@kaystrobach
Copy link

why not allowing it like on github ... drag'n'drop or clipboard paste ... it's the easiest way for endusers

@kemenaran
Copy link
Contributor

I agree that drag/drop upload would make more sense than attachements.

Drag/drop would put all the images of a project in an assets/<namespace>/<project>/ directory. Whether uploaded from an issue form, a merge-request form, the wiki — it doesn't matter, it's just a directory with some pictures. There would be no strong connection with the model (like the connection a note has with its attachement), just some lightweight markdown-friendly URLs.

I hacked a proof-of-concept of drag/drop upload, using the jQuery-File-Upload plugin and some trivial modifications to the Ruby code: it works quite well, and the mental model for this seems elegant enough to me (even if my implementation is messy). If some people are interested in this direction, I can cleanup the code and submit it.

@kaystrobach
Copy link

i would like to have that - please also add clipboard uploading ...
http://mobiarch.wordpress.com/2013/09/25/upload-image-by-copy-and-paste/

@kaystrobach
Copy link

imho there is no need to save these images structured in directories, but you can 😄

@BrianGilbert
Copy link

I really hope this makes it into 6.8

@jvanbaarsen
Copy link
Contributor

This merge request has been closed because a request for more information has not been reacted to for more than 2 weeks. If you respond and conform to the merge request guidelines in our contributing guidelines we will reopen this merge request. /cc @Razer6

@dosire
Copy link
Member

dosire commented Apr 6, 2014

@tudorpavel Please let us know if you have time to work on this and would like to reopen it.

@Razer6 Razer6 closed this Apr 6, 2014
@kaystrobach
Copy link

please reopen, this is really a killer feature i do really miss for now.

@dosire
Copy link
Member

dosire commented Apr 9, 2014

@kaystrobach We will reopen if someone has time to work on this.

@erbunao
Copy link
Contributor

erbunao commented May 12, 2014

Please reopen, we would like to work on this feature.

Specifically, we're going to do the following:

  • Drag&Drop
  • Multiple images to the description section of an issue
  • Save these images to the assets/<namespace>/<project>/

Hoping for feedback.

@kaystrobach
Copy link

@erbunao pleas also consider the clipboard uploading.
http://joelb.me/blog/2011/code-snippet-accessing-clipboard-images-with-javascript/

I would prefer a more general upload solution for all textareas supporting markdown 👍 this way you just need a uploadhandler + the JS across all sites

@jvanbaarsen
Copy link
Contributor

@erbunao Thanks for your interest in this feature, i'll re-open this one for now. But it will be closed if there is no activity in the next 14 days.

@jvanbaarsen jvanbaarsen reopened this May 12, 2014
@dosire
Copy link
Member

dosire commented May 12, 2014

@erbunao Awesome that you will work on this. Please send separate merge requests if possible.

Multiple images to the description section of an issue => Please also allow multiple images attached to comments.

@erbunao
Copy link
Contributor

erbunao commented May 13, 2014

We need some suggestions where to upload these images. We're proposing to create an assets directory in the same level with gitlab, gitlab-satellites, gitlab-shell, and repositories.

@kaystrobach
Copy link

@erbunao sounds great,
for the usability i suggest that you make it similar, how github made it in this issue tracker form 👍 it
s straigtforward and easy to use

@erbunao
Copy link
Contributor

erbunao commented May 13, 2014

@dosire, we already filed a pull request for this feature: #6962. UI print screens to follow.

@dosire
Copy link
Member

dosire commented May 13, 2014

@erbunao Awesome!

@jvanbaarsen
Copy link
Contributor

Since this feature has been merged via #7011 i'll close this MR.

@dosire
Copy link
Member

dosire commented Jun 2, 2014

Thanks @jvanbaarsen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
10 participants