Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Refactoring and add error
Browse files Browse the repository at this point in the history
  • Loading branch information
MIZOGUCHIKoki committed Dec 22, 2023
1 parent 23d5e7f commit d26a007
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 81 deletions.
34 changes: 22 additions & 12 deletions app/views/users/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
<%= form_with(model: @user) do |f| %>
<%= render 'shared/error_messages', object: f.object %>
<%= f.label :name, "名前(楽団名)" %>
<%= f.text_field :name %>
<%= f.label :email, "Eメールアドレス" %>
<%= f.email_field :email %>
<%= f.label :password, "パスワード" %>
<%= f.password_field :password %>
<%= f.label :password_confirmation, "パスワードの再確認" %>
<%= f.password_field :password_confirmation %>
<%= f.submit yield(:button_text) %>
<% end %>
<div>
<%= form_with model: @user do |form| %>
<%= render 'shared/error_messages', object: form.object %>
<div class="block-field">
<div class="box">
<%= form.text_field :name, :placeholder => "名前(楽団名)", class: "text-field" %>
</div>
<div class="box">
<%= form.email_field :email, :placeholder => "Eメールアドレス",class: "text-field" %>
</div>
<div class="box">
<%= form.password_field :password, :placeholder => "パスワード", class: "text-field" %>
</div>
<div class="box">
<%= form.password_field :password_confirmation, :placeholder => "再確認", class: "text-field" %>
</div>
<div class="box">
<%= form.submit yield(:button_text) %>
</div>
</div>
<% end %>
</div>
36 changes: 4 additions & 32 deletions app/views/users/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,37 +1,9 @@
<body>

<div class="center">

<div>
<h2>マイページ編集</h2>
</div>

<div>
<%= form_with(model: @user, url: user_path(@user), method: :patch) do |form| %>
<div class="box">
<%= form.label :name, "ユーザ名" %>
<%= form.text_field :name, value: @user.name %>
</div>

<div class="box">
<%= form.label :email, "メールアドレス" %>
<%= form.email_field :email, value: @user.email %>
</div>

<div class="box">
<%= form.label :password, "パスワード" %>
<%= form.password_field :password, value: @user.password %>
</div>

<div>
<%= form.submit "更新" %>
</div>
<% end %>

<div class="center">
<div>
<%= link_to "戻る", user_path(@user) %>
<h2>マイページ編集</h2>
</div>
</div>

<% provide(:button_text, '変更') %>
<%= render 'form' %>
</div>
</body>
45 changes: 8 additions & 37 deletions app/views/users/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,38 +1,9 @@
<body>
<div class="center">

<div class="left">
<h2>ご利用登録</h2>
</div>

<%= form_with model: @user do |form| %>
<div class="block-field">
<div class="box">

<%= form.text_field :name, :placeholder => "名前(楽団名)" , class: "text-field" %>
</div>

<div class="box">

<%= form.email_field :email, :placeholder => "Eメールアドレス" , class: "text-field"%>
</div>

<div class="box">

<%= form.password_field :password, :placeholder => "パスワード", class: "text-field" %>
</div>

<div class="box">

<%= form.password_field :password_confirmation, :placeholder => "再確認", class: "text-field" %>
</div>

<div class="box">
<%= form.submit "利用規約に同意して登録" %>
</div>
</div>
<% end %>


</div>
</body>
<div class="center">
<div class="left">
<h2>ご利用登録</h2>
</div>
<% provide(:button_text, '規約に同意して登録') %>
<%= render 'form' %>
</div>
</body>

0 comments on commit d26a007

Please sign in to comment.