diff options
| -rw-r--r-- | .rubocop.yml | 7 | ||||
| -rw-r--r-- | app/controllers/exports_controller.rb | 1 | ||||
| -rw-r--r-- | app/controllers/searches_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/shared_searches_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/tags_controller.rb | 3 | ||||
| -rw-r--r-- | app/controllers/things_controller.rb | 2 | ||||
| -rw-r--r-- | app/helpers/layout_helper.rb | 14 | ||||
| -rw-r--r-- | app/views/layouts/application.html.erb | 2 | ||||
| -rw-r--r-- | config/locales/ca.yml | 1 | ||||
| -rw-r--r-- | config/locales/en.yml | 1 |
10 files changed, 34 insertions, 1 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index ace564d..cd25bfe 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -112,3 +112,10 @@ Naming/MethodParameterName: Minitest/MultipleAssertions: Max: 5 + +# +# Rails +# + +Rails/HelperInstanceVariable: + Enabled: false 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à"> diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 59d377c..5e02e46 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -114,6 +114,7 @@ ca: new-action: nova update: Reanomena l'etiqueta none: Encara no hi ha cap etiqueta. Pots crear-ne una fent click + searching-by: Cercant per l'etiqueta create-success: Etiqueta creada correctament update-success: S'ha canviat el nom de l'etiqueta correctament diff --git a/config/locales/en.yml b/config/locales/en.yml index e1c2de5..8f38690 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -114,6 +114,7 @@ en: update: Rename tag new-action: new none: You have not created any tags. You can do so by clicking + searching-by: Searching by tag create-success: Tag was successfully created update-success: Tag was successfully updated |
