From de369d938fd1c068f14b2993b9dc1dcb30ea65e5 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Thu, 8 May 2014 12:34:16 +1000 Subject: [PATCH] Starting to work on anchor scrolling --- .../javascripts/darkswarm/directives/scrollto.js.coffee | 6 ++++++ app/views/layouts/darkswarm.html.haml | 2 +- app/views/shared/menu/_large_menu.html.haml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 app/assets/javascripts/darkswarm/directives/scrollto.js.coffee diff --git a/app/assets/javascripts/darkswarm/directives/scrollto.js.coffee b/app/assets/javascripts/darkswarm/directives/scrollto.js.coffee new file mode 100644 index 0000000000..3925480228 --- /dev/null +++ b/app/assets/javascripts/darkswarm/directives/scrollto.js.coffee @@ -0,0 +1,6 @@ +Darkswarm.directive "ofnScrollTo", ($location, $anchorScroll)-> + restrict: 'A' + link: (scope, element, attrs)-> + element.bind 'click', -> + $location.hash attrs.ofnScrollTo + $anchorScroll() diff --git a/app/views/layouts/darkswarm.html.haml b/app/views/layouts/darkswarm.html.haml index 52d0b74601..ab46b1f139 100644 --- a/app/views/layouts/darkswarm.html.haml +++ b/app/views/layouts/darkswarm.html.haml @@ -22,7 +22,7 @@ = display_flash_messages %ofn-flash - = render "shared/sidebar" + -#= render "shared/sidebar" %section{ role: "main" } = yield diff --git a/app/views/shared/menu/_large_menu.html.haml b/app/views/shared/menu/_large_menu.html.haml index 49f6dbf1a3..d7a4b996e9 100644 --- a/app/views/shared/menu/_large_menu.html.haml +++ b/app/views/shared/menu/_large_menu.html.haml @@ -5,7 +5,7 @@ %li.divider - if current_page? root_path %li - %a{href: "#hubs", "ofn-scroll-to" => true} + %a{"ofn-scroll-to" => "hubs"} %span.nav-primary Hubs - else %li