(js) Improve sg-search directive

Will now respect the "listRequiresDot" source parameter and uses
ng-messages to show an error if the minimum number of characters is not
reached.

Fixes #438, #3464
This commit is contained in:
Francis Lachapelle committed 2016-02-24 21:41:03 -05:00
1 parent 4b816677b0
commit 70fbeab27a
12 files changed
+75 -31

No files matched your search

+17
View File
@@ -22,6 +22,7 @@
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSUserDefaults.h> /* for locale strings */
#import <Foundation/NSValue.h>
#import <NGObjWeb/SoObjects.h>
#import <NGObjWeb/WOResponse.h>
@@ -509,6 +510,22 @@ static SoProduct *commonProduct = nil;
return [[context activeUser] login];
}
/* Common defaults and settings */
- (int) minimumSearchLength
{
return [[[context activeUser] domainDefaults] searchMinimumWordLength];
}
- (NSString *) minimumSearchLengthLabel
{
NSDictionary *defaults;
defaults = [NSDictionary dictionaryWithObject: [NSNumber numberWithInt: [self minimumSearchLength]]
forKey: @"minimumSearchLength"];
return [defaults keysWithFormat: [self commonLabelForKey: @"Enter at least %{minimumSearchLength} characters"]];
}
/* labels */
- (NSString *) labelForKey: (NSString *) _str