From 45072f34d27bda34b182f14f8b02d778d1648cce Mon Sep 17 00:00:00 2001 From: John Kelly Ferguson Date: Sun, 25 May 2014 18:48:14 -0400 Subject: Rename Posts to Articles in Guides' Getting Started App, continuation of #15215 [ci skip] --- .../app/views/articles/_form.html.erb | 27 ++++++++++++++++++++++ .../app/views/articles/edit.html.erb | 5 ++++ .../app/views/articles/index.html.erb | 21 +++++++++++++++++ .../app/views/articles/new.html.erb | 5 ++++ .../app/views/articles/show.html.erb | 18 +++++++++++++++ 5 files changed, 76 insertions(+) create mode 100644 guides/code/getting_started/app/views/articles/_form.html.erb create mode 100644 guides/code/getting_started/app/views/articles/edit.html.erb create mode 100644 guides/code/getting_started/app/views/articles/index.html.erb create mode 100644 guides/code/getting_started/app/views/articles/new.html.erb create mode 100644 guides/code/getting_started/app/views/articles/show.html.erb (limited to 'guides/code/getting_started/app/views/articles') diff --git a/guides/code/getting_started/app/views/articles/_form.html.erb b/guides/code/getting_started/app/views/articles/_form.html.erb new file mode 100644 index 0000000000..87e3353ed2 --- /dev/null +++ b/guides/code/getting_started/app/views/articles/_form.html.erb @@ -0,0 +1,27 @@ +<%= form_for @article do |f| %> + <% if @article.errors.any? %> +
+

<%= pluralize(@article.errors.count, "error") %> prohibited + this article from being saved:

+ +
+ <% end %> +

+ <%= f.label :title %>
+ <%= f.text_field :title %> +

+ +

+ <%= f.label :text %>
+ <%= f.text_area :text %> +

+ +

+ <%= f.submit %> +

+<% end %> + diff --git a/guides/code/getting_started/app/views/articles/edit.html.erb b/guides/code/getting_started/app/views/articles/edit.html.erb new file mode 100644 index 0000000000..14236e2a98 --- /dev/null +++ b/guides/code/getting_started/app/views/articles/edit.html.erb @@ -0,0 +1,5 @@ +

Edit article

+ +<%= render 'form' %> + +<%= link_to 'Back', action: :index %> diff --git a/guides/code/getting_started/app/views/articles/index.html.erb b/guides/code/getting_started/app/views/articles/index.html.erb new file mode 100644 index 0000000000..80e9c8c60c --- /dev/null +++ b/guides/code/getting_started/app/views/articles/index.html.erb @@ -0,0 +1,21 @@ +

Listing Articles

+ + + + + + + + + +<% @articles.each do |article| %> + + + + + + + +<% end %> +
TitleText
<%= article.title %><%= article.text %><%= link_to 'Show', action: :show, id: article.id %><%= link_to 'Edit', action: :edit, id: article.id %><%= link_to 'Destroy', { action: :destroy, id: article.id }, + method: :delete, data: { confirm: 'Are you sure?' } %>
diff --git a/guides/code/getting_started/app/views/articles/new.html.erb b/guides/code/getting_started/app/views/articles/new.html.erb new file mode 100644 index 0000000000..652b1c9c0b --- /dev/null +++ b/guides/code/getting_started/app/views/articles/new.html.erb @@ -0,0 +1,5 @@ +

New article

+ +<%= render 'form' %> + +<%= link_to 'Back', action: :index %> diff --git a/guides/code/getting_started/app/views/articles/show.html.erb b/guides/code/getting_started/app/views/articles/show.html.erb new file mode 100644 index 0000000000..6959c80bdb --- /dev/null +++ b/guides/code/getting_started/app/views/articles/show.html.erb @@ -0,0 +1,18 @@ +

+ Title: + <%= @article.title %> +

+ +

+ Text: + <%= @article.text %> +

+ +

Comments

+<%= render @article.comments %> + +

Add a comment:

+<%= render "comments/form" %> + +<%= link_to 'Edit Article', edit_article_path(@article) %> | +<%= link_to 'Back to Articles', articles_path %> -- cgit v1.2.3