show,index series,authors
This commit is contained in:
parent
5ee2ea8e48
commit
dc750eb188
3
app/assets/javascripts/authors.coffee
Normal file
3
app/assets/javascripts/authors.coffee
Normal file
@ -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/
|
3
app/assets/javascripts/series.coffee
Normal file
3
app/assets/javascripts/series.coffee
Normal file
@ -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/
|
3
app/assets/stylesheets/authors.scss
Normal file
3
app/assets/stylesheets/authors.scss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the authors controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
3
app/assets/stylesheets/series.scss
Normal file
3
app/assets/stylesheets/series.scss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the series controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
13
app/controllers/authors_controller.rb
Normal file
13
app/controllers/authors_controller.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
class AuthorsController < ApplicationController
|
||||||
|
|
||||||
|
def show
|
||||||
|
@author = Author.find(params[:id])
|
||||||
|
@title = @author.name
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@authors = Author.paginate(page: params[:page])
|
||||||
|
@title = "Authors"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
13
app/controllers/series_controller.rb
Normal file
13
app/controllers/series_controller.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
class SeriesController < ApplicationController
|
||||||
|
|
||||||
|
def show
|
||||||
|
@serie = Serie.find(params[:id])
|
||||||
|
@title = @serie.name
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@series = Serie.paginate(page: params[:page])
|
||||||
|
@title = "Series"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
2
app/helpers/authors_helper.rb
Normal file
2
app/helpers/authors_helper.rb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
module AuthorsHelper
|
||||||
|
end
|
2
app/helpers/series_helper.rb
Normal file
2
app/helpers/series_helper.rb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
module SeriesHelper
|
||||||
|
end
|
11
app/views/authors/index.html.erb
Normal file
11
app/views/authors/index.html.erb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<h1>Authors</h1>
|
||||||
|
|
||||||
|
<%= will_paginate %>
|
||||||
|
|
||||||
|
<ul class="authors">
|
||||||
|
<% @authors.each do |author| %>
|
||||||
|
<li><%= link_to author.name, author %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<%= will_paginate %>
|
1
app/views/authors/show.html.erb
Normal file
1
app/views/authors/show.html.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
<h1><%= @author.name %></h1>
|
@ -16,3 +16,4 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<p>Serie: <%= @book.serie.name %></p>
|
<p>Serie: <%= @book.serie.name %></p>
|
||||||
<p>Publisher: <%= @book.publisher.name %></p>
|
<p>Publisher: <%= @book.publisher.name %></p>
|
||||||
|
<p>Publishing date: <%= @book.pubdate.to_formatted_s(:date) %></p>
|
||||||
|
11
app/views/series/index.html.erb
Normal file
11
app/views/series/index.html.erb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<h1>Series</h1>
|
||||||
|
|
||||||
|
<%= will_paginate %>
|
||||||
|
|
||||||
|
<ul class="series">
|
||||||
|
<% @series.each do |serie| %>
|
||||||
|
<li><%= link_to serie.name, serie %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<%= will_paginate %>
|
6
app/views/series/show.html.erb
Normal file
6
app/views/series/show.html.erb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<h1><%= @serie.name %></h1>
|
||||||
|
<ul>
|
||||||
|
<% @serie.books.each do |book| %>
|
||||||
|
<li><%= link_to book.title, book %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
1
config/initializers/time_formats.rb
Normal file
1
config/initializers/time_formats.rb
Normal file
@ -0,0 +1 @@
|
|||||||
|
Time::DATE_FORMATS[:date] = '%Y-%m-%d'
|
@ -4,6 +4,8 @@ Rails.application.routes.draw do
|
|||||||
get 'static_pages/about'
|
get 'static_pages/about'
|
||||||
|
|
||||||
resources :books
|
resources :books
|
||||||
|
resources :authors
|
||||||
|
resources :series
|
||||||
|
|
||||||
# The priority is based upon order of creation: first created -> highest priority.
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
# See how all your routes lay out with "rake routes".
|
# See how all your routes lay out with "rake routes".
|
||||||
|
7
test/controllers/authors_controller_test.rb
Normal file
7
test/controllers/authors_controller_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class AuthorsControllerTest < ActionController::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
7
test/controllers/series_controller_test.rb
Normal file
7
test/controllers/series_controller_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class SeriesControllerTest < ActionController::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user