gdg-x / zeppelin

Awesome conference website in 5 minutes.
http://gdg-x.github.io/zeppelin/
MIT License
678 stars 933 forks source link

Auto Directions in Logistics page #56

Closed tasomaniac closed 9 years ago

tasomaniac commented 9 years ago

Added a configuration for Jekyll to enable/disable auto directions in Logistics page.

I have seen several people using the web site and no once noticed "my location" button in the Logistics page. So I decided to get their location immediately when they open Logistics page.

And then I thought it may be a config after all.

I am an Android developer. So I am a newbie to this. So please guide me. :smile:

With this code when I change scripts.min.js to scripts.js it works. But it cannot be minified because minifier thinks that {% illegal. What should I do? Thank you.

ozasadnyy commented 9 years ago

Great idea! One solution is to call or not to call that function from the page. Here is where you can put that call. For instance:

    {% elsif page.permalink == '/logistics/' %}
        <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places,geometry"></script>
      {% if site.logisticsMapAutoDirections %}
      callAutoDirection();
      {% endif %}
    {% endif %} 
tasomaniac commented 9 years ago

Ok, I will try it and update this PR.

I already tried to put in findway.html but it didn't see the javascript resources. I think I see why was the reason now, it should be in the defaults.html. ty.

tasomaniac commented 9 years ago

Hey! I have just updated the PR. So I have tried your suggestion but it didn't directly work. It was because all of the functions related to maps are scoped and I cannot directly access them in html. Secondly, I tried sending jQuery events to scripts.js and tried to do it there, but it didn't worked because maps not ready immediately. And again, I cannot access to the maps object directly. At the end, I am converting the Jekyll variable to a JS variable and using it in scripts.js. With this we can minify it.

What do you think?

ozasadnyy commented 9 years ago

Cool! That's what I have tried to explain you. Thanks for the contribution again!

tasomaniac commented 9 years ago

Thanks for the great project again :)