File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 409
409
tagIds = $ ( this ) . data ( 'tagids' ) . toString ( ) . split ( ',' ) ;
410
410
tagNames = $ ( this ) . data ( 'tagnames' ) . toString ( ) . split ( ',' ) ;
411
411
}
412
+
412
413
$ ( this ) . select2 ( {
413
414
tags : true ,
414
415
width : '200px' ,
415
416
placeholder : "Select tags..." ,
416
417
allowClear : true ,
418
+
417
419
ajax : {
418
- url : OC . generateUrl ( '/apps/timetracker/ajax/tags' ) + '?workItem=' + $ ( this ) . data ( 'myid' ) ,
420
+ url : function ( params ) { return OC . generateUrl ( '/apps/timetracker/ajax/tags' ) + '?workItem=' + $ ( this ) . data ( 'myid' ) + '&q=' + params ; } ,
419
421
formatNoMatches : function ( ) {
420
422
return '' ;
421
423
} ,
Original file line number Diff line number Diff line change @@ -770,6 +770,7 @@ public function deleteTag($id) {
770
770
public function getTags (){
771
771
$ workItem = $ this ->request ->workItem ;
772
772
$ project = null ;
773
+ $ q = $ this ->request ->q ;
773
774
if ($ workItem != null ){
774
775
$ wi = $ this ->workIntervalMapper ->find ($ workItem );
775
776
if ($ wi ->projectId != null ){
@@ -782,6 +783,15 @@ public function getTags(){
782
783
} else {
783
784
$ tags = $ this ->tagMapper ->findAll ($ this ->userId );
784
785
}
786
+ if ($ q != null ){
787
+ $ filteredTags = [];
788
+ foreach ($ tags as $ t ){
789
+ if (stripos ($ t ->name , $ q ) !== FALSE ){
790
+ $ filteredTags [] = $ t ;
791
+ }
792
+ }
793
+ $ tags = $ filteredTags ;
794
+ }
785
795
return new JSONResponse (["Tags " => json_decode (json_encode ($ tags ), true )]);
786
796
}
787
797
You can’t perform that action at this time.
0 commit comments