diff --git a/app/assets/javascripts/app/lib/app_post/collection.coffee b/app/assets/javascripts/app/lib/app_post/collection.coffee index 514ace6b3..3a0813029 100644 --- a/app/assets/javascripts/app/lib/app_post/collection.coffee +++ b/app/assets/javascripts/app/lib/app_post/collection.coffee @@ -9,10 +9,10 @@ class App.Collection _instance ?= new _collectionSingleton _instance.load(args) - @loadAssets: (args) -> + @loadAssets: (args, params) -> if _instance == undefined _instance ?= new _collectionSingleton - _instance.loadAssets(args) + _instance.loadAssets(args, params) @reset: (args) -> if _instance == undefined @@ -63,19 +63,25 @@ class _collectionSingleton extends Spine.Module # reset in-memory appObject.refresh(params.data, clear: true) - loadAssets: (assets) -> + loadAssets: (assets, params = {}) -> return if _.isEmpty(assets) # process not existing assets first / to avoid not exising ref errors loadAssetsLater = {} for type, collections of assets - later = @load(type: type, data: collections, later: true) - if !_.isEmpty(later) - loadAssetsLater[type] = later + if !params.targetModel || params.targetModel isnt type + later = @load(type: type, data: collections, later: true) + if !_.isEmpty(later) + loadAssetsLater[type] = later - # process existing assets - for type, collections of loadAssetsLater - App[type].refresh(collections) + # process existing assets + for type, collections of loadAssetsLater + App[type].refresh(collections) + + if params.targetModel + for type, collections of assets + if params.targetModel is type + @load(type: type, data: collections) load: (params) -> diff --git a/app/assets/javascripts/app/models/_application_model.coffee b/app/assets/javascripts/app/models/_application_model.coffee index 0a88e7f27..f115e6077 100644 --- a/app/assets/javascripts/app/models/_application_model.coffee +++ b/app/assets/javascripts/app/models/_application_model.coffee @@ -582,8 +582,8 @@ set new attributes of model (remove already available attributes) callback(App[@className].all()) App.QueueManager.add(queueManagerName, localCallback) - return if @fetchFullActive is true - @fetchFullActive = true + return if @fetchFullActive && @fetchFullActive > new Date().getTime() - 500 + @fetchFullActive = new Date().getTime() App.Ajax.request( type: 'GET' url: url @@ -599,7 +599,7 @@ set new attributes of model (remove already available attributes) # full / load assets if data.assets - App.Collection.loadAssets(data.assets) + App.Collection.loadAssets(data.assets, targetModel: @className) # in case of no record_ids are there, no inital render is fired if data.record_ids && _.isEmpty(data.record_ids) diff --git a/app/assets/javascripts/app/views/generic/object_search/input.jst.eco b/app/assets/javascripts/app/views/generic/object_search/input.jst.eco index 939750df5..a56584e7e 100644 --- a/app/assets/javascripts/app/views/generic/object_search/input.jst.eco +++ b/app/assets/javascripts/app/views/generic/object_search/input.jst.eco @@ -3,7 +3,7 @@ <% if @attribute.multiple: %> <%- @tokens %> <% end %> - role="textbox" aria-autocomplete="list" value="<%= @name %>" aria-haspopup="true"> + role="textbox" aria-autocomplete="list" value="<%= @name %>" aria-haspopup="true"> <% if @attribute.disableCreateObject isnt true: %><%- @Icon('arrow-down', 'dropdown-arrow') %><% end %> diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 614be3ab7..962ae30c9 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -1491,7 +1491,7 @@ wait untill text in selector disabppears sleep 0.5 begin if instance.find_elements(css: '.js-notificationsContainer .js-item:first-child')[0] - instance.mouse.move_to(instance.find_elements(css: '.js-notificationsContainer .js-item:first-child')[0]) + instance.action.move_to(instance.find_elements(css: '.js-notificationsContainer .js-item:first-child')[0]) sleep 0.1 click_element = instance.find_elements(css: '.js-notificationsContainer .js-item:first-child .js-remove')[0] click_element&.click