Skip to content

Commit d945f80

Browse files
committed
!410, !563 - Added fieldDataSelect2AddDataAttrFromData to select2 array. Provided array keys will be added as attribute to the options.
- Devtools added installed attribute to option so we can control which module we can edit. else we will receive json file non exists error.
1 parent 946b3a0 commit d945f80

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

apps/Core/Components/Devtools/Modules/ModulesComponent.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,7 @@ public function viewAction()
229229

230230
$routePath = implode('/', $pathArr) . '/Install/';
231231
} else if ($module['module_details']['module_type'] === 'views') {
232-
if (!$module['module_details']['view_modules_version'] ||
233-
($module['module_details']['base_view_module_id'] && $module['module_details']['base_view_module_id'] != '0')
234-
) {
232+
if (isset($module['module_details']['base_view_module_id']) && $module['module_details']['base_view_module_id'] != 0) {
235233
$baseView = $this->modules->views->getViewById($module['module_details']['base_view_module_id']);
236234

237235
$pathArr = preg_split('/(?=[A-Z])/', ucfirst($module['module_details']['name']), -1, PREG_SPLIT_NO_EMPTY);

apps/Core/Packages/Adminltetags/Tags/Fields/Select2.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ protected function generateContent()
102102
$this->params['fieldDataSelect2OptionsSelected'] :
103103
'';
104104

105+
$this->fieldParams['fieldDataSelect2AddDataAttrFromData'] =
106+
isset($this->params['fieldDataSelect2AddDataAttrFromData']) ?
107+
$this->params['fieldDataSelect2AddDataAttrFromData'] :
108+
null;
109+
105110
if (isset($this->params['fieldGroupPreAddonText']) ||
106111
isset($this->params['fieldGroupPreAddonIcon']) ||
107112
isset($this->params['fieldGroupPreAddonDropdown']) ||

apps/Core/Packages/Adminltetags/Tags/Tree.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ protected function treeItem($key, $items, $itemIcon, $children = null)
440440
// $hasValue = $itemValue;
441441
// $hasValueText = $itemValue;
442442
}
443-
// var_dump($itemValue['data']);
443+
444444
if (isset($itemValue['data'])) {
445445
$dataAttr = '';
446446
foreach ($itemValue['data'] as $dataKey => $dataValue) {
@@ -449,6 +449,14 @@ protected function treeItem($key, $items, $itemIcon, $children = null)
449449
} else {
450450
$dataAttr = '';
451451
}
452+
453+
if (isset($this->fieldParams['fieldDataSelect' . $selectType . 'AddDataAttrFromData'])) {
454+
foreach ($this->fieldParams['fieldDataSelect' . $selectType . 'AddDataAttrFromData'] as $dataValue) {
455+
if (isset($itemValue[$dataValue])) {
456+
$dataAttr .= 'data-' . $dataValue . '="' . $itemValue[$dataValue] . '" ';
457+
}
458+
}
459+
}
452460
// if (isset($itemValue['dataType'])) {
453461
// $dataType = 'data-datatype="' . $itemValue['dataType'] . '"';
454462
// } else {

apps/Core/Views/Default/html/devtools/modules/select.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
'fieldBazScan' : true,
119119
'fieldBazPostOnCreate' : true,
120120
'fieldBazPostOnUpdate' : true,
121+
'fieldDataSelect2AddDataAttrFromData' : ['installed'],
121122
'fieldDataSelect2Options' : modules,
122123
'fieldDataSelect2OptionsKey' : 'id',
123124
'fieldDataSelect2OptionsValue' : 'display_name:app_type|name:app_type',
@@ -261,9 +262,12 @@
261262
$('#{{componentId}}-{{sectionId}}-generate-new-release').attr('disabled', true);
262263
}
263264
}
264-
// if (label === 'bundles') {
265-
// $('#{{componentId}}-{{sectionId}}-generate-new-release').attr('disabled', true);
266-
// }
265+
266+
if ('installed' in $(e.params.data.element).data() &&
267+
$(e.params.data.element).data()['installed'] == 0
268+
) {
269+
$('#{{componentId}}-{{sectionId}}-clone-module, #{{componentId}}-{{sectionId}}-remove-module').attr('disabled', true);
270+
}
267271
});
268272

269273
$('#{{componentId}}-{{sectionId}}-include_core_modules').click(function() {

0 commit comments

Comments
 (0)