Add menu positioning settings#304
Conversation
|
Vajaminevad tõlked settings nupule: Mobiilse vaate seaded - Mobile view settings |
Added mobile menu view settings button for desktop and mobile view. Also added for script window.location.reload(); and removed overflow: scroll from css. Closes #304
siimha
left a comment
There was a problem hiding this comment.
Tõlked võiksid panna ka slacki keelepolitsei kanalisse ja kui sealt ka kinnitus, siis tuleks need CMSi lisada
| @@ -0,0 +1,69 @@ | |||
| {% if editmode %} | |||
| <button class="menu-position-settings"></button> | |||
There was a problem hiding this comment.
Kasutada paremat klassi nimetust, näiteks mobile-menu-button-settings
| var valuesObj = {}; | ||
| {% endif %}; | ||
|
|
||
| var productDescrptionBtn = document.querySelector('.menu-position-settings'); |
There was a problem hiding this comment.
Kasutada muutujal paremat nimetus, näiteks mobileMenuSettingsButton
| var SettingsEditor = new Edicy.SettingsEditor(productDescrptionBtn, { | ||
| menuItems: [ | ||
| { | ||
| "title": "Menu positioning", |
There was a problem hiding this comment.
Kasutada CMSist tulevaid tõlkeid. Selleks kasutada I18 võtmeid nagu on antud PRis.
| { | ||
| "title": "Menu positioning", | ||
| "type": "radio", | ||
| "key": "menu_positioning", |
| buttonActiveClass: 'settings-popover-open', | ||
|
|
||
| commit: function(data) { | ||
| siteData.set('menu_position_settings', data, { |
There was a problem hiding this comment.
Kasutada paremat võtme nimetust nt. mobile_menu_button_settings
| } | ||
| }; | ||
|
|
||
| var togglePositionSettingsLocation = function() { |
There was a problem hiding this comment.
Selle nimetus võiks olla toggleMobileMenuButtonPosition
| var $positionSettingsMenuElement = $('.js-menu-position-settings'); | ||
| if ($(window).width() <= 1024) { | ||
| $positionSettingsMenuElement.appendTo('.js-menu-main-mobile'); | ||
| console.log($positionSettingsMenuElement, 'smaller then'); |
There was a problem hiding this comment.
Console.log() eemaldada
| // Title for the button. | ||
| buttonTitle: 'Mobiilse vaate seaded', | ||
| // Class for the button while Settings Editor is visible. | ||
| buttonActiveClass: 'settings-popover-open', |
There was a problem hiding this comment.
Seda klassi ei kasutata vist millekski settings-popover-open
| }; | ||
|
|
||
| var togglePositionSettingsLocation = function() { | ||
| var $positionSettingsMenuElement = $('.js-menu-position-settings'); |
There was a problem hiding this comment.
Selle muutja nimetus võiks olla mobileMenuButtonElement
| <button class="btn btn-js-styled js-menu-language-settings-toggle js-prevent-sideclick"></button> | ||
| </li> | ||
| {% endif %} | ||
| <li class="menu-item-cms js-menu-position-settings">{% include "menu-settings-editor" %} </li> |
There was a problem hiding this comment.
Selle nimetus võiks olla js-mobile-menu-button-wrapper
|
Muutujate ja funktsioonide nimed parandatud. Puudu veel tooltipid ja tõlked. |
siimha
left a comment
There was a problem hiding this comment.
Mõningased kommentaarid.
| }, | ||
| { | ||
| "titleI18n": "always_visible", | ||
| "value": "visible-when" |
There was a problem hiding this comment.
Need väärtused on vahetusse läinud:
{
"titleI18n": "always_visible",
"value": "visible-when"
},
{
"titleI18n": "visible_when_scrolling_up",
"value": "always-visible"
}
| </div> | ||
|
|
||
| <div class="header-right js-header-right"> | ||
| <div class="header-right {{ site.data.menu_position_settings.menu_positioning }} js-header-right"> |
There was a problem hiding this comment.
data nimetus peaks olema mobile_menu_button_settings
| success: function() { | ||
| window.location.reload(); | ||
| } | ||
| }); |
| <script> | ||
| var siteData = new Edicy.CustomData({ | ||
| type: 'site', | ||
| id: {{ site.id }} |
There was a problem hiding this comment.
Lehe datal pole id-d
| } | ||
| } | ||
|
|
||
| &.visible-when, { |
There was a problem hiding this comment.
Koma on üleliigne &.visible-when, seda tuleb kasutada vaid siis kui sihitakse ka mingit muud klassi. Võib kasutada &.visible-when. scrolling { stiilid }.
| "value": "always-visible" | ||
| }, | ||
| ], | ||
|
|
There was a problem hiding this comment.
Komad üleliigsed objektil ja arrayl. Liigne tühi rida.
| {% if editmode %} | ||
| <li class="edit-btn">{% languageadd %}</li> | ||
| {% endif %} | ||
| {% endif %} |
| }, 400); | ||
| } else { | ||
| $('.visible-when').addClass('scrolling'); | ||
|
|
Close #303