From 6252ee603bb24dd518cb08e5b5f3b7bbd0004692 Mon Sep 17 00:00:00 2001 From: pero1203 Date: Thu, 3 Jun 2021 14:07:45 +0200 Subject: [PATCH] Dodana moznost dodajanja kategorije na mobile admin --- admin/survey/Branching.php | 2 ++ .../mobile/class.MobileSurveyAdmin.php | 9 ++++++ admin/survey/script/vprasanje.js | 28 +++++++++++-------- public/css/admin.css | 18 ++++++++++++ .../branching/questions/question_box.scss | 3 ++ .../sass/admin/mobile/pages/branching.scss | 14 ++++++++++ 6 files changed, 62 insertions(+), 12 deletions(-) diff --git a/admin/survey/Branching.php b/admin/survey/Branching.php index 18b7a0302..c59765674 100644 --- a/admin/survey/Branching.php +++ b/admin/survey/Branching.php @@ -1630,6 +1630,8 @@ class Branching { if ( in_array($row['tip'], array(1,2,6,16,19,20)) ) { if ($row['enota'] != 10 && $row['orientation'] != 10){ echo '
'.$lang['srv_novavrednost'].'
'; + + MobileSurveyAdmin::displayAddQuestionCategory($this->anketa, $spremenljivka, $row['tip']); } } diff --git a/admin/survey/classes/mobile/class.MobileSurveyAdmin.php b/admin/survey/classes/mobile/class.MobileSurveyAdmin.php index d68334427..358c02024 100644 --- a/admin/survey/classes/mobile/class.MobileSurveyAdmin.php +++ b/admin/survey/classes/mobile/class.MobileSurveyAdmin.php @@ -734,4 +734,13 @@ class MobileSurveyAdmin{ echo ' '; echo ''; } + + // Div za dodajanje kategorije v vprasanje + public static function displayAddQuestionCategory($ank_id, $spr_id, $tip){ + global $lang; + + echo '
'; + echo ' '.$lang['srv_novavrednost'].''; + echo '
'; + } } diff --git a/admin/survey/script/vprasanje.js b/admin/survey/script/vprasanje.js index 69b44c93d..414e49cc8 100644 --- a/admin/survey/script/vprasanje.js +++ b/admin/survey/script/vprasanje.js @@ -154,7 +154,7 @@ function vprasanje_tab (spremenljivka, tab) { } // shrani nastavitve vprasanja -function vprasanje_save (silentsave, spr) { +function vprasanje_save (silentsave, spr, callback) { var spremenljivka = $('input[name=spremenljivka]').val() || spr; // spr se prenese, ce je urejanje na desni zaprto @@ -213,6 +213,9 @@ function vprasanje_save (silentsave, spr) { inline_nova_vrednost(last); } + if (typeof callback == 'function') { + callback(); + } }); } @@ -270,6 +273,17 @@ function vrednost_new (spremenljivka, other, tip, mv) { } +// doda novo vrednost na mobitelu +function vrednost_new_mobile (spremenljivka, tip) { + + $.post('ajax.php?t=vprasanje&a=vrednost_new', {spremenljivka: spremenljivka, other: 0, anketa: srv_meta_anketa_id, mv:0}, function (data) { + + vprasanje_save(true, spremenljivka, function(){ + $('#spremenljivka_contentdiv'+spremenljivka).find('#variable_holder div:last-child').find('.vrednost_inline').focus(); + }); + }); +} + //preverimo ce ze obstaja function vrednost_new_dodatne (spremenljivka, mv, tip, checked){ var vrednost; @@ -281,18 +295,8 @@ function vrednost_new_dodatne (spremenljivka, mv, tip, checked){ var vre_id = $('#spremenljivka_content_'+spremenljivka+' #variable_holder [other|="'+mv+'"]').attr('id'); vre_id = vre_id.replace('variabla_', ''); inline_vrednost_delete(spremenljivka, vre_id, '0'); + return false; - /* - temp = document.getElementById(mv).name; - var arr = new Array(); - arr = temp.split('_'); - vrednost = arr[2]; - - $('#vrednost_'+vrednost).remove(); - $.post('ajax.php?t=vprasanje&a=vrednost_delete', {vrednost: vrednost, spremenljivka: spremenljivka, anketa: srv_meta_anketa_id}, function () { - vprasanje_save(true); - }) - */ } } diff --git a/public/css/admin.css b/public/css/admin.css index 60fec7c64..3a44923f8 100644 --- a/public/css/admin.css +++ b/public/css/admin.css @@ -15493,6 +15493,10 @@ and open the template in the editor. width: 100%; } +.add-variable-mobile { + display: none; +} + .add-variable { display: none; position: absolute; @@ -28910,6 +28914,11 @@ table.dashboard > tbody > tr > td { margin-left: 0; } + .locked .add-variable-mobile, +.spremenljivka_content:hover .add-variable { + display: none !important; + } + #branching { width: 100%; } @@ -28919,6 +28928,15 @@ table.dashboard > tbody > tr > td { #branching .spr_edit { display: none !important; } + #branching .content_div_normalmode { + padding-bottom: 40px; + } + #branching .add-variable-mobile { + display: block; + position: absolute; + left: 59px; + bottom: 20px; + } #branching .empty_vrivanje { padding: 30px 0 !important; margin: 20px 10px 20px 10px !important; diff --git a/resources/sass/admin/branching/questions/question_box.scss b/resources/sass/admin/branching/questions/question_box.scss index d5ca852c1..9bd37aa39 100644 --- a/resources/sass/admin/branching/questions/question_box.scss +++ b/resources/sass/admin/branching/questions/question_box.scss @@ -20,6 +20,9 @@ and open the template in the editor. .spremenljivka { width: 100%; } +.add-variable-mobile { + display: none; +} .add-variable { display: none; position: absolute; diff --git a/resources/sass/admin/mobile/pages/branching.scss b/resources/sass/admin/mobile/pages/branching.scss index 79ef5e4d6..4f84e19d7 100644 --- a/resources/sass/admin/mobile/pages/branching.scss +++ b/resources/sass/admin/mobile/pages/branching.scss @@ -4,6 +4,11 @@ margin-left: 0; } +.locked .add-variable-mobile, +.spremenljivka_content:hover .add-variable { + display: none !important; +} + #branching{ width: 100%; @@ -15,6 +20,15 @@ display: none !important; } + .content_div_normalmode{ + padding-bottom: 40px; + } + .add-variable-mobile { + display: block; + position: absolute; + left: 59px; + bottom: 20px; + } .empty_vrivanje { padding: 30px 0 !important;