Skip to content

Commit

Permalink
Merge pull request #816 from templaza/v3
Browse files Browse the repository at this point in the history
v3.1.5
  • Loading branch information
sonvnn authored Sep 25, 2024
2 parents e489837 + 0659166 commit 97e8cad
Show file tree
Hide file tree
Showing 14 changed files with 177 additions and 15 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
* Map Widget
* Accordion Widget
* Hover Motion Widget
* CodePen Widget
* [View all Widgets](https://astroidframe.work/widgets)

## Article Widgets
Expand Down
2 changes: 1 addition & 1 deletion assets/vendor/manager/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/vendor/manager/src/components/helpers/Presets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ const download = async (url, filename) => {
}
function exportPreset(preset) {
download(constant.site_url+'/media/templates/site/'+constant.tpl_template_name+'/astroid/presets/'+preset.name+'.json', preset.name+'.json');
download(constant.root_url+'media/templates/site/'+constant.tpl_template_name+'/astroid/presets/'+preset.name+'.json', preset.name+'.json');
}
</script>
<template>
Expand Down
4 changes: 2 additions & 2 deletions astroid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<name>Astroid Framework</name>
<libraryname>astroid</libraryname>
<author>Astroid Framework Team</author>
<creationDate>August 2024</creationDate>
<version>3.1.4</version>
<creationDate>September 2024</creationDate>
<version>3.1.5</version>
<url>https://astroidframe.work/</url>
<copyright>Copyright (C) 2024 TemPlaza, Inc. All rights reserved.</copyright>
<license>GNU General Public License version 3 or later; see LICENSE.txt</license>
Expand Down
4 changes: 2 additions & 2 deletions astroid_framework.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<updates>
<update>
<name>Astroid Framework</name>
<version>3.1.4</version>
<version>3.1.5</version>
<infourl title="Astroid Framework">https://astroidframe.work/</infourl>
<element>astroid</element>
<type>library</type>
<client>0</client>
<downloads>
<downloadurl type="full" format="zip">https://github.com/templaza/astroid-framework/releases/download/v3.1.4/astroid-framework-3.1.4.zip</downloadurl>
<downloadurl type="full" format="zip">https://github.com/templaza/astroid-framework/releases/download/v3.1.5/astroid-framework-3.1.5.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
Expand Down
2 changes: 1 addition & 1 deletion framework/elements/articles/articles.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
}

} elseif ($use_masonry) {
$document->loadMasonry();
$document->loadMasonry('.as-masonry');
}
if ($params->get('card_size', '') == 'custom') {
$card_padding = $params->get('card_padding', '');
Expand Down
76 changes: 76 additions & 0 deletions framework/elements/codepen/codepen.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?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
* DO NOT MODIFY THIS FILE DIRECTLY AS IT WILL BE OVERWRITTEN IN THE NEXT UPDATE
* You can easily override all files under /astroid/ folder.
* Just copy the file to JROOT/templates/YOUR_ASTROID_TEMPLATE/astroid/elements/module_position/module_position.php folder to create and override
*/

// No direct access.
defined('_JEXEC') or die;

use Astroid\Framework;
use Astroid\Helper;
use Joomla\CMS\Factory;

extract($displayData);
$document = Framework::getDocument();
$astroid_libs = json_decode($params->get('astroid_libs', '[]'), true);
if (count($astroid_libs)) {
foreach ($astroid_libs as $lib) {
switch ($lib['value']) {
case 'gsap':
$document->loadGSAP();
break;
case 'gsap.Flip':
$document->loadGSAP('Flip');
break;
case 'fancybox':
$document->loadFancyBox();
break;
case 'masonry':
$document->loadMasonry();
break;
case 'slick':
$document->loadSlick();
break;
case 'imagesloaded':
$document->loadImagesLoaded();
break;
}
}
}
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$external_css = $params->get('external_css', '');
if (!empty($external_css)) {
$external_css = json_decode($external_css);
if (count($external_css)) {
foreach ($external_css as $key => $css) {
$css_params = Helper::loadParams($css->params);
$wa->registerAndUseStyle($element->id.'.css-'.$key, $css_params->get('url', ''));
}
}
}
$external_js = $params->get('external_js', '');
if (!empty($external_js)) {
$external_js = json_decode($external_js);
if (count($external_js)) {
foreach ($external_js as $key => $js) {
$js_params = Helper::loadParams($js->params);
$wa->registerAndUseScript($element->id.'.js-'.$key, $js_params->get('url', ''));
}
}
}
echo $params->get('custom_html', '');
$custom_css = $params->get('custom_css', '');
$custom_js = $params->get('custom_js', '');
if (!empty($custom_css)) {
$wa->addInlineStyle($custom_css);
}
if (!empty($custom_js)) {
$wa->addInlineScript($custom_js);
}
56 changes: 56 additions & 0 deletions framework/elements/codepen/codepen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<element>
<title>ASTROID_WIDGET_CODEPEN_LABEL</title>
<description>ASTROID_WIDGET_CODEPEN_LABEL</description>
<icon>fa-brands fa-codepen</icon>
<category>ASTROID_ELEMENT_CATEGORY_ADVANCED,ASTROID_ELEMENT_CATEGORY_UTILITY</category>
<element_type>widget</element_type>
<form>
<fields>
<fieldset name="general-settings" label="TPL_ASTROID_GENERAL_SETTINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields">
<field astroidgroup="general" name="code_selector" type="astroidradio" width="full" default="html">
<option value="html">ASTROID_WIDGET_CODEPEN_HTML_LABEL</option>
<option value="css">ASTROID_WIDGET_CODEPEN_CSS_LABEL</option>
<option value="js">ASTROID_WIDGET_CODEPEN_JS_LABEL</option>
</field>
<field astroidgroup="general" ngShow="[code_selector]=='html'" code="html" name="custom_html" type="astroidtextarea" label="ASTROID_WIDGET_CODEPEN_CUSTOM_HTML_LABEL" description="ASTROID_WIDGET_CODEPEN_CUSTOM_HTML_LABEL"/>
<field astroidgroup="general" ngShow="[code_selector]=='css'" code="css" name="custom_css" type="astroidtextarea" label="ASTROID_WIDGET_CODEPEN_CUSTOM_CSS_LABEL" description="ASTROID_WIDGET_CODEPEN_CUSTOM_CSS_LABEL"/>
<field astroidgroup="general" ngShow="[code_selector]=='js'" code="javascript" name="custom_js" type="astroidtextarea" label="ASTROID_WIDGET_CODEPEN_CUSTOM_JS_LABEL" description="ASTROID_WIDGET_CODEPEN_CUSTOM_JS_LABEL"/>
<field astroidgroup="general" ngShow="[code_selector]=='js'" name="astroid_libs" type="astroidmultiselect" label="ASTROID_LIBRARIES" default="[]" description="ASTROID_LIBRARIES_DESC" hint="ASTROID_LIBRARIES_HINT">
<option value="gsap">GSAP</option>
<option value="gsap.Flip">GSAP.Flip</option>
<option value="fancybox">FancyBox</option>
<option value="masonry">Masonry</option>
<option value="slick">Slick</option>
<option value="imagesloaded">Images Loaded</option>
</field>
<field astroidgroup="general" ngShow="[code_selector]=='js'" name="external_js" as-index="url" type="astroidsubform" label="ASTROID_WIDGET_CODEPEN_EXTERNAL_JS_LABEL">
<form>
<fields>
<fieldset name="general-settings" label="TPL_ASTROID_GENERAL_SETTINGS_LABEL">
<field type="astroidtext" class="form-control" label="ASTROID_WIDGET_CODEPEN_EXTERNAL_JS_URL_LABEL" name="url"/>
</fieldset>
</fields>
</form>
</field>
<field astroidgroup="general" ngShow="[code_selector]=='css'" name="external_css" as-index="url" type="astroidsubform" label="ASTROID_WIDGET_CODEPEN_EXTERNAL_CSS_LABEL">
<form>
<fields>
<fieldset name="general-settings" label="TPL_ASTROID_GENERAL_SETTINGS_LABEL">
<field type="astroidtext" class="form-control" label="ASTROID_WIDGET_CODEPEN_EXTERNAL_CSS_URL_LABEL" name="url"/>
</fieldset>
</fields>
</form>
</field>
</fieldset>
<fieldset name="assignment-settings" label="TPL_ASTROID_ASSIGNMENT_SETTINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields" articleData="false">
<field type="astroidlist" name="assignment_type" label="ASTROID_WIDGET_ASSIGN" default="1">
<option value="1">ASTROID_WIDGET_ON_ALL_PAGES</option>
<option value="0">ASTROID_WIDGET_NO_PAGES</option>
<option value="2">ASTROID_WIDGET_SELECTED_PAGES</option>
</field>
<field ngShow="[assignment_type]==2" type="astroidassignment" label="ASTROID_ASSIGN_TO_MENU_ITEM" name="assignment"/>
</fieldset>
</fields>
</form>
</element>
11 changes: 9 additions & 2 deletions framework/elements/imagegroup/imagegroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

$enable_slider = $params->get('enable_slider', 0);
$use_masonry = $params->get('use_masonry', 0);
$use_lightbox = $params->get('use_lightbox', 0);
$slider_autoplay = $params->get('slider_autoplay', 0);
$slider_nav = $params->get('slider_nav', 1);
$slider_dotnav = $params->get('slider_dotnav', 0);
Expand Down Expand Up @@ -169,11 +170,13 @@
echo '<div>';
if ($image_params['use_link']) {
echo '<a href="'.$image_params['link'].'" title="'.$image_params['title'].'">';
} elseif ($use_lightbox) {
echo '<a href="'. Astroid\Helper\Media::getMediaPath($image_params['image']).'" data-fancybox="astroid-'.$element->id.'">';
}
echo '<div class="position-relative overflow-hidden' . $border_radius . $box_shadow . $hover_effect . $transition . '">';
echo '<img src="'. Astroid\Helper\Media::getMediaPath($image_params['image']).'" alt="'.$image_params['title'].'" class="d-inline-block">';
echo '</div>';
if ($image_params['use_link']) {
if ($image_params['use_link'] || $use_lightbox) {
echo '</a>';
}
echo '</div>';
Expand All @@ -182,8 +185,12 @@
echo '</div>';
$document = Framework::getDocument();

if ($use_lightbox) {
$document->loadFancyBox();
$document->addScriptDeclaration('Fancybox.bind(\'[data-fancybox="astroid-'.$element->id.'"]\');', 'body');
}
if ($enable_slider) {
$document->loadSlick('#'.$element->id.' .astroid-slick', implode(',', $slide_settings));
} elseif ($use_masonry) {
$document->loadMasonry();
$document->loadMasonry('.as-masonry');
}
1 change: 1 addition & 0 deletions framework/elements/imagegroup/imagegroup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
</field>

<field astroidgroup="widget_styles" ngShow="[enable_slider]==0" name="use_masonry" type="astroidradio" astroid-switch="true" default="0" label="ASTROID_USE_MASONRY"/>
<field astroidgroup="widget_styles" name="use_lightbox" type="astroidradio" astroid-switch="true" default="0" label="ASTROID_WIDGET_VIEW_IN_LIGHTBOX"/>
<field astroidgroup="widget_styles" name="border_radius" type="astroidlist" label="ASTROID_WIDGET_BORDER_RADIUS_LABEL" default="">
<option value="">ASTROID_NONE</option>
<option value="rounded">TPL_ASTROID_ICON_STYLE_ROUNDED</option>
Expand Down
2 changes: 1 addition & 1 deletion framework/html/com_content/category/blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

if ($use_masonry) {
$document = Framework::getDocument();
$document->loadMasonry();
$document->loadMasonry('.as-masonry');
}

?>
Expand Down
8 changes: 5 additions & 3 deletions framework/library/astroid/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -925,14 +925,16 @@ public function loadFancyBox(): void
self::$_fancybox = true;
}

public function loadMasonry(): void
public function loadMasonry($selector = ''): void
{
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
if (!self::$_masonry) {
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->registerAndUseScript('masonry', 'astroid/masonry.pkgd.min.js', ['relative' => true, 'version' => 'auto'], [], ['jquery']);
$wa->addInlineScript('jQuery(window).on("load", function(){$(\'.as-masonry\').masonry({itemSelector: \'.as-masonry > div\',percentPosition: true});});');
self::$_masonry = true;
}
if (!empty($selector)) {
$wa->addInlineScript('jQuery(window).on("load", function(){$(\''.$selector.'\').masonry({itemSelector: \''.$selector.' > div\',percentPosition: true});});');
}
}

public function loadSlick($obj = '', $config = ''): void
Expand Down
3 changes: 2 additions & 1 deletion framework/library/astroid/Helper/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class Constants
{
public static $astroid_version = '3.1.4';
public static $astroid_version = '3.1.5';
public static $fontawesome_version = '6.6.0';
public static $fancybox_version = '5.0';
public static $animatecss_version = '3.7.0';
Expand Down Expand Up @@ -46,6 +46,7 @@ public static function manager_configs($mode = '') : array
return [
'site_url' => Uri::root(true). '/',
'base_url' => Uri::base(true),
'root_url' => Uri::root(),
'astroid_media_url' => ASTROID_MEDIA_URL,
'template_id' => $template->id,
'template_name' => $template->template.'-'.$template->id,
Expand Down
20 changes: 19 additions & 1 deletion language/en-GB/en-GB.astroid.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@ ASTROID_ELEMENT_CATEGORY_TYPOGRAPHY="Typography"
ASTROID_ELEMENT_CATEGORY_MEDIA="Media"
ASTROID_ELEMENT_CATEGORY_UTILITY="Utility"
ASTROID_ELEMENT_CATEGORY_JOOMLA="Joomla"
ASTROID_ELEMENT_CATEGORY_ADVANCED="Advanced"

ASTROID_WIDGET_GENERAL_LABEL="General"
ASTROID_WIDGET_STYLES_LABEL="Widget Styles"
Expand Down Expand Up @@ -1340,6 +1341,7 @@ ASTROID_WIDGET_TOP_ICON="<i class='fa-lg as-icon as-icon-align-top me-1'></i> To
ASTROID_WIDGET_MIDDLE_ICON="<i class='fa-lg as-icon as-icon-align-center-horizontal me-1'></i> Middle"
ASTROID_WIDGET_BOTTOM_ICON="<i class='fa-lg as-icon as-icon-align-bottom me-1'></i> Bottom"
ASTROID_WIDGET_DISPLAY="Display"
ASTROID_WIDGET_VIEW_IN_LIGHTBOX="View in Lightbox"

; Joomla Content
ASTROID_SELECT_TEMPLATE="Select a Template"
Expand Down Expand Up @@ -1660,4 +1662,20 @@ ASTROID_WIDGET_ROWS_LABEL="Rows"
ASTROID_WIDGET_HOVER_MOTION_GALLERY_ROWS_DESC="Determine the number of image rows on the Library"
ASTROID_WIDGET_VIEW_DETAIL="View Detail"
ASTROID_WIDGET_ANGLE_LABEL="Angle"
ASTROID_WIDGET_IMAGE_ANGLE_DESC="Customize the tilt angle of the photos"
ASTROID_WIDGET_IMAGE_ANGLE_DESC="Customize the tilt angle of the photos"

; CodePen
ASTROID_WIDGET_CODEPEN_LABEL="CodePen"
ASTROID_WIDGET_CODEPEN_HTML_LABEL="<i class=\"fa-solid fa-code me-2\"></i>HTML"
ASTROID_WIDGET_CODEPEN_CSS_LABEL="<i class=\"fa-brands fa-css3 me-2\"></i>CSS"
ASTROID_WIDGET_CODEPEN_JS_LABEL="<i class=\"fa-brands fa-js me-2\"></i>JS"
ASTROID_WIDGET_CODEPEN_CUSTOM_HTML_LABEL="Insert HTML Code"
ASTROID_WIDGET_CODEPEN_CUSTOM_CSS_LABEL="Insert CSS Code"
ASTROID_WIDGET_CODEPEN_CUSTOM_JS_LABEL="Insert Javascript Code"
ASTROID_WIDGET_CODEPEN_EXTERNAL_JS_LABEL="External JS"
ASTROID_WIDGET_CODEPEN_EXTERNAL_JS_URL_LABEL="External JS URL"
ASTROID_WIDGET_CODEPEN_EXTERNAL_CSS_LABEL="External CSS"
ASTROID_WIDGET_CODEPEN_EXTERNAL_CSS_URL_LABEL="External CSS URL"
ASTROID_LIBRARIES="Astroid Libraries"
ASTROID_LIBRARIES_DESC="The system will automatically load Astroid libraries to support your scripts."
ASTROID_LIBRARIES_HINT="Select an Astroid Library"

0 comments on commit 97e8cad

Please sign in to comment.