projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Keine Mixins in Mixins: Helper nur in Controller per "use" hinzufügen: Probleme beim...
[kivitendo-erp.git]
/
js
/
autocomplete_project.js
diff --git
a/js/autocomplete_project.js
b/js/autocomplete_project.js
index
fb2285f
..
9e76119
100644
(file)
--- a/
js/autocomplete_project.js
+++ b/
js/autocomplete_project.js
@@
-1,4
+1,6
@@
namespace('kivi', function(k){
namespace('kivi', function(k){
+ "use strict";
+
k.ProjectPicker = function($real, options) {
// short circuit in case someone double inits us
if ($real.data("project_picker"))
k.ProjectPicker = function($real, options) {
// short circuit in case someone double inits us
if ($real.data("project_picker"))
@@
-12,6
+14,9
@@
namespace('kivi', function(k){
RIGHT: 39,
PAGE_UP: 33,
PAGE_DOWN: 34,
RIGHT: 39,
PAGE_UP: 33,
PAGE_DOWN: 34,
+ SHIFT: 16,
+ CTRL: 17,
+ ALT: 18,
};
var CLASSES = {
PICKED: 'projectpicker-picked',
};
var CLASSES = {
PICKED: 'projectpicker-picked',
@@
-56,10
+61,9
@@
namespace('kivi', function(k){
$real.val('');
$dummy.val('');
}
$real.val('');
$dummy.val('');
}
- state = STATES.PICKED;
- last_real = $real.val();
- last_dummy = $dummy.val();
- last_unverified_dummy = $dummy.val();
+ state = STATES.PICKED;
+ last_real = $real.val();
+ last_dummy = $dummy.val();
$real.trigger('change');
$real.trigger('set_item:ProjectPicker', item);
$real.trigger('change');
$real.trigger('set_item:ProjectPicker', item);
@@
-71,10
+75,9
@@
namespace('kivi', function(k){
if (state == STATES.PICKED) {
annotate_state();
return true
if (state == STATES.PICKED) {
annotate_state();
return true
- } else if (state == STATES.UNDEFINED && $dummy.val() == '')
+ } else if (state == STATES.UNDEFINED && $dummy.val() ==
=
'')
set_item({})
else {
set_item({})
else {
- last_unverified_dummy = $dummy.val();
set_item({ id: last_real, name: last_dummy })
}
annotate_state();
set_item({ id: last_real, name: last_dummy })
}
annotate_state();
@@
-83,10
+86,9
@@
namespace('kivi', function(k){
function annotate_state () {
if (state == STATES.PICKED)
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
function annotate_state () {
if (state == STATES.PICKED)
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
- else if (state == STATES.UNDEFINED && $dummy.val() == '')
+ else if (state == STATES.UNDEFINED && $dummy.val() ==
=
'')
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
else {
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
else {
- last_unverified_dummy = $dummy.val();
$dummy.addClass(STATES.UNDEFINED).removeClass(STATES.PICKED);
}
}
$dummy.addClass(STATES.UNDEFINED).removeClass(STATES.PICKED);
}
}
@@
-99,7
+101,7
@@
namespace('kivi', function(k){
}, ajax_data(function(){ var val = $('#project_picker_filter').val(); return val === undefined ? '' : val })),
success: function(data){ $('#project_picker_result').html(data) }
});
}, ajax_data(function(){ var val = $('#project_picker_filter').val(); return val === undefined ? '' : val })),
success: function(data){ $('#project_picker_result').html(data) }
});
- }
;
+ }
function result_timer (event) {
if (!$('no_paginate').prop('checked')) {
function result_timer (event) {
if (!$('no_paginate').prop('checked')) {
@@
-135,7
+137,7
@@
namespace('kivi', function(k){
annotate_state();
}
});
annotate_state();
}
});
- }
;
+ }
$dummy.autocomplete({
source: function(req, rsp) {
$dummy.autocomplete({
source: function(req, rsp) {
@@
-149,6
+151,10
@@
namespace('kivi', function(k){
select: function(event, ui) {
set_item(ui.item);
},
select: function(event, ui) {
set_item(ui.item);
},
+ search: function(event, ui) {
+ if ((event.which == KEY.SHIFT) || (event.which == KEY.CTRL) || (event.which == KEY.ALT))
+ event.preventDefault();
+ }
});
/* In case users are impatient and want to skip ahead:
* Capture <enter> key events and check if it's a unique hit.
});
/* In case users are impatient and want to skip ahead:
* Capture <enter> key events and check if it's a unique hit.
@@
-165,7
+171,7
@@
namespace('kivi', function(k){
$dummy.keydown(function(event){
if (event.which == KEY.ENTER || event.which == KEY.TAB) {
// if string is empty assume they want to delete
$dummy.keydown(function(event){
if (event.which == KEY.ENTER || event.which == KEY.TAB) {
// if string is empty assume they want to delete
- if ($dummy.val() == '') {
+ if ($dummy.val() ==
=
'') {
set_item({});
return true;
} else if (state == STATES.PICKED) {
set_item({});
return true;
} else if (state == STATES.PICKED) {
@@
-181,7
+187,7
@@
namespace('kivi', function(k){
});
return false;
}
});
return false;
}
- } else {
+ } else
if ((event.which != KEY.SHIFT) && (event.which != KEY.CTRL) && (event.which != KEY.ALT))
{
state = STATES.UNDEFINED;
}
});
state = STATES.UNDEFINED;
}
});