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

View File

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

View File

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