From d7154d483269fc25d771d5b8b7b8a2c889e4b3f5 Mon Sep 17 00:00:00 2001 From: James Gifford Date: Mon, 12 Sep 2011 10:30:45 -0400 Subject: Added getting_started code, updated guide with link to rails github repo and path to code --- .../app/views/comments/_comment.html.erb | 15 ++++++++++ .../app/views/comments/_form.html.erb | 13 +++++++++ .../getting_started/app/views/home/index.html.erb | 2 ++ .../getting_started/app/views/home/index.html.erb~ | 2 ++ .../app/views/layouts/application.html.erb | 14 ++++++++++ .../getting_started/app/views/posts/_form.html.erb | 32 ++++++++++++++++++++++ .../getting_started/app/views/posts/edit.html.erb | 6 ++++ .../getting_started/app/views/posts/index.html.erb | 27 ++++++++++++++++++ .../getting_started/app/views/posts/new.html.erb | 5 ++++ .../getting_started/app/views/posts/show.html.erb | 31 +++++++++++++++++++++ .../getting_started/app/views/tags/_form.html.erb | 12 ++++++++ 11 files changed, 159 insertions(+) create mode 100644 railties/guides/code/getting_started/app/views/comments/_comment.html.erb create mode 100644 railties/guides/code/getting_started/app/views/comments/_form.html.erb create mode 100644 railties/guides/code/getting_started/app/views/home/index.html.erb create mode 100644 railties/guides/code/getting_started/app/views/home/index.html.erb~ create mode 100644 railties/guides/code/getting_started/app/views/layouts/application.html.erb create mode 100644 railties/guides/code/getting_started/app/views/posts/_form.html.erb create mode 100644 railties/guides/code/getting_started/app/views/posts/edit.html.erb create mode 100644 railties/guides/code/getting_started/app/views/posts/index.html.erb create mode 100644 railties/guides/code/getting_started/app/views/posts/new.html.erb create mode 100644 railties/guides/code/getting_started/app/views/posts/show.html.erb create mode 100644 railties/guides/code/getting_started/app/views/tags/_form.html.erb (limited to 'railties/guides/code/getting_started/app/views') diff --git a/railties/guides/code/getting_started/app/views/comments/_comment.html.erb b/railties/guides/code/getting_started/app/views/comments/_comment.html.erb new file mode 100644 index 0000000000..4c3fbf26cd --- /dev/null +++ b/railties/guides/code/getting_started/app/views/comments/_comment.html.erb @@ -0,0 +1,15 @@ +

+ Commenter: + <%= comment.commenter %> +

+ +

+ Comment: + <%= comment.body %> +

+ +

+ <%= link_to 'Destroy Comment', [comment.post, comment], + :confirm => 'Are you sure?', + :method => :delete %> +

diff --git a/railties/guides/code/getting_started/app/views/comments/_form.html.erb b/railties/guides/code/getting_started/app/views/comments/_form.html.erb new file mode 100644 index 0000000000..d15bdd6b59 --- /dev/null +++ b/railties/guides/code/getting_started/app/views/comments/_form.html.erb @@ -0,0 +1,13 @@ +<%= form_for([@post, @post.comments.build]) do |f| %> +
+ <%= f.label :commenter %>
+ <%= f.text_field :commenter %> +
+
+ <%= f.label :body %>
+ <%= f.text_area :body %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/railties/guides/code/getting_started/app/views/home/index.html.erb b/railties/guides/code/getting_started/app/views/home/index.html.erb new file mode 100644 index 0000000000..bb4f3dcd1f --- /dev/null +++ b/railties/guides/code/getting_started/app/views/home/index.html.erb @@ -0,0 +1,2 @@ +

Hello, Rails!

+<%= link_to "My Blog", posts_path %> diff --git a/railties/guides/code/getting_started/app/views/home/index.html.erb~ b/railties/guides/code/getting_started/app/views/home/index.html.erb~ new file mode 100644 index 0000000000..2085730c72 --- /dev/null +++ b/railties/guides/code/getting_started/app/views/home/index.html.erb~ @@ -0,0 +1,2 @@ +

Home#index

+

Find me in app/views/home/index.html.erb

diff --git a/railties/guides/code/getting_started/app/views/layouts/application.html.erb b/railties/guides/code/getting_started/app/views/layouts/application.html.erb new file mode 100644 index 0000000000..1e1e4b9a99 --- /dev/null +++ b/railties/guides/code/getting_started/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + Blog + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/railties/guides/code/getting_started/app/views/posts/_form.html.erb b/railties/guides/code/getting_started/app/views/posts/_form.html.erb new file mode 100644 index 0000000000..e27da7f413 --- /dev/null +++ b/railties/guides/code/getting_started/app/views/posts/_form.html.erb @@ -0,0 +1,32 @@ +<% @post.tags.build %> +<%= form_for(@post) do |post_form| %> + <% if @post.errors.any? %> +
+

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

+ +
+ <% end %> + +
+ <%= post_form.label :name %>
+ <%= post_form.text_field :name %> +
+
+ <%= post_form.label :title %>
+ <%= post_form.text_field :title %> +
+
+ <%= post_form.label :content %>
+ <%= post_form.text_area :content %> +
+

Tags

+ <%= render :partial => 'tags/form', + :locals => {:form => post_form} %> +
+ <%= post_form.submit %> +
+<% end %> diff --git a/railties/guides/code/getting_started/app/views/posts/edit.html.erb b/railties/guides/code/getting_started/app/views/posts/edit.html.erb new file mode 100644 index 0000000000..720580236b --- /dev/null +++ b/railties/guides/code/getting_started/app/views/posts/edit.html.erb @@ -0,0 +1,6 @@ +

Editing post

+ +<%= render 'form' %> + +<%= link_to 'Show', @post %> | +<%= link_to 'Back', posts_path %> diff --git a/railties/guides/code/getting_started/app/views/posts/index.html.erb b/railties/guides/code/getting_started/app/views/posts/index.html.erb new file mode 100644 index 0000000000..45dee1b25f --- /dev/null +++ b/railties/guides/code/getting_started/app/views/posts/index.html.erb @@ -0,0 +1,27 @@ +

Listing posts

+ + + + + + + + + + + +<% @posts.each do |post| %> + + + + + + + + +<% end %> +
NameTitleContent
<%= post.name %><%= post.title %><%= post.content %><%= link_to 'Show', post %><%= link_to 'Edit', edit_post_path(post) %><%= link_to 'Destroy', post, confirm: 'Are you sure?', method: :delete %>
+ +
+ +<%= link_to 'New Post', new_post_path %> diff --git a/railties/guides/code/getting_started/app/views/posts/new.html.erb b/railties/guides/code/getting_started/app/views/posts/new.html.erb new file mode 100644 index 0000000000..36ad7421f9 --- /dev/null +++ b/railties/guides/code/getting_started/app/views/posts/new.html.erb @@ -0,0 +1,5 @@ +

New post

+ +<%= render 'form' %> + +<%= link_to 'Back', posts_path %> diff --git a/railties/guides/code/getting_started/app/views/posts/show.html.erb b/railties/guides/code/getting_started/app/views/posts/show.html.erb new file mode 100644 index 0000000000..da78a9527b --- /dev/null +++ b/railties/guides/code/getting_started/app/views/posts/show.html.erb @@ -0,0 +1,31 @@ +

<%= notice %>

+ +

+ Name: + <%= @post.name %> +

+ +

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

+ +

+ Content: + <%= @post.content %> +

+ +

+ Tags: + <%= join_tags(@post) %> +

+ +

Comments

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

Add a comment:

+<%= render "comments/form" %> + + +<%= link_to 'Edit Post', edit_post_path(@post) %> | +<%= link_to 'Back to Posts', posts_path %> | diff --git a/railties/guides/code/getting_started/app/views/tags/_form.html.erb b/railties/guides/code/getting_started/app/views/tags/_form.html.erb new file mode 100644 index 0000000000..7e424b0e20 --- /dev/null +++ b/railties/guides/code/getting_started/app/views/tags/_form.html.erb @@ -0,0 +1,12 @@ +<%= form.fields_for :tags do |tag_form| %> +
+ <%= tag_form.label :name, 'Tag:' %> + <%= tag_form.text_field :name %> +
+ <% unless tag_form.object.nil? || tag_form.object.new_record? %> +
+ <%= tag_form.label :_destroy, 'Remove:' %> + <%= tag_form.check_box :_destroy %> +
+ <% end %> +<% end %> -- cgit v1.2.3