aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/exports_controller.rb1
-rw-r--r--app/controllers/searches_controller.rb2
-rw-r--r--app/controllers/shared_searches_controller.rb2
-rw-r--r--app/controllers/tags_controller.rb3
-rw-r--r--app/controllers/things_controller.rb2
-rw-r--r--app/helpers/layout_helper.rb14
-rw-r--r--app/views/layouts/application.html.erb2
7 files changed, 25 insertions, 1 deletions
diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb
index 812cf39..4b809c9 100644
--- a/app/controllers/exports_controller.rb
+++ b/app/controllers/exports_controller.rb
@@ -36,6 +36,7 @@ class ExportsController < ApplicationController
else
Search.find(params[:search_id])
end
+ @subtitle = @search.name
end
def set_results
diff --git a/app/controllers/searches_controller.rb b/app/controllers/searches_controller.rb
index 376455c..a01fd59 100644
--- a/app/controllers/searches_controller.rb
+++ b/app/controllers/searches_controller.rb
@@ -14,6 +14,7 @@ class SearchesController < ApplicationController
def new
@search = Search.new
+ @subtitle = I18n.t('searches.title')
end
def edit; end
@@ -52,6 +53,7 @@ class SearchesController < ApplicationController
def set_search
@search = Search.find(params[:id])
+ @subtitle = @search.name
end
def search_params
diff --git a/app/controllers/shared_searches_controller.rb b/app/controllers/shared_searches_controller.rb
index ca65539..ffdd56e 100644
--- a/app/controllers/shared_searches_controller.rb
+++ b/app/controllers/shared_searches_controller.rb
@@ -6,10 +6,12 @@ class SharedSearchesController < ApplicationController
def index
@searches = Search.order(:name)
@saved_searches = @searches.where(shared: true)
+ @subtitle = I18n.t('searches.shared.title')
end
def show
@search = Search.where(shared: true).find(params[:search_id])
+ @subtitle = @search.name
@results = @search.results.values.flatten
end
end
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index c5ca6a8..c56b9f9 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -5,10 +5,12 @@ class TagsController < ApplicationController
def index
@tags = Tag.order(:name)
+ @subtitle = I18n.t('tags.title')
end
def new
@tag = Tag.new
+ @subtitle = I18n.t('tags.title')
end
def edit; end
@@ -59,6 +61,7 @@ class TagsController < ApplicationController
def search
@search = Search.new(name: 'temporary', body: "tag:\"#{@tag.name}\"")
+ @subtitle = "#{I18n.t('tags.searching-by')} '#{@tag.name}'"
render 'searches/show'
end
diff --git a/app/controllers/things_controller.rb b/app/controllers/things_controller.rb
index e994a3d..f9e7674 100644
--- a/app/controllers/things_controller.rb
+++ b/app/controllers/things_controller.rb
@@ -9,6 +9,7 @@ class ThingsController < ApplicationController
def new
@thing = Thing.new
+ @subtitle = I18n.t('activerecord.models.thing')
end
def edit; end
@@ -59,6 +60,7 @@ class ThingsController < ApplicationController
def set_thing
@thing = Thing.find(params[:id])
+ @subtitle = @thing.title
end
def thing_params
diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb
new file mode 100644
index 0000000..03917d5
--- /dev/null
+++ b/app/helpers/layout_helper.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module LayoutHelper
+ # Returns a strign containing the string to be used for the <title> HTML tag.
+ def page_title
+ title = ENV.fetch('OPERUM_BASE_TITLE', 'Operum')
+
+ if @subtitle
+ "#{@subtitle} - #{title}"
+ else
+ title
+ end
+ end
+end
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 422270d..8a46e3f 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="<%= I18n.default_locale %>">
<head>
- <title><%= ENV.fetch('OPERUM_BASE_TITLE', 'Operum') %></title>
+ <title><%= page_title %></title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="author" content="Miquel Sabaté Solà">