Improve the account settings page
This commit is contained in:
parent
3b14a0e5f1
commit
6ee6f20405
@ -72,7 +72,7 @@ label, input, button, select, textarea
|
||||
input, textarea, .uneditable-input
|
||||
margin-left: 0
|
||||
|
||||
input[type=text], textarea, select, .uneditable-input
|
||||
input[type=text], input[type=email], textarea, select, .uneditable-input
|
||||
width: 210px
|
||||
height: 18px
|
||||
padding: 4px
|
||||
|
@ -2,3 +2,12 @@
|
||||
span.error
|
||||
color: red
|
||||
margin-left: 5px
|
||||
|
||||
.simple_form
|
||||
.form-inputs
|
||||
div.input
|
||||
margin-bottom: 10px
|
||||
|
||||
.form-actions
|
||||
padding: 10px 0 0
|
||||
margin: 0
|
||||
|
@ -37,9 +37,13 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
current_user.update_attributes(params[:user])
|
||||
redirect_to profile_path(current_user),
|
||||
:notice => 'Account settings saved.'
|
||||
@user = User.find(current_user.id)
|
||||
|
||||
if @user.update_attributes(params[:user])
|
||||
redirect_to profile_path(@user), notice: 'Account settings saved.'
|
||||
else
|
||||
render :edit, status: 422
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -1,37 +0,0 @@
|
||||
<section class="supplimental">
|
||||
<div class="wrapper">
|
||||
<%= form_for @user, :html => { :class => 'form-horizontal' } do |f| %>
|
||||
<fieldset>
|
||||
<legend>Account settings</legend>
|
||||
|
||||
<div class="control-group">
|
||||
<%= f.label :nickname, 'Username', :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field :nickname, :class => 'text_field' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<%= f.label :name, 'Real name', :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field :name, :class => 'text_field' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<%= f.label :email, :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field :email, :class => 'text_field' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.submit 'Save', :class => 'btn btn-primary' %>
|
||||
<%= link_to 'Cancel', profile_path(@user), :class => 'btn' %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<div class="vertical-expander"></div>
|
||||
</div>
|
||||
</section>
|
17
app/views/users/edit.html.slim
Normal file
17
app/views/users/edit.html.slim
Normal file
@ -0,0 +1,17 @@
|
||||
section.supplimental
|
||||
.wrapper
|
||||
h1 Your account
|
||||
|
||||
= simple_form_for(@user) do |f|
|
||||
= f.error_notification
|
||||
|
||||
.form-inputs
|
||||
= f.input :nickname, label: 'Username'
|
||||
= f.input :email
|
||||
= f.input :name, label: 'Real name'
|
||||
|
||||
.form-actions
|
||||
= f.button :submit, 'Save'
|
||||
= link_to 'Cancel', profile_path(current_user), class: 'btn'
|
||||
|
||||
.vertical-expander
|
Loading…
Reference in New Issue
Block a user