| | |
| | |
|
| | | if (rootRepositories.size() > 0) {
|
| | | // inject the root repositories at the top of the page
|
| | | String rootPath = GitBlit.getString(Keys.web.repositoryRootGroupName, " ");
|
| | | roots.add(0, rootPath);
|
| | | groups.put(rootPath, rootRepositories);
|
| | | roots.add(0, "");
|
| | | groups.put("", rootRepositories);
|
| | | }
|
| | |
|
| | | Map<String, ProjectModel> projects = new HashMap<String, ProjectModel>();
|
| | | for (ProjectModel project : GitBlit.self().getProjectModels(user, true)) {
|
| | | projects.put(project.name, project);
|
| | | }
|
| | | List<RepositoryModel> groupedModels = new ArrayList<RepositoryModel>();
|
| | | for (String root : roots) {
|
| | | List<RepositoryModel> subModels = groups.get(root);
|
| | | GroupRepositoryModel group = new GroupRepositoryModel(root, subModels.size());
|
| | | if (projects.containsKey(root)) {
|
| | | group.title = projects.get(root).title;
|
| | | group.description = projects.get(root).description;
|
| | | ProjectModel project = GitBlit.self().getProjectModel(root);
|
| | | GroupRepositoryModel group = new GroupRepositoryModel(project.name, subModels.size());
|
| | | if (project != null) {
|
| | | group.title = project.title;
|
| | | group.description = project.description;
|
| | | }
|
| | | groupedModels.add(group);
|
| | | Collections.sort(subModels);
|
| | |
| | | public void populateItem(final Item<RepositoryModel> item) {
|
| | | final RepositoryModel entry = item.getModelObject();
|
| | | if (entry instanceof GroupRepositoryModel) {
|
| | | GroupRepositoryModel groupRow = (GroupRepositoryModel) entry;
|
| | | currGroupName = entry.name;
|
| | | Fragment row = new Fragment("rowContent", "groupRepositoryRow", this);
|
| | | item.add(row);
|
| | |
|
| | | String name = entry.toString();
|
| | | String name = groupRow.name;
|
| | | if (name.charAt(0) == '~') {
|
| | | // user page
|
| | | String username = name.substring(1);
|
| | | UserModel user = GitBlit.self().getUserModel(username);
|
| | | row.add(new LinkPanel("groupName", null, user == null ? username : user.getDisplayName(), UserPage.class, WicketUtils.newUsernameParameter(username)));
|
| | | row.add(new LinkPanel("groupName", null, (user == null ? username : user.getDisplayName()) + " (" + groupRow.count + ")", UserPage.class, WicketUtils.newUsernameParameter(username)));
|
| | | row.add(new Label("groupDescription", getString("gb.personalRepositories")));
|
| | | } else {
|
| | | // project page
|
| | | row.add(new LinkPanel("groupName", null, name, ProjectPage.class, WicketUtils.newProjectParameter(entry.name)));
|
| | | row.add(new LinkPanel("groupName", null, groupRow.toString(), ProjectPage.class, WicketUtils.newProjectParameter(entry.name)));
|
| | | row.add(new Label("groupDescription", entry.description == null ? "":entry.description));
|
| | | }
|
| | | WicketUtils.setCssClass(item, "group");
|
| | |
| | |
|
| | | @Override
|
| | | public String toString() {
|
| | | return StringUtils.isEmpty(title) ? name : title + " (" + count + ")";
|
| | | return (StringUtils.isEmpty(title) ? name : title) + " (" + count + ")";
|
| | | }
|
| | | }
|
| | |
|