mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-11 07:55:55 +01:00
cleanup: wiki urls could have been simpler
This commit is contained in:
@@ -14,6 +14,7 @@ import org.eclipse.jgit.patch._
|
|||||||
import org.eclipse.jgit.api.errors.PatchFormatException
|
import org.eclipse.jgit.api.errors.PatchFormatException
|
||||||
import scala.collection.JavaConverters._
|
import scala.collection.JavaConverters._
|
||||||
import RepositoryService.RepositoryInfo
|
import RepositoryService.RepositoryInfo
|
||||||
|
import RepositoryService.RepositoryUrls
|
||||||
|
|
||||||
object WikiService {
|
object WikiService {
|
||||||
|
|
||||||
@@ -38,11 +39,8 @@ object WikiService {
|
|||||||
*/
|
*/
|
||||||
case class WikiPageHistoryInfo(name: String, committer: String, message: String, date: Date)
|
case class WikiPageHistoryInfo(name: String, committer: String, message: String, date: Date)
|
||||||
|
|
||||||
def httpUrl(repoBase:RepoBase, repository: RepositoryInfo) =
|
def urls(repoBase:RepoBase, repository: RepositoryInfo):RepositoryUrls =
|
||||||
repository.urls(repoBase).httpUrl.replaceFirst("\\.git\\Z", ".wiki.git")
|
new RepositoryUrls(repoBase, repository.owner, repository.name + ".wiki")
|
||||||
|
|
||||||
def sshUrl(repoBase:RepoBase, repository: RepositoryInfo, userName: String) =
|
|
||||||
repository.urls(repoBase).sshUrl(userName).replaceFirst("\\.git\\Z", ".wiki.git")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trait WikiService {
|
trait WikiService {
|
||||||
|
|||||||
@@ -67,8 +67,8 @@
|
|||||||
<div class="small">
|
<div class="small">
|
||||||
<strong>Clone this wiki locally</strong>
|
<strong>Clone this wiki locally</strong>
|
||||||
</div>
|
</div>
|
||||||
@helper.html.copy("repository-url-copy", httpUrl(repoBase, repository)){
|
@helper.html.copy("repository-url-copy", urls(repoBase, repository).httpUrl){
|
||||||
<input type="text" value="@httpUrl(repoBase, repository)" id="repository-url" class="form-control input-sm" readonly>
|
<input type="text" value="@urls(repoBase, repository).httpUrl" id="repository-url" class="form-control input-sm" readonly>
|
||||||
}
|
}
|
||||||
@if(settings.ssh && loginAccount.isDefined){
|
@if(settings.ssh && loginAccount.isDefined){
|
||||||
<div class="small">
|
<div class="small">
|
||||||
@@ -133,11 +133,11 @@ $(function(){
|
|||||||
|
|
||||||
@if(settings.ssh && loginAccount.isDefined){
|
@if(settings.ssh && loginAccount.isDefined){
|
||||||
$('#repository-url-http').click(function(){
|
$('#repository-url-http').click(function(){
|
||||||
$('#repository-url').val('@httpUrl(repoBase, repository)');
|
$('#repository-url').val('@urls(repoBase, repository).httpUrl');
|
||||||
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
|
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
|
||||||
});
|
});
|
||||||
$('#repository-url-ssh').click(function(){
|
$('#repository-url-ssh').click(function(){
|
||||||
$('#repository-url').val('@sshUrl(repoBase, repository, loginAccount.get.userName)');
|
$('#repository-url').val('@urls(repoBase, repository).sshUrl(loginAccount.get.userName)');
|
||||||
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
|
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user