Added channel and video models, views, and routes
This commit is contained in:
43
views/video/create.erb
Normal file
43
views/video/create.erb
Normal file
@ -0,0 +1,43 @@
|
||||
<div class="row">
|
||||
<div class="twelve columns">
|
||||
<h1>Create new video</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="twelve columns">
|
||||
<form action="/video/create" method="POST" class="u-full-width">
|
||||
<div class="row">
|
||||
<div class="columns twelve">
|
||||
<label for="video_name">Video name:</label>
|
||||
<input class="u-full-width" type="text" placeholder="My new video" id="video_name" name="video_name" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns three">
|
||||
<label for="video_serial">Video serial:</label>
|
||||
<input class="u-full-width" type="number" placeholder="0001" id="video_serial" name="video_serial" required>
|
||||
</div>
|
||||
|
||||
<div class="columns nine">
|
||||
<label for="video_channel">Associated channel:</label>
|
||||
<select class="u-full-width" id="video_channel" name="video_channel" required>
|
||||
<% channels.each do |c| %>
|
||||
<option value="<%= c.id %>"><%= c.name %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="twelve columns">
|
||||
<label for="video_description">Video description:</label>
|
||||
<textarea class="u-full-width" type="text" placeholder="Description of the video" id="video_description" name="video_description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input class="button-primary u-full-width" type="submit" value="Submit">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
21
views/video/list.erb
Normal file
21
views/video/list.erb
Normal 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="/video/create">Create new video</a></p>
|
||||
|
||||
<% if videos.length > 0 %>
|
||||
<ul>
|
||||
<% videos.each do |video| %>
|
||||
<li><a href="/video/<%= video.id %>"><%= video.name %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% else %>
|
||||
<p>There are no videos recorded in the database yet.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
19
views/video/view.erb
Normal file
19
views/video/view.erb
Normal file
@ -0,0 +1,19 @@
|
||||
<div id="video-header" class="row">
|
||||
<div class="twelve columns">
|
||||
<h1 class="video-name"><%= video.name %></h1>
|
||||
<h3 class="video-serial"><%= video.channel.name %> - <%= serialize(video.serial) %></h3>
|
||||
<h4 class="video-created">Item added at: <%= date_format(video.created_at) %></h4>
|
||||
<% if video.updated_at %>
|
||||
<h4 class="video-updated">Last updated at: <%= date_format(video.updated_at) %></h4>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="twelve columns">
|
||||
<p class="inventory-actions">
|
||||
<a href="/video/<%= video.id %>/edit"><i class="fa-solid fa-pen-to-square"></i></a>
|
||||
<a href="/video/<%= video.id %>/delete"><i class="fa-solid fa-trash"></i></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user