Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Stash Form fragment location

Artem Triliser July 26, 2015

Hello.

Can i find somewhere a list of location where i can add my form fragment?

Actually i'm developing Stash plugin and i want to place the form fragment into the page of repository settings (Repository details).

Any help would be appreciated.

 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Mibex_Software
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 26, 2015

Hi,

 

A good starting point is https://developer.atlassian.com/stash/docs/latest/reference/web-fragments.html.

For repository settings, you can use 

 

<web-item key="your-key" name="your-name" weight="30" section="stash.repository.settings.panel/repository-settings-addons-section">
</web-item>

 

Hope this helps.

Cheers,

Michael

 

Artem Triliser July 26, 2015

Hi Michael. This solution doesnt work for me. I've added to atlassian-plugin.xml the following: <form-fragment key="file-size-merge-restrict-fragment" location="stash.repository.settings.panel/repository-settings-addons-section" class="path.to.my.class.FileSizeMergeRestrictFormFragment" weight="200"/> But it doesnt appear on the page Projects->MyProject->Repositories->MyRepo->Settings->Repository Details

Mibex_Software
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 26, 2015

I'm sorry, I misread your question and thought you would like to add a settings page to the repository settings. According to http://localhost:7990/stash/projects/PROJECT_1/repos/rep_1/settings?web.items&web.sections&web.panels you can officially only add a button to the action panel on the top right of the page or a web panel banner to the repository details page. If you want to add another setting (e.g., an input field) to this page, you have to do it with a (not-supported) JavaScript hack...

Artem Triliser July 27, 2015

Thank you for help, Michael. Could you explain me how to add the field with JavaScript hack? Thank you in advance.

Mibex_Software
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 27, 2015

Well, you could define a stash-resource with a javascript file and limit it to the repository details context "stash.page.repository.generalSettings". Then, your JS would only run on this page. You could then change this page by altering the DOM (e.g., with JQuery) to your liking. But please note that this is in no way as safe in terms of future changes as the official extension points are => such changes could break with any new Stash version...

TAGS
AUG Leaders

Atlassian Community Events