fix routes (series is uncountable...), improve design (bootstrap)

This commit is contained in:
Meutel 2015-06-28 18:46:22 +02:00
parent dc750eb188
commit 9ceaf42025
7 changed files with 117 additions and 12 deletions

View File

@ -2,7 +2,8 @@ source 'https://rubygems.org'
#gem 'magic_multi_connections' #gem 'magic_multi_connections'
gem 'will_paginate' gem 'will_paginate'
#gem 'bootstrap-will_paginate' gem 'bootstrap-sass'
gem 'bootstrap-will_paginate'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'

View File

@ -37,8 +37,16 @@ GEM
thread_safe (~> 0.3, >= 0.3.4) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
arel (6.0.0) arel (6.0.0)
autoprefixer-rails (5.2.1)
execjs
json
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.5.1)
autoprefixer-rails (>= 5.0.0.1)
sass (>= 3.3.0)
bootstrap-will_paginate (0.0.10)
will_paginate
builder (3.2.2) builder (3.2.2)
byebug (5.0.0) byebug (5.0.0)
columnize (= 0.9.0) columnize (= 0.9.0)
@ -143,6 +151,8 @@ PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
bootstrap-sass
bootstrap-will_paginate
byebug byebug
coffee-rails (~> 4.1.0) coffee-rails (~> 4.1.0)
jbuilder (~> 2.0) jbuilder (~> 2.0)

View File

@ -0,0 +1,70 @@
@import "bootstrap-sprockets";
@import "bootstrap";
/* universal */
body {
padding-top: 60px;
}
section {
overflow: auto;
}
textarea {
resize: vertical;
}
.center {
text-align: center;
}
.center h1 {
margin-bottom: 10px;
}
/* typography */
h1, h2, h3, h4, h5, h6 {
line-height: 1;
}
h1 {
font-size: 3em;
letter-spacing: -2px;
margin-bottom: 30px;
text-align: center;
}
h2 {
font-size: 1.2em;
letter-spacing: -1px;
margin-bottom: 30px;
text-align: center;
font-weight: normal;
color: #777;
}
p {
font-size: 1.1em;
line-height: 1.7em;
}
/* header */
#logo {
float: left;
margin-right: 10px;
font-size: 1.7em;
color: #fff;
text-transform: uppercase;
letter-spacing: -1px;
padding-top: 9px;
font-weight: bold;
}
#logo:hover {
color: #fff;
text-decoration: none;
}

View File

@ -7,8 +7,19 @@
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
</head> </head>
<body> <body>
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<%= link_to "Bouquins", '#', id: "logo" %>
<nav>
<ul class="nav navbar-nav navbar-right">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "About", about_path %></li>
</ul>
</nav>
</div>
</header>
<div class="container">
<%= yield %> <%= yield %>
</div>
</body> </body>
</html> </html>

View File

@ -1,2 +1,10 @@
<h1>Welcome</h1> <div class="center jumbotron">
<p><%= @books_count %> books in library</p> <h1>Library</h1>
<h2>Browse <%= @books_count %> books</h2>
<p>
<%= link_to "Books", books_path, class: "btn btn-lg btn-primary" %>
<%= link_to "Authors", authors_path, class: "btn btn-lg btn-primary" %>
<%= link_to "Series", series_path, class: "btn btn-lg btn-primary" %>
</p>
</div>

View File

@ -14,3 +14,7 @@
# ActiveSupport::Inflector.inflections(:en) do |inflect| # ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful' # inflect.acronym 'RESTful'
# end # end
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.uncountable %w( serie )
# end
ActiveSupport::Inflector.inflections.singular "series", "serie"

View File

@ -1,11 +1,12 @@
Rails.application.routes.draw do Rails.application.routes.draw do
get 'static_pages/home' root 'static_pages#home'
get 'about' => 'static_pages#about'
get 'static_pages/about' resources :books, only: [ :index, :show ]
resources :authors, only: [ :index, :show ]
resources :books resources :series, only: [ :index, :show ]
resources :authors #get 'series/:id' => 'series#show'
resources :series #get 'series' => 'series#index'
# 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".