K-Psul - Sélection des articles
Ajout de la sélection au clic (souris/tactile)
This commit is contained in:
parent
c79456e958
commit
0b618fa045
2 changed files with 30 additions and 4 deletions
|
@ -319,6 +319,11 @@ input[type=number]::-webkit-outer-spin-button {
|
|||
padding-left:20px;
|
||||
}
|
||||
|
||||
#articles_data .article:hover {
|
||||
background:rgba(200,16,46,0.3);
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
/* Second part - Left - bottom */
|
||||
|
||||
.kpsul_middle_left_bottom {
|
||||
|
|
|
@ -685,6 +685,12 @@ $(document).ready(function() {
|
|||
return false;
|
||||
}
|
||||
|
||||
// A utiliser après la sélection d'un article
|
||||
function goToArticleNb() {
|
||||
articleNb.val('1');
|
||||
articleNb.focus().select();
|
||||
}
|
||||
|
||||
articleSelect.on('keydown', function(e) {
|
||||
var text = articleSelect.val();
|
||||
// Comportement normal pour ces touches
|
||||
|
@ -699,13 +705,28 @@ $(document).ready(function() {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
if (updateMatchedArticles(text+e.key)) {
|
||||
articleNb.val('1');
|
||||
articleNb.focus().select();
|
||||
}
|
||||
if (updateMatchedArticles(text+e.key))
|
||||
goToArticleNb();
|
||||
return false;
|
||||
});
|
||||
|
||||
function getArticleId($article) {
|
||||
return $article.attr('id').split('-')[2];
|
||||
}
|
||||
|
||||
function getArticleName($article) {
|
||||
return $article.find('.name').text();
|
||||
}
|
||||
|
||||
// Sélection des articles à la souris/tactile
|
||||
articles_container.on('click', '.article', function() {
|
||||
console.log('1');
|
||||
articleId.val(getArticleId($(this)));
|
||||
articleSelect.val(getArticleName($(this)));
|
||||
displayMatchedArticles(articlesList);
|
||||
goToArticleNb();
|
||||
});
|
||||
|
||||
function is_nb_ok(nb) {
|
||||
return /^[0-9]+$/.test(nb) && nb > 0 && nb <= 24;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue