From 99193fb27f9b6f8e02e322bfb1797d9bd2c52b73 Mon Sep 17 00:00:00 2001 From: Ronaq13 Date: Mon, 10 Apr 2017 21:31:11 +0530 Subject: [PATCH] nothing changed --- .byebug_history | 12 + .gitignore | 2 + .idea/workspace.xml | 374 +++++++++++++------------ app/controllers/student_controller.rb | 10 + app/views/layouts/application.html.erb | 12 +- app/views/mentor/addNewCourse.html.erb | 5 +- app/views/student/doingCourse.html.erb | 5 +- app/views/student/profile.html.erb | 2 +- app/views/student/settings.html.erb | 4 +- 9 files changed, 236 insertions(+), 190 deletions(-) diff --git a/.byebug_history b/.byebug_history index 169731d..a7e9c89 100644 --- a/.byebug_history +++ b/.byebug_history @@ -1,4 +1,16 @@ c +profile_photo_name +c +newProfilPhoto +newProfilePhoto +profilePhoto +params[:profile_photo] +params +c +newFileName +new_image +params["profile_picture"] +c coursesIdArray coursesIdArray.pop() c diff --git a/.gitignore b/.gitignore index 050c9d9..8873a12 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ /log/* !/log/.keep /tmp + +public/uploads/* \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9062411..3fb1302 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,7 +4,17 @@ - + + + + + + + + + + + @@ -22,7 +32,87 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -86,10 +177,10 @@ DEFINITION_ORDER - @@ -106,9 +197,9 @@ + - @@ -145,51 +236,15 @@ - - - - - - - - - - - - - - - - - - - - - @@ -203,15 +258,7 @@ @@ -359,6 +384,7 @@ + + + + @@ -602,6 +631,10 @@ + + + + 1489737712487 @@ -621,12 +654,13 @@ - - + + - + @@ -690,26 +724,10 @@ - - - - - - - - - - - - - - - - @@ -717,7 +735,6 @@ - @@ -816,7 +833,6 @@ - @@ -834,13 +850,6 @@ - - - - - - - @@ -859,7 +868,6 @@ - @@ -905,42 +913,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -948,7 +924,6 @@ - @@ -956,7 +931,6 @@ - @@ -964,7 +938,6 @@ - @@ -972,17 +945,6 @@ - - - - - - - - - - - @@ -1004,60 +966,114 @@ - + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - + + + + + + + + + - + - - + + - + + + + + + - + - + - - + + - + - - + + - + diff --git a/app/controllers/student_controller.rb b/app/controllers/student_controller.rb index 54d3031..a8de297 100644 --- a/app/controllers/student_controller.rb +++ b/app/controllers/student_controller.rb @@ -17,12 +17,22 @@ def changeSettings changedAge = params[:age] changedGender = params[:gender] + + profilePhoto = params[:profile_photo] + profile_photo_name = current_user.id.to_s + "." + profilePhoto.original_filename.split(".")[1] + + + File.open(Rails.root.join('public', 'uploads','users', profile_photo_name), 'wb') do |file| + file.write(profilePhoto.read) + end + user = User.find(current_user.id) user.update_attribute(:email, changedEmail) user.update_attribute(:username, changedUserName) user.update_attribute(:short_bio,changedShortBio) user.update_attribute(:age,changedAge) user.update_attribute(:gender, changedGender) + user.update_attribute(:photo, profile_photo_name) return redirect_to '/profile' end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 74dd9c5..1dccda7 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -58,8 +58,16 @@ end %> - -