Skip to content

Commit

Permalink
Add Astroid Get Pro field
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Oct 31, 2024
1 parent 4caa7b7 commit aa4a7a3
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 27 deletions.
2 changes: 1 addition & 1 deletion assets/vendor/manager/dist/index.html

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions assets/vendor/manager/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/vendor/manager/index.html

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions assets/vendor/manager/index_.html

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion assets/vendor/manager/src/components/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ function selectPreset(event, group) {
});
}
}
const pro_badge = '<span class="badge text-bg-danger ms-2">PRO</span>';
</script>
<template>
<main class="as-main order-1">
Expand All @@ -156,7 +157,7 @@ function selectPreset(event, group) {
<div :class="(idx !== 0 && field.input.type !== 'astroidhidden' && field.input.type !== 'hidden' ? 'mt-3 pt-3 border-top': '')" v-for="(field, idx) in group.fields" :key="field.id" v-show="checkShow(field)">
<div class="row">
<div v-if="(field.label || field.description) && field.input.type !== `astroidheading`" class="col-sm-6 col-md-5">
<div v-if="(field.input.type === `astroidradio` && field.input.role !== 'switch') || (['astroidpreloaders', 'astroidmedia', 'astroidcolor', 'astroidicon', 'astroidcalendar', 'astroidgradient', 'astroidspacing', 'astroidicons'].includes(field.input.type))" class="form-label" v-html="field.label"></div>
<div v-if="(field.input.type === `astroidradio` && field.input.role !== 'switch') || (['astroidpreloaders', 'astroidmedia', 'astroidcolor', 'astroidicon', 'astroidcalendar', 'astroidgradient', 'astroidspacing', 'astroidicons', 'astroidgetpro'].includes(field.input.type))" class="form-label" v-html="(field.label + (field.input.type === `astroidgetpro` ? pro_badge : ``))"></div>
<label v-else :for="(typeof field.type !== 'undefined' && field.type === `json` ? field.input.id : 'params_'+field.name)" class="form-label" v-html="field.label"></label>
<p v-if="field.description !== ''" v-html="field.description" class="form-text"></p>
</div>
Expand Down
4 changes: 4 additions & 0 deletions assets/vendor/manager/src/components/helpers/Fields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,8 @@ function updateSubLayouts() {
<div v-else-if="props.field.input.type === `articlelayouts`" class="astroid-article-layouts">
<SubLayouts v-model="props.scope[props.field.name]" :field="props.field" type="article_layouts" />
</div>
<div v-else-if="props.field.input.type === `astroidgetpro`" class="astroid-get-pro card card-body">
<h6 class="card-title">{{ props.field.input.title }}</h6>
<div class="card-text form-text" v-html="props.field.input.desc"></div>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ function selectLayout(element) {
<a href="#" @click.prevent="selectElement(element)" class="bg-light text-dark border px-2 py-1 rounded-pill"><i class="fas fa-plus"></i><span class="add-element-text ms-1">Add Element</span></a>
</div>
</div>
<div v-else-if="props.group === `cols`" class="astroid-element card card-default card-body" :class="{'element-disabled' : !element.state}">
<div v-else-if="props.group === `cols` && typeof props.form[element.type] !== `undefined`" class="astroid-element card card-default card-body" :class="{'element-disabled' : !element.state}">
<div class="d-flex justify-content-between">
<div class="element-name">
<div><i class="text-body-tertiary me-2" :class="props.form[element.type].info.icon"></i>{{ element.params.find((param) => param.name === 'title').value }}<i v-if="element.type === `sublayout`" class="fa-regular fa-circle-question text-body-tertiary ms-1" :title="element.params.find((param) => param.name === 'desc').value"></i></div>
Expand All @@ -368,10 +368,6 @@ function selectLayout(element) {
</div>
</div>
</div>
<div v-else>
{{ element.id }}
<LayoutBuilder :list="element" :group="map[props.group]" :system="props.system" :form="props.form" :device="props.device" @edit:Element="_editElement" @select:Element="selectElement" @update:System="updateSystem" />
</div>
</template>
</draggable>
</template>
3 changes: 2 additions & 1 deletion assets/vendor/manager/src/components/helpers/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ function updateSubForm(value) {
function sidebarClick(id) {
document.getElementById(id).scrollIntoView();
}
const pro_badge = '<span class="badge text-bg-danger ms-2">PRO</span>';
</script>
<template>
<div class="astroid-modal modal d-block" :id="props.element.type+`-`+props.element.id" tabindex="-1" aria-hidden="true">
Expand All @@ -95,7 +96,7 @@ function sidebarClick(id) {
<p v-if="group.description" class="form-text">{{ group.description }}</p>
</div>
<div v-for="field in group.fields" :key="field.id" class="mb-4" v-show="checkShow(field)">
<div v-if="(field.input.type === `astroidradio` && field.input.role !== 'switch') || (['astroidpreloaders', 'astroidmedia', 'astroidcolor', 'astroidicon', 'astroidcalendar', 'astroidgradient', 'astroidspacing'].includes(field.input.type))" class="form-label fw-bold" v-html="field.label"></div>
<div v-if="(field.input.type === `astroidradio` && field.input.role !== 'switch') || (['astroidpreloaders', 'astroidmedia', 'astroidcolor', 'astroidicon', 'astroidcalendar', 'astroidgradient', 'astroidspacing', 'astroidgetpro'].includes(field.input.type))" class="form-label fw-bold" v-html="(field.label + (field.input.type === `astroidgetpro` ? pro_badge : ``))"></div>
<label v-else-if="field.input.type !== `astroidheading` && field.label" :for="field.input.id" class="form-label fw-bold" v-html="field.label"></label>
<div v-if="typeof field.type !== 'undefined' && field.type === `json`">
<Fields
Expand Down
38 changes: 38 additions & 0 deletions framework/fields/astroidgetpro.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* @package Astroid Framework
* @author Astroid Framework Team https://astroidframe.work
* @copyright Copyright (C) 2023 AstroidFrame.work.
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;
use Astroid\Helper\Constants;

class JFormFieldAstroidGetPro extends FormField
{

protected $type = 'astroidgetpro';

public function getLabel()
{
return '';
}

public function getInput()
{
$json = [
'id' => $this->id,
'name' => $this->name,
'value' => $this->value,
'type' => strtolower($this->type),
'title' => Text::_('ASTROID_GET_PRO_TITLE'),
'desc' => Text::sprintf('ASTROID_GET_PRO_DESCRIPTION', Text::_($this->getAttribute('label')), Constants::$go_pro)
];
return json_encode($json);
}
}
1 change: 1 addition & 0 deletions framework/library/astroid/Helper/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Constants
public static $astroid_link = 'https://astroidframe.work/';
public static $templates_link = 'https://astroidframe.work/partners';
public static $jed_link = 'https://extensions.joomla.org/extension/astroid-framework/';
public static $go_pro = 'https://astroidframe.work/pricing';

/**
* Return configurations of Manager
Expand Down
2 changes: 2 additions & 0 deletions framework/options/basic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<field type="astroidgroup" name="enable_back_to_top" title="TPL_ASTROID_ENABLE_TO_TOP_MAIN_TITLE_LABEL" help="https://github.com/templaza/astroid-framework/wiki/2.-Basic-Settings#back-to-top"/>
<field type="astroidgroup" name="colormode" title="TPL_ASTROID_BASIC_ENABLE_COLOR_MODE_LABEL" help="https://docs.astroidframe.work/basic-settings/color-mode"/>
<field type="astroidgroup" name="smooth_scroll" title="TPL_SMOOTH_SCROLL_TITLE" help="https://github.com/templaza/astroid-framework/wiki/2.-Basic-Settings#smooth-scroll"/>
<field type="astroidgroup" name="cursor_options" title="ASTROID_CURSOR_EFFECT_TITLE"/>

<field astroidgroup="bootstrap" name="bootstrap_js" type="astroidmultiselect" label="TPL_ASTROID_BOOTSTRAP_JS_LABEL" default="[]" description="TPL_ASTROID_BOOTSTRAP_JS_DESC" hint="TPL_ASTROID_BOOTSTRAP_JS_HINT_LABEL">
<option value="alert">Alert</option>
Expand Down Expand Up @@ -213,6 +214,7 @@
<field astroidgroup="colormode" ngShow="[astroid_color_mode_enable]==1 AND [enable_color_mode_transform]==1" name="astroid_colormode_transform_offset" type="astroidrange" min="1" max="100" step="1" default="50" label="TPL_ASTROID_BASIC_COLOR_MODE_TRANSFORM_OFFSET_LABEL" description="TPL_ASTROID_BASIC_COLOR_MODE_TRANSFORM_OFFSET_DESC" postfix="%" />

<field astroidgroup="smooth_scroll" description="TPL_SMOOTH_SCROLL_ENABLE_DESC" name="enable_smooth_scroll" type="astroidradio" astroid-switch="true" default="0" label="TPL_SMOOTH_SCROLL_ENABLE_LBL"/>
<field astroidgroup="cursor_options" name="enable_cursor_effect" type="astroidgetpro" label="ASTROID_CURSOR_EFFECT_ENABLE" description="ASTROID_CURSOR_EFFECT_ENABLE_DESC" />
</fieldset>
</fields>
</form>
5 changes: 5 additions & 0 deletions language/en-GB/en-GB.astroid.ini
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ ASTROID_FREE_TEMPLATE_MODAL_DESC="Your website currently does not have any Astro
ASTROID_FREE_TEMPLATE_CONGRATS="Congratulations! You have successfully installed"
ASTROID_GET_STARTED="Get Started"
ASTROID_VIEW_TEMPLATES="View Templates"
ASTROID_GET_PRO_TITLE="Unlock the Full Range of Pro Features"
ASTROID_GET_PRO_DESCRIPTION="<p>Upgrade to Astroid Pro to get the %s as well as additional professional and advanced widgets</p><a href=\"%s/\" target="_blank" class=\"btn btn-sm btn-as btn-danger\">Upgrade Now</a>"

; Tab Headings
ASTROID_OPTIONS_BASIC="Basic"
Expand All @@ -160,6 +162,9 @@ TPL_ASTROID_PRELOADER_MAIN_TITLE_LABEL="Preloader"
TPL_ASTROID_ENABLE_TO_TOP_MAIN_TITLE_LABEL="Back to Top"
TPL_ASTROID_LAYOUT_SETTING_MAIN_TITLE_LABEL="Layout Settings"
TPL_BOOTSTRAP_TITLE="Bootstrap Settings"
ASTROID_CURSOR_EFFECT_TITLE="Cursor Effect"
ASTROID_CURSOR_EFFECT_ENABLE="Enable Cursor Effect"
ASTROID_CURSOR_EFFECT_ENABLE_DESC="Create special effects along with mouse movements. Helps enhance user experience."

; Header Group Titles
TPL_ASTROID_HEADER_ELEMENT_MAIN_TITLE_LABEL="Header"
Expand Down

0 comments on commit aa4a7a3

Please sign in to comment.