forked from LYK2014-Ruby-Rails/blog-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Article update options were completed
- Article was updated - Forms were simplified
- Loading branch information
1 parent
bf6203e
commit b58fd4f
Showing
6 changed files
with
57 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<%= form_for @article do |f| %> | ||
|
||
<% 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> | ||
<%= f.label :title %><br> | ||
<%= f.text_field :title %> | ||
</p> | ||
|
||
<p> | ||
<%= f.label :text %><br> | ||
<%= f.text_area :text %> | ||
</p> | ||
|
||
<p> | ||
<%= f.submit %> | ||
</p> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h1>Editing article</h1> | ||
|
||
<%= render 'form' %> | ||
|
||
<%= link_to 'Back', articles_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
<h1>Listing Articles</h1> | ||
|
||
<%= link_to 'New article', new_article_path %> | ||
|
||
<table> | ||
<tr> | ||
<th>Title</th> | ||
<th>Text</th> | ||
<th colspan="2">Options</th> | ||
</tr> | ||
|
||
<% @articles.each do |article| %> | ||
<tr> | ||
<td><%= article.title %></td> | ||
<td><%= article.text %></td> | ||
<td><%= link_to 'Show', article_path(article) %></td> | ||
<td><%= link_to 'Edit', edit_article_path(article) %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<p> | ||
<%= link_to 'New article', new_article_path %> | ||
</p> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,5 @@ | ||
<h1>New Article</h1> | ||
|
||
<%= form_for :article, url: articles_path do |f| %> | ||
|
||
<% 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> | ||
<%= f.label :title %><br> | ||
<%= f.text_field :title %> | ||
</p> | ||
|
||
<p> | ||
<%= f.label :text %><br> | ||
<%= f.text_area :text %> | ||
</p> | ||
|
||
<p> | ||
<%= f.submit %> | ||
</p> | ||
<% end %> | ||
<%= render 'form' %> | ||
|
||
<%= link_to 'Back', articles_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters