Skip to content

Commit 0b43a5c

Browse files
author
root
committed
Fix TagIt loading for ProtectedBranches
1 parent cadf33c commit 0b43a5c

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed

Diff for: app/views/repository_protected_branches/_form.html.haml

+4-32
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,13 @@
99
%p
1010
%label{ for: "repository_protected_branche[user_list]" }= l(:label_user_list) + ' :'
1111

12-
%ul{ id: 'user_list' }
12+
= tag_it_list 'repository_protected_branche_user_list',
13+
{ name: 'repository_protected_branche[user_list][]' },
14+
{ source: 'user_list', placeholder: '+ add user' } do
1315
- if @protected_branch.user_list.any?
1416
- @protected_branch.user_list.each do |item|
1517
%li= item
1618

1719
:javascript
1820
var user_list = #{raw @protected_branch.available_users.to_json};
19-
20-
function loadTagIt(target){
21-
22-
$('#' + target).gtagit({
23-
autocomplete: {source: function(request, resolve) {
24-
// fetch new values with request.resolve
25-
resolve(user_list);
26-
}
27-
},
28-
afterTagAdded: function(event, ui) {
29-
var value = ui.tag.children('input:hidden').val();
30-
user_list = user_list.filter(function(v) { return v != value;});
31-
$(".ui-dialog-content").dialog("option", "position", ['center', 'center']).animate('slow');
32-
},
33-
afterTagRemoved: function(event, ui) {
34-
var value = ui.tag.children('input:hidden').val();
35-
user_list.push(value);
36-
$(".ui-dialog-content").dialog("option", "position", ['center', 'center']).animate('slow');
37-
},
38-
showAutocompleteOnFocus: true,
39-
placeholderText: '+ add user',
40-
allowDuplicates: false,
41-
caseSensitive: false,
42-
fieldName: 'repository_protected_branche[' + target + '][]',
43-
});
44-
45-
}
46-
47-
$(document).ready(function() {
48-
loadTagIt('user_list');
49-
});
21+
$(document).ready(function(){ setTagIt(); });

0 commit comments

Comments
 (0)