Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add display none for preview and add hide actions #223

Merged
merged 5 commits into from
Dec 5, 2023

Conversation

LukasJanik
Copy link
Contributor

No description provided.

@@ -5,7 +5,7 @@
</div>
<% @filters.each do |filter| %>
<% url = message_threads_path(q: filter.query) %>
<%= link_to url, class: "text-gray-700 hover:text-indigo-600 hover:bg-gray-50 group w-72 flex gap-x-3 rounded-md p-2 px-4 text-sm leading-6 font-semibold data-[active=true]:bg-gray-50 data-[active=true]:text-indigo-600", data: { active: current_page?(url) } do %>
<%= link_to url, "data-action": "click->slideover#hide", class: "text-gray-700 hover:text-indigo-600 hover:bg-gray-50 group w-72 flex gap-x-3 rounded-md p-2 px-4 text-sm leading-6 font-semibold data-[active=true]:bg-gray-50 data-[active=true]:text-indigo-600", data: { active: current_page?(url) } do %>
Copy link
Member

Choose a reason for hiding this comment

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

Teraz som z tohto zmateny, tak riesi to ten data-turbo-preview hore alebo ideme na kazdu linku takto riesit (co nie je asi dobre)

@LukasJanik
Copy link
Contributor Author

@jsuchal Vyzera, ze to zafungovalo aj len s css 🤔 Ci este mas nejaky scenar, kde to nastavalo?

Screen.Recording.2023-12-01.at.09.52.21.mov

@LukasJanik
Copy link
Contributor Author

Ak je to 🆗 , tak pridam aj na ostatne dynamicke elementy.

@jsuchal
Copy link
Member

jsuchal commented Dec 1, 2023

Myslim, ze scenare boli vsetky prvky ked ich otvoris a potom das back a forward. modal, dropdown. Nepamatam si uplne ten scenar ale je to zjavne vtedy ked sa nacachuje nejaky otvoreny prvok co tam nechces aby bol ked sa vratis spat (resp. kliknes na rovnaky link - url+get method- vtedy ide z cache)

@LukasJanik
Copy link
Contributor Author

Hmm, nie je to este uplne dobre. Zobrazuje sa to pri back/forward

Screen.Recording.2023-12-01.at.10.06.31.mov

data-action by to asi vyriesilo 🤔

@jsuchal
Copy link
Member

jsuchal commented Dec 1, 2023

@LukasJanik este zvazujem nejaky js ktory sa napichne vseobecne na dokument a pri nejakom turbo evente prejde vsetky tieto preview-hide elementy a proste ich pred cache schova.

cize nieco ako https://turbo.hotwired.dev/handbook/building#preparing-the-page-to-be-cached

document.querySelectorAll("[data-preview-cache-hide]").forEach(function(elm) {
  elm.addEventListener("turbo:before-cache", function() {
    // schovaj elm
  }
})

@jsuchal
Copy link
Member

jsuchal commented Dec 1, 2023

Ja navrhujem spravit nejake nase elementy tak, ze vyrobime triedy ktore budeme na toto pouzivat. Tak ako turbo ma data-turbo-temporary tak si vyrobme vlastny data-turbo-temporary-hide a co budeme potrebovat. podla toho vyrobime hentaky JS a podla mna to pojde.

@LukasJanik
Copy link
Contributor Author

Zatial sa mi nepodarilo vymysliet lepsie riesenie nez reload pri back/forward. Hral som sa aj s odstranovanim style="display: none" a pridavanim classy hidden, no controller sa asi ocitne na zaciatku v stave, ze slideover je otvoreny a realne sa zobrazi az po 2. kliku na hamburger menu.

Screen.Recording.2023-12-05.at.08.03.16.mov

@LukasJanik
Copy link
Contributor Author

@jsuchal vyzera, ze to zafungovalo 😄 🥳 Sry, ze to tolko trvalo.

Screen.Recording.2023-12-05.at.08.55.00.mov

@jsuchal jsuchal merged commit 825a25c into main Dec 5, 2023
3 checks passed
@jsuchal jsuchal deleted the GO-352-menu-stale-blika-na-mobile branch December 5, 2023 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants