zy:view routes profile

This commit is contained in:
lovelyzhang 2017-01-07 12:33:43 +08:00
parent c29cd77767
commit 9dad27c6da
3 changed files with 79 additions and 73 deletions

View File

@ -69,9 +69,11 @@ class UsersController < ApplicationController
end end
redirect_to login_path redirect_to login_path
end end
end end
def changeprofile
render html: "等待完成"
end
private private
@ -84,7 +86,7 @@ class UsersController < ApplicationController
verify_code = rand(999999).to_s verify_code = rand(999999).to_s
result = UserMailer.send_verify_code(user.email, verify_code).deliver_now result = UserMailer.send_verify_code(user.email, verify_code).deliver_now
p result p result
user.update_attribute(:verify_code,verify_code) user.update_attribute(:verify_code, verify_code)
end end
def check_change_params(email, verify_code, password, password_confirmation) def check_change_params(email, verify_code, password, password_confirmation)

View File

@ -6,29 +6,30 @@
<%= render 'layouts/nav' %> <%= render 'layouts/nav' %>
<form action="/baidu" class="form-horizontal" id="profile" method="post"> <%= form_tag("/changeprofile", method: "post", class: "form-horizontal", id: "profile") do %>
<div class="row">
<div class="widget-container"> <div class="row">
<div class="heading"> <div class="widget-container">
<i class="icon-user"></i>个人设置 <div class="heading">
<i class="icon-user"></i>个人设置
</div>
</div> </div>
</div> </div>
</div> <div class="row">
<div class="row"> <div class="widget-container">
<div class="widget-container"> <div class="heading">
<div class="heading"> <i class="icon-user"></i>用户图像
<i class="icon-user"></i>用户图像 </div>
</div> <div class="col-md-12 text-center">
<div class="col-md-12 text-center"> <div class="fileupload fileupload-new" data-provides="fileupload">
<div class="fileupload fileupload-new" data-provides="fileupload"> <div class="fileupload-new img-thumbnail" style="width: 200px; height: 200px;">
<div class="fileupload-new img-thumbnail" style="width: 200px; height: 200px;"> <!--原照片-->
<!--原照片--> <img src="<%= @user.picurl %>">
<img src="/images/avatars/default/avatar.png"> </div>
</div> <div class="fileupload-preview fileupload-exists img-thumbnail"
<div class="fileupload-preview fileupload-exists img-thumbnail" style="width: 200px; max-height: 200px">
style="width: 200px; max-height: 200px"> </div>
</div> <div class="padded">
<div class="padded">
<span class="btn btn-default btn-file"> <span class="btn btn-default btn-file">
<span <span
class="fileupload-new">选择照片 class="fileupload-new">选择照片
@ -37,72 +38,74 @@
class="fileupload-exists"> class="fileupload-exists">
重新选择 重新选择
</span> </span>
<input type="file" name="image_file"> <input type="file" name="user[pic]">
</span> </span>
<a <a
class="btn btn-default fileupload-exists" data-dismiss="fileupload" class="btn btn-default fileupload-exists" data-dismiss="fileupload"
href="#">清除照片 href="#">清除照片
</a> </a>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> <div class="row">
<div class="row"> <div class="widget-container fluid-height clearfix">
<div class="widget-container fluid-height clearfix"> <div class="heading">
<div class="heading"> <i class="icon-reorder"></i>基本信息
<i class="icon-reorder"></i>基本信息
</div>
<div class="padded">
<div class="form-group">
<label class="control-label col-md-2">姓名</label>
<div class="col-md-9">
<input class="form-control" placeholder="Text" type="text">
</div>
</div> </div>
<div class="padded">
<div class="form-group"> <div class="form-group">
<label class="control-label col-md-2">专业</label> <label class="control-label col-md-2">姓名</label>
<div class="col-md-9"> <div class="col-md-9">
<input class="form-control" placeholder="Text" type="text"> <input class="form-control" placeholder="请输入您的姓名" value="<%= @user.name %>"
type="text" name="user[username]">
</div>
</div> </div>
</div>
<div class="form-group">
<div class="form-group"> <label class="control-label col-md-2">专业</label>
<label class="control-label col-md-2">学院</label> <div class="col-md-9">
<div class="col-md-9"> <input class="form-control" placeholder="请输入您的专业" value="<%= @user.profession %>"
<select class="form-control"> type="text" name="user[profession]">
<option value="Category 1">Option 1</option> </div>
<option value="Category 2">Option 2</option>
<option value="Category 3">Option 3</option>
<option value="Category 4">Option 4</option>
</select>
</div> </div>
</div>
<div class="form-group">
<label class="control-label col-md-2">性别</label> <div class="form-group">
<div class="col-md-9"> <label class="control-label col-md-2">学院</label>
<label class="radio-inline"><input name="optionsRadios" type="radio" <div class="col-md-9">
value="1"><span>男</span></label><label <select class="form-control" name="user[academy]">
class="radio-inline"><input name="optionsRadios" <option value="计算机与控制学院">计算机与控制学院</option>
type="radio" <option value="数学与系统学院">数学与系统学院</option>
value="0"><span>女</span></label> <option value="电子信息工程学院">电子信息工程学院</option>
<option value="生命科学院">生命科学院</option>
</select>
</div>
</div> </div>
</div>
<div class="form-group"> <div class="form-group">
<div class="col-md-12 text-center"> <label class="control-label col-md-2">性别</label>
<button class="btn btn-primary" type="submit">修改</button> <div class="col-md-9">
<button class="btn btn-default-outline">取消</button> <label class="radio-inline"><input name="user[sex]" type="radio"
value="1" checked="true"><span>男</span></label><label
class="radio-inline"><input name="user[sex]"
type="radio"
value="0"><span>女</span></label>
</div>
</div> </div>
</div>
<div class="form-group">
<div class="col-md-12 text-center">
<button class="btn btn-primary" type="submit">修改</button>
<button class="btn btn-default-outline">取消</button>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> <% end %>
</form>
</div> </div>
</div> </div>

View File

@ -11,6 +11,7 @@ Rails.application.routes.draw do
get '/forgetpasswd', to: 'users#forgetpasswd' get '/forgetpasswd', to: 'users#forgetpasswd'
get '/changepasswd', to: 'users#changepasswd' get '/changepasswd', to: 'users#changepasswd'
post '/changepasswd', to: 'users#changepasswd' post '/changepasswd', to: 'users#changepasswd'
post '/changeprofile', to: 'users#changeprofile'
get '/main', to: 'main#show' get '/main', to: 'main#show'
get '/activity', to: 'main#activity' get '/activity', to: 'main#activity'