aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/tags.css15
-rw-r--r--app/controllers/tags_controller.rb10
-rw-r--r--app/views/searches/show.html.erb2
-rw-r--r--app/views/tags/_tag.html.erb4
4 files changed, 23 insertions, 8 deletions
diff --git a/app/assets/stylesheets/tags.css b/app/assets/stylesheets/tags.css
index bcf74cf..6d7e725 100644
--- a/app/assets/stylesheets/tags.css
+++ b/app/assets/stylesheets/tags.css
@@ -16,10 +16,19 @@
.tag-container {
display: flex;
align-items: flex-start;
-}
-.tag-container .name {
- flex-grow: 1;
+ .name {
+ flex-grow: 1;
+ }
+
+ .name a {
+ text-decoration: none;
+ color: var(--text) !important;
+ }
+
+ .name a:hover {
+ text-decoration: underline;
+ }
}
.tag-container .action {
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index ee837ef..c5ca6a8 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class TagsController < ApplicationController
- before_action :set_tag, only: %i[edit update destroy]
+ before_action :set_tag, only: %i[edit update destroy search]
def index
@tags = Tag.order(:name)
@@ -57,10 +57,16 @@ class TagsController < ApplicationController
redirect_to tags_url, notice: t('tags.destroy-success')
end
+ def search
+ @search = Search.new(name: 'temporary', body: "tag:\"#{@tag.name}\"")
+
+ render 'searches/show'
+ end
+
private
def set_tag
- @tag = Tag.find(params[:id])
+ @tag = Tag.find(params[:id] || params[:tag_id])
end
def tag_params
diff --git a/app/views/searches/show.html.erb b/app/views/searches/show.html.erb
index b7d3854..16e5996 100644
--- a/app/views/searches/show.html.erb
+++ b/app/views/searches/show.html.erb
@@ -1 +1 @@
-<%= render "search", items: @search.results %>
+<%= render "searches/search", items: @search.results %>
diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb
index 0a82898..9fe2669 100644
--- a/app/views/tags/_tag.html.erb
+++ b/app/views/tags/_tag.html.erb
@@ -1,9 +1,9 @@
<div class="tag-container" id="<%= dom_id tag %>">
<div class="name">
- <%= tag.name %>
+ <%= link_to tag.name, edit_tag_path(tag), title: I18n.t('general.edit').capitalize %>
</div>
<div class="action">
- <%= link_to I18n.t('general.edit'), edit_tag_path(tag) %> |
+ <%= link_to I18n.t('searches.object'), tag_search_path(tag) %> |
<%= link_to I18n.t('general.delete'), tag_path(tag), data: { "turbo-method": :delete } %>
</div>
</div>