Skip to content

Commit

Permalink
Fix issue when load from old Preset system
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Jun 25, 2022
1 parent c838ad9 commit ed0de4f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion framework/fields/astroidpreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function getInput() {
$html[] = '<div class="form-group"><label for="astroid-preset-desc">Description</label><textarea class="form-control" name="astroid-preset-desc" id="astroid-preset-desc" rows="3"></textarea></div>';
$html[] = '<input type="hidden" name="astroid-preset" id="astroid-preset">';
$html[] = '<input type="hidden" name="astroid-template" id="astroid-template">';
$html[] = '<a href="#" class="btn btn-primary" id="astroid-save-preset">'.JText::_('JOLLYANY_SAVE_PRESET').'</a>';
$html[] = '<a href="#" class="btn btn-primary" id="astroid-save-preset">'.JText::_('TPL_ASTROID_SAVE_PRESET').'</a>';
$html[] = '</div></div>';
$html[] = '</div>';
$html[] = '</div>';
Expand Down
6 changes: 4 additions & 2 deletions framework/layouts/manager/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@
echo '<ul class="dropdown-menu" aria-labelledby="astroid-preset-dropdown-'.$groupname.'">';
$presets_name = explode(',', $group['preset']);
for ($i = 0; $i < count($presets); $i++) {
$preset = json_decode($presets[$i]['preset'], true);
echo '<li><a class="dropdown-item" href="javascript:void(0)" ng-click=\'selectPreset('.$i.','.json_encode($presets_name).')\'>'.$presets[$i]['title'].'</a></li>';
if (isset($presets[$i]['preset']) && is_string($presets[$i]['preset'])) {
$preset = json_decode($presets[$i]['preset'], true);
echo '<li><a class="dropdown-item" href="javascript:void(0)" ng-click=\'selectPreset('.$i.','.json_encode($presets_name).')\'>'.$presets[$i]['title'].'</a></li>';
}
}
echo '</ul>';
echo '</span>';
Expand Down
4 changes: 2 additions & 2 deletions framework/options/presets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<fields name="params">
<fieldset label="TPL_ASTROID_PRESETS_MAIN_TITLE_LABEL" icon="fas fa-rocket" name="preset" addfieldpath="/libraries/astroid/framework/fields" order="12">

<field type="astroidgroup" name="presets" title="TPL_ASTROID_PRESETS_MAIN_TITLE_LABEL"/>
<field type="astroidgroup" name="presets" title="TPL_ASTROID_PRESETS_MAIN_TITLE_LABEL" description="TPL_ASTROID_PRESETS_DESC"/>

<field astroidgroup="presets" description="TPL_ASTROID_PRESETS_DESC" name="presets_style" type="astroidpreset" astroid-switch="true" default="1" label="TPL_ASTROID_PRESETS_LABEL"></field>
<field astroidgroup="presets" name="presets_style" type="astroidpreset" astroid-switch="true" default="1" />
</fieldset>
</fields>
</form>
1 change: 1 addition & 0 deletions language/en-GB/en-GB.astroid.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ TPL_ASTROID_ICONS="Icons"
TPL_ASTROID_DISPLAY="Display"
TPL_ASTROID_EXPORT="Export"
TPL_ASTROID_EXPORT_PRESET="Export Preset"
TPL_ASTROID_SAVE_PRESET="Save Preset"
TPL_ASTROID_LOAD_PRESET="Load Preset"
TPL_ASTROID_LOAD_PRESET_FILE_ERROR="Can not read preset file!"
TPL_ASTROID_PRESET_EMPTY_ERROR="Preset is empty"
Expand Down

0 comments on commit ed0de4f

Please sign in to comment.