Skip to content

Commit

Permalink
Merge branch 'release/5.0.0-beta.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
w00fz committed Apr 24, 2015
2 parents 1b9014a + b949df9 commit 0ab80c7
Show file tree
Hide file tree
Showing 106 changed files with 2,312 additions and 1,307 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ Gantry 5 is a framework by which Gantry-powered themes are made. In order for a

The first thing you need to do is download the latest build of Gantry 5 and Hydrogen. You can do so by clicking the links below, or via [GitHub](http://github.com/gantry/gantry5/).

* [Download Gantry 5](https://github.com/gantry/gantry5/releases/download/5.0.0-beta.3/joomla-pkg_gantry5_v5.0.0-beta.3.zip)
* [Download Hydrogen Theme](https://github.com/gantry/gantry5/releases/download/5.0.0-beta.3/joomla-tpl_g5_hydrogen_v5.0.0-beta.3.zip)
* [Download Gantry 5](https://github.com/gantry/gantry5/releases/download/5.0.0-beta.4/joomla-pkg_gantry5_v5.0.0-beta.4.zip)
* [Download Hydrogen Theme](https://github.com/gantry/gantry5/releases/download/5.0.0-beta.4/joomla-tpl_g5_hydrogen_v5.0.0-beta.4.zip)

>>> During the initial beta, the **Framework** and **Template** are being distributed in different installable packages. A bundled package is planned, but will likely be available after the initial beta launch.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0-beta.3
5.0.0-beta.4
52 changes: 41 additions & 11 deletions assets/common/application/menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ var Menu = new prime({
this.active = null;
this.location = [];

var mainContainer = $(this.selectors.mainContainer);
if (!mainContainer) { return; }

if (hasTouchEvents) {
$(this.selectors.mainContainer).addClass(this.states.touchEvents);
mainContainer.addClass(this.states.touchEvents);
}

this.attach();
Expand All @@ -65,7 +68,8 @@ var Menu = new prime({
body.delegate('click', ':not(' + selectors.mainContainer + ') ' + selectors.linkedParent + ', .g-fullwidth .g-sublevel ' + selectors.linkedParent, this.bound('click'));

if (hasTouchEvents) {
$(selectors.linkedParent).on('touchend', this.bound('touchend'));
var linkedParent = $(selectors.linkedParent);
if (linkedParent) { linkedParent.on('touchend', this.bound('touchend')); }
this.overlay.on('touchend', this.bound('closeAllDropdowns'));
}

Expand Down Expand Up @@ -130,15 +134,15 @@ var Menu = new prime({
}, this));
}

if ((menuType == 'megamenu' || !parent.parent(selectors.mainContainer)) && (parent.find(' > ' + selectors.dropdown) || isGoingBack)) {
if ((menuType == 'megamenu' || !parent.parent(selectors.mainContainer)) && (parent.find(' > ' + selectors.dropdown + ', > * > ' + selectors.dropdown) || isGoingBack)) {
var sublevel = target.parent('.g-sublevel') || target.parent('.g-toplevel'),
slideout = parent.find('.g-sublevel'),
columns = parent.parent('.g-dropdown-column'),
blocks;

if (sublevel) {
var isNavMenu = target.parent(selectors.mainContainer);
if (isNavMenu && !sublevel.hasClass('g-toplevel')) { this._fixHeights(sublevel, slideout, isGoingBack); }
if (!isNavMenu || (isNavMenu && !sublevel.matches('.g-toplevel'))) { this._fixHeights(sublevel, slideout, isGoingBack, isNavMenu); }
if (!isNavMenu && columns && (blocks = columns.search('> .g-grid > .g-block'))) {
if (blocks.length > 1) { sublevel = blocks.search('> .g-sublevel'); }
}
Expand Down Expand Up @@ -193,6 +197,17 @@ var Menu = new prime({
this.toggleOverlay(topLevel);
},

resetStates: function(menu) {
if (!menu) { return; }
var items = menu.search('.g-toplevel, .g-dropdown-column, .g-dropdown, .g-selected, .g-active, .g-slide-out'),
actives = menu.search('.g-active');
if (!items) { return; }

menu.attribute('style', null).removeClass('g-selected').removeClass('g-slide-out');
items.attribute('style', null).removeClass('g-selected').removeClass('g-slide-out');
if (actives) { actives.removeClass('g-active').addClass('g-inactive'); }
},

toggleOverlay: function(menu) {
if (!menu) { return; }
var shouldOpen = !!menu.find('.g-active, .g-selected');
Expand All @@ -201,19 +216,33 @@ var Menu = new prime({
this.overlay[0].style.opacity = shouldOpen ? 1 : 0;
},

_fixHeights: function(parent, sublevel, isGoingBack) {
_fixHeights: function(parent, sublevel, isGoingBack, isNavMenu) {
if (parent == sublevel) { return; }
if (isGoingBack) { parent.attribute('style', null); }

var heights = {
from: parent[0].getBoundingClientRect(),
to: sublevel[0].getBoundingClientRect()
};
from: parent[0].getBoundingClientRect(),
to: (!isNavMenu ? sublevel.parent('.g-dropdown')[0] : sublevel[0]).getBoundingClientRect()
},
height = Math.max(heights.from.height, heights.to.height);

if (!isGoingBack) {
// if from height is < than to height set the parent height else, set the target
if (heights.from.height < heights.to.height) { parent[0].style.height = Math.max(heights.from.height, heights.to.height) + 'px'; }
else { sublevel[0].style.height = Math.max(heights.from.height, heights.to.height) + 'px'; }
if (heights.from.height < heights.to.height) { parent[0].style.height = height + 'px'; }
else { sublevel[0].style.height = height + 'px'; }

// fix sublevels heights in side menu (offcanvas etc)
if (!isNavMenu) {
var maxHeight = height,
block = $(sublevel).parent('.g-block:not(.size-100)'),
column = block ? block.parent('.g-dropdown-column') : null;
(sublevel.parents('.g-slide-out, .g-dropdown-column') || parent).forEach(function(slideout) {
maxHeight = Math.max(height, parseInt(slideout.style.height, 10));
});

if (column) { column[0].style.height = maxHeight + 'px'; }
sublevel[0].style.height = maxHeight + 'px';
}
}
},

Expand All @@ -226,7 +255,6 @@ var Menu = new prime({
},

_checkQuery: function(mq) {

var selectors = this.options.selectors,
mobileContainer = $(selectors.mobileContainer),
mainContainer = $(selectors.mainContainer),
Expand All @@ -239,6 +267,8 @@ var Menu = new prime({
find = mobileContainer.find(selectors.topLevel);
if (find) { find.top(mainContainer); }
}

this.resetStates(find);
},

_debug: function() {}
Expand Down
23 changes: 14 additions & 9 deletions assets/common/application/offcanvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var ready = require('domready'),
forEach = require('mout/array/forEach'),
mapNumber = require('mout/math/map'),
clamp = require('mout/math/clamp'),
timeout = require('mout/function/timeout'),
trim = require('mout/string/trim'),
decouple = require('../utils/decouple'),
Bound = require('prime-util/prime/bound'),
Expand Down Expand Up @@ -336,8 +337,8 @@ var Offcanvas = new prime({

_checkTogglers: function(mutator) {
var togglers = $('[data-offcanvas-toggle], [data-offcanvas-open], [data-offcanvas-close]'),
blocks = this.offcanvas.search('.g-block'),
mobileContainer = $('#g-mobilemenu-container');
mobileContainer = $('#g-mobilemenu-container'),
blocks;

// if there is no mobile menu there's no need to check the offcanvas mutation
if (!mobileContainer) {
Expand All @@ -348,14 +349,18 @@ var Offcanvas = new prime({
if (!togglers || (mutator && ((mutator.target || mutator.srcElement) !== mobileContainer[0]))) { return; }
if (this.opened) { this.close(); }

var shouldCollapse = (blocks && blocks.length == 1) && mobileContainer && !trim(this.offcanvas.text()).length;
togglers[shouldCollapse ? 'addClass' : 'removeClass']('g-offcanvas-hide');
timeout(function(){
blocks = this.offcanvas.search('.g-block');
var shouldCollapse = (blocks && blocks.length == 1) && mobileContainer && !trim(this.offcanvas.text()).length;

if (!shouldCollapse && !this.attached) { this.attach(); }
else if (shouldCollapse && this.attached) {
this.detach();
this.attachMutationEvent();
}
togglers[shouldCollapse ? 'addClass' : 'removeClass']('g-offcanvas-hide');

if (!shouldCollapse && !this.attached) { this.attach(); }
else if (shouldCollapse && this.attached) {
this.detach();
this.attachMutationEvent();
}
}, 0, this);
}
});

Expand Down
77 changes: 56 additions & 21 deletions assets/common/js/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 8 additions & 18 deletions bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,32 +58,22 @@ if [ -f $GIT_TARGET/configuration.php ]; then
elif [ -f $GIT_TARGET/wp-config.php ]; then
PLATFORM=WordPress
sources=(
'platforms/wordpress/gantryadmin'
# Admin
'platforms/wordpress/gantry5'
'platforms/common'
'src'
'vendor'
# Themes
'themes/hydrogen/wordpress'
'themes/hydrogen/common'
'themes/hydrogen-demo/wordpress'
'themes/hydrogen-demo/common'
'themes/gantry/wordpress'
'themes/gantry/common'
'src'
'vendor'
)
targets=(
'wp-content/plugins/gantryadmin'
'wp-content/plugins/gantryadmin/common'
'wp-content/plugins/gantryadmin/src'
'wp-content/plugins/gantryadmin/vendor'
# Admin
'wp-content/plugins/gantry5'
'wp-content/plugins/gantry5/common'
'wp-content/plugins/gantry5/src'
# Themes
'wp-content/themes/hydrogen'
'wp-content/themes/hydrogen/common'
'wp-content/themes/hydrogen/src'
'wp-content/themes/hydrogen/vendor'
'wp-content/themes/hydrogen-demo'
'wp-content/themes/hydrogen-demo/common'
'wp-content/themes/hydrogen-demo/src'
'wp-content/themes/hydrogen-demo/vendor'
)
elif [ -f $GIT_TARGET/system/config/system.yaml ]; then
PLATFORM=Grav
Expand Down

0 comments on commit 0ab80c7

Please sign in to comment.