From ea6326612a02e1555212e3a0f98cad089927b1c5 Mon Sep 17 00:00:00 2001 From: Meutel Date: Sun, 28 Jun 2015 14:29:09 +0200 Subject: [PATCH] show book --- app/assets/javascripts/books.coffee | 3 +++ app/assets/stylesheets/books.scss | 3 +++ app/controllers/books_controller.rb | 7 +++++++ app/helpers/books_helper.rb | 2 ++ app/views/books/show.html.erb | 1 + config/routes.rb | 2 ++ test/controllers/books_controller_test.rb | 7 +++++++ 7 files changed, 25 insertions(+) create mode 100644 app/assets/javascripts/books.coffee create mode 100644 app/assets/stylesheets/books.scss create mode 100644 app/controllers/books_controller.rb create mode 100644 app/helpers/books_helper.rb create mode 100644 app/views/books/show.html.erb create mode 100644 test/controllers/books_controller_test.rb diff --git a/app/assets/javascripts/books.coffee b/app/assets/javascripts/books.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/books.coffee @@ -0,0 +1,3 @@ +# 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/app/assets/stylesheets/books.scss b/app/assets/stylesheets/books.scss new file mode 100644 index 0000000..81379d1 --- /dev/null +++ b/app/assets/stylesheets/books.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the books controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb new file mode 100644 index 0000000..1a0d2cf --- /dev/null +++ b/app/controllers/books_controller.rb @@ -0,0 +1,7 @@ +class BooksController < ApplicationController + + def show + @book = Calibre::Book.find(params[:id]) + end + +end diff --git a/app/helpers/books_helper.rb b/app/helpers/books_helper.rb new file mode 100644 index 0000000..4b9311e --- /dev/null +++ b/app/helpers/books_helper.rb @@ -0,0 +1,2 @@ +module BooksHelper +end diff --git a/app/views/books/show.html.erb b/app/views/books/show.html.erb new file mode 100644 index 0000000..4afce77 --- /dev/null +++ b/app/views/books/show.html.erb @@ -0,0 +1 @@ +

<%= @book.title %>

diff --git a/config/routes.rb b/config/routes.rb index e056630..29050c8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,6 +3,8 @@ Rails.application.routes.draw do get 'static_pages/about' + resources :books + # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/test/controllers/books_controller_test.rb b/test/controllers/books_controller_test.rb new file mode 100644 index 0000000..66da31d --- /dev/null +++ b/test/controllers/books_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class BooksControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end