Skip to content

Commit

Permalink
Merge pull request #808 from gotdibbs/Issue788
Browse files Browse the repository at this point in the history
Corrected settings menu bugs
  • Loading branch information
ErisDS committed Sep 18, 2013
2 parents 1bf36f5 + ebe7053 commit 1fc7966
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion core/client/assets/sass/layouts/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,8 @@ body.zen {
position: relative;
top: 1px;

&:hover {
&:hover,
&.active {
color: $lightgrey;
}
}
Expand Down
24 changes: 21 additions & 3 deletions core/client/toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
(function () {
"use strict";

Ghost.temporary.hideToggles = function () {
$('[data-toggle]').each(function () {
var toggle = $(this).data('toggle');
$(this).parent().children(toggle + ':visible').fadeOut();
});

// Toggle active classes on menu headers
$("[data-toggle].active").removeClass("active");
};

Ghost.temporary.initToggles = function ($el) {

$el.find('[data-toggle]').each(function () {
Expand All @@ -14,9 +24,17 @@
$el.find('[data-toggle]').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
$(this).toggleClass('active');
var toggle = $(this).data('toggle');
$(this).parent().children(toggle).fadeToggle(200).toggleClass('open');
var $this = $(this),
toggle = $this.data('toggle'),
isAlreadyActive = $this.is('.active');

// Close all the other open toggle menus
Ghost.temporary.hideToggles();

if (!isAlreadyActive) {
$this.toggleClass('active');
$(this).parent().children(toggle).toggleClass('open').fadeToggle(200);
}
});

};
Expand Down

0 comments on commit 1fc7966

Please sign in to comment.