From 9ceaf4202507773dcc94d1f9b35aa1ad417d8608 Mon Sep 17 00:00:00 2001 From: Meutel Date: Sun, 28 Jun 2015 18:46:22 +0200 Subject: [PATCH] fix routes (series is uncountable...), improve design (bootstrap) --- Gemfile | 3 +- Gemfile.lock | 10 ++++ app/assets/stylesheets/custom.css.scss | 70 ++++++++++++++++++++++++++ app/views/layouts/application.html.erb | 17 +++++-- app/views/static_pages/home.html.erb | 12 ++++- config/initializers/inflections.rb | 4 ++ config/routes.rb | 13 ++--- 7 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 app/assets/stylesheets/custom.css.scss diff --git a/Gemfile b/Gemfile index 6748838..a96eca6 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,8 @@ source 'https://rubygems.org' #gem 'magic_multi_connections' gem 'will_paginate' -#gem 'bootstrap-will_paginate' +gem 'bootstrap-sass' +gem 'bootstrap-will_paginate' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' diff --git a/Gemfile.lock b/Gemfile.lock index edf97d0..67f09a8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,8 +37,16 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.0) + autoprefixer-rails (5.2.1) + execjs + json binding_of_caller (0.7.2) 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) byebug (5.0.0) columnize (= 0.9.0) @@ -143,6 +151,8 @@ PLATFORMS ruby DEPENDENCIES + bootstrap-sass + bootstrap-will_paginate byebug coffee-rails (~> 4.1.0) jbuilder (~> 2.0) diff --git a/app/assets/stylesheets/custom.css.scss b/app/assets/stylesheets/custom.css.scss new file mode 100644 index 0000000..53f7491 --- /dev/null +++ b/app/assets/stylesheets/custom.css.scss @@ -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; +} diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 41d98b6..5382f4b 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,8 +7,19 @@ <%= csrf_meta_tags %> - -<%= yield %> - + +
+ <%= yield %> +
diff --git a/app/views/static_pages/home.html.erb b/app/views/static_pages/home.html.erb index be2a515..12952a5 100644 --- a/app/views/static_pages/home.html.erb +++ b/app/views/static_pages/home.html.erb @@ -1,2 +1,10 @@ -

Welcome

-

<%= @books_count %> books in library

+
+

Library

+

Browse <%= @books_count %> books

+ +

+ <%= 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" %> +

+
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf..c0d93c9 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -14,3 +14,7 @@ # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.acronym 'RESTful' # end +# ActiveSupport::Inflector.inflections(:en) do |inflect| + # inflect.uncountable %w( serie ) +# end +ActiveSupport::Inflector.inflections.singular "series", "serie" diff --git a/config/routes.rb b/config/routes.rb index dfefb48..86a06d9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,11 +1,12 @@ Rails.application.routes.draw do - get 'static_pages/home' + root 'static_pages#home' + get 'about' => 'static_pages#about' - get 'static_pages/about' - - resources :books - resources :authors - resources :series + resources :books, only: [ :index, :show ] + resources :authors, only: [ :index, :show ] + resources :series, only: [ :index, :show ] + #get 'series/:id' => 'series#show' + #get 'series' => 'series#index' # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes".