Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sidebar navbar "active" option problem #11

Open
cmerida79 opened this issue Jun 4, 2017 · 1 comment
Open

sidebar navbar "active" option problem #11

cmerida79 opened this issue Jun 4, 2017 · 1 comment
Assignees

Comments

@cmerida79
Copy link

cmerida79 commented Jun 4, 2017

Hi,
When create item fail and the controller action render :new again I have active the index link option because of this: (in sb-admin-2.js)

var url = window.location;
var element = $('ul.nav a').filter(function() {
return this.href == url;
}).addClass('active').parents('ul').addClass('in');
if (element.is('li')) {
element.addClass('active');
}

the render :new set url without /new and the href checkin in js is true...

Regards,

Carlos

@dreamingechoes dreamingechoes self-assigned this Jun 4, 2017
@VicML
Copy link

VicML commented Dec 5, 2017

The problem is for the url params, with this, you can repair it.

var url = window.location;
var element = $('ul.nav a').filter(function() {
return this.href == url.origin + url.pathname;
}).addClass('active').parents('ul').addClass('in');
if (element.is('li')) {
element.addClass('active');
}
});

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

No branches or pull requests

3 participants