FIX: Text content search warning if more than 50 results

FIX: Text content search warning if more than 50 results

diff --git a/app/assets/javascripts/admin/templates/site-text-index.hbs b/app/assets/javascripts/admin/templates/site-text-index.hbs
index 78f2c17..e75b4a1 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}}
+    <p class="warning">{{i18n 'admin.site_text.more_than_50_results'}}</p>
+  {{/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 48ead3d..378b7b3 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 b00aae3..1cd37e3 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 acb5ea7..5e23831 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"

GitHub sha: dc4541a9

 .warning { color: #e45735;  }

woops, we can not hardcode colors like this @awesomerobot can you sort it out?

3 Likes

This was fixed in 95dc52e15ea0a211c2ab797145d510b52fcb06e9

1 Like