Skip to content

Commit

Permalink
dev: disable buttons (copy, questionTypeSelector) when survey is active
Browse files Browse the repository at this point in the history
  • Loading branch information
Trischi80 authored and olleharstedt committed May 7, 2021
1 parent b9d736a commit 61b791c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
Expand Up @@ -68,7 +68,7 @@
<?php endif; ?>

<!-- Copy -->
<?php if($hasSurveyContentCreatePermission):?>
<?php if($hasSurveyContentCreatePermission && ($oSurvey->active!='Y')):?>
<a class="btn btn-default" id="copy_button" href='<?php echo Yii::App()->createUrl("questionAdministration/copyQuestion/surveyId/{$oQuestion->sid}/questionGroupId/{$oQuestion->gid}/questionId/{$oQuestion->qid}");?>'>
<span class="icon-copy icon"></span>
<?php eT("Copy"); ?>
Expand Down
Expand Up @@ -109,6 +109,11 @@ class PreviewModalWidget extends CWidget
*/
public $debug = false;

/**
* @var bool true if survey is active, in this case questiontype should not be changed (button disabled)
*/
public $survey_active = false;

/**
* @return void
*/
Expand Down
Expand Up @@ -7,6 +7,11 @@ class="btn btn-block btn-primary"
data-toggle="modal"
aria-haspopup="true"
aria-expanded="false"
<?php
if ($this->survey_active) {
echo 'disabled';
}
?>
>
<?php if ($this->iconPosition === 'front') : ?>
<i class="fa fa-folder-open"></i>&nbsp;&nbsp;
Expand Down
1 change: 1 addition & 0 deletions application/views/questionAdministration/codeAndType.php
Expand Up @@ -19,6 +19,7 @@
'renderType' => isset($selectormodeclass) && $selectormodeclass == "none" ? "group-simple" : "group-modal",
'modalTitle' => gT("Select question type"),
'groupTitleKey' => "questionGroupName",
'survey_active' => $question->survey->active,
'groupItemsKey' => "questionTypes",
'debugKeyCheck' => gT("Type:") . " ",
'previewWindowTitle' => gT("Preview question type"),
Expand Down

0 comments on commit 61b791c

Please sign in to comment.