Skip to content

Commit

Permalink
nothing changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronaq13 committed Apr 10, 2017
1 parent 01700cd commit 99193fb
Show file tree
Hide file tree
Showing 9 changed files with 236 additions and 190 deletions.
12 changes: 12 additions & 0 deletions .byebug_history
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
/log/*
!/log/.keep
/tmp

public/uploads/*
374 changes: 195 additions & 179 deletions .idea/workspace.xml

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions app/controllers/student_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 10 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,16 @@
end

%>
<button class="dropbtn"><i class="fa fa-user-circle-o fa-lg" aria-hidden="true"></i>&nbsp;<%= value%></button>
<div class="dropdown-content" style="left:0;">
<% if current_user.photo %>

<div>
<img src="/uploads/users/<%= current_user.photo %>" style="width: 40px; height: 40px; border-radius: 50%">
&nbsp;<%= value %>
</div>
<%else%>
<button class="dropbtn"><i class="fa fa-user-circle-o fa-lg" aria-hidden="true"></i>&nbsp;<%= value %></button>
<%end%>
<div class="dropdown-content" style="left:0;">
<a href="/myCourses">My Courses</a>
<a href="/accomplishment">Accomplishment</a>
<a href="/profile">Profile</a>
Expand Down
5 changes: 3 additions & 2 deletions app/views/mentor/addNewCourse.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<md-card>
<%= form_tag '/nowAddingCourse' do%>
<%= form_tag '/nowAddingCourse', :multipart => true do%>
<h3>Category : <%= text_field_tag 'category',nil,placeholder: "Web, Android, others" %> </h3>

<h3>Title : <%= text_field_tag 'title' %></h3>
<h3>Subtitle : <%= text_field_tag 'subtitle' %></h3>
<h3>Level : <%= text_field_tag 'level',nil,placeholder: "Hard,easy,medium" %></h3>
<h3>Image : <%= text_field_tag 'image' %></h3>
<!--<h3>Image : <%#= text_field_tag 'image' %></h3>-->
<h3>Image : <%= file_field_tag :profile_picture %></h3>
<h3>Video Link : <%= text_field_tag 'teaser_video' %></h3>
<h3>Summary : <%= text_field_tag 'summary' %></h3>
<h3>Short_summary : <%= text_field_tag 'short_summary' %></h3>
Expand Down
5 changes: 1 addition & 4 deletions app/views/student/doingCourse.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
<%course.videos.each do |c|%>
<%numOfVideos += 1%>
<div style="display: flex;">
<div class="desdiv" style="padding: 16px;"
onclick="var frame = document.getElementById('videoFrame');
frame.setAttribute('src', '<%= c.link %>');">
<div class="desdiv" style="padding: 16px;" onclick="var frame = document.getElementById('videoFrame'); frame.setAttribute('src', '<%= c.link %>');">
<p><%= c.desc %></p>
</div>

Expand All @@ -35,7 +33,6 @@

tmpLink = '/doneVideo/' + c.link.split('/')[-1].to_s + '/' + course.id.to_s


%>
<%if courseIsDone%>
<i class="fa fa-check" aria-hidden="true"></i>
Expand Down
2 changes: 1 addition & 1 deletion app/views/student/profile.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<md-card>

<img src="/uploads/users/<%= current_user.photo %>" style="width: 100px; height: 100px; border-radius: 50%">
<h3>Email ID : <%= current_user.email %> </h3>
<h3>User Name : <%= current_user.username %> </h3>
<h3>Short Bio : <%= current_user.short_bio %></h3>
Expand Down
4 changes: 2 additions & 2 deletions app/views/student/settings.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<md-card>
<%= form_tag '/changeSettings' do%>
<%= form_tag '/changeSettings', :multipart => true do%>
<h3>Email ID : <%= text_field_tag 'email_id', current_user.email %> </h3>
<h3>User Name : <%= text_field_tag 'user_name', current_user.username %> </h3>
<h3>Short Bio : <%= text_field_tag 'short_bio', current_user.short_bio %></h3>
<h3>Age : <%= number_field_tag 'age', current_user.age %> years</h3>

<h3>Profile Photo : <%= file_field_tag :profile_photo %></h3>
<!--<h3>Gender : <%# text_field_tag 'gender', nil, placeholder: current_user.gender %></h3>-->
<div style="display: flex; align-items: center;">
<h3>Gender : </h3>
Expand Down

0 comments on commit 99193fb

Please sign in to comment.