Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/menu-language.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<button class="btn btn-js-styled js-menu-language-settings-toggle js-prevent-sideclick"></button>
</li>
{% endif %}
<li class="menu-item-cms js-mobile-menu-button-wrapper">{% include "menu-settings-editor" %} </li>
</ul>
{% endif %}
</nav>
Expand Down
2 changes: 1 addition & 1 deletion components/menu-mobile.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{% endfor %}
{% if editmode %}
<li class="edit-btn">{% languageadd %}</li>
{% endif %}
{% endif %}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Üleliigsed tühikud

</ul>
</div>
{% endif %}
Expand Down
67 changes: 67 additions & 0 deletions components/menu-settings-editor.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{% if editmode %}
<button class="mobile-menu-button-settings"></button>
{% endif %}

{% editorjsblock %}
<!-- Settings popover javascript. -->
<script
src="{{ site.static_asset_host }}/libs/edicy-tools/latest/edicy-tools.js"
></script>

<!-- Setings popover initiation. -->
<script>
var siteData = new Edicy.CustomData({
type: 'site',
id: {{ site.id }}

@siimha siimha Aug 12, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lehe datal pole id-d

});

{% if site.data.mobile_menu_button_settings %}
var valuesObj = {{ site.data.mobile_menu_button_settings | json }};
{% else %}
var valuesObj = {};
{% endif %};

var mobileMenuSettingsButton = document.querySelector('.mobile-menu-button-settings');

var SettingsEditor = new Edicy.SettingsEditor(mobileMenuSettingsButton, {
menuItems: [
{
"titleI18n": "menu_positioning",
"type": "radio",
"key": "menu_positioning",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lisada ka tooltip nagu antud PRis.

"list": [
{
"titleI18n": "fixed_in_header",
"value": ""
},
{
"titleI18n": "always_visible",
"value": "visible-when"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need väärtused on vahetusse läinud:

{
  "titleI18n": "always_visible",
  "value": "visible-when"
},
{
  "titleI18n": "visible_when_scrolling_up",
  "value": "always-visible"
}
            

},
{
"titleI18n": "visible_when_scrolling_up",
"value": "always-visible"
},
],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Komad üleliigsed objektil ja arrayl. Liigne tühi rida.

},
],

// Binded data object which should contain custom data object.
values: valuesObj,

// Style type the button.
buttonStyle: 'default',
// Title for the button.
buttonTitleI18n: 'mobile_view_settings',

commit: function(data) {
siteData.set('mobile_menu_button_settings', data, {
success: function() {
window.location.reload();
}
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Joondus paigast.

}
});
</script>
{% endeditorjsblock %}
2 changes: 1 addition & 1 deletion components/site-header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="header-title content-area">{% unless editmode %}<a href="{{ site.root_item.url }}">{% endunless %}{% editable site.header %}{% unless editmode %}</a>{% endunless %}</div>
</div>

<div class="header-right js-header-right">
<div class="header-right {{ site.data.menu_position_settings.menu_positioning }} js-header-right">

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data nimetus peaks olema mobile_menu_button_settings

{% include "menu-main" %}

<div class="site-options">
Expand Down
27 changes: 26 additions & 1 deletion javascripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@
return $('html').hasClass('editmode');
};

// show mobile menu on scrolling up
var lastScrollTop = 0;
$(window).scroll(function() {
var st = $(this).scrollTop();
if (st > lastScrollTop) {
setTimeout(function(){
$('.visible-when').removeClass('scrolling');
}, 400);
} else {
$('.visible-when').addClass('scrolling');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Üleliigne tühi rida

}
lastScrollTop = st;
});

// Function to limit the rate at which a function can fire.
var debounce = function(func, wait, immediate) {
var timeout;
Expand Down Expand Up @@ -249,6 +264,15 @@
}
};

var toggleMobileMenuButtonPosition = function() {
var $mobileMenuButtonElement = $('.js-mobile-menu-button-wrapper');
if ($(window).width() <= 1024) {
$mobileMenuButtonElement.appendTo('.js-menu-main-mobile');
} else if ($(window).width() > 1024) {
$mobileMenuButtonElement.appendTo('.js-menu-language-popover-setting-parent');
}
};

var bindFallbackHeaderLeftWidthCalculation = function() {
var headerWidth = $('.js-header-top-wrap').width(),
headerRight = $('.js-header-right'),
Expand Down Expand Up @@ -813,6 +837,7 @@
commentsHeight();
handleMobileSearchHeight();
toggleLanguageSettingsLocation();
toggleMobileMenuButtonPosition();

$('.js-menu-language-settings-popover').hide();
}, 100));
Expand Down Expand Up @@ -1040,7 +1065,7 @@
focusFormWithErrors();
//autoSizeFormCommentArea();
detectDesignEditorChanges();

toggleMobileMenuButtonPosition();
if (!Modernizr.flexbox && editmode()) {
bindFallbackHeaderLeftWidthCalculation();
}
Expand Down
2 changes: 1 addition & 1 deletion javascripts/main.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@
"layout_name": "menu-mobile",
"title": "menu-mobile"
},
{
"content_type": "component",
"component": true,
"file": "components/menu-settings-editor.tpl",
"layout_name": "menu-settings-editor",
"title": "menu-settings-editor"
},
{
"content_type": "component",
"component": true,
Expand Down
27 changes: 26 additions & 1 deletion sources/javascripts/concat/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
return $('html').hasClass('editmode');
};

// show mobile menu on scrolling up
var lastScrollTop = 0;
$(window).scroll(function() {
var st = $(this).scrollTop();
if (st > lastScrollTop) {
setTimeout(function(){
$('.visible-when').removeClass('scrolling');
}, 400);
} else {
$('.visible-when').addClass('scrolling');

}
lastScrollTop = st;
});

// Function to limit the rate at which a function can fire.
var debounce = function(func, wait, immediate) {
var timeout;
Expand Down Expand Up @@ -194,6 +209,15 @@
}
};

var toggleMobileMenuButtonPosition = function() {
var $mobileMenuButtonElement = $('.js-mobile-menu-button-wrapper');
if ($(window).width() <= 1024) {
$mobileMenuButtonElement.appendTo('.js-menu-main-mobile');
} else if ($(window).width() > 1024) {
$mobileMenuButtonElement.appendTo('.js-menu-language-popover-setting-parent');
}
};

var bindFallbackHeaderLeftWidthCalculation = function() {
var headerWidth = $('.js-header-top-wrap').width(),
headerRight = $('.js-header-right'),
Expand Down Expand Up @@ -758,6 +782,7 @@
commentsHeight();
handleMobileSearchHeight();
toggleLanguageSettingsLocation();
toggleMobileMenuButtonPosition();

$('.js-menu-language-settings-popover').hide();
}, 100));
Expand Down Expand Up @@ -985,7 +1010,7 @@
focusFormWithErrors();
//autoSizeFormCommentArea();
detectDesignEditorChanges();

toggleMobileMenuButtonPosition();
if (!Modernizr.flexbox && editmode()) {
bindFallbackHeaderLeftWidthCalculation();
}
Expand Down
27 changes: 8 additions & 19 deletions sources/stylesheets/components/_navigation-menus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
}

.menu-item-cms {
margin-left: 10px;
margin-left: 15px;

&.float-right {
float: right;
Expand Down Expand Up @@ -221,21 +221,13 @@
}
}

.mobilemenu-open,
.mobilesearch-open {
position: fixed;
overflow: hidden;
top: 0;
left: 0;
width: 100%;
height: 100%;

#mobile-menu {
position: absolute;
top: 0;
width: 250px;
height: 100%;
}
}

.mobile-menu-toggler {
Expand Down Expand Up @@ -298,15 +290,12 @@

#mobile-menu {
transition: transform .5s;
transform: translate3d(100%, 0, 0);
font-family: $font-main;
position: fixed;
z-index: 1000;
top: 0;
right: 0;
position: fixed;
overflow: auto;
height: 100%;
display: block;
overflow: auto;
box-sizing: border-box;
width: 250px;
padding: 30px 20px;
Expand All @@ -325,7 +314,8 @@
}

.mobilemenu-open & {
transform: translate3d(0, 0, 0);
right: 0px;
top: 0px;
}

.search-open-btn {
Expand Down Expand Up @@ -698,16 +688,15 @@ $flags:

&.menu-item-cms {
padding-right: 18px;
padding-left: 18px;

padding-bottom: 10px;
&:last-child {
padding-top: 5px;
padding-bottom: 10px;

.language-menu-mode-list & {
padding-right: 9px;
}

#mobile-menu & {
padding-top: 0;
padding-left: 0
Expand Down
26 changes: 26 additions & 0 deletions sources/stylesheets/components/_site-header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,32 @@

@media screen and (max-width: $tablet-1) {
margin-top: 1px;

&.always-visible {
position: fixed;
top: 40px;
right: 40px;
z-index: 1001;
height: 100vh;

.mobilemenu-open & {
right: 270px;
}
}

&.visible-when, {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Koma on üleliigne &.visible-when, seda tuleb kasutada vaid siis kui sihitakse ka mingit muud klassi. Võib kasutada &.visible-when. scrolling { stiilid }.

&.scrolling {
position: fixed;
top: 40px;
right: 40px;
z-index: 1001;
height: 100vh;

.mobilemenu-open & {
right: 270px;
}
}
}
}

@media screen and (max-width: $tablet-3) {
Expand Down
19 changes: 8 additions & 11 deletions sources/stylesheets/general/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// BASICS
// =============================================================================
html {

@media screen and (max-width: $tablet-3) {
&.search-open,
&.comments-open {
Expand Down Expand Up @@ -30,16 +31,12 @@ body {
height: 100%;
overflow: hidden;
}
}

@media screen and (max-width: $tablet-3) {
.mobilemenu-open & {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
.js-background-type {
.mobilemenu-open & {
position: relative;
left: -250px;
}
}
}
}
Expand Down Expand Up @@ -114,7 +111,6 @@ a {
.site-container {
margin: 0 auto;
position: relative;
perspective: 1000px;
-webkit-transition: -webkit-transform 0.5s;
transition: transform 0.5s;

Expand Down Expand Up @@ -143,7 +139,8 @@ a {

.mobilemenu-open & {
@media screen and (max-width: $tablet-1) {
transform: translate3d(-250px, 0, 0);
position: absolute;
left: -250px;
}

&:after {
Expand Down
Loading