diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-06-25 00:00:28 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-06-25 00:00:28 -0400 |
commit | ad80c40944743515a45d70014e8d5ffb88cd74fc (patch) | |
tree | 0e97b3d46f3ed3594a1e4074e4a5a06deefcd76d /app | |
parent | 5581530930129d7854ed5d99d058939ad9c790c2 (diff) | |
download | thoughts-ad80c40944743515a45d70014e8d5ffb88cd74fc.tar.gz thoughts-ad80c40944743515a45d70014e8d5ffb88cd74fc.tar.bz2 thoughts-ad80c40944743515a45d70014e8d5ffb88cd74fc.zip |
Started designing index page
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/entries.coffee | 3 | ||||
-rw-r--r-- | app/assets/javascripts/records.coffee | 3 | ||||
-rw-r--r-- | app/assets/stylesheets/application.css | 59 | ||||
-rw-r--r-- | app/assets/stylesheets/entries.scss | 3 | ||||
-rw-r--r-- | app/assets/stylesheets/records.scss | 61 | ||||
-rw-r--r-- | app/controllers/entries_controller.rb | 7 | ||||
-rw-r--r-- | app/controllers/records_controller.rb | 7 | ||||
-rw-r--r-- | app/helpers/entries_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/records_helper.rb | 2 | ||||
-rw-r--r-- | app/models/blog.rb | 4 | ||||
-rw-r--r-- | app/models/entry.rb | 9 | ||||
-rw-r--r-- | app/models/record.rb | 5 | ||||
-rw-r--r-- | app/views/entries/show.html.haml | 2 | ||||
-rw-r--r-- | app/views/layouts/application.html.erb | 14 | ||||
-rw-r--r-- | app/views/layouts/application.html.haml | 14 | ||||
-rw-r--r-- | app/views/records/index.html.haml | 7 |
16 files changed, 188 insertions, 14 deletions
diff --git a/app/assets/javascripts/entries.coffee b/app/assets/javascripts/entries.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/entries.coffee | |||
@@ -0,0 +1,3 @@ | |||
1 | # Place all the behaviors and hooks related to the matching controller here. | ||
2 | # All this logic will automatically be available in application.js. | ||
3 | # You can use CoffeeScript in this file: http://coffeescript.org/ | ||
diff --git a/app/assets/javascripts/records.coffee b/app/assets/javascripts/records.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/records.coffee | |||
@@ -0,0 +1,3 @@ | |||
1 | # Place all the behaviors and hooks related to the matching controller here. | ||
2 | # All this logic will automatically be available in application.js. | ||
3 | # You can use CoffeeScript in this file: http://coffeescript.org/ | ||
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index d05ea0f..6fd12b7 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css | |||
@@ -10,6 +10,65 @@ | |||
10 | * files in this directory. Styles in this file should be added after the last require_* statement. | 10 | * files in this directory. Styles in this file should be added after the last require_* statement. |
11 | * It is generally better to create a new file per style scope. | 11 | * It is generally better to create a new file per style scope. |
12 | * | 12 | * |
13 | *= require normalize-rails | ||
13 | *= require_tree . | 14 | *= require_tree . |
14 | *= require_self | 15 | *= require_self |
15 | */ | 16 | */ |
17 | |||
18 | @import url('https://fonts.googleapis.com/css?family=Inconsolata'); | ||
19 | |||
20 | body { | ||
21 | background-color: #bfefff; | ||
22 | } | ||
23 | |||
24 | #container { | ||
25 | margin: 5em auto 0; | ||
26 | width: 50%; | ||
27 | border: 1px solid black; | ||
28 | background-color: white; | ||
29 | box-sizing: border-box; | ||
30 | -webkit-border-top-left-radius: 15px; | ||
31 | -webkit-border-top-right-radius: 15px; | ||
32 | -moz-border-radius-topleft: 15px; | ||
33 | -moz-border-radius-topright: 15px; | ||
34 | border-top-left-radius: 15px; | ||
35 | border-top-right-radius: 15px; | ||
36 | } | ||
37 | |||
38 | #banner { | ||
39 | width: 100%; | ||
40 | border-bottom: 1px solid black; | ||
41 | padding: 1em; | ||
42 | box-sizing: border-box; | ||
43 | } | ||
44 | |||
45 | #banner h1 { | ||
46 | text-align: center; | ||
47 | margin: 0; | ||
48 | } | ||
49 | |||
50 | #banner h1 a { | ||
51 | text-decoration: none; | ||
52 | color: black; | ||
53 | } | ||
54 | |||
55 | #banner h1 a:visited { | ||
56 | color: black; | ||
57 | } | ||
58 | |||
59 | #main { | ||
60 | display: -webkit-flex; | ||
61 | display: flex; | ||
62 | } | ||
63 | |||
64 | #content { | ||
65 | width: 75%; | ||
66 | box-sizing: border-box; | ||
67 | border-right: 1px solid black; | ||
68 | } | ||
69 | |||
70 | #sidebar { | ||
71 | width: 25%; | ||
72 | box-sizing: border-box; | ||
73 | padding-right: 1em; | ||
74 | } | ||
diff --git a/app/assets/stylesheets/entries.scss b/app/assets/stylesheets/entries.scss new file mode 100644 index 0000000..f779b1b --- /dev/null +++ b/app/assets/stylesheets/entries.scss | |||
@@ -0,0 +1,3 @@ | |||
1 | // Place all the styles related to the Entries controller here. | ||
2 | // They will automatically be included in application.css. | ||
3 | // You can use Sass (SCSS) here: http://sass-lang.com/ | ||
diff --git a/app/assets/stylesheets/records.scss b/app/assets/stylesheets/records.scss new file mode 100644 index 0000000..0054edd --- /dev/null +++ b/app/assets/stylesheets/records.scss | |||
@@ -0,0 +1,61 @@ | |||
1 | // Place all the styles related to the Records controller here. | ||
2 | // They will automatically be included in application.css. | ||
3 | // You can use Sass (SCSS) here: http://sass-lang.com/ | ||
4 | |||
5 | #records { | ||
6 | padding: 0; | ||
7 | margin: 0 1em; | ||
8 | |||
9 | & > li { | ||
10 | display: block; | ||
11 | padding: .25em 0; | ||
12 | |||
13 | .description { | ||
14 | a { | ||
15 | text-decoration: none; | ||
16 | color: black; | ||
17 | font-family: 'Inconsolata', monospace; | ||
18 | |||
19 | &:hover { | ||
20 | text-decoration: underline; | ||
21 | } | ||
22 | |||
23 | &:visited { | ||
24 | color: black; | ||
25 | } | ||
26 | } | ||
27 | } | ||
28 | |||
29 | .tags { | ||
30 | margin: .25em; | ||
31 | display: flex; | ||
32 | padding-left: 0; | ||
33 | |||
34 | li { | ||
35 | display: inline; | ||
36 | font-size: .75em; | ||
37 | font-family: 'Inconsolata', monospace; | ||
38 | padding: .25em; | ||
39 | -webkit-border-radius: 5px; | ||
40 | -moz-border-radius: 5px; | ||
41 | border-radius: 5px; | ||
42 | |||
43 | &.record-date { | ||
44 | background-color: #fef1bf; | ||
45 | } | ||
46 | |||
47 | &.entry-type { | ||
48 | text-transform: uppercase; | ||
49 | |||
50 | &.entry-type-blog { | ||
51 | background-color: #90fefb; | ||
52 | } | ||
53 | } | ||
54 | |||
55 | & + li { | ||
56 | margin-left: 1em; | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | } | ||
diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb new file mode 100644 index 0000000..89d06c0 --- /dev/null +++ b/app/controllers/entries_controller.rb | |||
@@ -0,0 +1,7 @@ | |||
1 | class EntriesController < ApplicationController | ||
2 | |||
3 | def show | ||
4 | @entry = Entry.where(directory: params[:directory], slug: params[:slug]).first | ||
5 | end | ||
6 | |||
7 | end | ||
diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb new file mode 100644 index 0000000..200d63c --- /dev/null +++ b/app/controllers/records_controller.rb | |||
@@ -0,0 +1,7 @@ | |||
1 | class RecordsController < ApplicationController | ||
2 | |||
3 | def index | ||
4 | @records = Record.order(created_at: :desc).limit(20) | ||
5 | end | ||
6 | |||
7 | end | ||
diff --git a/app/helpers/entries_helper.rb b/app/helpers/entries_helper.rb new file mode 100644 index 0000000..ed8c595 --- /dev/null +++ b/app/helpers/entries_helper.rb | |||
@@ -0,0 +1,2 @@ | |||
1 | module EntriesHelper | ||
2 | end | ||
diff --git a/app/helpers/records_helper.rb b/app/helpers/records_helper.rb new file mode 100644 index 0000000..e63c599 --- /dev/null +++ b/app/helpers/records_helper.rb | |||
@@ -0,0 +1,2 @@ | |||
1 | module RecordsHelper | ||
2 | end | ||
diff --git a/app/models/blog.rb b/app/models/blog.rb new file mode 100644 index 0000000..d2b1c27 --- /dev/null +++ b/app/models/blog.rb | |||
@@ -0,0 +1,4 @@ | |||
1 | class Blog < Entry | ||
2 | validates :title, :body, presence: true | ||
3 | end | ||
4 | |||
diff --git a/app/models/entry.rb b/app/models/entry.rb new file mode 100644 index 0000000..22b330a --- /dev/null +++ b/app/models/entry.rb | |||
@@ -0,0 +1,9 @@ | |||
1 | class Entry < ApplicationRecord | ||
2 | has_many :records, as: :recordable | ||
3 | |||
4 | validates :slug, presence: true, format: /\A[-a-z0-9]+\z/ | ||
5 | |||
6 | def path | ||
7 | "/says/#{slug}" | ||
8 | end | ||
9 | end | ||
diff --git a/app/models/record.rb b/app/models/record.rb new file mode 100644 index 0000000..5837702 --- /dev/null +++ b/app/models/record.rb | |||
@@ -0,0 +1,5 @@ | |||
1 | class Record < ApplicationRecord | ||
2 | belongs_to :recordable, polymorphic: true | ||
3 | |||
4 | validates :description, :recordable, presence: true | ||
5 | end | ||
diff --git a/app/views/entries/show.html.haml b/app/views/entries/show.html.haml new file mode 100644 index 0000000..8a2a2a9 --- /dev/null +++ b/app/views/entries/show.html.haml | |||
@@ -0,0 +1,2 @@ | |||
1 | <h1>Entries#show</h1> | ||
2 | <p>Find me in app/views/entries/show.html.erb</p> | ||
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index 732b30e..0000000 --- a/app/views/layouts/application.html.erb +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html> | ||
3 | <head> | ||
4 | <title>Thoughts</title> | ||
5 | <%= csrf_meta_tags %> | ||
6 | |||
7 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> | ||
8 | <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> | ||
9 | </head> | ||
10 | |||
11 | <body> | ||
12 | <%= yield %> | ||
13 | </body> | ||
14 | </html> | ||
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml new file mode 100644 index 0000000..ad1e8df --- /dev/null +++ b/app/views/layouts/application.html.haml | |||
@@ -0,0 +1,14 @@ | |||
1 | !!! 5 | ||
2 | %html | ||
3 | %head | ||
4 | %title Thoughts | ||
5 | = csrf_meta_tags | ||
6 | = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' | ||
7 | = javascript_include_tag 'application', 'data-turbolinks-track': 'reload' | ||
8 | %body | ||
9 | #container | ||
10 | #banner | ||
11 | %h1= link_to "Thoughts", root_url | ||
12 | #main | ||
13 | #content= yield | ||
14 | #sidebar I'm Fef. | ||
diff --git a/app/views/records/index.html.haml b/app/views/records/index.html.haml new file mode 100644 index 0000000..29c9dfb --- /dev/null +++ b/app/views/records/index.html.haml | |||
@@ -0,0 +1,7 @@ | |||
1 | %ul#records | ||
2 | - @records.each do |record| | ||
3 | %li | ||
4 | %span.description= link_to record.description, record.recordable.path | ||
5 | %ul.tags | ||
6 | %li.record-date= record.created_at.strftime("%m.%e.%y") | ||
7 | %li.entry-type{ class: "entry-type-#{record.recordable.type.downcase}" }= record.recordable.type | ||