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
Image upload in creating issue #6962
Conversation
links = [] | ||
params['issue-imgs'].each do |img| | ||
uploader.store!(img) | ||
links << File.join(root_url,uploader.url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing after comma.
Can you please attach screenshot or |
def upload_image | ||
uploader = AttachmentUploader.new(@project.namespace.path, @project.path) | ||
links = [] | ||
params['issue-imgs'].each do |img| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be simpler to limit the upload API to a single image (rather than several images at once), and let the javascript/browser send one request per image to upload?
IMHO it would make the error handling easier on the browser side: each upload would receive its own success or error. If several files can be uploaded at once the error handling must deal with partial errors.
@randx, here are the print screens: |
def upload_image | ||
@upload_path = File.join(project.namespace.path, @project.path) | ||
@accepted_types = %w(png jpg jpeg gif) | ||
uploader = FileUploader.new('uploads/'+@upload_path,@accepted_types) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing after comma.
Surrounding space missing for operator '+'.
@@ -300,9 +299,10 @@ | |||
end | |||
end | |||
|
|||
resources :issues, constraints: {id: /\d+/}, except: [:destroy] do | |||
resources :issues, constraints: {id: /\d+/}, except: [:destroy] do= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space inside { missing.
Space inside } missing.
@@ -77,7 +80,7 @@ def update | |||
@issue = Issues::UpdateService.new(project, current_user, params[:issue]).execute(issue) | |||
|
|||
respond_to do |format| | |||
format.js | |||
format.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
links = [] | ||
params['issue-imgs'].each do |img| | ||
alt = uploader.store!(img) | ||
links << {'alt' => File.basename(alt,'.*'), 'url' => File.join(root_url, uploader.url)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [93/80]
Space missing after comma.
Space inside { missing.
Space inside } missing.
@kemenaran:
@kemenaran, we have considered your point and started working on it. So far we are done with issue, comment, and wiki forms. @randx, do we need to submit a separate pull request for the feature mentioned by @kemenaran or just maintain this PR. |
@@ -13,5 +13,4 @@ def download | |||
redirect_to uploader.url | |||
end | |||
end | |||
end | |||
|
|||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final newline missing.
+1! |
@erbunao I would think you want to implement within projects up front. It will be a better user experience. It seems like it would also be advantageous to have this new behavior in notes/comments as some point. Anything that can unify the experience. Things seem to be looking good so far. From a UI standpoint I'm not sure I like the location of the invalid file type alert. It would probably be best to have it red so it matches the normal bootstrap alert/danger scheme. It may be more appropriate to have the bar appear above or below the description field or at the bottom of the screen like other error banners do. I understand it may be helpful to have the error message appear more in context so the user notices it easily. |
Also, be careful with your editor to ensure you don't have trailing whitespace and you don't remove new lines at the end of files. It'll make review and merging easier later on. :) |
if issue.save | ||
notification_service.new_issue(issue, current_user) | ||
event_service.open_issue(issue, current_user) | ||
issue.create_cross_references!(issue.project, current_user) | ||
execute_hooks(issue) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid changes like this in files where you're not adding/changing code.
favicon.ico file seems to have been removed in this PR, also. |
@@ -69,7 +68,11 @@ def create | |||
render :new | |||
end | |||
end | |||
format.js | |||
format.js do |format| | |||
# issue = Issues.create() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this comment try to explain?
@dblessing, @jvanbaarsen, we're already refactoring the code for the feature and we're planning to submit another PR for a more generic markdown area (maybe we can incorporate this feature to the notes (comments) section and/or wiki). Thanks for the feedback! |
very nice feature! 👍 |
@randx, @dosire, @dblessing. We submitted a new pull request which applies this feature to other markdown area. Please take a look at #7011. Thanks! |
[WIP] Expecting for feedback. We have already implemented:
Looking for feedback.