Changes and improvements to the process.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<h1>Listing Articles</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Text</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<%= link_to 'New article', new_article_path %>
|
||||
|
||||
<% @articles.each do |article| %>
|
||||
<tr>
|
||||
<td><%= article.title %></td>
|
||||
<td><%= article.text %></td>
|
||||
<td><%= link_to 'Show', article_path(article) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
@@ -0,0 +1,33 @@
|
||||
<%= form_with scope: :article, url: articles_path, local: true do |form| %>
|
||||
|
||||
<% if @article.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2>
|
||||
<%= pluralize(@article.errors.count, "error") %> prohibited
|
||||
this article from being saved:
|
||||
</h2>
|
||||
<ul>
|
||||
<% @article.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<%= form.label :title %><br>
|
||||
<%= form.text_field :title %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= form.label :text %><br>
|
||||
<%= form.text_area :text %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= form.submit %>
|
||||
</p>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', articles_path %>
|
||||
@@ -0,0 +1,11 @@
|
||||
<p>
|
||||
<strong>Title:</strong>
|
||||
<%= @article.title %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Text:</strong>
|
||||
<%= @article.text %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Back', articles_path %>
|
||||
Reference in New Issue
Block a user