Skip to content

Commit

Permalink
Merge branch 'task/zoho-L41-T742-modals-ui-changes-one-commit'
Browse files Browse the repository at this point in the history
  • Loading branch information
Trischi80 committed Jun 18, 2021
2 parents c9cb28f + 34c06a4 commit d0b555b
Show file tree
Hide file tree
Showing 68 changed files with 41,228 additions and 41,150 deletions.
Expand Up @@ -76,7 +76,7 @@ class="list-group-item selector__Item--select-<?=$this->widgetsJsName?> <?=@$aIt
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
<button type="button" class="btn btn-Cancel" data-dismiss="modal">
<?=gT($this->closeButton)?>
</button>
<button type="button" id="selector__select-this-<?=$this->widgetsJsName?>" class="btn btn-primary">
Expand Down
Expand Up @@ -61,7 +61,7 @@ class="list-group-item selector__Item--select-<?=$this->widgetsJsName?> <?=@$aIt
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
<button type="button" class="btn btn-cancel" data-dismiss="modal">
<?=gT($this->closeButton)?>
</button>
<button type="button" id="selector__select-this-<?=$this->widgetsJsName?>" class="btn btn-primary">
Expand Down
Expand Up @@ -17,6 +17,17 @@
*/
class massiveActionsWidget extends CWidget
{

/** @var string[] these are the names of the views in MassiveActionsWidget/../modals/ */
private const NAME_OF_MODEL_VIEWS = [
'yes-no',
'empty',
'yes-no-lg',
'empty-lg',
'cancel-apply',
'cancel-delete'
];

// Selector variables
public $pk; // The primary key of the grid
public $gridid; // The id of the related grid
Expand Down Expand Up @@ -63,8 +74,15 @@ public function run()

}

/**
* Check if the view is in the list
*
* @param $display string this is the name of one of the files in
* extensions/admin/MassiveActionsWidget/views/modals
* @return bool
*/
private function isView($display)
{
return in_array($display, array('yes-no', 'empty', 'yes-no-lg', 'empty-lg'));
return in_array($display, self::NAME_OF_MODEL_VIEWS);
}
}
@@ -0,0 +1,80 @@
<?php

if (isset($aAction['showSelected'])) {
$showSelected = $aAction['showSelected'];
} else {
$showSelected = 'no';
}

if (isset($aAction['selectedUrl'])) {
$selectedUrl = $aAction['selectedUrl'];
} else {
$selectedUrl = '#';
}

if (isset($aAction['largeModalView']) && $aAction['largeModalView']) {
$largeModalView = 'modal-lg';
}else{
$largeModalView = '';
}
?>

<!-- Modal confirmation for <?php
echo $aAction['action']; ?> -->

<div id="massive-actions-modal-<?php
echo $this->gridid; ?>-<?php
echo $aAction['action']; ?>-<?php
echo $key; ?>"
class="modal fade"
role="dialog"
data-keepopen="<?php echo $aAction['keepopen']; ?>"
data-show-selected="<?php echo $showSelected; ?>"
data-selected-url="<?php echo $selectedUrl ?>"
>
<div class="modal-dialog <?php echo $largeModalView?>">
<!-- Modal content-->
<div class="modal-content" style="text-align:left; color:#000">
<?php
Yii::app()->getController()->renderPartial(
'/layouts/partial_modals/modal_header',
['modalTitle' => $aAction['sModalTitle']]
);
?>
<div class="modal-body">
<div class='modal-body-text'><?php
echo $aAction['htmlModalBody']; ?></div>

<!-- shows list of selected items in the modal-->
<div class="selected-items-list"></div>

<?php
if (isset($aAction['aCustomDatas'])) { ?>
<!--
Custom datas needed for action defined directly in the widget call.
Always hidden in Yes/No case.
For specific input (like text, selector, etc) that should be filled by user
parse a form to htmlModalBody and attribute to the wanted input the class "custom-data"
-->
<div class="custom-modal-datas hidden">
<?php
foreach ($aAction['aCustomDatas'] as $aCustomData) { ?>
<input
class="custom-data"
type="hidden"
name="<?php
echo $aCustomData['name']; ?>"
value="<?php
echo $aCustomData['value']; ?>"/>
<?php
} ?>
</div>
<?php
} ?>
</div>
<?php
Yii::app()->getController()->renderPartial('/layouts/partial_modals/modal_footer_cancelapply');
?>
</div>
</div>
</div>
@@ -0,0 +1,80 @@
<?php

if (isset($aAction['showSelected'])) {
$showSelected = $aAction['showSelected'];
} else {
$showSelected = 'no';
}

if (isset($aAction['selectedUrl'])) {
$selectedUrl = $aAction['selectedUrl'];
} else {
$selectedUrl = '#';
}

if (isset($aAction['largeModalView']) && $aAction['largeModalView']) {
$largeModalView = 'modal-lg';
}else{
$largeModalView = '';
}
?>

<!-- Modal confirmation for <?php
echo $aAction['action']; ?> -->

<div id="massive-actions-modal-<?php
echo $this->gridid; ?>-<?php
echo $aAction['action']; ?>-<?php
echo $key; ?>"
class="modal fade"
role="dialog"
data-keepopen="<?php echo $aAction['keepopen']; ?>"
data-show-selected="<?php echo $showSelected; ?>"
data-selected-url="<?php echo $selectedUrl ?>"
>
<div class="modal-dialog <?php echo $largeModalView?>">
<!-- Modal content-->
<div class="modal-content" style="text-align:left; color:#000">
<?php
Yii::app()->getController()->renderPartial(
'/layouts/partial_modals/modal_header',
['modalTitle' => $aAction['sModalTitle']]
);
?>
<div class="modal-body">
<div class='modal-body-text'><?php
echo $aAction['htmlModalBody']; ?></div>

<!-- shows list of selected items in the modal-->
<div class="selected-items-list"></div>

<?php
if (isset($aAction['aCustomDatas'])) { ?>
<!--
Custom datas needed for action defined directly in the widget call.
Always hidden in Yes/No case.
For specific input (like text, selector, etc) that should be filled by user
parse a form to htmlModalBody and attribute to the wanted input the class "custom-data"
-->
<div class="custom-modal-datas hidden">
<?php
foreach ($aAction['aCustomDatas'] as $aCustomData) { ?>
<input
class="custom-data"
type="hidden"
name="<?php
echo $aCustomData['name']; ?>"
value="<?php
echo $aCustomData['value']; ?>"/>
<?php
} ?>
</div>
<?php
} ?>
</div>
<?php
Yii::app()->getController()->renderPartial('/layouts/partial_modals/modal_footer_canceldelete');
?>
</div>
</div>
</div>
Expand Up @@ -37,8 +37,15 @@
</table>

<?php if(!$bArchiveIsEmpty):?>
<div class="modal-footer modal-footer-buttons">
<button type="button" class="btn btn-cancel" data-dismiss="modal">
&nbsp
<?php
eT("Cancel"); ?>
</button>
<a class='btn btn-primary' href="<?php echo App()->createUrl('/admin/export/sa/downloadZip/sZip/'.$sZip);?>">
<span class="fa fa-download"></span>
<?php eT('Download archive');?>
</a>
</div>
<?php endif; ?>
Expand Up @@ -27,7 +27,7 @@

// modal
'actionType' => 'modal',
'modalType' => 'yes-no',
'modalType' => 'cancel-delete',
'keepopen' => 'yes',
'showSelected' => 'yes',
'selectedUrl' => App()->createUrl('/surveyAdministration/renderItemsSelected/'),
Expand All @@ -53,12 +53,12 @@
'grid-reload' => 'no',
// modal
'actionType' => 'modal',
'modalType' => 'yes-no',
'showSelected' => 'yes',
'modalType' => 'cancel-apply',
'showSelected' => 'yes',
'selectedUrl' => App()->createUrl('/surveyAdministration/renderItemsSelected/'),
'keepopen' => 'yes',
'sModalTitle' => gT('Set survey theme'),
'htmlModalBody' => $this->controller->renderFile(__DIR__.'/_select_survey_theme.php',array(),true),
'htmlModalBody' => $this->controller->renderFile(__DIR__.'/_select_survey_theme.php', array(), true),
),

// Change survey group selector
Expand All @@ -72,9 +72,9 @@
'grid-reload' => 'yes',
// modal
'actionType' => 'modal',
'modalType' => 'yes-no',
'modalType' => 'cancel-apply',
'keepopen' => 'yes',
'showSelected' => 'yes',
'showSelected' => 'yes',
'selectedUrl' => App()->createUrl('/surveyAdministration/renderItemsSelected/'),
'sModalTitle' => gT('Change survey group'),
'htmlModalBody' => $this->controller->renderFile(__DIR__.'/_change_survey_group.php',array(),true),
Expand Down Expand Up @@ -106,9 +106,9 @@

// modal
'actionType' => 'modal',
'modalType' => 'yes-no',
'modalType' => 'cancel-apply',
'keepopen' => 'yes',
'showSelected' => 'yes',
'showSelected' => 'yes',
'selectedUrl' => App()->createUrl('/surveyAdministration/renderItemsSelected/'),
'sModalTitle' => gT('Export survey archive'),
'htmlModalBody' => gT('This will export the survey archive (.lsa) for all selected active surveys. They will be provided in a single ZIP archive.').' '.gT('Continue?'),
Expand All @@ -126,9 +126,9 @@

// modal
'actionType' => 'modal',
'modalType' => 'yes-no',
'modalType' => 'cancel-apply',
'keepopen' => 'yes',
'showSelected' => 'yes',
'showSelected' => 'yes',
'selectedUrl' => App()->createUrl('/surveyAdministration/renderItemsSelected/'),
'sModalTitle' => gT('Export survey structure'),
'htmlModalBody' => gT('This will export the survey structure (.lss) for all selected active surveys. They will be provided in a single ZIP archive.').' '.gT('Continue?'),
Expand All @@ -144,9 +144,9 @@
'text' => gT("Printable survey (*.html)"),
// modal
'actionType' => 'modal',
'modalType' => 'yes-no',
'modalType' => 'cancel-apply',
'keepopen' => 'yes',
'showSelected' => 'yes',
'showSelected' => 'yes',
'selectedUrl' => App()->createUrl('/surveyAdministration/renderItemsSelected/'),
'sModalTitle' => gT('Export printable survey'),
'htmlModalBody' => gT('This will export a printable version of your survey.').' '.gT('Continue?'),
Expand All @@ -162,12 +162,12 @@
'grid-reload' => 'yes',
// modal
'actionType' => 'modal',
'modalType' => 'yes-no',
'showSelected' => 'yes',
'modalType' => 'cancel-apply',
'showSelected' => 'yes',
'selectedUrl' => App()->createUrl('/surveyAdministration/renderItemsSelected/'),
'keepopen' => 'yes',
'sModalTitle' => gT('Set expiry date'),
'htmlModalBody' => $this->controller->renderFile(__DIR__.'/_expiry_dialog.php',array(),true),
'htmlModalBody' => $this->controller->renderFile(__DIR__.'/_expiry_dialog.php', array(), true),
),
),

Expand Down
6 changes: 3 additions & 3 deletions application/models/Box.php
Expand Up @@ -142,10 +142,10 @@ public function getbuttons()
$url = Yii::app()->createUrl("/homepageSettings/deleteBox");
//$url .= '/'.$this->id;
$button .= '<a class="btn btn-default selector--ConfirmModal"'
. ' data-button-no="' . gT('No, cancel') . '"'
. ' data-button-yes="' . gT('Yes, delete') . '"'
. ' data-button-no="' . gT('Cancel') . '"'
. ' data-button-yes="' . gT('Delete') . '"'
. ' href="' . $url . '"'
. ' title="' . gT("Delete box") . '"'
. ' title="' . gT("Delete the box") . '"'
. ' role="button" data-post=\'' . json_encode(['id' => $this->id]) . '\''
. ' data-text="' . gT('Are you sure you want to delete this box ?') . '"'
. '><span class="text-danger fa fa-trash" ></span></a>';
Expand Down
8 changes: 8 additions & 0 deletions application/models/TemplateConfiguration.php
Expand Up @@ -767,6 +767,8 @@ class='btn btn-default btn-block'>
])
. '\'
data-text="' . gT('Please type in the new theme name above.') . '"
data-button-no="' . gt('Cancel') . '"
data-button-yes="' . gt('Apply') . '"
title="' . sprintf(gT('Type in the new name to extend %s'), $this->template_name) . '"
class="btn btn-primary btn-block selector--ConfirmModal">
<i class="fa fa-copy"></i>
Expand All @@ -778,6 +780,9 @@ class="btn btn-primary btn-block selector--ConfirmModal">
href="' . $sUninstallUrl . '"
data-post=\'{ "templatename": "' . $this->template_name . '" }\'
data-text="' . gT('This will reset all the specific configurations of this theme.') . '<br>' . gT('Do you want to continue?') . '"
data-button-no="' . gt('Cancel') . '"
data-button-yes="' . gt('Uninstall') . '"
data-button-type="btn-danger"
title="' . gT('Uninstall this theme') . '"
class="btn btn-danger btn-block selector--ConfirmModal">
<span class="icon-trash"></span>
Expand All @@ -789,6 +794,9 @@ class="btn btn-danger btn-block selector--ConfirmModal">
href="' . $sResetUrl . '"
data-post=\'{ "templatename": "' . $this->template_name . '" }\'
data-text="' . gT('This will reload the configuration file of this theme.') . '<br>' . gT('Do you want to continue?') . '"
data-button-no="' . gt('Cancel') . '"
data-button-yes="' . gt('Reset') . '"
data-button-type="btn-warning"
title="' . gT('Reset this theme') . '"
class="btn btn-warning btn-block selector--ConfirmModal">
<span class="icon-trash"></span>
Expand Down
3 changes: 3 additions & 0 deletions application/models/TemplateManifest.php
Expand Up @@ -664,6 +664,9 @@ class='btn btn-default btn-block'>
href="' . $sDeleteUrl . '"
data-post=\'{ "templatename": "' . $this->sTemplateName . '" }\'
data-text="' . gT('Are you sure you want to delete this theme? ') . '"
data-button-no="' . gt('Cancel') . '"
data-button-yes="' . gt('Delete') . '"
data-button-type="btn-danger"
title="' . gT('Delete') . '"
class="btn btn-danger btn-block selector--ConfirmModal">
<span class="fa fa-trash "></span>
Expand Down
4 changes: 2 additions & 2 deletions application/views/admin/conditions/conditionshead_view.php
Expand Up @@ -69,9 +69,9 @@ class='btn btn-default pull-right condition-header-button'
<?php echo $quickAddConditionForm; ?>
</div>
<div class="modal-footer">
<button type="button" id='quick-add-condition-close-button' class="btn btn-cancel" data-dismiss="modal">&nbsp;<?php eT("Cancel"); ?></button>
<button type='submit' id='quick-add-condition-save-button' class='btn btn-primary'><?php eT('Save'); ?></button>
<button type='submit' id='quick-add-condition-save-and-close-button' class='btn btn-default'><?php eT('Save and close'); ?></button>
<button type="button" id='quick-add-condition-close-button' class="btn btn-danger" data-dismiss="modal">&nbsp;<?php eT("Close"); ?></button>
<button type='submit' id='quick-add-condition-save-and-close-button' class='btn btn-primary'><?php eT('Save and close'); ?></button>
<span id='quick-add-url' class='hidden'><?php echo $quickAddConditionURL; ?></span>
</div>
</div>
Expand Down
Expand Up @@ -80,6 +80,9 @@
<div class="modal-body" style="padding: 0;">
<iframe frameBorder="0" style="min-height: 600px; height:100%; width: 100%;" src="about:blank"></iframe>
</div>
<div class='modal-footer'>
<button type="button" class='btn btn-default' data-dismiss='modal'><?php eT("Cancel");?></button>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit d0b555b

Please sign in to comment.