From 4d106129ee90ae6c7cbd1e39cc385b29b9387f8a Mon Sep 17 00:00:00 2001 From: Rob H Date: Thu, 21 Aug 2014 15:29:23 +1000 Subject: [PATCH] Creating an about page including flash boxes for registration --- .../directives/inline_flash.js.coffee | 6 ++++ .../enterprise_creation_service.js.coffee | 28 +++++++-------- .../templates/registration/about.html.haml | 36 ++++++++++++++++++- .../darkswarm/registration.css.sass | 18 ++++++++++ 4 files changed, 73 insertions(+), 15 deletions(-) create mode 100644 app/assets/javascripts/darkswarm/directives/inline_flash.js.coffee diff --git a/app/assets/javascripts/darkswarm/directives/inline_flash.js.coffee b/app/assets/javascripts/darkswarm/directives/inline_flash.js.coffee new file mode 100644 index 0000000000..46550b854f --- /dev/null +++ b/app/assets/javascripts/darkswarm/directives/inline_flash.js.coffee @@ -0,0 +1,6 @@ +Darkswarm.directive "ofnInlineFlash", -> + restrict: 'E' + controller: ($scope) -> + $scope.visible = true + $scope.closeFlash = -> + $scope.visible = false diff --git a/app/assets/javascripts/darkswarm/services/enterprise_creation_service.js.coffee b/app/assets/javascripts/darkswarm/services/enterprise_creation_service.js.coffee index f23f11700a..5898cdf1c3 100644 --- a/app/assets/javascripts/darkswarm/services/enterprise_creation_service.js.coffee +++ b/app/assets/javascripts/darkswarm/services/enterprise_creation_service.js.coffee @@ -7,20 +7,20 @@ Darkswarm.factory "EnterpriseCreationService", ($http, RegistrationService, Curr country: availableCountries[0] create: => - $http( - method: "POST" - url: "/api/enterprises" - data: - enterprise: @prepare() - params: - token: SpreeApiKey - ).success((data) -> - RegistrationService.select('about') - ).error((data) -> - console.log angular.toJson(data) - alert('Failed to create your enterprise.\nPlease ensure all fields are completely filled out.') - ) - # RegistrationService.select('about') + # $http( + # method: "POST" + # url: "/api/enterprises" + # data: + # enterprise: @prepare() + # params: + # token: SpreeApiKey + # ).success((data) -> + # RegistrationService.select('about') + # ).error((data) -> + # console.log angular.toJson(data) + # alert('Failed to create your enterprise.\nPlease ensure all fields are completely filled out.') + # ) + RegistrationService.select('about') prepare: => enterprise = {} diff --git a/app/assets/javascripts/templates/registration/about.html.haml b/app/assets/javascripts/templates/registration/about.html.haml index ad44ebbf7f..faed853791 100644 --- a/app/assets/javascripts/templates/registration/about.html.haml +++ b/app/assets/javascripts/templates/registration/about.html.haml @@ -1 +1,35 @@ -Yay! You created an enterprise! \ No newline at end of file +.container#registration-contact + .row.header + %h2 Nice one! + %h5 Now let's flesh out the details about {{ enterprise.name }}. + %ng-include{ src: "'registration/steps.html'" } + .row.content + %ofn-inline-flash.turquoise.small-12.columns{ ng: { show: 'visible' } } + %i.ofn-i_009-close.close-button{ ng: { click: 'closeFlash()' } } + {{ enterprise.name }} has been created on the Open Food Network. If you leave at any point from here onwards, your enterprise will be saved, and you can always login to the admin section to update or continue filling out your enterprise details. + %ofn-inline-flash.brick.small-12.columns{ ng: { show: 'visible' } } + %i.ofn-i_009-close.close-button{ ng: { click: 'closeFlash()' } } + {{ enterprise.name }} won't be visible on the Open Food Network until you enter a long and short description. + + .small-12.large-8.columns + .row + .small-12.columns + %label{ for: 'enterprise_description' } Short Description: + %input.chunky.small-12.columns{ id: 'enterprise_description', placeholder: "A short sentence describing your enterprise", ng: { model: 'enterprise.description' } } + .row + .small-12.columns + %label{ for: 'enterprise_long_desc' } Long Description: + %textarea.chunky.small-12.columns{ id: 'enterprise_long_desc', placeholder: "We recommend keeping you description to under 600 characters or 150 words. Why? Cus people are lazy, and don't like to read too much text online. ;)", ng: { model: 'enterprise.long_description' } } + {{ enterprise.long_description.length }} characters used + .small-12.large-4.columns + .row + .small-12.columns + %label{ for: 'enterprise_abn' } ABN: + %input.chunky.small-12.columns{ id: 'enterprise_abn', placeholder: "eg. 99 123 456 789", ng: { model: 'enterprise.abn' } } + .row + .small-12.columns + %label{ for: 'enterprise_acn' } ACN: + %input.chunky.small-12.columns{ id: 'enterprise_acn', placeholder: "eg. 123 456 789", ng: { model: 'enterprise.acn' } } + .row + .small-12.columns + %input.button.primary{ type: "button", value: "Continue", ng: { click: "select('images')" }, style: 'float:right' } \ No newline at end of file diff --git a/app/assets/stylesheets/darkswarm/registration.css.sass b/app/assets/stylesheets/darkswarm/registration.css.sass index e12c00f17b..c48737f7e3 100644 --- a/app/assets/stylesheets/darkswarm/registration.css.sass +++ b/app/assets/stylesheets/darkswarm/registration.css.sass @@ -12,6 +12,24 @@ i font-size: 150% + ofn-inline-flash + display: block + padding: 15px + position: relative + margin-bottom: 10px + &.brick + background-color: $clr-brick-light + border: 2px solid $clr-brick + color: $clr-brick + &.turquoise + background-color: $clr-turquoise-light + border: 2px solid $clr-turquoise + color: $clr-turquoise + .close-button + position: absolute + top: 0px + right: 0px + input.chunky padding: 8px font-size: 105%