]> source.dussan.org Git - gitblit.git/commitdiff
Fixed dashboard owned repo list and the activity titles
authorJames Moger <james.moger@gitblit.com>
Thu, 20 Jun 2013 12:35:53 +0000 (08:35 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 20 Jun 2013 12:35:53 +0000 (08:35 -0400)
src/main/java/com/gitblit/wicket/pages/DashboardPage.java
src/main/java/com/gitblit/wicket/pages/MyDashboardPage.java
src/main/java/com/gitblit/wicket/pages/ProjectPage.java

index 3c2828b7292e5df1e4d1bc3334515cfd61d715e4..64d525546769968037cc9074639eb8b239662037 100644 (file)
@@ -74,7 +74,7 @@ public abstract class DashboardPage extends RootPage {
                return true;\r
        }\r
 \r
-       protected void addActivity(UserModel user, Collection<RepositoryModel> repositories, boolean isStarred, int daysBack) {\r
+       protected void addActivity(UserModel user, Collection<RepositoryModel> repositories, String feedTitle, int daysBack) {\r
                Calendar c = Calendar.getInstance();\r
                c.add(Calendar.DATE, -1*daysBack);\r
                Date minimumDate = c.getTime();\r
@@ -91,7 +91,7 @@ public abstract class DashboardPage extends RootPage {
                \r
                Fragment activityFragment = new Fragment("activity", "activityFragment", this);\r
                add(activityFragment);\r
-               activityFragment.add(new Label("feedTitle", getString( isStarred ?  "gb.starredAndOwned" : "gb.recentActivity")));\r
+               activityFragment.add(new Label("feedTitle", feedTitle));\r
                if (digests.size() == 0) {\r
                        // quiet or no starred repositories\r
                        if (repositories.size() == 0) {\r
index f6f96853a81dbcbf36e698bb6f715103c0aba7c9..69dadbd0531b229bc22f991628d3e194b2a0a7e3 100644 (file)
@@ -130,14 +130,26 @@ public class MyDashboardPage extends DashboardPage {
                Collections.sort(starred, lastUpdateSort);\r
                Collections.sort(active, lastUpdateSort);\r
                \r
+               String activityTitle;\r
                Set<RepositoryModel> feed = new HashSet<RepositoryModel>();\r
                feed.addAll(starred);\r
                feed.addAll(owned);\r
                if (feed.isEmpty()) {\r
+                       // no starred or owned, go with recent activity\r
+                       activityTitle = getString("gb.recentActivity");\r
                        feed.addAll(active);\r
+               } else if (starred.isEmpty()){\r
+                       // no starred, owned repos feed\r
+                       activityTitle = getString("gb.owned");\r
+               } else if (owned.isEmpty()){\r
+                       // no owned, starred repos feed\r
+                       activityTitle = getString("gb.starred");\r
+               } else {\r
+                       // starred and owned repositories\r
+                       activityTitle = getString("gb.starredAndOwned");\r
                }\r
                \r
-               addActivity(user, feed, starred.size() > 0 || owned.size() > 0, daysBack);\r
+               addActivity(user, feed, activityTitle, daysBack);\r
                \r
                Fragment repositoryTabs;\r
                if (UserModel.ANONYMOUS.equals(user)) {\r
@@ -174,7 +186,7 @@ public class MyDashboardPage extends DashboardPage {
                if (ArrayUtils.isEmpty(owned)) {\r
                        repositoryTabs.add(new Label("owned").setVisible(false));\r
                } else {\r
-                       FilterableRepositoryList repoList = new FilterableRepositoryList("owned", starred);\r
+                       FilterableRepositoryList repoList = new FilterableRepositoryList("owned", owned);\r
                        repoList.setTitle(getString("gb.myRepositories"), "icon-user");\r
                        repoList.setAllowCreate(user.canCreate() || user.canAdmin());\r
                        repositoryTabs.add(repoList);\r
index bfc8493ccd25f93962233a7b9303140043f327ec..fbd1db024183b49425fb9174c0040891453a8851 100644 (file)
@@ -122,8 +122,7 @@ public class ProjectPage extends DashboardPage {
                        }\r
                });\r
 \r
-               \r
-               addActivity(user, repositories, false, daysBack);\r
+               addActivity(user, repositories, getString("gb.recentActivity"), daysBack);\r
                \r
                if (repositories.isEmpty()) {\r
                        add(new Label("repositoryList").setVisible(false));\r