From a8e6b6bcded056f53bcc4b291cd20c9bd9cc59ac Mon Sep 17 00:00:00 2001 From: pero1203 Date: Wed, 31 Aug 2022 12:13:52 +0200 Subject: [PATCH] Dodaj kategorijo - klik ne odpre celega vprasanja ampak samo doda polje in ga fokusira --- admin/survey/Branching.php | 2 +- admin/survey/script/vprasanje.js | 12 ++++++++++-- admin/survey/script/vprasanjeInline.js | 8 ++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/admin/survey/Branching.php b/admin/survey/Branching.php index a6a5da0f4..78466fdc9 100644 --- a/admin/survey/Branching.php +++ b/admin/survey/Branching.php @@ -5796,7 +5796,7 @@ class Branching { // Add variable - hover if ( in_array($row['tip'], array(1,2,6,16,19,20)) ) { if ($row['enota'] != 10 && $row['orientation'] != 10){ - echo '
'.$lang['srv_novavrednost'].'
'; + echo '
'.$lang['srv_novavrednost'].'
'; MobileSurveyAdmin::displayAddQuestionCategory($this->anketa, $spremenljivka, $row['tip']); } diff --git a/admin/survey/script/vprasanje.js b/admin/survey/script/vprasanje.js index e01d6b526..bcf2e9777 100644 --- a/admin/survey/script/vprasanje.js +++ b/admin/survey/script/vprasanje.js @@ -11,7 +11,7 @@ function onload_init_vprasanje() { }); } // prikaze fullscreen urejanje vprasanja -function vprasanje_fullscreen (spremenljivka, cache, chart_edit, no_close) { +function vprasanje_fullscreen (spremenljivka, cache, chart_edit, no_close, focus_last) { if (locked) return; //za ureditev custom opisnih label pri drsniku @@ -55,7 +55,7 @@ function vprasanje_fullscreen (spremenljivka, cache, chart_edit, no_close) { // odpremo okno za dodajanje nove kategorije var last = $('#branching_'+spremenljivka+' .variabla:last-child div.vrednost_inline'); - inline_nova_vrednost(last); + inline_nova_vrednost(last, focus_last); //Preklop na tab za urejanje label grafov if(chart_edit == 1){ vprasanje_tab(spremenljivka, 4); } @@ -1673,3 +1673,11 @@ function fieldsetToggle(element){ } +// Gumb dodaj kategorijo - doda okno za novo kategorijo in ga fokusira +function add_question_category(spremenljivka){ + + var last = $('#branching_'+spremenljivka+' .variabla:last-child div.vrednost_inline'); + + inline_nova_vrednost(last, true); +} + diff --git a/admin/survey/script/vprasanjeInline.js b/admin/survey/script/vprasanjeInline.js index e003274ec..93e6984ed 100644 --- a/admin/survey/script/vprasanjeInline.js +++ b/admin/survey/script/vprasanjeInline.js @@ -640,7 +640,7 @@ function inline_vrednost_delete(spremenljivka, vrednost, confirmed/*, tip, other } // narise polje za dodajanje vrednosti -function inline_nova_vrednost (_this) { +function inline_nova_vrednost (_this, focus) { // ce je anketa zaklenjena if ($(_this).attr('contenteditable') != 'true') return; @@ -874,8 +874,12 @@ function inline_nova_vrednost (_this) { } $(_this).closest('.variabla').parent().append(new_div); + + // Po potrebi izvedemo focus na novi variabli + if(focus === true) + $('#branching_'+spremenljivka).find('#vre_id_new').focus(); } - } + } } // skrije (odstrani) polje za dodajanje vrednosti