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 409409 tagIds = $ ( this ) . data ( 'tagids' ) . toString ( ) . split ( ',' ) ;
410410 tagNames = $ ( this ) . data ( 'tagnames' ) . toString ( ) . split ( ',' ) ;
411411 }
412+
412413 $ ( this ) . select2 ( {
413414 tags : true ,
414415 width : '200px' ,
415416 placeholder : "Select tags..." ,
416417 allowClear : true ,
418+
417419 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 ; } ,
419421 formatNoMatches : function ( ) {
420422 return '' ;
421423 } ,
Original file line number Diff line number Diff line change @@ -770,6 +770,7 @@ public function deleteTag($id) {
770770 public function getTags (){
771771 $ workItem = $ this ->request ->workItem ;
772772 $ project = null ;
773+ $ q = $ this ->request ->q ;
773774 if ($ workItem != null ){
774775 $ wi = $ this ->workIntervalMapper ->find ($ workItem );
775776 if ($ wi ->projectId != null ){
@@ -782,6 +783,15 @@ public function getTags(){
782783 } else {
783784 $ tags = $ this ->tagMapper ->findAll ($ this ->userId );
784785 }
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+ }
785795 return new JSONResponse (["Tags " => json_decode (json_encode ($ tags ), true )]);
786796 }
787797
You can’t perform that action at this time.
0 commit comments