Prenova dodajanja vprasanja na mobitelu

This commit is contained in:
pero1203 2021-05-26 10:30:19 +02:00
parent 1ebde6ff1d
commit 215deccf11
9 changed files with 282 additions and 6 deletions

View File

@ -339,10 +339,8 @@ class Branching {
$row = SurveyInfo::getInstance()->getSurveyRow();
//if ($row['toolbox'] == 1 || $row['toolbox'] == 2)
if($this->survey_type != 0)
$this->toolbox_basic2();
//else
if ($row['toolbox'] >= 3)
$this->toolbox_library();
@ -353,6 +351,8 @@ class Branching {
});
</script><?php
// Mobile add question
MobileSurveyAdmin::displayAddQuestion($this->anketa);
}
/**

View File

@ -689,4 +689,34 @@ class MobileSurveyAdmin{
echo '<a href="'.$url.'" title="'.$title.'">'.$title.'</a>';
echo '</li>';
}
// Gumb za dodajanje vprasanja
public static function displayAddQuestion($ank_id){
global $lang;
echo '<div class="mobile_add_question">';
echo ' <span class="buttonwrapper"><a class="ovalbutton ovalbutton_orange" href="#" onclick="mobile_add_question_popup(); return false;">';
echo ' <span class="plus">+</span> ';
echo ' <span>'.$lang['srv_mobile_add_question'].'</span>';
echo ' </a></span>';
echo '</div>';
// Popup za dodajanje vprašanja
echo '<div class="mobile_add_question_popup">';
echo ' <div class="mobile_add_question_item" onClick="mobile_add_question(\'1\');"><span class="faicon radio_32"></span> <span class="item_text">'.$lang['srv_vprasanje_tip_1'].'</span></div>';
echo ' <div class="mobile_add_question_item" onClick="mobile_add_question(\'5\');"><span class="faicon check_32"></span> <span class="item_text">'.$lang['srv_vprasanje_tip_2'].'</span></div>';
echo ' <div class="mobile_add_question_item" onClick="mobile_add_question(\'21\');"><span class="faicon abc_32"></span> <span class="item_text">'.$lang['srv_vprasanje_tip_21'].'</span></div>';
echo ' <div class="mobile_add_question_item" onClick="mobile_add_question(\'7\');"><span class="faicon number_32"></span> <span class="item_text">'.$lang['srv_vprasanje_tip_7'].'</span></div>';
echo ' <div class="mobile_add_question_item" onClick="mobile_add_question(\'5\');"><span class="faicon nagovor"></span> <span class="item_text">'.$lang['srv_vprasanje_tip_5'].'</span></div>';
echo ' <div class="mobile_add_question_item" onClick="mobile_add_question(\'6\');"><span class="faicon matrix_32"></span> <span class="item_text">'.$lang['srv_vprasanje_tip_6'].'</span></div>';
echo ' <span class="buttonwrapper mobile_add_question_button">';
echo ' <a class="ovalbutton ovalbutton_orange" href="#" onclick="mobile_add_question_popup_close(); return false;"><span>Zapri</span></a>';
echo ' </span>';
echo '</div>';
}
}

View File

@ -2035,13 +2035,16 @@ function dodaj_blok_interpretacije() {
// ---------------------------------------
// refresha levo stran z branchingom
function refreshLeft(spremenljivka, removeID) {
function refreshLeft(spremenljivka, callback) {
$.post('ajax.php?t=branching&a=refresh_left', {
spremenljivka: spremenljivka,
anketa: srv_meta_anketa_id
}, function (data) {
$('#branching').html(data);
if (typeof callback == "function")
callback();
});
}

View File

@ -35,3 +35,41 @@ function mobile_init(){
});
})
}
// Popup za dodajanje vprasanja na mobile
function mobile_add_question_popup(){
$('.mobile_add_question_popup').fadeIn();
}
// Popup za dodajanje vprasanja na mobile
function mobile_add_question_popup_close(){
$('.mobile_add_question_popup').fadeOut();
}
// Popup za dodajanje vprasanja na mobile
function mobile_add_question(tip){
mobile_add_question_popup_close();
$.post('ajax.php?t=branching&a=spremenljivka_new', {
spremenljivka: 0,
'if': 0,
endif: 1,
copy: 0,
tip: tip,
podtip: 0,
anketa: srv_meta_anketa_id
}, function (data) {
if (!data) return;
refreshLeft(data.nova_spremenljivka_id, function(){
// Scroll do novega vprasanja
$("html, body").animate({
scrollTop: $('#spremenljivka_content_'+data.nova_spremenljivka_id).offset().top - 100
}, 1000);
});
}, 'json');
}

View File

@ -3852,6 +3852,7 @@ $lang = array (
"srv_mobile_settings" => "Mobilne nastavitve",
"srv_mobile_settings_title" => "Nastavitve prikaza pri mobinih napravah",
"srv_mobile_survey" => "Anketa ustvarjena v mobilni aplikaciji",
"srv_mobile_add_question" => "Dodaj vprašanje",
"srv_standardne_besede" => "Standardne besede",
"srv_prevajanje_dodaj" => "Dodaj nov prevod za",
"srv_base_lang" => "Osnovni jezik",

View File

@ -3825,6 +3825,7 @@ $lang = array (
"srv_mobile_settings" => "Mobile settings",
"srv_mobile_settings_title" => "Display settings for mobile devices",
"srv_mobile_survey" => "Survey created with mobile app",
"srv_mobile_add_question" => "Add question",
"srv_prevajanje_dodaj" => "Add translation for",
"srv_base_lang" => "Basic language",
"srv_lang_elements" => "Standard text",

View File

@ -14116,6 +14116,14 @@ and open the template in the editor.
padding-top: 85px;
}
.mobile_add_question {
display: none;
}
.mobile_add_question_popup {
display: none;
}
/*
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
@ -28841,11 +28849,15 @@ table.dashboard > tbody > tr > td {
margin: 15px 0;
}
.page_branching #placeholder {
margin-left: 0;
}
#branching {
width: 100%;
}
#branching li {
margin: 0 10px 0 20px !important;
margin: 0 10px 0 10px !important;
}
#branching .spr_edit {
display: none !important;
@ -28886,10 +28898,12 @@ table.dashboard > tbody > tr > td {
}
#toolbox_advanced_settings {
display: none !important;
top: 150px;
}
#toolbox_basic {
display: none !important;
top: 187px;
}
@ -28897,6 +28911,81 @@ table.dashboard > tbody > tr > td {
display: none !important;
}
.mobile_add_question {
display: block;
position: fixed;
bottom: 25px;
left: calc(50% - 95px);
width: 190px;
}
.mobile_add_question a {
display: flex !important;
justify-content: center;
padding: 10px 20px 10px !important;
font-size: 14px;
font-weight: 500;
}
.mobile_add_question .plus {
margin-right: 8px;
font-size: 28px;
line-height: 15px;
font-weight: 600;
}
.mobile_add_question_popup {
z-index: 9999;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 40px 20px 20px 20px;
background: white;
}
.mobile_add_question_popup .mobile_add_question_item {
cursor: pointer;
position: relative;
box-sizing: border-box;
width: 300px;
height: 45px;
margin: 15px auto 5px auto;
font-size: 16px;
font-weight: 500;
text-align: center;
background-color: #f5fafe;
border: 1px #dfeffb solid;
}
.mobile_add_question_popup .mobile_add_question_item:hover {
background-color: #dfeffb;
border: 1px #c8e3f8 solid;
}
.mobile_add_question_popup .mobile_add_question_item span.faicon {
position: absolute;
left: 20px;
line-height: 42px;
}
.mobile_add_question_popup .mobile_add_question_item span.faicon.matrix_32 {
line-height: 10px;
margin-top: 9px;
}
.mobile_add_question_popup .mobile_add_question_item span.item_text {
line-height: 42px;
}
.mobile_add_question_popup .mobile_add_question_button {
position: absolute;
bottom: 25px;
left: calc(50% - 95px);
box-sizing: border-box;
width: 190px;
text-align: center;
}
.mobile_add_question_popup .mobile_add_question_button a {
padding: 10px 20px 10px !important;
font-size: 14px;
font-weight: 500;
}
#vprasanje_float_editing {
position: fixed;
z-index: 99999;

View File

@ -232,4 +232,12 @@ and open the template in the editor.
}
height: 266px;
top: 235px;
}
}
.mobile_add_question{
display: none;
}
.mobile_add_question_popup{
display: none;
}

View File

@ -1,9 +1,13 @@
.page_branching #placeholder{
margin-left: 0;
}
#branching{
width: 100%;
li{
margin: 0 10px 0 20px !important;
margin: 0 10px 0 10px !important;
}
.spr_edit{
@ -58,9 +62,11 @@
// Toolbox na levi
#toolbox_advanced_settings{
display: none !important;
top: 150px;
}
#toolbox_basic{
display: none !important;
top: 187px;
}
@ -70,6 +76,106 @@
}
// Mobile gumb za dodajanje vprašanja na konec
.mobile_add_question{
display: block;
position: fixed;
bottom: 25px;
left: calc(50% - 95px);
width: 190px;
a{
display: flex !important;
justify-content: center;
padding: 10px 20px 10px !important;
font-size: 14px;
font-weight: 500;
}
.plus{
margin-right: 8px;
font-size: 28px;
line-height: 15px;
font-weight: 600;
}
}
// Mobile popup za dodajanje vprasanja
.mobile_add_question_popup{
z-index: 9999;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 40px 20px 20px 20px;
background: white;
.mobile_add_question_item{
cursor: pointer;
position: relative;
box-sizing: border-box;
width: 300px;
height: 45px;
margin: 15px auto 5px auto;
font-size: 16px;
font-weight: 500;
text-align: center;
background-color: $soft_blue_very_lighten;
border: 1px $soft_blue_lighten solid;
&:hover{
background-color: $soft_blue_lighten;
border: 1px $soft_blue solid;
}
span.faicon{
position: absolute;
left: 20px;
line-height: 42px;
&.matrix_32{
line-height: 10px;
margin-top: 9px;
}
}
span.item_text{
line-height: 42px;
}
}
.mobile_add_question_button{
position: absolute;
bottom: 25px;
left: calc(50% - 95px);
box-sizing: border-box;
width: 190px;
text-align: center;
a{
padding: 10px 20px 10px !important;
font-size: 14px;
font-weight: 500;
}
}
}
// Urejanje vprasanja popup
#vprasanje_float_editing{
position: fixed;