From b6ffb863ce74efa2259d87f7a58508a6d855d4cf Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Wed, 30 Apr 2014 11:41:53 +1000 Subject: [PATCH] Adding mailto directive --- .../javascripts/darkswarm/directives/mailto.js.coffee | 6 ++++++ app/views/shared/_footer.html.haml | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/darkswarm/directives/mailto.js.coffee diff --git a/app/assets/javascripts/darkswarm/directives/mailto.js.coffee b/app/assets/javascripts/darkswarm/directives/mailto.js.coffee new file mode 100644 index 0000000000..27299005a9 --- /dev/null +++ b/app/assets/javascripts/darkswarm/directives/mailto.js.coffee @@ -0,0 +1,6 @@ +Darkswarm.directive "mailto", (Navigation)-> + restrict: 'A' + link: (scope, element, attrs)-> + element.bind 'click', (e)-> + e.preventDefault() + window.location.href = "mailto:#{attrs.href.split("").reverse().join("")}" diff --git a/app/views/shared/_footer.html.haml b/app/views/shared/_footer.html.haml index a09435efb3..eb655b7c37 100644 --- a/app/views/shared/_footer.html.haml +++ b/app/views/shared/_footer.html.haml @@ -13,9 +13,7 @@ %i.fi-social-linkedin LinkedIn    %p - %a.button.neutral-btn{href: '#', target: '_blank'} - %i.fi-at-sign - Email us at + %a{href: "hello@openfoodnetwork.org".reverse, target: '_blank', mailto: true} %span.email = "hello@openfoodnetwork.org".reverse .small-2.columns