Changed new subscription dialog to use tom-select from select2

fixed z-index, text-alignment in the dropdown menu to left in new subscription modal, replaced click_link with page.find().click in subscription specs, removed href in subscription index
This commit is contained in:
Ashwini Seshadri
2022-09-25 18:10:24 +02:00
parent 4f290b5bc5
commit edee5c693b
7 changed files with 23 additions and 53 deletions

View File

@@ -1,29 +0,0 @@
angular.module("admin.subscriptions").directive 'newSubscriptionDialog', ($rootScope, $compile, $window, $templateCache, DialogDefaults, shops) ->
restrict: 'A'
scope: true
link: (scope, element, attr) ->
scope.submitted = false
scope.shops = shops
scope.shop_id = null
scope.newSubscription = ->
scope.new_subscription_form.$setPristine()
scope.submitted = true
if scope.shop_id?
$window.location.href = "/admin/subscriptions/new?subscription[shop_id]=#{scope.shop_id}"
return
# Compile modal template
template = $compile($templateCache.get('admin/new_subscription_dialog.html'))(scope)
# Set Dialog options
template.dialog(DialogDefaults)
# Link opening of dialog to click event on element
element.bind 'click', (e) ->
if shops.length == 1
scope.shop_id = shops[0].id
scope.newSubscription()
else
template.dialog('open')
$rootScope.$evalAsync()