diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-13 11:51:47 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-13 11:51:47 -0400 |
commit | 0333f3e258026696af265f777f862e612bab1bd7 (patch) | |
tree | f1ed811b0c327d9561d4fda299345b5526591a69 | |
parent | 843f3515e5619120ca2c65954a011845225a31f1 (diff) | |
download | thoughts-0333f3e258026696af265f777f862e612bab1bd7.tar.gz thoughts-0333f3e258026696af265f777f862e612bab1bd7.tar.bz2 thoughts-0333f3e258026696af265f777f862e612bab1bd7.zip |
Tag links
-rwxr-xr-x | app/assets/images/tag.png | bin | 0 -> 389 bytes | |||
-rw-r--r-- | app/assets/stylesheets/main/entries.scss | 24 | ||||
-rw-r--r-- | app/controllers/tags_controller.rb | 5 | ||||
-rw-r--r-- | app/views/blogs/_blog.html.haml | 3 | ||||
-rw-r--r-- | config/routes.rb | 2 |
5 files changed, 33 insertions, 1 deletions
diff --git a/app/assets/images/tag.png b/app/assets/images/tag.png new file mode 100755 index 0000000..e093032 --- /dev/null +++ b/app/assets/images/tag.png | |||
Binary files differ | |||
diff --git a/app/assets/stylesheets/main/entries.scss b/app/assets/stylesheets/main/entries.scss index 5fbd4ef..1a42d85 100644 --- a/app/assets/stylesheets/main/entries.scss +++ b/app/assets/stylesheets/main/entries.scss | |||
@@ -88,6 +88,30 @@ | |||
88 | font: 75%/150% sans-serif; | 88 | font: 75%/150% sans-serif; |
89 | color: #999; | 89 | color: #999; |
90 | } | 90 | } |
91 | |||
92 | .post-tag-3 { | ||
93 | background: image-url("tag.png") no-repeat; | ||
94 | padding-left: 20px; | ||
95 | margin: 0 0 0 3em; | ||
96 | float: left; | ||
97 | font-size: 95%; | ||
98 | color: #999999; | ||
99 | font: 75%/150% sans-serif; | ||
100 | display: block; | ||
101 | |||
102 | li { | ||
103 | display: inline-block; | ||
104 | margin-right: 0.5em; | ||
105 | |||
106 | a { | ||
107 | text-decoration: none; | ||
108 | |||
109 | &:hover { | ||
110 | text-decoration: underline; | ||
111 | } | ||
112 | } | ||
113 | } | ||
114 | } | ||
91 | } | 115 | } |
92 | } | 116 | } |
93 | 117 | ||
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 7115d28..cf5d50b 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb | |||
@@ -1,5 +1,10 @@ | |||
1 | class TagsController < ApplicationController | 1 | class TagsController < ApplicationController |
2 | 2 | ||
3 | def show | ||
4 | @blogs = Blog.tagged_with(params[:name]).where(published: true).order(published_at: :desc).paginate(page: params[:page], per_page: 10) | ||
5 | render "blogs/summary" | ||
6 | end | ||
7 | |||
3 | def suggest | 8 | def suggest |
4 | @tags = ActsAsTaggableOn::Tag.pluck(:name).select do |tag| | 9 | @tags = ActsAsTaggableOn::Tag.pluck(:name).select do |tag| |
5 | tag.starts_with? params[:term] | 10 | tag.starts_with? params[:term] |
diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml index 8972c2e..c607e63 100644 --- a/app/views/blogs/_blog.html.haml +++ b/app/views/blogs/_blog.html.haml | |||
@@ -6,6 +6,9 @@ | |||
6 | .blog-title | 6 | .blog-title |
7 | %h2= link_to_unless_current blog.title, blog | 7 | %h2= link_to_unless_current blog.title, blog |
8 | .post-author Hatkirby | 8 | .post-author Hatkirby |
9 | %ul.post-tag-3 | ||
10 | - blog.tags.each do |tag| | ||
11 | %li= link_to tag, tag_url(tag.name) | ||
9 | %blockquote#blog-content.entry-content.bubble.rounded.bottom | 12 | %blockquote#blog-content.entry-content.bubble.rounded.bottom |
10 | - if short and blog.has_read_more | 13 | - if short and blog.has_read_more |
11 | = markdown(blog.short_body) | 14 | = markdown(blog.short_body) |
diff --git a/config/routes.rb b/config/routes.rb index dcfe673..a3448f0 100644 --- a/config/routes.rb +++ b/config/routes.rb | |||
@@ -36,7 +36,7 @@ Rails.application.routes.draw do | |||
36 | 36 | ||
37 | get 'plays', to: 'games#index' | 37 | get 'plays', to: 'games#index' |
38 | 38 | ||
39 | resources :tags, only: [], param: :name do | 39 | resources :tags, only: [:show], param: :name do |
40 | collection do | 40 | collection do |
41 | get 'suggest' | 41 | get 'suggest' |
42 | end | 42 | end |