diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/assets/stylesheets/application.css.scss | 16 | ||||
| -rw-r--r-- | app/assets/stylesheets/entries.scss | 54 | ||||
| -rw-r--r-- | app/controllers/entries_controller.rb | 21 | ||||
| -rw-r--r-- | app/views/entries/show.html.haml | 4 | 
4 files changed, 92 insertions, 3 deletions
| diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 6ec040a..0fa0535 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | */ | 16 | */ | 
| 17 | 17 | ||
| 18 | @import url('https://fonts.googleapis.com/css?family=Inconsolata'); | 18 | @import url('https://fonts.googleapis.com/css?family=Inconsolata'); | 
| 19 | @import url('https://fonts.googleapis.com/css?family=Slabo+27px'); | ||
| 20 | @import url('https://fonts.googleapis.com/css?family=Roboto:400,700'); | ||
| 19 | 21 | ||
| 20 | body#main-body { | 22 | body#main-body { | 
| 21 | background-color: #bfefff; | 23 | background-color: #bfefff; | 
| @@ -207,3 +209,17 @@ body#userdata-body { | |||
| 207 | .sidebar-module a:visited { | 209 | .sidebar-module a:visited { | 
| 208 | color: #352712; | 210 | color: #352712; | 
| 209 | } | 211 | } | 
| 212 | |||
| 213 | .breadcrumb { | ||
| 214 | margin-left: 1em; | ||
| 215 | |||
| 216 | a, a:visited { | ||
| 217 | color: #555d66; | ||
| 218 | text-decoration: none; | ||
| 219 | font-size: .75em; | ||
| 220 | } | ||
| 221 | |||
| 222 | a:hover { | ||
| 223 | text-decoration: underline; | ||
| 224 | } | ||
| 225 | } | ||
| diff --git a/app/assets/stylesheets/entries.scss b/app/assets/stylesheets/entries.scss index f779b1b..6833141 100644 --- a/app/assets/stylesheets/entries.scss +++ b/app/assets/stylesheets/entries.scss | |||
| @@ -1,3 +1,57 @@ | |||
| 1 | // Place all the styles related to the Entries controller here. | 1 | // Place all the styles related to the Entries controller here. | 
| 2 | // They will automatically be included in application.css. | 2 | // They will automatically be included in application.css. | 
| 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ | 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ | 
| 4 | |||
| 5 | #blog-post { | ||
| 6 | font-size: 16px; | ||
| 7 | line-height: 24px; | ||
| 8 | margin: 0 3em; | ||
| 9 | |||
| 10 | h2 { | ||
| 11 | font-size: 45px; | ||
| 12 | line-height: 48px; | ||
| 13 | margin-top: .5em; | ||
| 14 | } | ||
| 15 | |||
| 16 | h3 { | ||
| 17 | font-size: 37px; | ||
| 18 | line-height: 42px; | ||
| 19 | } | ||
| 20 | |||
| 21 | h2, h3 { | ||
| 22 | font-family: 'Slabo 27px', serif; | ||
| 23 | margin-bottom: 0; | ||
| 24 | font-weight: normal; | ||
| 25 | } | ||
| 26 | |||
| 27 | #blog-content { | ||
| 28 | hyphens: auto; | ||
| 29 | word-wrap: break-word; | ||
| 30 | font-family: 'Roboto', sans-serif; | ||
| 31 | text-align: justify; | ||
| 32 | |||
| 33 | a { | ||
| 34 | text-decoration: none; | ||
| 35 | font-weight: bold; | ||
| 36 | |||
| 37 | &, &:visited { | ||
| 38 | color: #ee2c2c; | ||
| 39 | } | ||
| 40 | |||
| 41 | &:hover { | ||
| 42 | text-decoration: underline; | ||
| 43 | color: #9ea1ad; | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | li { | ||
| 48 | & + li { | ||
| 49 | margin-top: 1em; | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | img { | ||
| 54 | max-width: 100%; | ||
| 55 | } | ||
| 56 | } | ||
| 57 | } | ||
| diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb index 89d06c0..366de53 100644 --- a/app/controllers/entries_controller.rb +++ b/app/controllers/entries_controller.rb | |||
| @@ -1,7 +1,26 @@ | |||
| 1 | class EntriesController < ApplicationController | 1 | class EntriesController < ApplicationController | 
| 2 | before_action :authenticate_user!, only: [:edit, :update] | ||
| 2 | 3 | ||
| 3 | def show | 4 | def show | 
| 4 | @entry = Entry.where(directory: params[:directory], slug: params[:slug]).first | 5 | @entry = Entry.where(slug: params[:slug]).first | 
| 5 | end | 6 | end | 
| 6 | 7 | ||
| 8 | def edit | ||
| 9 | @entry = Entry.where(slug: params[:slug]).first | ||
| 10 | end | ||
| 11 | |||
| 12 | def update | ||
| 13 | @entry = Entry.where(slug: params[:slug]).first | ||
| 14 | |||
| 15 | if @entry.update_attributes(entry_params) | ||
| 16 | flash.notice = "" | ||
| 17 | end | ||
| 18 | end | ||
| 19 | |||
| 20 | private | ||
| 21 | |||
| 22 | def entry_params | ||
| 23 | params.require(:blog).permit(:title, :body, :slug) | ||
| 24 | end | ||
| 25 | |||
| 7 | end | 26 | end | 
| diff --git a/app/views/entries/show.html.haml b/app/views/entries/show.html.haml index 8a2a2a9..3a9337c 100644 --- a/app/views/entries/show.html.haml +++ b/app/views/entries/show.html.haml | |||
| @@ -1,2 +1,2 @@ | |||
| 1 | <h1>Entries#show</h1> | 1 | .breadcrumb= link_to "← Back to home page", root_path | 
| 2 | <p>Find me in app/views/entries/show.html.erb</p> | 2 | = render @entry | 
