Skip to content

Commit

Permalink
feat: support auto-complete color and tooltip for manually added items
Browse files Browse the repository at this point in the history
  • Loading branch information
amirch1 committed Jul 17, 2017
1 parent a0bd1b1 commit 31ebf26
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
suggestionLabelField="name"
field="screenName"
[multiple]="true"
[onItemAdding]="_convertUserInputToValidValue"
[onItemAdding]="_convertUserInputToValidValue.bind(this)"
[limitToSuggestions]="false"
[minLength]="3"
suggestionSelectableField="isSelectable"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, Input, Output, EventEmitter, ViewChild, AfterViewInit,OnInit, OnDestroy } from '@angular/core';
import { Component, ViewChild, AfterViewInit,OnInit, OnDestroy } from '@angular/core';
import { AppLocalization } from '@kaltura-ng/kaltura-common';
import { ISubscription } from 'rxjs/Subscription';
import { Subject } from 'rxjs/Subject';
import { KalturaUser } from 'kaltura-typescript-client/types/KalturaUser';
Expand All @@ -20,7 +21,7 @@ export class EntryUsers implements AfterViewInit, OnInit, OnDestroy {
public _usersProvider = new Subject<SuggestionsProviderData>();
public _handler : EntryUsersHandler;

constructor(private _entryFormManager : EntryFormManager) {
constructor(private _entryFormManager : EntryFormManager, private _appLocalization: AppLocalization) {
}


Expand All @@ -46,16 +47,18 @@ export class EntryUsers implements AfterViewInit, OnInit, OnDestroy {
this.ownerPopup.close();
}

public _convertUserInputToValidValue(value : string) : KalturaUser {
public _convertUserInputToValidValue(value : string) : any {
let result = null;

let tt = this._appLocalization.get('applications.content.entryDetails.users.tooltip', {0: value});
if (value) {
result = new KalturaUser(
result =
{
id : value,
screenName: value
}
);
screenName: value,
userAdded: true,
tooltip: tt
};

}

return result;
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@
"changeOwnerPH": "Enter user name or id",
"save": "Save",
"co-editors": "Co-Editors",
"co-publishers": "Co-Publishers"
"co-publishers": "Co-Publishers",
"tooltip": "User is not yet listed in Kaltura. {{0}} will be considered as user's identifier"
},
"errors": {
"reload": "Reload",
Expand Down

0 comments on commit 31ebf26

Please sign in to comment.