[PATCH 01 of 19] autocomplete: remove dead code
Thomas De Schampheleire
patrickdepinguin at gmail.com
Tue Jun 30 16:43:11 EDT 2015
# HG changeset patch
# User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
# Date 1435174346 -7200
# Wed Jun 24 21:32:26 2015 +0200
# Node ID 16fff695ace152d8f165b033980678a68e60822c
# Parent 03dd2a5776400d58670071530910f7526d13d259
autocomplete: remove dead code
The three blocks of autocomplete code are clearly copy/pasted from one
another, with dead code remaining due to group-autocomplete not being
relevant for some cases.
diff --git a/kallithea/public/js/base.js b/kallithea/public/js/base.js
--- a/kallithea/public/js/base.js
+++ b/kallithea/public/js/base.js
@@ -725,7 +725,7 @@ var injectInlineForm = function(tr){
// callbacks
tooltip_activate();
MentionsAutoComplete('text_'+lineno, 'mentions_container_'+lineno,
- _USERS_AC_DATA, _GROUPS_AC_DATA);
+ _USERS_AC_DATA);
$('#text_'+lineno).focus();
},10)
};
@@ -1283,9 +1283,8 @@ var _MembersAutoComplete = function (div
};
}
-var MentionsAutoComplete = function (divid, cont, users_list, groups_list) {
+var MentionsAutoComplete = function (divid, cont, users_list) {
var myUsers = users_list;
- var myGroups = groups_list;
// Define a custom search function for the DataSource of users
var matchUsers = function (sQuery) {
@@ -1312,11 +1311,6 @@ var MentionsAutoComplete = function (div
return matches
};
- //match all
- var matchAll = function (sQuery) {
- return matchUsers(sQuery);
- };
-
// DataScheme for owner
var ownerDS = new YAHOO.util.FunctionDataSource(matchUsers);
@@ -1509,10 +1503,9 @@ var removeReviewMember = function(review
$li.find('.reviewer_member_remove').replaceWith(' (remove not saved)');
}
-/* activate auto completion of users and groups ... but only used for users as PR reviewers */
-var PullRequestAutoComplete = function (divid, cont, users_list, groups_list) {
+/* activate auto completion of users as PR reviewers */
+var PullRequestAutoComplete = function (divid, cont, users_list) {
var myUsers = users_list;
- var myGroups = groups_list;
// Define a custom search function for the DataSource of users
var matchUsers = function (sQuery) {
@@ -1534,29 +1527,6 @@ var PullRequestAutoComplete = function (
return matches;
};
- // Define a custom search function for the DataSource of userGroups
- var matchGroups = function (sQuery) {
- // Case insensitive matching
- var query = sQuery.toLowerCase();
- var i = 0;
- var l = myGroups.length;
- var matches = [];
-
- // Match against each name of each contact
- for (; i < l; i++) {
- matched_group = myGroups[i];
- if (matched_group.grname.toLowerCase().indexOf(query) > -1) {
- matches[matches.length] = matched_group;
- }
- }
- return matches;
- };
-
- //match all
- var matchAll = function (sQuery) {
- return matchUsers(sQuery);
- };
-
// DataScheme for owner
var ownerDS = new YAHOO.util.FunctionDataSource(matchUsers);
diff --git a/kallithea/templates/pullrequests/pullrequest.html b/kallithea/templates/pullrequests/pullrequest.html
--- a/kallithea/templates/pullrequests/pullrequest.html
+++ b/kallithea/templates/pullrequests/pullrequest.html
@@ -130,7 +130,7 @@
<script type="text/javascript">
var _USERS_AC_DATA = ${c.users_array|n};
var _GROUPS_AC_DATA = ${c.user_groups_array|n};
- PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
+ PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA);
pyroutes.register('pullrequest_repo_info', "${url('pullrequest_repo_info',repo_name='%(repo_name)s')}", ['repo_name']);
diff --git a/kallithea/templates/pullrequests/pullrequest_show.html b/kallithea/templates/pullrequests/pullrequest_show.html
--- a/kallithea/templates/pullrequests/pullrequest_show.html
+++ b/kallithea/templates/pullrequests/pullrequest_show.html
@@ -369,7 +369,7 @@
<script type="text/javascript">
$(document).ready(function(){
- PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
+ PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA);
$('.add-bubble').click(function(e){
var tr = e.currentTarget;
More information about the kallithea-general
mailing list