mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-19 02:15:36 +00:00
(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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user