]> source.dussan.org Git - gitblit.git/commitdiff
Show display name for owner, when possible
authorJames Moger <james.moger@gitblit.com>
Tue, 2 Oct 2012 02:54:48 +0000 (22:54 -0400)
committerJames Moger <james.moger@gitblit.com>
Tue, 2 Oct 2012 02:54:48 +0000 (22:54 -0400)
src/com/gitblit/wicket/pages/SummaryPage.java
src/com/gitblit/wicket/pages/UserPage.java
src/com/gitblit/wicket/panels/ProjectRepositoryPanel.java
src/com/gitblit/wicket/panels/RepositoriesPanel.java

index 22b1c1ab4a08c8c509c06bba91e89999c51e6cc3..8df2cebc6f03f088536b13e59a27db18e2fec22c 100644 (file)
@@ -45,12 +45,14 @@ import com.gitblit.Keys;
 import com.gitblit.models.Metric;\r
 import com.gitblit.models.PathModel;\r
 import com.gitblit.models.RepositoryModel;\r
+import com.gitblit.models.UserModel;\r
 import com.gitblit.utils.ArrayUtils;\r
 import com.gitblit.utils.JGitUtils;\r
 import com.gitblit.utils.MarkdownUtils;\r
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.wicket.WicketUtils;\r
 import com.gitblit.wicket.panels.BranchesPanel;\r
+import com.gitblit.wicket.panels.LinkPanel;\r
 import com.gitblit.wicket.panels.LogPanel;\r
 import com.gitblit.wicket.panels.RepositoryUrlPanel;\r
 import com.gitblit.wicket.panels.TagsPanel;\r
@@ -80,7 +82,17 @@ public class SummaryPage extends RepositoryPage {
 \r
                // repository description\r
                add(new Label("repositoryDescription", getRepositoryModel().description));\r
-               add(new Label("repositoryOwner", getRepositoryModel().owner));\r
+               String owner = getRepositoryModel().owner;\r
+               if (StringUtils.isEmpty(owner)) {\r
+                       add(new Label("repositoryOwner").setVisible(false));\r
+               } else {\r
+                       UserModel ownerModel = GitBlit.self().getUserModel(owner);\r
+                       if (ownerModel != null) {\r
+                               add(new LinkPanel("repositoryOwner", null, ownerModel.getDisplayName(), UserPage.class, WicketUtils.newUsernameParameter(owner)));\r
+                       } else {\r
+                               add(new Label("repositoryOwner", owner));\r
+                       }\r
+               }\r
 \r
                add(WicketUtils.createTimestampLabel("repositoryLastChange",\r
                                JGitUtils.getLastChange(r), getTimeZone(), getTimeUtils()));\r
index cabefb4e5907c2f95e703766277f5f3eb48085cb..e36614626326797ce0c40ae770a8b3f517a46dbf 100644 (file)
@@ -87,7 +87,7 @@ public class UserPage extends RootPage {
                \r
                ProjectModel project = GitBlit.self().getProjectModel(projectName);\r
                if (project == null) {\r
-                       throw new RedirectException(GitBlitWebApp.get().getHomePage());\r
+                       project = new ProjectModel(projectName);\r
                }\r
                \r
                add(new Label("userDisplayName", user.getDisplayName()));\r
index f7deaf134289c9ea468ead6e78b266e184241c9b..c66fa60f94484573b30b8269bab4b00bbff281a1 100644 (file)
@@ -51,7 +51,7 @@ public class ProjectRepositoryPanel extends BasePanel {
 \r
        private static final long serialVersionUID = 1L;\r
 \r
-       public ProjectRepositoryPanel(String wicketId, Localizer localizer, Component owner,\r
+       public ProjectRepositoryPanel(String wicketId, Localizer localizer, Component parent,\r
                        final boolean isAdmin, final RepositoryModel entry,\r
                        final Map<AccessRestrictionType, String> accessRestrictions) {\r
                super(wicketId);\r
@@ -66,7 +66,7 @@ public class ProjectRepositoryPanel extends BasePanel {
                        swatch = new Label("repositorySwatch", "&nbsp;").setEscapeModelStrings(false);\r
                } else {\r
                        swatch = new Label("repositorySwatch", "!");\r
-                       WicketUtils.setHtmlTooltip(swatch, localizer.getString("gb.workingCopyWarning", owner));\r
+                       WicketUtils.setHtmlTooltip(swatch, localizer.getString("gb.workingCopyWarning", parent));\r
                }\r
                WicketUtils.setCssBackground(swatch, entry.toString());\r
                add(swatch);\r
@@ -91,13 +91,13 @@ public class ProjectRepositoryPanel extends BasePanel {
                add(new BookmarkablePageLink<Void>("docs", DocsPage.class, pp).setVisible(entry.useDocs));\r
 \r
                if (entry.isFrozen) {\r
-                       add(WicketUtils.newImage("frozenIcon", "cold_16x16.png", localizer.getString("gb.isFrozen", owner)));\r
+                       add(WicketUtils.newImage("frozenIcon", "cold_16x16.png", localizer.getString("gb.isFrozen", parent)));\r
                } else {\r
                        add(WicketUtils.newClearPixel("frozenIcon").setVisible(false));\r
                }\r
 \r
                if (entry.isFederated) {\r
-                       add(WicketUtils.newImage("federatedIcon", "federated_16x16.png", localizer.getString("gb.isFederated", owner)));\r
+                       add(WicketUtils.newImage("federatedIcon", "federated_16x16.png", localizer.getString("gb.isFederated", parent)));\r
                } else {\r
                        add(WicketUtils.newClearPixel("federatedIcon").setVisible(false));\r
                }\r
@@ -121,8 +121,17 @@ public class ProjectRepositoryPanel extends BasePanel {
                        add(WicketUtils.newBlankImage("accessRestrictionIcon"));\r
                }\r
 \r
-               add(new Label("repositoryOwner", StringUtils.isEmpty(entry.owner) ? "" : (entry.owner + " ("\r
-                               + localizer.getString("gb.owner", owner) + ")")));\r
+               if (StringUtils.isEmpty(entry.owner)) {\r
+                       add(new Label("repositoryOwner").setVisible(false));\r
+               } else {\r
+                       UserModel ownerModel = GitBlit.self().getUserModel(entry.owner);\r
+                       String owner = entry.owner;\r
+                       if (ownerModel != null) {\r
+                               owner = ownerModel.getDisplayName();\r
+                       }\r
+                       add(new Label("repositoryOwner", owner + " (" +\r
+                                       localizer.getString("gb.owner", parent) + ")"));\r
+               }\r
 \r
                UserModel user = GitBlitWebSession.get().getUser();\r
                Fragment repositoryLinks;\r
@@ -151,7 +160,7 @@ public class ProjectRepositoryPanel extends BasePanel {
                                        }\r
                                };\r
                                deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(\r
-                                               localizer.getString("gb.deleteRepository", owner), entry)));\r
+                                               localizer.getString("gb.deleteRepository", parent), entry)));\r
                                repositoryLinks.add(deleteLink);\r
                        }\r
                } else {\r
@@ -181,7 +190,7 @@ public class ProjectRepositoryPanel extends BasePanel {
                        add(new Label("repositorySize", entry.size).setVisible(showSize));\r
                } else {\r
                        // New repository\r
-                       add(new Label("repositorySize", localizer.getString("gb.empty", owner)).setEscapeModelStrings(false));\r
+                       add(new Label("repositorySize", localizer.getString("gb.empty", parent)).setEscapeModelStrings(false));\r
                }\r
 \r
                add(new ExternalLink("syndication", SyndicationServlet.asLink("", entry.name, null, 0)));\r
index 0855780b4099103ab35d702c1e11bc8f6a629dbd..4c9ed280149a96bedc49b19f13ac174a707e85cf 100644 (file)
@@ -271,7 +271,14 @@ public class RepositoriesPanel extends BasePanel {
                                        row.add(WicketUtils.newBlankImage("accessRestrictionIcon"));\r
                                }\r
 \r
-                               row.add(new Label("repositoryOwner", entry.owner));\r
+                               String owner = entry.owner;\r
+                               if (!StringUtils.isEmpty(owner)) {\r
+                                       UserModel ownerModel = GitBlit.self().getUserModel(owner);\r
+                                       if (ownerModel != null) {\r
+                                               owner = ownerModel.getDisplayName();\r
+                                       }\r
+                               }\r
+                               row.add(new Label("repositoryOwner", owner));\r
 \r
                                String lastChange;\r
                                if (entry.lastChange.getTime() == 0) {\r