summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorguntasgrewal <guntasgrewal@gmail.com>2014-03-04 17:44:48 -0500
committerguntasgrewal <guntasgrewal@gmail.com>2014-03-04 17:44:48 -0500
commit6b27e11f1613967d2b97b0eead6cf06263e6140b (patch)
tree67665de6ce65f759d4cac18d26f813343c0fe04c /app
parent489a9f7291b6b7c1143bb482f637020d82f944d5 (diff)
parent8e005f8d325a43e378f21a1042df6a4baf79c12f (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app')
-rw-r--r--app/views/common/_error_messages.html.erb11
-rw-r--r--app/views/users/new.html.erb36
2 files changed, 15 insertions, 32 deletions
diff --git a/app/views/common/_error_messages.html.erb b/app/views/common/_error_messages.html.erb
new file mode 100644
index 0000000..c9fdd51
--- /dev/null
+++ b/app/views/common/_error_messages.html.erb
@@ -0,0 +1,11 @@
+<%# http://railscasts.com/episodes/211-validations-in-rails-3 %>
+<% if target.errors.any? %>
+<div id="errorExplanation">
+ <h2><%= pluralize(target.errors.count, "error") %> prohibited this record from being saved:</h2>
+ <ul>
+ <% target.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+</div>
+<% end %>
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
index f0ce746..704aa10 100644
--- a/app/views/users/new.html.erb
+++ b/app/views/users/new.html.erb
@@ -1,12 +1,12 @@
<h1> Sign Up </h1>
-<% if false %>
-<%= form_for :user do |f| %>
+<%= form_for @user do |f| %>
+ <%= render "common/error_messages", :target => @user %>
<p>
<%= f.label :name %><br>
<%= f.text_field :name %>
</p>
- <p>
+ <p>
<%= f.label :email %><br>
<%= f.text_field :email %>
</p>
@@ -14,7 +14,7 @@
<%= f.label :user_name %><br>
<%= f.text_field :user_name %>
</p>
- <p>
+ <p>
<%= f.label :password %><br>
<%= f.password_field :password %>
</p>
@@ -28,33 +28,5 @@
<% end %>
-<% end %>
-
-<form accept-charset="UTF-8" action="/users" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="6WQoPLFISlDYCsi4LhAgT0hgrht19yydD3w5TlKfb7I=" /></div>
- <p>
- <label for="user_name">Name</label><br>
- <input id="user_name" name="user[name]" type="text" />
- </p>
- <p>
- <label for="user_email">Email</label><br>
- <input id="user_email" name="user[email]" type="text" />
- </p>
- <p>
- <label for="user_user_name">User name</label><br>
- <input id="user_user_name" name="user[user_name]" type="text" />
- </p>
- <p>
- <label for="user_password">Password</label><br>
- <input id="user_password" name="user[password]" type="password" />
- </p>
- <p>
- <label for="user_password_confirm">Password confirm</label><br>
- <input id="user_password_confirmation" name="user[password_confirmation]" type="password" />
- </p>
- <p>
- <input name="commit" type="submit" value="Save User" />
- </p>
-</form>
-
<%= link_to 'Already Have an Account? Log in', new_session_path, :class => "btn btn-warning btn-lg" %>