Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

feat(tab): allow active index string #5713

Closed
wants to merge 1 commit into from
Closed

Conversation

deeg
Copy link
Contributor

@deeg deeg commented Mar 31, 2016

Allow Tab index to be a string

Closes #5687
Closes #5577

@deeg
Copy link
Contributor Author

deeg commented Mar 31, 2016

There are two other isNumber checks in the tabs component which did not have isString checks added from the pull request I started with.

@wesleycho, @RobJacobs did we need to add some is string checks there as well?

@@ -85,7 +85,7 @@ angular.module('ui.bootstrap.tabs', [])

function findTabIndex(index) {
for (var i = 0; i < ctrl.tabs.length; i++) {
if (ctrl.tabs[i].index === index) {
if (ctrl.tabs[i].index === +index) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was not in the pull request I started from, but it seemed needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a strange change - do you know why this is as you have it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was getting called from line 76 where we were now allowing the value to be a string.

The comparison wouldn't work for 1 === "1".

Copy link
Contributor

Choose a reason for hiding this comment

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

But why is the type getting mutated?

Allow Tab index to be a string

Closes angular-ui#5687
Closes angular-ui#5577
Closes angular-ui#5713
@deeg
Copy link
Contributor Author

deeg commented Mar 31, 2016

Here is the plunker forked with the fix

I haven't been following along really, but I'm not sure it is actually working. Was the previous PR ready to go besides test? I gotta run, but I can take a look closer tomorrow.

@RobJacobs
Copy link
Contributor

@deeg I created a PR to demo my thoughts on how to approach this is it was easier than trying to write it out. The part where it auto generates an index if one is not defined still needs some work. Here is a plunk with the changes in action.

@deeg
Copy link
Contributor Author

deeg commented Mar 31, 2016

@RobJacobs, sweet thanks for doing that!

@deeg
Copy link
Contributor Author

deeg commented Mar 31, 2016

@wesleycho, @RobJacobs, is everyone good with Rob's solution in the commit referenced on this PR?

If so I can incorporate his changes into this PR to get this closed.

@RobJacobs
Copy link
Contributor

@deeg Like I mentioned, in the uibTab directive - link function where we try and add an index if none is defined needs to be re-worked. Right now, it is assumed the indexes are numbers, but we may want to generate a random string (4 char?) and check that it is not already assigned to another tab index. Or if you can think of a better way?

@icfantv
Copy link
Contributor

icfantv commented Apr 1, 2016

@Foxandxss, @wesleycho, i don't want to lose momentum on this PR - do you guys have any thoughts to add here regarding dynamic ID generation? We do this already in other components (datepicker and accordion).

@mathielen
Copy link

+1

@icfantv
Copy link
Contributor

icfantv commented Apr 2, 2016

@mathielen please do not just +1 issues. It adds no intrinsic value and only clutters up the thread. If you would like to show your support for an issue please use GitHub's emoji feature. It's the smiley icon next to the pencil in the upper right corner.

This is a work in progress and is nearly complete.

@@ -168,6 +168,16 @@ describe('tabs', function() {
expect(titles().length).toBe(scope.tabs.length);
expectTabActive(scope.tabs[2]);
});

it("should watch active state", function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should use single quotes here

@wesleycho
Copy link
Contributor

@deeg can you make the needed adjustments and answer my question above?

With #5732, the 1.3 release work is complete, so if we want this in, it needs to be ready soon.

@deeg
Copy link
Contributor Author

deeg commented Apr 4, 2016

@wesleycho, this PR wasn't working. I can make the changes you asked for and incorporate @RobJacobs's changes which are better and actually work, but there was still one outstanding question.

I believe it was about the auto generation of the index. Barring that answer, I don't mind cleaning all this up and getting it ready to go.

@wesleycho wesleycho modified the milestones: 1.3.0, 1.3.1, 1.3.2 Apr 5, 2016
@wesleycho wesleycho modified the milestones: 1.3.2, 1.3.1 Apr 5, 2016
@deeg deeg closed this Apr 12, 2016
@deeg deeg deleted the tab-index branch April 12, 2016 13:37
@icfantv
Copy link
Contributor

icfantv commented Apr 12, 2016

@deeg, were you still working on a fix for this or did we abandon this feature?

@deeg
Copy link
Contributor Author

deeg commented Apr 12, 2016

@icfantv I thought I was still waiting on a decision. I'm happy to wrap this up, but @RobJacobs had a branch with a better fix and a question, and I thought we were waiting for feedback.

@icfantv
Copy link
Contributor

icfantv commented Apr 12, 2016

oh. hmmm. ok. @RobJacobs do you recall what, if anything, we're waiting for? thanks.

@RobJacobs
Copy link
Contributor

Just wanted some feedback on what would be the best approach for the indexes the directive auto generates. Use case is if no index is defined on the tab, the tabset will never set it to active. Previously, the auto generated tab index made the assumption the index would be a number and found the max number in the index collection and added 1. Now with index as a string, that won't work...

@deeg
Copy link
Contributor Author

deeg commented Apr 12, 2016

Sorry I didn't mean to close this, I deleted the branch by mistake. Will re-open once we decide on a path forward.

@icfantv
Copy link
Contributor

icfantv commented Apr 12, 2016

it might be too late for this, but in the ng2 port we're going to use the actual tab reference as the "index" - what do you think about that instead or in addition to?

bonita-ci pushed a commit to bonitasoft/bonita-ui-designer that referenced this pull request Apr 30, 2017
Add captions to the text, title, table and datatable widgets with a link
to a new Filters section in the help popup.
This required:
- upgrading to angular ui bootstrap 1.3.3 to be able to set the focus on
a specific tab (see angular-ui/bootstrap/pull/5713)
- converting openHelp function to a directive
- adding a new directive to support angular directives and not just HTML
in the captions

Covers [BS-16403](https://bonitasoft.atlassian.net/browse/BS-16403)
educhastenier pushed a commit to bonitasoft/bonita-ui-designer that referenced this pull request Oct 31, 2017
Add captions to the text, title, table and datatable widgets with a link
to a new Filters section in the help popup.
This required:
- upgrading to angular ui bootstrap 1.3.3 to be able to set the focus on
a specific tab (see angular-ui/bootstrap/pull/5713)
- converting openHelp function to a directive
- adding a new directive to support angular directives and not just HTML
in the captions

Covers [BS-16403](https://bonitasoft.atlassian.net/browse/BS-16403)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants