commit | author | age
|
82df52
|
1 |
/*
|
JM |
2 |
* Copyright 2011 gitblit.com.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
package com.gitblit.wicket.pages;
|
|
17 |
|
|
18 |
import java.text.MessageFormat;
|
|
19 |
import java.util.ArrayList;
|
|
20 |
import java.util.List;
|
|
21 |
|
|
22 |
import org.apache.wicket.PageParameters;
|
|
23 |
import org.apache.wicket.markup.html.basic.Label;
|
|
24 |
|
|
25 |
import com.gitblit.GitBlit;
|
|
26 |
import com.gitblit.Keys;
|
e21181
|
27 |
import com.gitblit.models.RepositoryModel;
|
JM |
28 |
import com.gitblit.utils.ArrayUtils;
|
82df52
|
29 |
import com.gitblit.wicket.WicketUtils;
|
JM |
30 |
import com.gitblit.wicket.panels.RepositoryUrlPanel;
|
|
31 |
|
|
32 |
public class EmptyRepositoryPage extends RootPage {
|
|
33 |
|
|
34 |
public EmptyRepositoryPage(PageParameters params) {
|
|
35 |
super(params);
|
|
36 |
|
|
37 |
String repositoryName = WicketUtils.getRepositoryName(params);
|
e21181
|
38 |
RepositoryModel repository = GitBlit.self().getRepositoryModel(repositoryName);
|
82df52
|
39 |
setupPage(repositoryName, getString("gb.emptyRepository"));
|
JM |
40 |
|
|
41 |
List<String> repositoryUrls = new ArrayList<String>();
|
|
42 |
|
|
43 |
if (GitBlit.getBoolean(Keys.git.enableGitServlet, true)) {
|
e21181
|
44 |
// add the Gitblit repository url
|
JM |
45 |
repositoryUrls.add(getRepositoryUrl(repository));
|
82df52
|
46 |
}
|
JM |
47 |
repositoryUrls.addAll(GitBlit.self().getOtherCloneUrls(repositoryName));
|
|
48 |
|
e21181
|
49 |
String primaryUrl = ArrayUtils.isEmpty(repositoryUrls) ? "" : repositoryUrls.get(0);
|
82df52
|
50 |
add(new Label("repository", repositoryName));
|
e21181
|
51 |
add(new RepositoryUrlPanel("pushurl", primaryUrl));
|
02e0f7
|
52 |
add(new Label("cloneSyntax", MessageFormat.format("git clone {0}", repositoryUrls.get(0))));
|
e21181
|
53 |
add(new Label("remoteSyntax", MessageFormat.format("git remote add gitblit {0}\ngit push gitblit master", primaryUrl)));
|
82df52
|
54 |
}
|
JM |
55 |
}
|