#3838 Pull Request assignee
Merged 5 years ago by pingou. Opened 5 years ago by ryanlerch.
ryanlerch/pagure user-selectize  into  master

file modified
+18
@@ -349,3 +349,21 @@ 

  .line-height-1{

    line-height: 1em;

  }

+ 

+ 

+ .selectize-control:before{

+ 	-webkit-animation: fa-spin 2s infinite linear;

+   animation: fa-spin 2s infinite linear;

+ 	content: '\f1ce';

+   font-family: FontAwesome;

+ 	z-index: 2;

+ 	position: absolute;

+ 	display: block;

+ 	right: 34px;

+   top: 7px;

+ 	opacity: 0;

+ }

+ 

+ .selectize-control.loading:before{

+   opacity:0.4;

+ }

file modified
+19 -11
@@ -675,6 +675,25 @@ 

      doUpload("{{ form.csrf_token.current_token }}", this.files);

    });

  

+   $('.mainform #assignee').selectize({

+     valueField: 'user',

+     labelField: 'user',

+     searchField: 'user',

+     maxItems: 1,

+     create: false,

+     load: function(query, callback) {

+       if (!query.length) return callback();

+       $.getJSON(

+         "{{ url_for('api_ns.api_users') }}", {

+           pattern: "*"+query+"*"

+         },

+         function( data ) {

+           callback( data.users.map(function(x) { return { user: x }; }) );

+         }

+       );

+     }

+   });

+ 

    $.get("{{ url_for('api_ns.api_users') }}", {

      pattern: '*'

    }).done(function(resp) {
@@ -687,17 +706,6 @@ 

      }

      $("#comment").atwho(userConfig);

  

-     $('.mainform #assignee').selectize({

-       valueField: 'user',

-       labelField: 'user',

-       searchField: 'user',

-       maxItems: 1,

-       create: false,

-       load: function(query, callback) {

-         callback( resp.users.map(function(x) { return { user: x }; }) );

-       }

-     });

- 

    });

     $.when($.get("{{ url_for('api_ns.api_view_issues',

                              repo=repo.name,

@@ -1015,7 +1015,7 @@ 

      if (!query.length) return callback();

      $.getJSON(

        "{{ url_for('api_ns.api_users') }}", {

-         pattern: query.term

+         pattern: "*"+query+"*"

        },

        function( data ) {

          callback( data.users.map(function(x) { return { user: x }; }) );

Make the selectize async call for the assignee actaully work properly. Previously it was just pulling down all the users all the time.

Also, add a loading spinner to selectize elements when loading aync data.

This will need to be tested in staging pretty well. Its hard to test laggyness on a local setup with only a handful of users.

rebased onto 0992b20adec601ff0ded34fce17983206e085bad

5 years ago

rebased onto 0992b20adec601ff0ded34fce17983206e085bad

5 years ago

Awesome!

We should fix this in the issue page as well, I can take care of this

1 new commit added

  • Load user async when looking up assignee on issue
5 years ago

rebased onto f4d4a53

5 years ago

Pull-Request has been merged by pingou

5 years ago