From 89446ce4f60792617a4066a56112d332247924f6 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Tue, 8 Mar 2016 22:55:43 +0100 Subject: [PATCH] Use angular-chosen instead of ui-select for better performance. The jQuery select field from angular-chosen is used for all ui-select fields. See https://github.com/leocaseiro/angular-chosen/ Use input delay on users filter field with 'debounce'. Fixed #2006. --- bower.json | 2 +- gulpfile.js | 8 ++- openslides/agenda/static/js/agenda/site.js | 6 +-- .../static/templates/agenda/item-detail.html | 22 +++----- .../assignments/static/js/assignments/site.js | 6 +-- .../assignments/assignment-detail.html | 24 ++++----- openslides/core/static/css/app.css | 4 ++ openslides/core/static/js/core/site.js | 27 +++------- .../templates/core/select-multiple.html | 10 ++++ .../static/templates/core/select-single.html | 12 +++++ .../templates/core/ui-select-multiple.html | 10 ---- .../templates/core/ui-select-single.html | 10 ---- .../mediafiles/static/js/mediafiles/site.js | 8 +-- .../templates/mediafiles/mediafile-form.html | 20 +++---- openslides/motions/static/js/motions/site.js | 44 +++++---------- .../static/templates/motions/motion-list.html | 54 +++++++++---------- openslides/users/static/js/users/site.js | 10 ++-- .../static/templates/users/user-list.html | 2 +- 18 files changed, 116 insertions(+), 163 deletions(-) create mode 100644 openslides/core/static/templates/core/select-multiple.html create mode 100644 openslides/core/static/templates/core/select-single.html delete mode 100644 openslides/core/static/templates/core/ui-select-multiple.html delete mode 100644 openslides/core/static/templates/core/ui-select-single.html diff --git a/bower.json b/bower.json index 755c18e00..a06f11ba8 100644 --- a/bower.json +++ b/bower.json @@ -12,12 +12,12 @@ "angular-sanitize": "~1.4.9", "angular-bootstrap": "~0.14.3", "angular-bootstrap-colorpicker": "~3.0.24", + "angular-chosen-localytics": "~1.3.0", "angular-csv-import": "~0.0.27", "angular-formly-templates-bootstrap": "~6.2.0", "angular-formly": "~7.3.9", "angular-loading-bar": "~0.8.0", "angular-ui-router": "~0.2.17", - "angular-ui-select": "~0.13.1", "angular-ui-tree": "~2.5.0", "angular-gettext": "~2.2.0", "angular-scroll-glue": "~2.0.6", diff --git a/gulpfile.js b/gulpfile.js index eadcd54a6..dedb3d634 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -68,6 +68,12 @@ gulp.task('fonts-libs', function() { .pipe(gulp.dest(path.join(output_directory, 'fonts'))); }); +// Catches image files for angular-chosen. +gulp.task('angular-chosen-img', function () { + return gulp.src(path.join('bower_components', 'chosen', '*.png')) + .pipe(gulp.dest(path.join(output_directory, 'css'))); +}); + // Catches all skins files for TinyMCE editor. gulp.task('tinymce-skins', function () { return gulp.src(path.join('bower_components', 'tinymce-dist', 'skins', '**')) @@ -108,7 +114,7 @@ gulp.task('translations', function () { }); // Gulp default task. Runs all other tasks before. -gulp.task('default', ['js-libs', 'css-libs', 'fonts-libs', 'tinymce', 'translations'], function () {}); +gulp.task('default', ['js-libs', 'css-libs', 'fonts-libs', 'tinymce', 'angular-chosen-img', 'translations'], function () {}); /** diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 21532c481..ccd0cf285 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -226,18 +226,14 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda']) 'operator', 'Agenda', 'User', - 'LimitUsers', 'item', - function ($scope, $filter, $http, $state, operator, Agenda, User, LimitUsers, item) { + function ($scope, $filter, $http, $state, operator, Agenda, User, item) { Agenda.bindOne(item.id, $scope, 'item'); User.bindAll({}, $scope, 'users'); $scope.speakerSelectBox = {}; $scope.alert = {}; $scope.speakers = $filter('orderBy')(item.speakers, 'weight'); - // limit the number of users in ui-select field - $scope.LimitUsers = LimitUsers; - $scope.$watch(function () { return Agenda.lastModified(); }, function () { diff --git a/openslides/agenda/static/templates/agenda/item-detail.html b/openslides/agenda/static/templates/agenda/item-detail.html index 0d81a4ee4..babbcc672 100644 --- a/openslides/agenda/static/templates/agenda/item-detail.html +++ b/openslides/agenda/static/templates/agenda/item-detail.html @@ -130,20 +130,14 @@ {{ alert.msg }} -
- - - {{ $select.selected.get_full_name() }} - - -
-
-
- - - - - +
+

- - - {{ $item.get_full_name() }} - - -
-
-
+
- - - {{ $item.name }} - - - {{ tag.name }} - - +
- - - - {{ $item.get_full_name() }} - - -
-
-
+ +
diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 528af52cf..3eea33247 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -300,16 +300,12 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users']) }, { key: 'groups', - type: 'ui-select-multiple', + type: 'select-multiple', templateOptions: { label: gettextCatalog.getString('Groups'), - optionsAttr: 'bs-options', options: Group.getAll(), - ngOptions: 'option[to.valueProp] as option in to.options | ' + - 'filter: {id: "!1"} | filter: {id: "!2"} | ' + - 'filter: $select.search', - valueProp: 'id', - labelProp: 'name', + ngOptions: 'option.id as option.name for option in to.options | ' + + 'filter: {id: "!1"} | filter: {id: "!2"}', placeholder: gettextCatalog.getString('Select or search a group ...') } }, diff --git a/openslides/users/static/templates/users/user-list.html b/openslides/users/static/templates/users/user-list.html index 0753c4767..d19728097 100644 --- a/openslides/users/static/templates/users/user-list.html +++ b/openslides/users/static/templates/users/user-list.html @@ -52,7 +52,7 @@
-