summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/sessions/_form.html.erb21
-rw-r--r--app/views/sessions/edit.html.erb6
-rw-r--r--app/views/sessions/index.html.erb27
-rw-r--r--app/views/sessions/index.json.jbuilder4
-rw-r--r--app/views/sessions/new.html.erb5
-rw-r--r--app/views/sessions/show.html.erb9
-rw-r--r--app/views/sessions/show.json.jbuilder1
7 files changed, 73 insertions, 0 deletions
diff --git a/app/views/sessions/_form.html.erb b/app/views/sessions/_form.html.erb
new file mode 100644
index 0000000..1b94e77
--- /dev/null
+++ b/app/views/sessions/_form.html.erb
@@ -0,0 +1,21 @@
+<%= form_for(@session) do |f| %>
+ <% if @session.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@session.errors.count, "error") %> prohibited this session from being saved:</h2>
+
+ <ul>
+ <% @session.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :user_id %><br>
+ <%= f.text_field :user_id %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
diff --git a/app/views/sessions/edit.html.erb b/app/views/sessions/edit.html.erb
new file mode 100644
index 0000000..bbd8407
--- /dev/null
+++ b/app/views/sessions/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing session</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @session %> |
+<%= link_to 'Back', sessions_path %>
diff --git a/app/views/sessions/index.html.erb b/app/views/sessions/index.html.erb
new file mode 100644
index 0000000..707a47d
--- /dev/null
+++ b/app/views/sessions/index.html.erb
@@ -0,0 +1,27 @@
+<h1>Listing sessions</h1>
+
+<table>
+ <thead>
+ <tr>
+ <th>User</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <% @sessions.each do |session| %>
+ <tr>
+ <td><%= session.user %></td>
+ <td><%= link_to 'Show', session %></td>
+ <td><%= link_to 'Edit', edit_session_path(session) %></td>
+ <td><%= link_to 'Destroy', session, method: :delete, data: { confirm: 'Are you sure?' } %></td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<br>
+
+<%= link_to 'New Session', new_session_path %>
diff --git a/app/views/sessions/index.json.jbuilder b/app/views/sessions/index.json.jbuilder
new file mode 100644
index 0000000..18fd4fa
--- /dev/null
+++ b/app/views/sessions/index.json.jbuilder
@@ -0,0 +1,4 @@
+json.array!(@sessions) do |session|
+ json.extract! session, :id, :user_id
+ json.url session_url(session, format: :json)
+end
diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb
new file mode 100644
index 0000000..55c9eca
--- /dev/null
+++ b/app/views/sessions/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New session</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', sessions_path %>
diff --git a/app/views/sessions/show.html.erb b/app/views/sessions/show.html.erb
new file mode 100644
index 0000000..5176869
--- /dev/null
+++ b/app/views/sessions/show.html.erb
@@ -0,0 +1,9 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <strong>User:</strong>
+ <%= @session.user %>
+</p>
+
+<%= link_to 'Edit', edit_session_path(@session) %> |
+<%= link_to 'Back', sessions_path %>
diff --git a/app/views/sessions/show.json.jbuilder b/app/views/sessions/show.json.jbuilder
new file mode 100644
index 0000000..4ebf936
--- /dev/null
+++ b/app/views/sessions/show.json.jbuilder
@@ -0,0 +1 @@
+json.extract! @session, :id, :user_id, :created_at, :updated_at