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

paper-drawer-panel and Turbolinks doesn't work #82

Closed
nonameolsson opened this issue Jul 26, 2015 · 2 comments
Closed

paper-drawer-panel and Turbolinks doesn't work #82

nonameolsson opened this issue Jul 26, 2015 · 2 comments

Comments

@nonameolsson
Copy link

I have a web app with Rails 4 and Turbolinks, https://github.com/rails/turbolinks. Now I've started to add more Polymer elements to the app. But I can't get paper-drawer-panel to work.
When loading the page the first time everything looks and behaves as expected. But when clicking a link the problem starts. I made a video of the problem.
https://www.youtube.com/watch?v=Zqtn9uxI1xs

It seems like the paper-drawer-panel isn't populated with the content after changing page with Turbolinks. I don't think this is a problem with Turbolinks, but more a result of how it works and how paper-drawer-panel works.
I don't really understand how paper-drawer-panel works and load it's content. Therefore I haven't been able to figure out a solution.

But a while ago I had the same problem with jquery.mmenu and Turbolinks.
Problem: https://github.com/BeSite/jQuery.mmenu/issues/41
Solution: http://mmenu.frebsite.nl/tutorials/frameworks/turbolinks.html

Could it be a similar solution to get paper-drawer-panel to work with Turbolinks? All help is appreciated. I really need this one to work in our app, and disabling Turbolinks isn't an option.

UPDATE:
Here is some code.
application.html.haml

!!!
/[if lt IE 7] <html class="no-js lt-ie9 lt-ie8 lt-ie7">
/[if IE 7] <html class="no-js lt-ie9 lt-ie8">
/[if IE 8] <html class="no-js lt-ie9">
%html
  = render 'layouts/head'

  %body{class: "#{body_classes(yield :body_classes)}fullbleed layout vertical"}
    - if current_user
      = render 'layouts/content'
      = render 'shared/notifications'

    - else
      = render 'shared/notifications'
      = yield

    / outdated-browser
    #outdated= render "layouts/outdatedbrowser/#{I18n.locale}"

layouts/_content.html.haml

/ Page Content
%paper-drawer-panel
  %div{:drawer => ""}
    = render 'layouts/menu'

  %div{:main => ""}
    %paper-header-panel{:drawer => ""}
      %paper-toolbar
        %paper-icon-button{:icon => "menu", "paper-drawer-toggle" => ""}
        %div= current_title(yield(:title))
      = yield
@nonameolsson nonameolsson changed the title Paper-drawer-panel and Turbolinks doesn't work paper-drawer-panel and Turbolinks doesn't work Jul 26, 2015
@blasten
Copy link
Contributor

blasten commented Jul 28, 2015

@nonameolsson I don't see how paper-drawer-panel could be causing the issue. It seems like the whole page is refreshed after you clicked the link. You might want to call preventDefault on the click event. e.g.

document.querySelector('[drawer]').addEventListener('click', function(e) {
   e.preventDefault();
});

@blasten
Copy link
Contributor

blasten commented Aug 21, 2015

I am closing this. please reopen if you have an update.

@blasten blasten closed this as completed Aug 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants