summaryrefslogtreecommitdiff
path: root/app/views/users
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-03-03 22:20:02 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-03-03 22:20:02 -0500
commit423d0e5a440d8d66407522bc842ef273196173bc (patch)
treeec2dfc14881734c4585622962235b225c653da04 /app/views/users
parentf825d7e30ff6393b66a5abcc05a33f72d7d6712b (diff)
run ./generate.sh
Diffstat (limited to 'app/views/users')
-rw-r--r--app/views/users/_form.html.erb29
-rw-r--r--app/views/users/edit.html.erb6
-rw-r--r--app/views/users/index.html.erb31
-rw-r--r--app/views/users/index.json.jbuilder4
-rw-r--r--app/views/users/new.html.erb5
-rw-r--r--app/views/users/show.html.erb19
-rw-r--r--app/views/users/show.json.jbuilder1
7 files changed, 95 insertions, 0 deletions
diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb
new file mode 100644
index 0000000..4d28738
--- /dev/null
+++ b/app/views/users/_form.html.erb
@@ -0,0 +1,29 @@
+<%= 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_field :name %>
+ </div>
+ <div class="field">
+ <%= f.label :email %><br>
+ <%= f.text_field :email %>
+ </div>
+ <div class="field">
+ <%= f.label :user_name %><br>
+ <%= f.text_field :user_name %>
+ </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..3692112
--- /dev/null
+++ b/app/views/users/index.html.erb
@@ -0,0 +1,31 @@
+<h1>Listing users</h1>
+
+<table>
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Email</th>
+ <th>User name</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <% @users.each do |user| %>
+ <tr>
+ <td><%= user.name %></td>
+ <td><%= user.email %></td>
+ <td><%= user.user_name %></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..42d8b72
--- /dev/null
+++ b/app/views/users/index.json.jbuilder
@@ -0,0 +1,4 @@
+json.array!(@users) do |user|
+ json.extract! user, :id, :name, :email, :user_name
+ json.url user_url(user, format: :json)
+end
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
new file mode 100644
index 0000000..efc0404
--- /dev/null
+++ b/app/views/users/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New user</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', users_path %>
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
new file mode 100644
index 0000000..9455a3c
--- /dev/null
+++ b/app/views/users/show.html.erb
@@ -0,0 +1,19 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <strong>Name:</strong>
+ <%= @user.name %>
+</p>
+
+<p>
+ <strong>Email:</strong>
+ <%= @user.email %>
+</p>
+
+<p>
+ <strong>User name:</strong>
+ <%= @user.user_name %>
+</p>
+
+<%= link_to 'Edit', edit_user_path(@user) %> |
+<%= link_to 'Back', users_path %>
diff --git a/app/views/users/show.json.jbuilder b/app/views/users/show.json.jbuilder
new file mode 100644
index 0000000..4919af3
--- /dev/null
+++ b/app/views/users/show.json.jbuilder
@@ -0,0 +1 @@
+json.extract! @user, :id, :name, :email, :user_name, :created_at, :updated_at