Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Little code to clean up breadcrumb of custom home form

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

Little code to clean up breadcrumb of custom home form

Unread post 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
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4299
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

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

Unread post 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!
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

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

Unread post by Andrea »

Hi Kev1n,

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

Best wishes

Andrea
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

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

Unread post 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
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4299
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

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

Unread post by kev1n »

What nuBuilder version are you on? The latest from Github doesn't seem to have this issue, it is not replicable here.
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

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

Unread post 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
kev1n
nuBuilder Team
Posts: 4299
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

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

Unread post by kev1n »

Please try updating to the latest version if possible to see if the issue is still there.
Andrea
Posts: 29
Joined: Sun Jan 02, 2022 10:18 am
Been thanked: 1 time

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

Unread post 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
Post Reply