Skip to content

Commit

Permalink
ビューの実装、フォーム
Browse files Browse the repository at this point in the history
flash に入れるメッセージ内で変数展開できるように修正
  • Loading branch information
kyanny committed Jan 25, 2010
1 parent b3e3f28 commit 68a916e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
4 changes: 2 additions & 2 deletions depot/app/controllers/users_controller.rb
Expand Up @@ -44,7 +44,7 @@ def create

respond_to do |format|
if @user.save
flash[:notice] = 'User #{@user.name} was successfully created.'
flash[:notice] = "User #{@user.name} was successfully created."
format.html { redirect_to(:action => 'index') }
format.xml { render :xml => @user, :status => :created, :location => @user }
else
Expand All @@ -61,7 +61,7 @@ def update

respond_to do |format|
if @user.update_attributes(params[:user])
flash[:notice] = 'User #{@user.name} was successfully updated.'
flash[:notice] = "User #{@user.name} was successfully updated."
format.html { redirect_to(:action => 'index') }
format.xml { head :ok }
else
Expand Down
2 changes: 1 addition & 1 deletion depot/app/views/layouts/users.html.erb
Expand Up @@ -5,7 +5,7 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Users: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
<%= stylesheet_link_tag 'scaffold', 'depot' %>
</head>
<body>

Expand Down
42 changes: 27 additions & 15 deletions depot/app/views/users/new.html.erb
@@ -1,23 +1,35 @@
<h1>New user</h1>

<div class="depot-form">

<% form_for(@user) do |f| %>
<%= f.error_messages %>

<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.label :hashed_password %><br />
<%= f.text_field :hashed_password %>
</p>
<p>
<%= f.label :salt %><br />
<%= f.text_field :salt %>
</p>
<p>
<%= f.submit "Create" %>
</p>
<fieldset>
<legend>ユーザの詳細情報入力</legend>
<div>
<%= f.label :name %>
<%= f.text_field :name, :size => 40 %>
</div>

<div>
<%= f.label :user_password, 'パスワード' %>
<%= f.password_field :password, :size => 40 %>
</div>

<div>
<%= f.label :user_password_confirmation, '確認' %>
<%= f.password_field :password_confirmation, :size => 40 %>
</div>

<div>
<%= f.submit "Create", :class => "submit" %>
</div>

</fieldset>
<% end %>

</div>

<%= link_to 'Back', users_path %>

0 comments on commit 68a916e

Please sign in to comment.