};
drawQuickSearchAutocomplete=function(selector){
-
- $( selector ? selector : "#quick-search-autocomplete" ).typeahead(
+ var box = $( selector ? selector : "#quick-search-autocomplete" );
+ box.typeahead(
{
name: 'quick-search-result',
remote: 'restServices/archivaServices/searchService/quickSearch?queryString=%QUERY',
valueKey: 'artifactId',
+ maxParallelRequests:1,
limit: 50
}
);
- $( selector ? selector : "#quick-search-autocomplete" ).bind('typeahead:selected', function(obj, datum, name) {
+ box.bind('typeahead:selected', function(obj, datum, name) {
window.sammyArchivaApplication.setLocation("#quicksearch~" + datum.artifactId);
});
};
* specific language governing permissions and limitations
* under the License.
*/
-define("redback.users",["jquery","utils","i18n","jquery.validate","knockout","knockout.simpleGrid"],
-function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid) {
+define("redback.users",["jquery","utils","i18n","jquery.validate","knockout","knockout.simpleGrid","typeahead"],
+function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,typeahead) {
/**
* view model used for users grid
filter: true
}
],
- pageSize: 10
+ pageSize: 10,
+ gridUpdateCallBack: function(){
+ $.log("gridUpdateCallBack users result");
+ applyAutocompleteOnHeaders(self);
+ }
});
clearFilters=function(){
self.users(self.originalUsers());
- applyAutocompleteOnHeaders(self);
+
};
filterLocked=function(){
var founds=[];
}
});
self.users(founds);
- applyAutocompleteOnHeaders(self);
}
filterNonLocked=function(){
var founds=[];
}
});
self.users(founds);
- applyAutocompleteOnHeaders(self);
}
filterPasswordChangeRequired=function(){
}
});
self.users(founds);
- applyAutocompleteOnHeaders(self);
}
filterPasswordChangeNotRequired=function(){
var founds=[];
}
});
self.users(founds);
- applyAutocompleteOnHeaders(self);
}
}
applyAutocompleteOnHeader=function(property,usersViewModel){
+
$("#main-content").find("#users-grid-filter-auto-"+property ).autocomplete({
minLength: 0,
source: function(request, response){
return false;
}
});
+
+ /*
+ olamy: doesn't work????
+ var values=[];
+ $(usersViewModel.users()).each(function(idx,user){
+ var value=user[property];
+ if(value!=null && $.inArray(value, values)<0){
+ values.push(value);
+ }
+ });
+ var jid = "#users-grid-filter-auto-"+property;
+ $.log("applyAutocompleteOnHeader:"+values.length+" for " + jid);
+
+ var box = $("#main-content").find(jid);
+
+ box.typeahead( { local: values } );
+ box.bind('typeahead:selected', function(obj, datum, name) {
+ var users=[];
+ $(usersViewModel.users()).each(function(idx,user){
+ if(user[property] && user[property]() && user[property]().indexOf(datum.value)>=0){
+ users.push(user);
+ }
+ });
+ usersViewModel.users(users);
+ });*/
}
/**
}
})
mainContent.find("#users-view-tabs-content #users-view").addClass("active");
- applyAutocompleteOnHeaders(usersViewModel);
mainContent.find("#usersTable").find('.dropdown-toggle').dropdown();
}
}