diff --git a/app/assets/javascripts/darkswarm/mixins/fieldset_mixin.js.coffee b/app/assets/javascripts/darkswarm/mixins/fieldset_mixin.js.coffee index 0bd1b78ef3..96273ffaed 100644 --- a/app/assets/javascripts/darkswarm/mixins/fieldset_mixin.js.coffee +++ b/app/assets/javascripts/darkswarm/mixins/fieldset_mixin.js.coffee @@ -21,11 +21,14 @@ window.FieldsetMixin = ($scope)-> $scope.field(name).$error $scope.fieldErrors = (path)-> - # TODO: display server errors errors = for error, invalid of $scope.error(path) if invalid switch error - when "required" then "must not be blank" + when "required" then "can't be blank" when "number" then "must be number" when "email" then "must be email address" - (errors.filter (error) -> error?).join ", " + + server_errors = $scope.Order.errors[path.replace('order.', '')] + errors.push server_errors if server_errors? + (errors.filter (error) -> error?).unique().join ", " + diff --git a/app/assets/javascripts/darkswarm/overrides.js.coffee b/app/assets/javascripts/darkswarm/overrides.js.coffee index 4d678c77a1..b9dd47500b 100644 --- a/app/assets/javascripts/darkswarm/overrides.js.coffee +++ b/app/assets/javascripts/darkswarm/overrides.js.coffee @@ -1,20 +1,4 @@ -#Foundation.libs.section.toggle_active = (e)-> - #$this = $(this) - #self = Foundation.libs.section - #region = $this.parent() - #content = $this.siblings(self.settings.content_selector) - #section = region.parent() - #settings = $.extend({}, self.settings, self.data_options(section)) - #prev_active_region = section.children(self.settings.region_selector).filter("." + self.settings.active_class) - - ##for anchors inside [data-section-title] - #e.preventDefault() if not settings.deep_linking and content.length > 0 - #e.stopPropagation() #do not catch same click again on parent - #unless region.hasClass(self.settings.active_class) - #prev_active_region.removeClass self.settings.active_class - #region.addClass self.settings.active_class - ##force resize for better performance (do not wait timer) - #self.resize region.find(self.settings.section_selector).not("[" + self.settings.resized_data_attr + "]"), true - #else if not settings.one_up# and (self.small(section) or self.is_vertical_nav(section) or self.is_horizontal_nav(section) or self.is_accordion(section)) - #region.removeClass self.settings.active_class - #settings.callback section +Array::unique = -> + output = {} + output[@[key]] = @[key] for key in [0...@length] + value for key, value of output diff --git a/app/views/shop/checkout/_shipping.html.haml b/app/views/shop/checkout/_shipping.html.haml index 06bad5836b..d5692b1bea 100644 --- a/app/views/shop/checkout/_shipping.html.haml +++ b/app/views/shop/checkout/_shipping.html.haml @@ -51,7 +51,7 @@ .large-6.columns = validated_input "First Name", "order.ship_address.firstname" .large-6.columns - = validated_input "Last Name", "order.ship_address.last" + = validated_input "Last Name", "order.ship_address.lastname" .row .large-6.columns = validated_input "Phone", "order.ship_address.phone" diff --git a/app/views/shop/checkout/_summary.html.haml b/app/views/shop/checkout/_summary.html.haml index 730263a249..97ec4984cd 100644 --- a/app/views/shop/checkout/_summary.html.haml +++ b/app/views/shop/checkout/_summary.html.haml @@ -1,5 +1,7 @@ %orderdetails = form_for current_order, url: "#", html: {"ng-submit" => "purchase($event)"} do |f| + + {{ Order.errors }} %fieldset %legend Your Order %table