Commit 8ab9277

mo khan <mo@mokhan.ca>
2017-03-05 19:56:48
add hamburger menu behaviour.
1 parent de20a24
Changed files (2)
app
assets
javascripts
views
app/assets/javascripts/lib/behaviours/hamburger_menu.js.coffee
@@ -0,0 +1,3 @@
+$(document).on "turbolinks:load", () ->
+  $(".nav-toggle").on "click", (event) ->
+    $(".nav-menu").toggleClass "is-active"
app/views/application/_navigation.html.erb
@@ -2,11 +2,6 @@
   <nav class="nav">
     <div class="nav-left">
       <%= link_to t("app"), root_path, class: 'nav-item is-brand' %>
-      <%= link_to t(".workouts"), workouts_path, class: 'nav-item' %>
-      <% if feature_enabled? :athletes %>
-      <%= link_to t(".athletes"), profiles_path, class: 'nav-item' %>
-      <% end %>
-      <%= link_to t(".gyms"), gyms_path, class: 'nav-item' %>
       <%= link_to t(".blog"), "http://slog.stronglifters.com", class: 'nav-item' %>
       <%= link_to t(".about"), "http://slog.stronglifters.com/about", class: 'nav-item' %>
     </div>
@@ -33,6 +28,11 @@
     <!-- This "nav-menu" is hidden on mobile -->
     <!-- Add the modifier "is-active" to display it on mobile -->
     <div class="nav-right nav-menu">
+      <%= link_to t(".workouts"), workouts_path, class: 'nav-item' %>
+      <% if feature_enabled? :athletes %>
+      <%= link_to t(".athletes"), profiles_path, class: 'nav-item' %>
+      <% end %>
+      <%= link_to t(".gyms"), gyms_path, class: 'nav-item' %>
       <%= link_to profile_path(current_user), class: 'nav-item is-tab' do %>
         <figure class="image is-16x16" style="margin-right: 8px;">
           <%= gravatar_for(current_user, size: 16) %>