Added channel and video models, views, and routes

This commit is contained in:
2023-03-03 14:19:20 -05:00
parent 646d2d19f9
commit 8a538cb018
16 changed files with 245 additions and 8 deletions

27
views/channel/create.erb Normal file
View File

@ -0,0 +1,27 @@
<div class="row">
<div class="twelve columns">
<h1>Create new channel</h1>
</div>
</div>
<div class="row">
<div class="twelve columns">
<form action="/channel/create" method="POST" class="u-full-width">
<div class="row">
<div class="columns twelve">
<label for="channel_name">Channel name:</label>
<input class="u-full-width" type="text" placeholder="My new channel" id="channel_name" name="channel_name" required>
</div>
</div>
<div class="row">
<div class="twelve columns">
<label for="channel_description">Channel description:</label>
<textarea class="u-full-width" type="text" placeholder="Description of the channel" id="channel_description" name="channel_description"></textarea>
</div>
</div>
<input class="button-primary u-full-width" type="submit" value="Submit">
</form>
</div>
</div>

21
views/channel/list.erb Normal file
View File

@ -0,0 +1,21 @@
<div class="row">
<div class="twelve columns">
<h1>Hardware Inventory List</h1>
</div>
</div>
<div class="row">
<div class="twelve columns">
<p><a href="/channel/create">Create new channel</a></p>
<% if channels.length > 0 %>
<ul>
<% channels.each do |channel| %>
<li><a href="/channel/<%= channel.id %>"><%= channel.name %></a></li>
<% end %>
</ul>
<% else %>
<p>There are no channels recorded in the database yet.</p>
<% end %>
</div>
</div>

18
views/channel/view.erb Normal file
View File

@ -0,0 +1,18 @@
<div id="channel-header" class="row">
<div class="twelve columns">
<h1 class="channel-name"><%= channel.name %></h1>
<h4 class="channel-created">Item added at: <%= date_format(channel.created_at) %></h4>
<% if channel.updated_at %>
<h4 class="channel-updated">Last updated at: <%= date_format(channel.updated_at) %></h4>
<% end %>
</div>
</div>
<div class="row">
<div class="twelve columns">
<p class="inventory-actions">
<a href="/channel/<%= channel.id %>/edit"><i class="fa-solid fa-pen-to-square"></i></a>
<a href="/channel/<%= channel.id %>/delete"><i class="fa-solid fa-trash"></i></a>
</p>
</div>
</div>