From dc4541a95cec3c951c83245d1eb0675833970fc2 Mon Sep 17 00:00:00 2001 From: venarius Date: Fri, 8 Mar 2019 22:13:10 +0100 Subject: [PATCH] FIX: Text content search warning if more than 50 results --- app/assets/javascripts/admin/templates/site-text-index.hbs | 4 ++++ app/assets/stylesheets/common/admin/admin_base.scss | 3 +++ app/controllers/admin/site_texts_controller.rb | 3 ++- config/locales/client.en.yml | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/admin/templates/site-text-index.hbs b/app/assets/javascripts/admin/templates/site-text-index.hbs index 78f2c1735e7..e75b4a1af91 100644 --- a/app/assets/javascripts/admin/templates/site-text-index.hbs +++ b/app/assets/javascripts/admin/templates/site-text-index.hbs @@ -23,4 +23,8 @@ {{#each siteTexts as |siteText|}} {{site-text-summary siteText=siteText editAction=(action "edit") term=q searchRegex=siteTexts.extras.regex}} {{/each}} + + {{#if siteTexts.extras.has_more}} +

{{i18n 'admin.site_text.more_than_50_results'}}

+ {{/if}} {{/conditional-loading-spinner}} diff --git a/app/assets/stylesheets/common/admin/admin_base.scss b/app/assets/stylesheets/common/admin/admin_base.scss index 48ead3d93c4..378b7b3681b 100644 --- a/app/assets/stylesheets/common/admin/admin_base.scss +++ b/app/assets/stylesheets/common/admin/admin_base.scss @@ -260,6 +260,9 @@ $mobile-breakpoint: 700px; margin-top: 1em; } } + .warning { + color: #e45735; + } } .content-list { diff --git a/app/controllers/admin/site_texts_controller.rb b/app/controllers/admin/site_texts_controller.rb index b00aae3ad47..1cd37e31715 100644 --- a/app/controllers/admin/site_texts_controller.rb +++ b/app/controllers/admin/site_texts_controller.rb @@ -43,7 +43,8 @@ class Admin::SiteTextsController < Admin::AdminController end end - render_serialized(results[0..50], SiteTextSerializer, root: 'site_texts', rest_serializer: true, extras: extras) + extras[:has_more] = true if results.size > 50 + render_serialized(results[0..49], SiteTextSerializer, root: 'site_texts', rest_serializer: true, extras: extras) end def show diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index acb5ea74f16..5e23831ce51 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -4034,6 +4034,7 @@ en: go_back: "Back to Search" recommended: "We recommend customizing the following text to suit your needs:" show_overriden: "Only show overridden" + more_than_50_results: "There are more than 50 results. Please refine your search." settings: # used by theme and site settings show_overriden: "Only show overridden"