Tag cloud threshold is displayed on the screen

This commit is contained in:
echarp 2019-04-26 11:13:53 +02:00
parent 6c6b293099
commit 2048398aa7
6 changed files with 18 additions and 5 deletions

View File

@ -51,6 +51,10 @@ ul.ui-autocomplete li
margin: 0 margin: 0
background-color: #F0F8FF background-color: #F0F8FF
body.tags .event[class*='libre-en-fete-'] em.city:before body.tags
content: image-url(lef-small) .event[class*='libre-en-fete-'] em.city:before
margin-right: 0.5em content: image-url(lef-small)
margin-right: 0.5em
.info
float: right
margin-right: 10%

View File

@ -5,7 +5,8 @@ class TagsController < InheritedResources::Base
has_scope :tag, as: :id has_scope :tag, as: :id
def index def index
@tags = ActsAsTaggableOn::Tag.where('taggings_count > 3') @tags = ActsAsTaggableOn::Tag.where('taggings_count > ?',
Rails.configuration.cloud_threshold)
if params[:term] if params[:term]
# Used to autocomplete tags # Used to autocomplete tags
@tags = @tags.select(:id, :name, 'name AS label') @tags = @tags.select(:id, :name, 'name AS label')

View File

@ -2,5 +2,9 @@
%em.fa.fa-tags %em.fa.fa-tags
= title t '.title' = title t '.title'
- tag_cloud @tags, %w(css1 css2 css3 css4) do |tag, css_class| - tag_cloud @tags.order(:name), %w[css1 css2 css3 css4] do |tag, css_class|
= link_to tag.name, { action: :show, id: tag.name }, class: css_class = link_to tag.name, { action: :show, id: tag.name }, class: css_class
%p.info
%em.fa.fa-info-circle
= t '.threshold', threshold: Rails.configuration.cloud_threshold

View File

@ -50,5 +50,7 @@ module AgendaDuLibreRails
config.action_controller.per_form_csrf_tokens = false config.action_controller.per_form_csrf_tokens = false
config.active_record.sqlite3.represent_boolean_as_integer = true config.active_record.sqlite3.represent_boolean_as_integer = true
config.cloud_threshold = 3
end end
end end

View File

@ -151,6 +151,7 @@ it more readable or agreable."
tags: tags:
index: index:
title: Tags title: Tags
threshold: used more than %{threshold} times
show: show:
title: Tag title: Tag
links: See also links: See also

View File

@ -164,6 +164,7 @@ lévénement pour la rendre plus complète, plus lisible ou plus attrayante."
tags: tags:
index: index:
title: Mots-clés title: Mots-clés
threshold: utilisés plus de %{threshold} fois
show: show:
title: Mot-clé title: Mot-clé
links: Voir aussi links: Voir aussi