This repository was archived by the owner on Apr 18, 2023. It is now read-only.
-
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.
Add edit , update , show and inex listing
- Loading branch information
Ahmed Abdelsalam
committed
Jul 11, 2016
1 parent
e6d5872
commit 1fe48e9
Showing
5 changed files
with
73 additions
and
7 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,25 @@ | ||
<h2>Edit existing article</h2> | ||
<% if @article.errors.any? %> | ||
<h3>The following errors prevented the article from getting edited</h3> | ||
<ul> | ||
<% @article.errors.full_messages.each do |msg| %> | ||
<li><%= msg %></li> | ||
<% end %> | ||
</ul> | ||
<% end %> | ||
|
||
<%= form_for @article do |f| %> | ||
<p> | ||
<%= f.label :title %> | ||
<%= f.text_field :title%> | ||
</p> | ||
|
||
<p> | ||
<%= f.label :description %></br> | ||
<%= f.text_area :description %> | ||
</p> | ||
<%= f.submit %> | ||
|
||
|
||
<% end %> | ||
<%= link_to 'Back to articles' , 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<h1> All Articles </h1> | ||
<%= link_to "Create new article" , new_article_path %> | ||
|
||
<style>table{border:1px solid #ccc;padding:15px;}tr{}</style> | ||
<table border="1"> | ||
<tr> | ||
<th>Title</th> | ||
<th>Description</th> | ||
</tr> | ||
|
||
<% @articles.each do |article| %> | ||
<tr> | ||
<td><%= article.title %></td> | ||
<td><%= article.description %></td> | ||
<td><%= link_to 'Edit', edit_article_path(article) %></td> | ||
<td><%= link_to 'Show', article_path(article) %></td> | ||
</tr> | ||
<% end %> | ||
</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
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