- Created by Seibert Media employee, last modified by Administrator on Nov 15, 2024
Documentation's navigation
On this page
To connect a sidebar panel you need to use Atlassian's ModuleDescriptor mechanism. An corresponding entry in the atlassian-plugin.xml looks like this: key: a unique key for the descriptor within the implementing app Obsolete attributes since version 1.3 of the Linchpin Sidebar app section-name: the section within which the panel is supposed to appear. Available sections: "linchpin", "confluence-features", "jira" Since version 1.3 of the Linchpin Sidebar app (which comes bundled with new versions of Linchpin Theme, Suite and Essentials) segmenting and ordering items in the sidebar is configurable. Necessary Java classes are being exported by the app. The implementing app needs appropriate imports (pom.xml): You need to download and install this dependency to your local Maven repository: linchpin-sidebar-1.2.3.obr (This version should be sufficient for development, but you can also use linchpin-sidebar-1.3.0.obr) (see also http://maven.apache.org/general.html#importing-jars) Necessary instructions for the maven-confluence-plugin in your pom.xml: Currently the API only offers one method of integrating new sidebar content (see DisplayStrategy). While implementing the panel, a link to an action is transferred via the interface LinchpinSidebarPanel. The content of the panel is an iframe that renders this action. Definition of an action in the atlassian-plugin.xml: Definition of a sidebar icons resource in the atlassian-plugin.xml: Minimum content of a velocity-template in the resource folder: Stylings depending on a space scheme can be made with this lines within the iframe: Integrating the resources under the context "linchpin-sidebar-iframe-utils" is necessary if: Within the action you can import two methods via requireJS (or almond), that make communication with the window outside the iframe easier. With this it's possible for example to open an aui dialog outside of the action. Example: By implementing the LinchpinSidebarPanel you define the URL to the action, how menu entries and their icons are shown etc. Example:Setup (Backend)
<linchpin-sidebar-panel key="saved-for-later" class="net.seibertmedia.confluence.linchpinsidebar.panels.savedforlater.SavedForLaterPanel" />
class: a class that implements the interface LinchpinSidebarPanel and thus further configures the panel (see JavaDocs of the interface).
weight: Weight of the panel, determining the order of the panels within the section. <dependency>
<groupId>net.seibertmedia.confluence</groupId>
<artifactId>linchpin-sidebar</artifactId>
<version>1.2.3</version>
<scope>provided</scope>
</dependency>
mvn install:install-file
-Dfile=./linchpin-sidebar-1.2.3.obr
-DgroupId=net.seibertmedia.confluence
-DartifactId=linchpin-sidebar
-Dversion=1.2.3
-Dpackaging=obr
-DgeneratePom=true
<DynamicImport-Package>
net.seibertmedia.confluence.linchpinsidebar.connect.external,
net.seibertmedia.confluence.linchpinsidebar.render.translate.external
</DynamicImport-Package>
Setup (Content)
<xwork name="Linchpin Sidebar Actions" key="linchpin-sidebar-actions">
<package name="linchpin-sidebar-actions" extends="default" namespace="/linchpin/sidebar">
<default-interceptor-ref name="defaultStack"/>
<action name="saved-for-later" class="net.seibertmedia.confluence.linchpinsidebar.panels.savedforlater.SavedForLaterAction" method="doDefault">
<result name="success" type="velocity">/sidebar/saved-for-later.vm</result>
</action>
</package>
</xwork>
<web-resource key="linchpin-sidebar-panel-icons">
<resource name="recent.svg" type="download" location="sidebar/recent.svg" />
<resource name="new-star.svg" type="download" location="sidebar/new-star.svg" />
</web-resource>
#requireResourcesForContext("linchpin-sidebar-iframe-utils")
<html>
<head>
<title>Sidebar iFrame</title>
<meta name="decorator" content="atl.popup" />
</head>
<body>
<div>
<p>Some content...</p>
</div>
</body>
</html>
#set ($spaceKey = $req.getParameter("spaceKey"))
#set( $ltpCtx = {"spaceKey" : "$spaceKey"})
#if($spaceKey && $linchpinTheme)
$linchpinTheme.includeExtensionResources($ltpCtx)
#end
#* alternativ *#
#parse ("/sidebar/space-scheme-aware-iframe.util.vm")
AJS.toInit(function () {
var iframeUtils = require("linchpin/sidebar/iframe-utils");
// move dialog to parent
iframeUtils.getParentBody().append($('#demo-dialog'));
$('#demo-dialog').remove();
// Shows the dialog button within frame is clicked
AJS.$("#dialog-show-button").click(function (e) {
e.preventDefault();
iframeUtils.executeInParent(function () {
AJS.dialog2("#demo-dialog").show();
});
});
// register close handler in parent
iframeUtils.executeInParent(function () {
// Hides the dialog
AJS.$("#dialog-submit-button").click(function (e) {
e.preventDefault();
AJS.dialog2("#demo-dialog").hide();
});
});
})
public class SavedForLaterPanel implements LinchpinSidebarPanel {
private final static I18nKey headline = I18nKey.of("starred.title");
private final static I18nKey link = I18nKey.of("some.i18n.key");
/* wird später u.U. für Migrationspfade nötig. aktuelle Version: 1 */
@Override
public int getApiVersion() {return 1; }
/* aktuell einzige Art und Weise der Darstellung */
@Override
public DisplayStrategy getDisplayStrategy() {
return DisplayStrategy.ACTION;
}
/* Angabe, wo das Icon des Eintrags zu sehen ist (überall oder nur im ausgeklappten Modus der Sidebar, vgl. JavaDocs am Enum) */
@Override
public MenuViewStrategy getMenuViewStrategy() {
return MenuViewStrategy.DEFAULT;
}
/* Link zur Action */
@Override
public String getActionUrl() {
return "/linchpin/sidebar/saved-for-later.action";
}
/* Identifier für das SVG-Icon (Format ist wichtig!) des Menüeintrages */
@Override
public FrontendResourceIdentifier getIcon() {
return new FrontendResourceIdentifier("net.seibertmedia.confluence.linchpin-sidebar:linchpin-sidebar-panel-icons", "new-star.svg");
}
/* Identifier für das svg (Format ist wichtig!) Icon des Menüeintrages im ausgeklappten Zustand. Falls null wird das obere Icon verwendet. */
@Nullable
@Override
public FrontendResourceIdentifier getNavigationIcon() {
return null;
}
/* i18n Objekt für die Headline. Nicht im getter erzeugen. Objekt wird zur Laufzeit übersetzt. */
@Override
public I18nKey getHeadline() {
return headline;
}
/* Link, der neben der Headline angezeigt wird. Optional. */
@Override
public AnchorLink getAnchor() {
return new AnchorLink(link, "http://google.com");
}
}
☁️ Looking for a Cloud-based Intranet?
Check out Mantra, your go-to alternative to Linchpin in the Atlassian Cloud!
Mantra is your a comprehensive solution for connecting teams, making collaboration a breeze, and keeping your company's internal communication strong and streamlined - all in the cloud.
Test the intranet for Confluence Cloud now for free:
Link to this page: https://seibert.biz/sidebar-api