dreamingechoes / bootstrap_sb_admin_base_v2

Rails gem of the Bootstrap based admin theme SB Admin 2.
http://dreamingechoes.github.io/bootstrap_sb_admin_base_v2
MIT License
63 stars 23 forks source link

sidebar navbar "active" option problem #11

Open cmerida79 opened 7 years ago

cmerida79 commented 7 years ago

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

VicML commented 6 years ago

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'); } });