Search in sources :

Example 1 with RepositoriesPanel

use of com.gitblit.wicket.panels.RepositoriesPanel in project gitblit by gitblit.

the class RepositoriesPage method setup.

private void setup(PageParameters params) {
    setupPage("", "");
    // check to see if we should display a login message
    boolean authenticateView = app().settings().getBoolean(Keys.web.authenticateViewPages, true);
    if (authenticateView && !GitBlitWebSession.get().isLoggedIn()) {
        String messageSource = app().settings().getString(Keys.web.loginMessage, "gitblit");
        String message = readMarkdown(messageSource, "login.mkd");
        Component repositoriesMessage = new Label("repositoriesMessage", message);
        add(repositoriesMessage.setEscapeModelStrings(false));
        add(new Label("repositoriesPanel"));
        return;
    }
    // Load the markdown welcome message
    String messageSource = app().settings().getString(Keys.web.repositoriesMessage, "gitblit");
    String message = readMarkdown(messageSource, "welcome.mkd");
    Component repositoriesMessage = new Label("repositoriesMessage", message).setEscapeModelStrings(false).setVisible(message.length() > 0);
    add(repositoriesMessage);
    // conditionally include personal repositories in this page
    List<RepositoryModel> repositories = getRepositories(params);
    if (!app().settings().getBoolean(Keys.web.includePersonalRepositories, true)) {
        Iterator<RepositoryModel> itr = repositories.iterator();
        while (itr.hasNext()) {
            RepositoryModel rm = itr.next();
            if (rm.isPersonalRepository()) {
                itr.remove();
            }
        }
    }
    RepositoriesPanel repositoriesPanel = new RepositoriesPanel("repositoriesPanel", showAdmin, true, repositories, true, getAccessRestrictions());
    // welcome message
    if (!showAdmin && !repositoriesMessage.isVisible()) {
        WicketUtils.setCssStyle(repositoriesPanel, "padding-top:5px;");
    }
    add(repositoriesPanel);
}
Also used : RepositoriesPanel(com.gitblit.wicket.panels.RepositoriesPanel) Label(org.apache.wicket.markup.html.basic.Label) RepositoryModel(com.gitblit.models.RepositoryModel) Component(org.apache.wicket.Component)

Aggregations

RepositoryModel (com.gitblit.models.RepositoryModel)1 RepositoriesPanel (com.gitblit.wicket.panels.RepositoriesPanel)1 Component (org.apache.wicket.Component)1 Label (org.apache.wicket.markup.html.basic.Label)1