Page 1 of 1

Little code to clean up breadcrumb of custom home form

Posted: Sat Jan 08, 2022 12:26 pm
by Andrea
Hello,

I just want to share a little code to clean up the breadcrumb of custom home forms.

I created some access groups for different tables and made custom home forms for them.


Example:

username: projekteRW
access group: projekteRW
user home: projekte_home

b0admin.JPG
b1_admin.JPG

When the user logged in there were a several items in the breadcrumb:
b2_user.JPG
b3_user.JPG

Breadcrumb after click on Projekte:
b4_user.JPG

I looked into the source and found the breadcrumb elements: nuBreadcrumb0 (Home), nuBreadcrumb1, nuBreadcrumb2, nuBreadcrumb3
b5_user.JPG

So I put a code to before edit of the custom home form:

Code: Select all

//nuMessage(nuAccessLevelCode());
var myEle = document.getElementById("nuBreadcrumb3");

if(myEle != null && nuAccessLevelCode() == 'projekteRW'){
nuGetBreadcrumb(0);
}
The code checks if an element nuBreadcrumb3 exists and if the access group of the logged in user is 'projekteRW' nuGetBreadcrumb(0)
is executed to go to Home:
b6_admin.JPG

When the user now logs in it looks like that:
b7_user.JPG

and after click on Projekte:
b8_user.JPG

Hope, this is useful :-)

Best wishes

Andrea

Re: Little code to clean up breadcrumb of custom home form

Posted: Sat Jan 08, 2022 7:43 pm
by kev1n
Hi Andrea,

Thanks for that :thumb:

For me, this behaviour only occurs when I click the Submit button several times in a row.
To prevent this, one can disable the "Log in" button after clicking it. Only if there is an error (e.g. invalid password) will it be reactivated.

There's a modified https://github.com/nuBuilder/nuBuilder-4.5/blob/master/index.php in the Github repo.

Please try it and tell me if it works for you. Thanks!

Re: Little code to clean up breadcrumb of custom home form

Posted: Sun Jan 09, 2022 12:40 pm
by Andrea
Hi Kev1n,

many thanks! I'll try and let you know, soon :-)

Best wishes

Andrea

Re: Little code to clean up breadcrumb of custom home form

Posted: Sun Jan 09, 2022 12:54 pm
by Andrea
Hi Kev1n,

I replaced the index.php and tested.
Breadcrumb is clean now without my script but the Home-Symbol does not show up if switching to other forms.
Also the "menue-dots" top left are gone - but clickable.
nunu.JPG
Best wishes

Andrea

Re: Little code to clean up breadcrumb of custom home form

Posted: Sun Jan 09, 2022 3:35 pm
by kev1n
What nuBuilder version are you on? The latest from Github doesn't seem to have this issue, it is not replicable here.

Re: Little code to clean up breadcrumb of custom home form

Posted: Sun Jan 09, 2022 5:45 pm
by Andrea
Hi Kev1n,

nuBuilder Forte 4.5
DB Version: V.4.5-2021.12.13.00
Files Version: V.4.5-2021.12.12.02
(V.MajorVersion-CurrentDate.BuildNumber)

I downloaded on 26.12.2021 from here: https://netcologne.dl.sourceforge.net/p ... der4.5.zip

Best wishes

Andrea

Re: Little code to clean up breadcrumb of custom home form

Posted: Sun Jan 09, 2022 5:53 pm
by kev1n
Please try updating to the latest version if possible to see if the issue is still there.

Re: Little code to clean up breadcrumb of custom home form

Posted: Sun Jan 09, 2022 6:08 pm
by Andrea
Hi Kev1n,

I now installed the version from Github and breadcrumb is fine :-)
It also has somewhat different symbols than the sourceforge-Version.

Thankyou!

Andrea