From 7c8ef1c5c58904bad74d0c7c846792322500d16f Mon Sep 17 00:00:00 2001 From: Lieuwe Rooijakkers Date: Sun, 26 Feb 2017 00:14:19 +0100 Subject: [PATCH] searchbar: remove dynamic placeholders --- .../app/components/searchBar/searchBar.coffee | 64 ------------------- .../app/components/searchBar/searchBar.html | 2 +- 2 files changed, 1 insertion(+), 65 deletions(-) diff --git a/client/app/components/searchBar/searchBar.coffee b/client/app/components/searchBar/searchBar.coffee index 1b35aa67..05dc44ac 100644 --- a/client/app/components/searchBar/searchBar.coffee +++ b/client/app/components/searchBar/searchBar.coffee @@ -1,62 +1,5 @@ CACHE_TIMEOUT = ms.minutes 10 -# improve placeholders - -placeholders = [ - 'Samenvattingen voor %class%' - 'Woordenlijsten voor %class%' - '%class% Projecten' - '%class% Powerpoint H%num%' - 'samenvatting %class% H%num%' - '%class% project H%num%' - '%name%' -] -fallbackClasses = [ - 'Nederlands' - 'Engels' - 'Wiskunde' - 'Lichamelijke opvoeding' -] -fallbackNames = [ - 'Piet' - 'Piet Jansen' - 'Maria' - 'Isaac' - 'Josephine' -] - -getClassName = -> - currentLesson = Helpers.embox ScheduleFunctions.currentLesson - c = ( - if currentLesson? - currentLesson.class() - else - _.sample classes().fetch() - ) - if c? - if _.random(1) then c.name else c.abbreviations[0] - else - _.sample fallbackClasses - -getName = -> - user = _.sample Meteor.users.find({ - _id: $ne: Meteor.userId() - 'profile.firstName': $ne: '' - }, { - fields: - _id: 1 - 'profile.firstName': 1 - 'profile.lastName': 1 - transform: null - }).fetch() - - if user? - s = user.profile.firstName - s += " #{user.profile.lastName}" if _.random 1 - s - else - _.sample fallbackNames - cache = {} _fetch = _.throttle ((query, callback) -> Meteor.apply 'search', [ query ], @@ -104,13 +47,6 @@ route = (query, d) -> Meteor.call 'search.analytics.store', query, d._id -Template.searchBar.helpers - placeholder: -> - _.sample(placeholders) - .replace '%class%', getClassName - .replace '%num%', _.random 1, 15 - .replace '%name%', getName - Template.searchBar.events 'keyup input': (event) -> query = event.target.value diff --git a/client/app/components/searchBar/searchBar.html b/client/app/components/searchBar/searchBar.html index 0aaa0435..2c359d3f 100644 --- a/client/app/components/searchBar/searchBar.html +++ b/client/app/components/searchBar/searchBar.html @@ -2,7 +2,7 @@