diff options
Diffstat (limited to 'guides/code/getting_started/app')
31 files changed, 0 insertions, 271 deletions
diff --git a/guides/code/getting_started/app/assets/javascripts/application.js b/guides/code/getting_started/app/assets/javascripts/application.js deleted file mode 100644 index 5a4fbaa370..0000000000 --- a/guides/code/getting_started/app/assets/javascripts/application.js +++ /dev/null @@ -1,15 +0,0 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, -// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// compiled file. -// -// stub path allows dependency to be excluded from the asset bundle. -// -//= require jquery -//= require jquery_ujs -//= require turbolinks -//= require_tree . diff --git a/guides/code/getting_started/app/assets/javascripts/comments.js.coffee b/guides/code/getting_started/app/assets/javascripts/comments.js.coffee deleted file mode 100644 index 24f83d18bb..0000000000 --- a/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/guides/code/getting_started/app/assets/javascripts/posts.js.coffee b/guides/code/getting_started/app/assets/javascripts/posts.js.coffee deleted file mode 100644 index 24f83d18bb..0000000000 --- a/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee b/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee deleted file mode 100644 index 24f83d18bb..0000000000 --- a/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/guides/code/getting_started/app/assets/stylesheets/application.css b/guides/code/getting_started/app/assets/stylesheets/application.css deleted file mode 100644 index 3192ec897b..0000000000 --- a/guides/code/getting_started/app/assets/stylesheets/application.css +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, - * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the top of the - * compiled file, but it's generally better to create a new file per style scope. - * - *= require_self - *= require_tree . - */ diff --git a/guides/code/getting_started/app/assets/stylesheets/comments.css.scss b/guides/code/getting_started/app/assets/stylesheets/comments.css.scss deleted file mode 100644 index e730912783..0000000000 --- a/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the Comments controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/guides/code/getting_started/app/assets/stylesheets/posts.css.scss b/guides/code/getting_started/app/assets/stylesheets/posts.css.scss deleted file mode 100644 index 1a7e15390c..0000000000 --- a/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the posts controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss b/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss deleted file mode 100644 index 77ce11a740..0000000000 --- a/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the welcome controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/guides/code/getting_started/app/controllers/application_controller.rb b/guides/code/getting_started/app/controllers/application_controller.rb deleted file mode 100644 index d83690e1b9..0000000000 --- a/guides/code/getting_started/app/controllers/application_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ApplicationController < ActionController::Base - # Prevent CSRF attacks by raising an exception. - # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception -end diff --git a/guides/code/getting_started/app/controllers/comments_controller.rb b/guides/code/getting_started/app/controllers/comments_controller.rb deleted file mode 100644 index b2d9bcdf7f..0000000000 --- a/guides/code/getting_started/app/controllers/comments_controller.rb +++ /dev/null @@ -1,23 +0,0 @@ -class CommentsController < ApplicationController - - http_basic_authenticate_with name: "dhh", password: "secret", only: :destroy - - def create - @post = Post.find(params[:post_id]) - @comment = @post.comments.create(comment_params) - redirect_to post_path(@post) - end - - def destroy - @post = Post.find(params[:post_id]) - @comment = @post.comments.find(params[:id]) - @comment.destroy - redirect_to post_path(@post) - end - - private - - def comment_params - params.require(:comment).permit(:commenter, :body) - end -end diff --git a/guides/code/getting_started/app/controllers/concerns/.keep b/guides/code/getting_started/app/controllers/concerns/.keep deleted file mode 100644 index e69de29bb2..0000000000 --- a/guides/code/getting_started/app/controllers/concerns/.keep +++ /dev/null diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb deleted file mode 100644 index 02689ad67b..0000000000 --- a/guides/code/getting_started/app/controllers/posts_controller.rb +++ /dev/null @@ -1,53 +0,0 @@ -class PostsController < ApplicationController - - http_basic_authenticate_with name: "dhh", password: "secret", except: [:index, :show] - - def index - @posts = Post.all - end - - def show - @post = Post.find(params[:id]) - end - - def edit - @post = Post.find(params[:id]) - end - - def update - @post = Post.find(params[:id]) - - if @post.update(post_params) - redirect_to action: :show, id: @post.id - else - render 'edit' - end - end - - def new - @post = Post.new - end - - def create - @post = Post.new(post_params) - - if @post.save - redirect_to action: :show, id: @post.id - else - render 'new' - end - end - - def destroy - @post = Post.find(params[:id]) - @post.destroy - - redirect_to action: :index - end - - private - - def post_params - params.require(:post).permit(:title, :text) - end -end diff --git a/guides/code/getting_started/app/controllers/welcome_controller.rb b/guides/code/getting_started/app/controllers/welcome_controller.rb deleted file mode 100644 index f9b859b9c9..0000000000 --- a/guides/code/getting_started/app/controllers/welcome_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -class WelcomeController < ApplicationController - def index - end -end diff --git a/guides/code/getting_started/app/helpers/application_helper.rb b/guides/code/getting_started/app/helpers/application_helper.rb deleted file mode 100644 index de6be7945c..0000000000 --- a/guides/code/getting_started/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/guides/code/getting_started/app/helpers/comments_helper.rb b/guides/code/getting_started/app/helpers/comments_helper.rb deleted file mode 100644 index 0ec9ca5f2d..0000000000 --- a/guides/code/getting_started/app/helpers/comments_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module CommentsHelper -end diff --git a/guides/code/getting_started/app/helpers/posts_helper.rb b/guides/code/getting_started/app/helpers/posts_helper.rb deleted file mode 100644 index a7b8cec898..0000000000 --- a/guides/code/getting_started/app/helpers/posts_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PostsHelper -end diff --git a/guides/code/getting_started/app/helpers/welcome_helper.rb b/guides/code/getting_started/app/helpers/welcome_helper.rb deleted file mode 100644 index eeead45fc9..0000000000 --- a/guides/code/getting_started/app/helpers/welcome_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module WelcomeHelper -end diff --git a/guides/code/getting_started/app/mailers/.keep b/guides/code/getting_started/app/mailers/.keep deleted file mode 100644 index e69de29bb2..0000000000 --- a/guides/code/getting_started/app/mailers/.keep +++ /dev/null diff --git a/guides/code/getting_started/app/models/.keep b/guides/code/getting_started/app/models/.keep deleted file mode 100644 index e69de29bb2..0000000000 --- a/guides/code/getting_started/app/models/.keep +++ /dev/null diff --git a/guides/code/getting_started/app/models/comment.rb b/guides/code/getting_started/app/models/comment.rb deleted file mode 100644 index 4e76c5b5b0..0000000000 --- a/guides/code/getting_started/app/models/comment.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Comment < ActiveRecord::Base - belongs_to :post -end diff --git a/guides/code/getting_started/app/models/concerns/.keep b/guides/code/getting_started/app/models/concerns/.keep deleted file mode 100644 index e69de29bb2..0000000000 --- a/guides/code/getting_started/app/models/concerns/.keep +++ /dev/null diff --git a/guides/code/getting_started/app/models/post.rb b/guides/code/getting_started/app/models/post.rb deleted file mode 100644 index 64e0d721fd..0000000000 --- a/guides/code/getting_started/app/models/post.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Post < ActiveRecord::Base - has_many :comments, dependent: :destroy - - validates :title, - presence: true, - length: { minimum: 5 } -end diff --git a/guides/code/getting_started/app/views/comments/_comment.html.erb b/guides/code/getting_started/app/views/comments/_comment.html.erb deleted file mode 100644 index 593493339e..0000000000 --- a/guides/code/getting_started/app/views/comments/_comment.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<p> - <strong>Commenter:</strong> - <%= comment.commenter %> -</p> - -<p> - <strong>Comment:</strong> - <%= comment.body %> -</p> - -<p> - <%= link_to 'Destroy Comment', [comment.post, comment], - method: :delete, - data: { confirm: 'Are you sure?' } %> -</p> diff --git a/guides/code/getting_started/app/views/comments/_form.html.erb b/guides/code/getting_started/app/views/comments/_form.html.erb deleted file mode 100644 index 00cb3a08f0..0000000000 --- a/guides/code/getting_started/app/views/comments/_form.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%= form_for([@post, @post.comments.build]) do |f| %> - <p> - <%= f.label :commenter %><br /> - <%= f.text_field :commenter %> - </p> - <p> - <%= f.label :body %><br /> - <%= f.text_area :body %> - </p> - <p> - <%= f.submit %> - </p> -<% end %> diff --git a/guides/code/getting_started/app/views/layouts/application.html.erb b/guides/code/getting_started/app/views/layouts/application.html.erb deleted file mode 100644 index 95368c37a3..0000000000 --- a/guides/code/getting_started/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <title>Blog</title> - <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> - <%= javascript_include_tag "application", "data-turbolinks-track" => true %> - <%= csrf_meta_tags %> -</head> -<body> - -<%= yield %> - -</body> -</html> diff --git a/guides/code/getting_started/app/views/posts/_form.html.erb b/guides/code/getting_started/app/views/posts/_form.html.erb deleted file mode 100644 index f2f83585e1..0000000000 --- a/guides/code/getting_started/app/views/posts/_form.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<%= form_for @post do |f| %> - <% if @post.errors.any? %> - <div id="error_explanation"> - <h2><%= pluralize(@post.errors.count, "error") %> prohibited - this post from being saved:</h2> - <ul> - <% @post.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 %> - diff --git a/guides/code/getting_started/app/views/posts/edit.html.erb b/guides/code/getting_started/app/views/posts/edit.html.erb deleted file mode 100644 index 393e7430d0..0000000000 --- a/guides/code/getting_started/app/views/posts/edit.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<h1>Edit post</h1> - -<%= render 'form' %> - -<%= link_to 'Back', action: :index %> diff --git a/guides/code/getting_started/app/views/posts/index.html.erb b/guides/code/getting_started/app/views/posts/index.html.erb deleted file mode 100644 index 7369f0396f..0000000000 --- a/guides/code/getting_started/app/views/posts/index.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<h1>Listing Posts</h1> -<table> - <tr> - <th>Title</th> - <th>Text</th> - <th></th> - <th></th> - <th></th> - </tr> - -<% @posts.each do |post| %> - <tr> - <td><%= post.title %></td> - <td><%= post.text %></td> - <td><%= link_to 'Show', action: :show, id: post.id %></td> - <td><%= link_to 'Edit', action: :edit, id: post.id %></td> - <td><%= link_to 'Destroy', { action: :destroy, id: post.id }, - method: :delete, data: { confirm: 'Are you sure?' } %></td> - </tr> -<% end %> -</table> diff --git a/guides/code/getting_started/app/views/posts/new.html.erb b/guides/code/getting_started/app/views/posts/new.html.erb deleted file mode 100644 index efa81038ec..0000000000 --- a/guides/code/getting_started/app/views/posts/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<h1>New post</h1> - -<%= render 'form' %> - -<%= link_to 'Back', action: :index %> diff --git a/guides/code/getting_started/app/views/posts/show.html.erb b/guides/code/getting_started/app/views/posts/show.html.erb deleted file mode 100644 index e99e9edbb3..0000000000 --- a/guides/code/getting_started/app/views/posts/show.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<p> - <strong>Title:</strong> - <%= @post.title %> -</p> - -<p> - <strong>Text:</strong> - <%= @post.text %> -</p> - -<h2>Comments</h2> -<%= render @post.comments %> - -<h2>Add a comment:</h2> -<%= render "comments/form" %> - -<%= link_to 'Edit Post', edit_post_path(@post) %> | -<%= link_to 'Back to Posts', posts_path %> diff --git a/guides/code/getting_started/app/views/welcome/index.html.erb b/guides/code/getting_started/app/views/welcome/index.html.erb deleted file mode 100644 index 56be8dd3cc..0000000000 --- a/guides/code/getting_started/app/views/welcome/index.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<h1>Hello, Rails!</h1> - -<%= link_to "My Blog", controller: "posts" %> -<%= link_to "New Post", new_post_path %> |