mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-23 05:28:53 +00:00
Make product modal show close button only if there is a scroll bar
This commit is contained in:
@@ -4,3 +4,9 @@ Darkswarm.controller "ProductNodeCtrl", ($scope, $modal, FilterSelectorsService)
|
||||
$scope.triggerProductModal = ->
|
||||
$scope.productPropertySelectors = FilterSelectorsService.createSelectors()
|
||||
$modal.open(templateUrl: "product_modal.html", scope: $scope)
|
||||
|
||||
$scope.hasVerticalScrollBar = (selector) ->
|
||||
elem = angular.element(document.querySelector(selector))
|
||||
return false unless elem[0]
|
||||
|
||||
elem[0].scrollHeight > elem[0].clientHeight
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
%ng-include{src: "'partials/close.html'"}
|
||||
|
||||
.buttons
|
||||
.buttons{ "ng-show": "hasVerticalScrollBar('.reveal-modal')" }
|
||||
.button.bottom-close-button{"ng-click" => "$close()"}
|
||||
= t('js.shop.products.product_modal.close')
|
||||
|
||||
Reference in New Issue
Block a user