From f5849e91dcd52ad4f4d9e9ccd117167b70de1ebd Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Thu, 25 Sep 2014 12:25:32 +1000 Subject: [PATCH] Adding limit reached modal to registration --- .../directives/registration_limit_modal.js.coffee | 13 +++++++++++++ .../registration/limit_reached.html.haml | 15 +++++++++++++++ app/views/registration/limit_reached.html.haml | 2 ++ 3 files changed, 30 insertions(+) create mode 100644 app/assets/javascripts/darkswarm/directives/registration_limit_modal.js.coffee create mode 100644 app/assets/javascripts/templates/registration/limit_reached.html.haml create mode 100644 app/views/registration/limit_reached.html.haml diff --git a/app/assets/javascripts/darkswarm/directives/registration_limit_modal.js.coffee b/app/assets/javascripts/darkswarm/directives/registration_limit_modal.js.coffee new file mode 100644 index 0000000000..1fecfbf804 --- /dev/null +++ b/app/assets/javascripts/darkswarm/directives/registration_limit_modal.js.coffee @@ -0,0 +1,13 @@ +Darkswarm.directive "ofnRegistrationLimitModal", (Navigation, $modal, Loading) -> + restrict: 'A' + link: (scope, elem, attr)-> + scope.modalInstance = $modal.open + templateUrl: 'registration/limit_reached.html' + windowClass: "login-modal large" + backdrop: 'static' + + scope.modalInstance.result.then scope.close, scope.close + + scope.close = -> + Loading.message = "Taking you back to the home page" + Navigation.go "/" diff --git a/app/assets/javascripts/templates/registration/limit_reached.html.haml b/app/assets/javascripts/templates/registration/limit_reached.html.haml new file mode 100644 index 0000000000..e2131c1727 --- /dev/null +++ b/app/assets/javascripts/templates/registration/limit_reached.html.haml @@ -0,0 +1,15 @@ +%div + .header.center + %h2 Oh no! + %h4 You have reached the limit! + .row + .small-12.medium-3.large-2.columns.text-right.hide-for-small-only + %img{:src => "/assets/potatoes.png"} + .small-12.medium-9.large-10.columns + %p + You have reached the limit for the number of enterprises you are allowed to own on the + %strong Open Food Network. + .row + .small-12.columns + %hr + %input.button.primary{ type: "button", value: "Return to the homepage", ng: { click: "close()" } } diff --git a/app/views/registration/limit_reached.html.haml b/app/views/registration/limit_reached.html.haml new file mode 100644 index 0000000000..bfaec6da3d --- /dev/null +++ b/app/views/registration/limit_reached.html.haml @@ -0,0 +1,2 @@ +/ Directive which loads the modal +%div{ "ofn-registration-limit-modal" => true }