Skip to content

Commit

Permalink
Merge pull request #7 from hiteshaggarwal/master
Browse files Browse the repository at this point in the history
Bug fixes and optimization
  • Loading branch information
hiteshaggarwal authored Jul 23, 2018
2 parents 7b36b48 + 505e640 commit 16f6309
Show file tree
Hide file tree
Showing 24 changed files with 531 additions and 223 deletions.
2 changes: 1 addition & 1 deletion astroid/astroid-framework/astroid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<libraryname>astroid</libraryname>
<author>JoomDev</author>
<creationDate>July 2018</creationDate>
<version>1.1.0</version>
<version>1.1.1</version>
<url>http://astroidframework.com</url>
<copyright>Copyright (C) 2018 Joomdev, Inc. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
3 changes: 2 additions & 1 deletion astroid/astroid-framework/framework/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class AstroidFrameworkConstants {

public static $astroid_version = '1.1.0';
public static $astroid_version = '1.1.1';
public static $fontawesome_version = '5.1.0';
public static $animatecss_version = '3.6';
public static $animations = [
Expand Down Expand Up @@ -219,6 +219,7 @@ class AstroidFrameworkConstants {
['title' => 'Dribbble', 'link' => '', 'icons' => ['fab fa-dribbble', 'fab fa-dribbble-square'], 'color' => '#F10A77', 'enabled' => false, 'icon' => 'fab fa-dribbble'],
['title' => 'Spotify', 'link' => '', 'icons' => ['fab fa-spotify'], 'color' => '#00E155', 'enabled' => false, 'icon' => 'fab fa-spotify'],
['title' => 'Flickr', 'link' => '', 'icons' => ['fab fa-flickr'], 'color' => '#0054E3', 'enabled' => false, 'icon' => 'fab fa-flickr'],
['title' => 'vk', 'link' => '', 'icons' => ['fab fa-vk'], 'color' => '#4273AD', 'enabled' => false, 'icon' => 'fab fa-vk'],
];
public static $system_fonts = [
"Arial, Helvetica, sans-serif" => 'Arial, Helvetica',
Expand Down
64 changes: 64 additions & 0 deletions astroid/astroid-framework/framework/element.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function __construct($type = '', $data = [], $template = null) {
if (!empty($data)) {
$this->id = $data['id'];
$this->data = $data['params'];
$this->raw_data = $data;
}
$this->app = JFactory::getApplication();

Expand Down Expand Up @@ -209,6 +210,12 @@ public function getClass() {
$params = $this->getParams();
$classes = [];
$classes[] = $this->template->slugify('astroid-' . $this->type);
if ($this->type == 'section') {
$section_classes = $this->getSectionClasses();
if (!empty($section_classes)) {
$classes[] = $section_classes;
}
}
$customclass = $params->get('customclass', '');
if (!empty($customclass)) {
$classes[] = $customclass;
Expand Down Expand Up @@ -238,6 +245,63 @@ public function getClass() {
return implode(' ', $classes);
}

public function getSectionClasses() {
$data = $this->raw_data;
$classes = [];

$header_module_position = $this->template->params->get('header_module_position', '');
$footer_module_position = $this->template->params->get('footer_module_position', '');

// check section has component
foreach ($data['rows'] as $row) {
foreach ($row['cols'] as $colIndex => $col) {
foreach ($col['elements'] as $element) {
if ($element['type'] == 'component') {
$classes[] = 'astroid-component-section';
break;
}
}
}
}

// check section has header
if (!empty($header_module_position)) {
foreach ($data['rows'] as $row) {
foreach ($row['cols'] as $colIndex => $col) {
foreach ($col['elements'] as $element) {
if ($element['type'] == 'module_position') {
$el = new AstroidElement('module_position', $element, $this->template);
$position = $el->getValue('position', '');
if ($position == $header_module_position) {
$classes[] = 'astroid-header-section';
}
}
break;
}
}
}
}

// check section has footer
if (!empty($header_module_position)) {
foreach ($data['rows'] as $row) {
foreach ($row['cols'] as $colIndex => $col) {
foreach ($col['elements'] as $element) {
if ($element['type'] == 'module_position') {
$el = new AstroidElement('module_position', $element, $this->template);
$position = $el->getValue('position', '');
if ($position == $footer_module_position) {
$classes[] = 'astroid-footer-section';
}
}
break;
}
}
}
}
return implode(' ', $classes);
}

public function getAnimation() {
$params = $this->getParams();
$animation = $params->get('animation', '');
Expand Down
2 changes: 1 addition & 1 deletion astroid/astroid-framework/framework/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function renderLayout() {
$renderedHTML .= $el->render();
}
if (empty($renderedHTML)) {
$bufferSize = $col['size'];
$bufferSize += $col['size'];
} else {
if ($hasComponent) {
$row['cols'][$componentIndex]['size'] = $row['cols'][$componentIndex]['size'] + $bufferSize;
Expand Down
2 changes: 1 addition & 1 deletion astroid/astroid-framework/plugins/astroid/astroid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>Astroid Plugin</name>
<author>JoomDev</author>
<creationDate>June 2018</creationDate>
<version>1.1.0</version>
<version>1.1.1</version>
<url>http://www.joomdev.com</url>
<copyright>Copyright (C) 2018 Joomdev, Inc. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
Expand Down
14 changes: 7 additions & 7 deletions astroid/astroid-template-zero/astroid/options/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<field astroidgroup="body" name="body_link_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_LINK_COLOR_COLOR_LABEL" description="TPL_ASTROID_LINK_COLOR_COLOR_DESC">
</field>
<field astroidgroup="body" name="body_link_hover_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_LINK_HOVER_COLOR_COLOR_LABEL" description="TPL_ASTROID_LINK_HOVER_COLOR_COLOR_DESC">
</field>
</field>
<field astroidgroup="header_colors" name="header_bg" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_HEADER_BACKGROUND_COLOR_LABEL" description="TPL_ASTROID_COLOURS_HEADER_BACKGROUND_COLOR_DESC">
</field>
<field astroidgroup="header_colors" name="header_text_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_HEADER_TEXT_COLOR_LABEL" description="TPL_ASTROID_COLOURS_HEADER_TEXT_COLOR_DESC">
Expand All @@ -30,22 +30,22 @@
</field>
<field astroidgroup="main_menu" name="main_menu_link_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_MENU_LINK_COLOR_LABEL" description="TPL_ASTROID_COLOURS_MENU_LINK_COLOR_DESC">
</field>
<field astroidgroup="main_menu" name="main_menu_link_hover_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_MENU_LINK_HOVER_COLOR_LABEL" description="TPL_ASTROID_COLOURS_MENU_LINK_HOVER_COLOR_DESC">
</field>
<field astroidgroup="main_menu" name="main_menu_link_active_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_MENU_LINK_ACTIVE_COLOR_LABEL" description="TPL_ASTROID_COLOURS_MENU_LINK_ACTIVE_COLOR_DESC">
</field>
<field astroidgroup="main_menu" name="main_menu_link_hover_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_MENU_LINK_HOVER_COLOR_LABEL" description="TPL_ASTROID_COLOURS_MENU_LINK_HOVER_COLOR_DESC">
</field>
<field astroidgroup="dropdown_menu" name="dropdown_bg_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_DROPDOWN_BACKGROUND_COLOR_LABEL" description="TPL_ASTROID_COLOURS_DROPDOWN_BACKGROUND_COLOR_DESC">
</field>
<field astroidgroup="dropdown_menu" name="dropdown_link_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_DROPDOWN_LINK_COLOR_LABEL" description="TPL_ASTROID_COLOURS_DROPDOWN_LINK_COLOR_DESC">
</field>
<field astroidgroup="dropdown_menu" name="dropdown_menu_link_hover_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_DROPDOWN_HOVER_LINK_COLOR_LABEL" description="TPL_ASTROID_COLOURS_DROPDOWN_HOVER_LINK_COLOR_DESC">
</field>
<field astroidgroup="dropdown_menu" name="dropdown_menu_hover_bg_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_DROPDOWN_HOVER_BACKGROUND_COLOR_LABEL" description="TPL_ASTROID_COLOURS_DROPDOWN_HOVER_BACKGROUND_COLOR_DESC">
</field>
<field astroidgroup="dropdown_menu" name="dropdown_menu_active_link_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_DROPDOWN_ACTIVE_LINK_COLOR_LABEL" description="TPL_ASTROID_COLOURS_DROPDOWN_ACTIVE_LINK_COLOR_DESC">
</field>
<field astroidgroup="dropdown_menu" name="dropdown_menu_active_bg_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_DROPDOWN_ACTIVE_BACKGROUND_COLOR_LABEL" description="TPL_ASTROID_COLOURS_DROPDOWN_ACTIVE_BACKGROUND_COLOR_DESC">
</field>
<field astroidgroup="dropdown_menu" name="dropdown_menu_link_hover_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_DROPDOWN_HOVER_LINK_COLOR_LABEL" description="TPL_ASTROID_COLOURS_DROPDOWN_HOVER_LINK_COLOR_DESC">
</field>
<field astroidgroup="dropdown_menu" name="dropdown_menu_hover_bg_color" type="astroidcolor" large="true" default="" label="TPL_ASTROID_COLOURS_DROPDOWN_HOVER_BACKGROUND_COLOR_LABEL" description="TPL_ASTROID_COLOURS_DROPDOWN_HOVER_BACKGROUND_COLOR_DESC">
</field>
<field astroidgroup="off_canvas" name="mobile_backgroundcolor" type="astroidcolor" default="" label="TPL_ASTROID_OFF_CANVAS_BACKGROUND_LABEL" description="TPL_ASTROID_OFF_CANVAS_BACKGROUND_DESC">
</field>
<field astroidgroup="off_canvas" name="mobile_menu_text_color" type="astroidcolor" default="" label="TPL_ASTROID_COLOURS_OFF_CANVAS_TEXT_LABEL" description="TPL_ASTROID_COLOURS_OFF_CANVAS_TEXT_DESC">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
<option value="before">TPL_ASTROID_BEFORE_MODULE</option>
</field>

<field astroidgroup="contact_info" name="contact_address" type="astroidtext" label="TPL_ASTROID_MISCELL_ADDRESS_LABEL" default="15 Barnes Wallis Way, West Road, Chorley, USA" description="TPL_ASTROID_MISCELL_ADDRESS_DESC" hint="15 Barnes Wallis Way, West Road, Chorley, USA" ngShow="contact_details=='1'" class="form-control">
<field astroidgroup="contact_info" name="contact_address" type="astroidtext" label="TPL_ASTROID_MISCELL_ADDRESS_LABEL" description="TPL_ASTROID_MISCELL_ADDRESS_DESC" hint="15 Barnes Wallis Way, West Road, Chorley, USA" ngShow="contact_details=='1'" class="form-control">
</field>

<field astroidgroup="contact_info" name="contact_phone_number" type="astroidtext" label="TPL_ASTROID_MISCELL_PHONE_NUMBER_LABEL" description="TPL_ASTROID_MISCELL_PHONE_NUMBER_DESC" default="(888) 888-1234" hint="+1 123 456 7890" ngShow="contact_details=='1'" class="form-control">
<field astroidgroup="contact_info" name="contact_phone_number" type="astroidtext" label="TPL_ASTROID_MISCELL_PHONE_NUMBER_LABEL" description="TPL_ASTROID_MISCELL_PHONE_NUMBER_DESC" hint="+1 123 456 7890" ngShow="contact_details=='1'" class="form-control">
</field>

<field astroidgroup="contact_info" name="contact_mobile_number" type="astroidtext" label="TPL_ASTROID_MISCELL_MOBILE_NUMBER_LABEL" description="TPL_ASTROID_MISCELL_MOBILE_NUMBER_DESC" hint="+1 123 456 7890" ngShow="contact_details=='1'" class="form-control">
Expand Down
49 changes: 25 additions & 24 deletions astroid/astroid-template-zero/frontend/colors.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Astroid Framework
* @author JoomDev https://www.joomdev.com
Expand Down Expand Up @@ -28,7 +29,7 @@
$main_link_hover_color = $template->params->get('main_menu_link_hover_color', '');
$main_link_active_color = $template->params->get('main_menu_link_active_color', '');

// Dropdowns
// Dropdown Menu
$dropdown_main_background_color = $template->params->get('dropdown_bg_color', '');
$dropdown_main_link_color = $template->params->get('dropdown_link_color', '');
$dropdown_main_hover_link_color = $template->params->get('dropdown_menu_link_hover_color', '');
Expand All @@ -44,7 +45,7 @@
$mobile_active_link_color = $template->params->get('mobile_menu_active_link_color', '');
$mobile_active_background_color = $template->params->get('mobile_menu_active_bg_color', '');

//Footer
// Footer
$footer_background_color = $template->params->get('footer_bg_color', '');
$footer_text_color = $template->params->get('footer_text_color', '');
$footer_link_color = $template->params->get('footer_link_color', '');
Expand All @@ -71,28 +72,13 @@

<?php

// Main Menu Coloring
$main_menu_styles = [];
if (!empty($main_link_color)) {
$main_menu_styles[] = '.astroid-nav .nav-link,.astroid-nav .nav-link{ color: ' . $main_link_color . ' !important;}';
}
if (!empty($main_link_hover_color)) {
$main_menu_styles[] = '.astroid-nav .nav-link:hover, .astroid-nav .nav-link:hover{ color: ' . $main_link_hover_color . ' !important;}';
}
if (!empty($main_link_active_color)) {
$main_menu_styles[] = '.astroid-nav .nav-link.active, .astroid-nav .nav-link.active{ color: ' . $main_link_active_color . ' !important;}';
}
?>

<?php

// Header Coloring
$header_styles = [];
if (!empty($header_background_color)) {
$header_styles[] = 'header{ background-color: ' . $header_background_color . ' !important;}';
$header_styles[] = '.astroid-header-section{ background-color: ' . $header_background_color . ' !important;}';
}
if (!empty($header_text_color)) {
$header_styles[] = 'header *{ color: ' . $header_text_color . ' !important;}';
$header_styles[] = 'header{ color: ' . $header_text_color . ' !important;}';
}
if (!empty($header_logo_text_color)) {
$header_styles[] = '.astroid-logo-text .site-title{ color: ' . $header_logo_text_color . ' !important;}';
Expand All @@ -107,10 +93,25 @@

<?php

// Main Menu Coloring
$main_menu_styles = [];
if (!empty($main_link_color)) {
$main_menu_styles[] = '.astroid-nav .nav-link{ color: ' . $main_link_color . ' !important;}';
}
if (!empty($main_link_hover_color)) {
$main_menu_styles[] = '.astroid-nav .nav-link:hover, .astroid-nav .nav-link:focus{ color: ' . $main_link_hover_color . ' !important;}';
}
if (!empty($main_link_active_color)) {
$main_menu_styles[] = '.astroid-nav .nav-link.active{ color: ' . $main_link_active_color . ' !important;}';
}
?>

<?php

// Dropdown Coloring
$dropdown_styles = [];
if (!empty($dropdown_main_background_color)) {
$dropdown_styles[] = '.astroid-nav .navbar-subnav,.astroid-nav .has-subnav.nav-item-level-1.hovered:after,.astroid-nav .has-subnav.nav-item-level-1.hovered:before{ background: ' . $dropdown_main_background_color . ' !important;}';
$dropdown_styles[] = '.astroid-nav .navbar-subnav, .astroid-nav .has-subnav.nav-item-level-1.hovered:after, .astroid-nav .has-subnav.nav-item-level-1.hovered:before{ background: ' . $dropdown_main_background_color . ' !important;}';
$dropdown_styles[] = '.astroid-nav .megamenu-container,.astroid-nav .has-megamenu.nav-item-level-1.hovered:after,.astroid-nav .has-megamenu.nav-item-level-1.hovered:before{ background: ' . $dropdown_main_background_color . ' !important;}';
}
if (!empty($dropdown_main_link_color)) {
Expand All @@ -137,7 +138,7 @@

<?php

// MobilemenuColoring
// Mobile Menu Coloring
$mobilemenu_styles = [];
if (!empty($mobile_background_color)) {
$mobilemenu_styles[] = '.astroid-mobilemenu-container .astroid-mobilemenu-inner .menu-item a,.astroid-mobilemenu-container .astroid-mobilemenu-inner .menu-item .menu-indicator,.astroid-mobilemenu-container .astroid-mobilemenu-inner .menu-indicator-back{ background-color: ' . $mobile_background_color . ' !important;}';
Expand All @@ -161,10 +162,10 @@

<?php

// MobilemenuColoring
// Footer Coloring
$footer_styles = [];
if (!empty($footer_background_color)) {
$footer_styles[] = '#astroid-footer{ background-color: ' . $footer_background_color . ' !important;}';
$footer_styles[] = '.astroid-footer-section{ background-color: ' . $footer_background_color . ' !important;}';
}
if (!empty($footer_text_color)) {
$footer_styles[] = '#astroid-footer{ color: ' . $footer_text_color . ' !important;}';
Expand All @@ -182,8 +183,8 @@
$document = JFactory::getDocument();
$document->addStyledeclaration(implode('', $body_styles));
$document->addStyledeclaration(implode('', $header_styles));
$document->addStyledeclaration(implode('', $main_menu_styles));
$document->addStyledeclaration(implode('', $dropdown_styles));
$document->addStyledeclaration(implode('', $mobilemenu_styles));
$document->addStyledeclaration(implode('', $main_menu_styles));
$document->addStyledeclaration(implode('', $footer_styles));
?>
Loading

0 comments on commit 16f6309

Please sign in to comment.