diff options
author | James Moger <james.moger@gitblit.com> | 2014-04-22 22:53:06 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-05-05 11:32:46 -0400 |
commit | 7a401a3ff909bf82fb4068d6dba430497f74084a (patch) | |
tree | b435b1c014e7e3b7e237d2c2decfbba7a621465f /src/site | |
parent | 859deba551b5e6850fb6331084493a402cecce45 (diff) | |
download | gitblit-7a401a3ff909bf82fb4068d6dba430497f74084a.tar.gz gitblit-7a401a3ff909bf82fb4068d6dba430497f74084a.zip |
Allow plugins to extend the top navbar and repository navbar
This change also ties the plugin manager into the Wicket framework and
allows plugins to contribute and mount new pages which are linked by the
top navbar and repository navbar extensions.
Diffstat (limited to 'src/site')
-rw-r--r-- | src/site/plugins_extensions.mkd | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/src/site/plugins_extensions.mkd b/src/site/plugins_extensions.mkd index 18a7e325..7bf63c17 100644 --- a/src/site/plugins_extensions.mkd +++ b/src/site/plugins_extensions.mkd @@ -52,6 +52,37 @@ public class ExamplePlugin extends GitblitPlugin { public void onUninstall() { } } + +/** + * You can also create Webapp plugins that register mounted pages. + */ +public class ExampleWicketPlugin extends GitblitWicketPlugin { + @Override + public void start() { + } + + @Override + public void stop() { + } + + @Override + public void onInstall() { + } + + @Override + public void onUpgrade(Version oldVersion) { + } + + @Override + public void onUninstall() { + } + + @Override + protected void init(GitblitWicketApp app) { + app.mount("/logo", LogoPage.class); + app.mount("/hello", HelloWorldPage.class); + } +} ``` ### SSH Dispatch Command @@ -225,7 +256,32 @@ public class MyUserMenuContributor extends UserMenuExtension { @Override public List<MenuItem> getMenuItems(UserModel user) { - return Arrays.asList((MenuItem) new ExternalLinkMenuItem("Github", String.format("https://github.com/%s", user.username)); + MenuItem item = new ExternalLinkMenuItem("Github", String.format("https://github.com/%s", user.username)); + return Arrays.asList(item); + } +} +``` + +### Navigation Links + +*SINCE 1.6.0* + +You can provide your own top-level navigation links by subclassing the *NavLinkExtension* class. + +```java +import java.util.Arrays; +import java.util.List; +import ro.fortsoft.pf4j.Extension; +import com.gitblit.extensions.NavLinkExtension; +import com.gitblit.models.UserModel; + +@Extension +public class MyNavLink extends NavLinkExtension { + + @Override + public List<NavLink> getNavLinks(UserModel user) { + NavLink link = new ExternalLinkMenuItem("Github", String.format("https://github.com/%s", user.username)); + return Arrays.asList(link); } } ``` |