Skip to content

Commit ba638de

Browse files
committed
refactor/Use collection endpoint for user edit modal
1 parent 962dc76 commit ba638de

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

app/controllers/users_controller.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
class UsersController < ApplicationController
22
def edit_avatar_modal
3-
@user = User.find(params[:id])
4-
53
render layout: false
64
end
75

app/javascript/controllers/upload_controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class extends Controller {
2222
reader.onload = function(e) {
2323
self.uploadedFile = e.target.result
2424

25-
self.modal.present('/users/1/edit_avatar_modal')
25+
self.modal.present('/users/edit_avatar_modal')
2626
}
2727

2828
reader.readAsDataURL(input.files[0]);

config/routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
get :hovercard, on: :member
4646

4747
# Modals
48-
get :edit_avatar_modal, on: :member
48+
get :edit_avatar_modal, on: :collection
4949

5050
resources :snippets, only: :index
5151
end

0 commit comments

Comments
 (0)