szurubooru icon indicating copy to clipboard operation
szurubooru copied to clipboard

how to change this block?

Open IlyaKangin opened this issue 2 years ago • 1 comments

upload_2022_11_14_12_42_35_205 upload_2022_11_14_12_42_52_050

IlyaKangin avatar Nov 14 '22 08:11 IlyaKangin

I didnt learn js, but it looks like a menu item is defined by this class which takes a key(?) and some useful parameters https://github.com/rr-/szurubooru/blob/8088ff3bbe101907c2cea3341bc4437285b3d12d/client/js/models/top_navigation.js#L6

there is a function here that you'll need to add a line to create your item in the menu. I assume the link parameter is actually a link, and its already based on / of the server ret.add("myitem", new TopNavigationItem("X", "ItemName", "linktofileonserver")); https://github.com/rr-/szurubooru/blob/8088ff3bbe101907c2cea3341bc4437285b3d12d/client/js/models/top_navigation.js#L79

I'm guessing its as simple as adding your own ret.add call to that function where the second parameter is a new TopNavigationItem, and the constructor parameters for that object(?) are all the necessary things.

Also, there is the ability to limit the visibility of links based on permissions: https://github.com/rr-/szurubooru/blob/8088ff3bbe101907c2cea3341bc4437285b3d12d/client/js/controllers/top_navigation_controller.js#L31

404Fox avatar Nov 27 '22 07:11 404Fox