Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Refactor branch #1134

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open

Refactor branch #1134

wants to merge 35 commits into from

Conversation

ProLoser
Copy link
Member

@ProLoser ProLoser commented Aug 7, 2015

Continuation of #1108 refactor. Will try to give feedback here.

abudel and others added 30 commits February 26, 2015 14:30
Adds an onBeforeSelect callback to allow intercepting a selection. Ensures
access to both the prospective new selection and the current selection.
* fix_issue_453:
  Fix test to check against ui-select-offscreen class, not ng-hide
  Update to move search box off screen
  Don't hide select when SearchEnable is false angular-ui#453

Conflicts:
	examples/bootstrap.html
* limit_multi_select:
  Added test to check multiple limit
  Limit the number of selections allowed in multiple mode
@ProLoser
Copy link
Member Author

ProLoser commented Aug 7, 2015

This diff is way too large to review. @cdjackson I think you may have to just develop on a branch in here

@cdjackson
Copy link
Contributor

Fixes #848

@cdjackson
Copy link
Contributor

@ProLoser currently I've changed the callbacks to use controller stubs (it possibly needs more modularising yet, but...). The reason I went down this route is that for some parts of the selection where overriding the default implementation is expected, I think it's useful to support promises where async operations is likely (eg the beforeDropdownOpen where the dev might want to populate the list from a server or something).

Thus, if the dev wants to override these callbacks for basic callback functions, it's very simple, and there's a clean interface that provides a good level of functionality. If they want to do something fancier, then they can override a lower level method, but then their a little more on their own as this won't be documented.

I've also split the tagging out into a separate directive - I wouldn't call it refined, but it functions ok from my initial tests (it needs some more work).

I had to add the KEY.MAP back into the code to cover tagging - I could have put it into the tagging directive since this is the only place it's currently needed, but it means other directives wouldn't be able to use it... Previously this was in the global space which I didn't like. I might revisit this as a trawl through the issues list tonight revealed a problem in this area with keycode mapping...

There's still some work to do on this, but I thought I'd throw out an update... I'm not sure how you want to proceed? It needs more tests, and it needs docs, and probably more of a tidy, It would be good if we could get a few more people commenting/testing this - my view is it would be good to get it merged, close all outstanding issues and request people resubmit if needed (as we head toward 500 issues and 180 PRs, it's unmanageable).

@ProLoser
Copy link
Member Author

@cdjackson I understand a desire to support promises, but that arrises from treating the list of items as something private and very precisely controlled. If you make these items public, then the user can modify this collection anytime they wish, they can do ajax and just update the collection anytime they want, the support for promises because superfluous.

Again, I still recommend not using before and after callbacks and simply demonstrating how to override extremely simplified functions.

@ProLoser
Copy link
Member Author

For now to make the code easier to review, can you remove the dist folder? It's just bloating this PR tremendously, we can deal with it after all the src is reviewed.

@ProLoser
Copy link
Member Author

I also feel that the repeater logic needs to be removed. It just bloats and complicates everything. Instead of allowing people to define the template for one row and handling the repeating for them, just move the logic up one level and let people define the entire dropdown container.

@cdjackson
Copy link
Contributor

If you make these items public, then the user can modify this collection anytime they wish

True, but they might still want this loading to be triggered when the dropdown is opened... Anyway, I appreciate there's many ways to achieve this so I'll take another look - it might be another few days (other things to do and all that :) ).

I'll remove the dist files now though.

@ProLoser
Copy link
Member Author

If you look at how I do it in ui-mention, you can override the 'findChoices' method and set your own loading flag and use that alongside the list of choice,s

@@ -0,0 +1,190 @@
angular.module('ui.select.tagging', ['ui.select'])
.directive('uiSelectTagging',
['$parse', '$timeout', function () {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't be using this injection syntax.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants