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

Two plugins sharing the same web-section

Remigiusz Jackowski
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.
June 9, 2013

Hello,

I've created a plugin that adds web-section and web-link in top menu:

My company name

|---- Task A

|---- Task B

I would like to create another plugin that will add another web-link, but under the same web-section as previous plugin.

My company name (defined in both plugins)

|---- Task A (first plugin)

|---- Task B (first plugin)

|---- Task C (second plugin)

Is it possible? I've tried defining web-section in both plugins, but all I get is two menus with the same ID.

My code:

First plugin:

<web-section key="section_workflow" name="eR Workflow Main Section" location="er_workflow_links" weight="5">
        <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition" />
    </web-section>

    <web-item key="er_workflow_links" name="Main Section - header link" section="system.top.navigation.bar" weight="5">
        <label>eR</label>
        <link linkId="er_workflow_links">/plugins/servlet/eR_Workflow</link>
        <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition" />
    </web-item>

    <web-item key="workflow_link" name="Workflow page" section="er_workflow_links/section_workflow" weight="10">
        <label>Team Workflow</label>
        <link linkId="workflow_link">/plugins/servlet/eR_Workflow</link>
        <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition" />
    </web-item>

Second plugin:
<web-section key="section_workflow" name="eR Workflow Main Section" location="er_workflow_links" weight="5">
        <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition" />
    </web-section>

    <web-item key="er_workflow_links" name="Main Section - header link" section="system.top.navigation.bar" weight="5">
        <label>eR</label>
        <link linkId="er_workflow_links">#</link>
        <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition" />
    </web-item>

    <web-item key="workflow_link" name="Workflow page" section="er_workflow_links/section_workflow" weight="10">
        <label>FluidWork for Tempo</label>
        <link linkId="workflow_link">/plugins/servlet/eR_FluidWork</link>
        <condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition" />
    </web-item>

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Remigiusz Jackowski
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.
June 9, 2013

Apparently, the best way to do this is to make three plugins:

  1. Common plugin that creates web-item to nav bar and common web-section inside.
  2. Plugin A that depends on common plugin and defines web-item in common section.
  3. Plugin B that depends on common plugin and defines web-item in common section.

I'm basing my answer on this video: http://summit.atlassian.com/archives/2012/plugin-dev/plugins-in-your-plugins

Plugin A has to be released with Common plugin. The same with Plugin B.

Also, you should define web-item first, then web-section and then web-items in web-section. It makes more sense that way.

Remigiusz Jackowski
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.
June 9, 2013

Also, you should define web-item first, then web-section and then web-items in web-section. It makes more sense that way.

Interesting DOC about web-section and web-item placement:

https://developer.atlassian.com/display/JIRADEV/User+Accessible+Locations#UserAccessibleLocations-TopNavigationBarLocation

Remigiusz Jackowski
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 31, 2013

Another interesting way to do it:

  1. Add "Main Section - header link" in both plugins - they must have the same ID in both.
  2. Disable it in one of them.

It's not "customer friendly", but if you are creating plugins for internal usage, it's fast and easy.

TAGS
AUG Leaders

Atlassian Community Events