File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 81
81
empty : '<div class="empty-message">Unable to find any Messages that match that Id</div>' ,
82
82
suggestion : Handlebars . compile ( jQuery ( "#entry-template" ) . html ( ) )
83
83
}
84
- } ) ;
85
- inReplyToFieldContainer . find ( ".input-group .typeahead" ) . bind ( 'typeahead:select' , function ( ev , suggestion ) {
84
+ } , function ( suggestion ) {
86
85
jQuery ( "#@mailType.slug-subject-prefix input" ) . changeVal ( suggestion . suggestsPrefix ) ;
87
86
} ) ;
88
87
} ) ;
Original file line number Diff line number Diff line change 1
1
( function ( jQ ) {
2
2
3
- jQ . fn . messageIdPicker = function ( options , datasets ) {
3
+ jQ . fn . messageIdPicker = function ( options , datasets , onSelect ) {
4
4
return this . each ( function ( index , elem ) {
5
5
var inputGroup = jQ ( elem ) . find ( ".input-group" ) ;
6
6
var messageIdent = jQ ( elem ) . find ( ".message-ident" ) ;
21
21
input . bind ( 'typeahead:render' , function ( ) {
22
22
inputGroup . find ( "time.timeago" ) . timeago ( ) ;
23
23
} ) ;
24
- input . bind ( 'typeahead:select' , function ( ev , suggestion ) {
24
+ var showIdent = function ( suggestion ) {
25
25
messageIdentContent . html ( suggestionTemplate ( suggestion ) ) ;
26
26
messageIdentContent . find ( "time.timeago" ) . timeago ( ) ;
27
27
inputGroup . hide ( ) ;
28
28
messageIdent . show ( ) ;
29
- } ) ;
29
+ onSelect ( suggestion ) ;
30
+ } ;
31
+ input . bind ( 'typeahead:select' , function ( ev , suggestion ) { showIdent ( suggestion ) } ) ;
32
+
33
+ var initialMessageId = input . val ( ) ;
34
+ if ( initialMessageId !== "" ) {
35
+ function showIdentIfSingleResult ( datums ) {
36
+ if ( datums . length == 1 ) { showIdent ( datums [ 0 ] ) ; }
37
+ }
38
+ datasets . source ( initialMessageId , showIdentIfSingleResult , showIdentIfSingleResult ) ;
39
+ }
30
40
31
41
input . typeahead ( options , datasets ) ;
32
42
} ) ;
You can’t perform that action at this time.
0 commit comments