diff options
author | Tomer Kimia <tkimia@purdue.edu> | 2014-03-03 19:00:25 -0500 |
---|---|---|
committer | Tomer Kimia <tkimia@purdue.edu> | 2014-03-03 19:00:25 -0500 |
commit | fb8aedbf8f39c627e6537c567f030b389cfb3cfb (patch) | |
tree | 714e1a5294f839c4a5c22195e5f4685af847f6a8 /app/views/users | |
parent | 38c41dc461244832d739b755e073989c61dacf47 (diff) | |
parent | cd69a777235e96266d4ed101ef22de7ed1308dd5 (diff) |
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app/views/users')
-rw-r--r-- | app/views/users/_form.html.erb | 25 | ||||
-rw-r--r-- | app/views/users/edit.html.erb | 6 | ||||
-rw-r--r-- | app/views/users/index.html.erb | 29 | ||||
-rw-r--r-- | app/views/users/index.json.jbuilder | 4 | ||||
-rw-r--r-- | app/views/users/new.html.erb | 35 | ||||
-rw-r--r-- | app/views/users/show.html.erb | 3 | ||||
-rw-r--r-- | app/views/users/show.json.jbuilder | 1 |
7 files changed, 102 insertions, 1 deletions
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb new file mode 100644 index 0000000..56d9f90 --- /dev/null +++ b/app/views/users/_form.html.erb @@ -0,0 +1,25 @@ +<%= form_for(@user) do |f| %> + <% if @user.errors.any? %> + <div id="error_explanation"> + <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2> + + <ul> + <% @user.errors.full_messages.each do |msg| %> + <li><%= msg %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="field"> + <%= f.label :name %><br> + <%= f.text_area :name %> + </div> + <div class="field"> + <%= f.label :pw_hash %><br> + <%= f.text_area :pw_hash %> + </div> + <div class="actions"> + <%= f.submit %> + </div> +<% end %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb new file mode 100644 index 0000000..99bd4cc --- /dev/null +++ b/app/views/users/edit.html.erb @@ -0,0 +1,6 @@ +<h1>Editing user</h1> + +<%= render 'form' %> + +<%= link_to 'Show', @user %> | +<%= link_to 'Back', users_path %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb new file mode 100644 index 0000000..8b9056b --- /dev/null +++ b/app/views/users/index.html.erb @@ -0,0 +1,29 @@ +<h1>Listing users</h1> + +<table> + <thead> + <tr> + <th>Name</th> + <th>Pw hash</th> + <th></th> + <th></th> + <th></th> + </tr> + </thead> + + <tbody> + <% @users.each do |user| %> + <tr> + <td><%= user.name %></td> + <td><%= user.pw_hash %></td> + <td><%= link_to 'Show', user %></td> + <td><%= link_to 'Edit', edit_user_path(user) %></td> + <td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> +</table> + +<br> + +<%= link_to 'New User', new_user_path %> diff --git a/app/views/users/index.json.jbuilder b/app/views/users/index.json.jbuilder new file mode 100644 index 0000000..182437e --- /dev/null +++ b/app/views/users/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@users) do |user| + json.extract! user, :id, :name, :pw_hash + json.url user_url(user, format: :json) +end diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 418f2e2..2a745cc 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -1,5 +1,6 @@ <h1> Sign Up </h1> +<% if false %> <%= form_for :user do |f| %> <p> <%= f.label :name %><br> @@ -19,9 +20,41 @@ </p> <p> <%= f.label :password_confirm %><br> - <%= f.text_field :password_confirm %> + <%= f.text_field :password_confirmation %> </p> <p> <%= f.submit %> </p> <% 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="✓" /><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="text" /> + </p> + <p> + <label for="user_password_confirm">Password confirm</label><br> + <input id="user_password_confirmation" name="user[password_confirmation]" type="text" /> + </p> + <p> + <input name="commit" type="submit" value="Save User" /> + </p> +</form> + +<%= link_to 'Already Have an Account? Log in', "signin", :class => "btn btn-warning btn-lg" %> + diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb new file mode 100644 index 0000000..43c12fe --- /dev/null +++ b/app/views/users/show.html.erb @@ -0,0 +1,3 @@ +app/views/users/show.html.erb + +<%= @user.name %>, <%= @user.email %> diff --git a/app/views/users/show.json.jbuilder b/app/views/users/show.json.jbuilder new file mode 100644 index 0000000..1262e80 --- /dev/null +++ b/app/views/users/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @user, :id, :name, :pw_hash, :created_at, :updated_at |