Add show more link for repositories and wiki pages

This commit is contained in:
Naoki Takezoe
2015-08-23 03:19:52 +09:00
parent 2222299793
commit d6b6781861
5 changed files with 67 additions and 35 deletions

View File

@@ -28,7 +28,7 @@
<div class="pull-right">
<a href="@path/new" class="btn btn-success btn-mini">New repository</a>
</div>
Your repositories (@userRepositories.size)
<span class="strong">Your repositories</span> <span class="label">@userRepositories.size</span>
</div>
@if(userRepositories.isEmpty){
<div class="box-content-bottom">
@@ -36,21 +36,28 @@
</div>
} else {
<div class="box-content-bottom" style="padding: 0px;">
@userRepositories.map { repository =>
<div class="box-content-row">
@helper.html.repositoryicon(repository, false)
@if(repository.owner == loginAccount.get.userName){
<a href="@url(repository)"><span class="strong">@repository.name</span></a>
} else {
<a href="@url(repository)">@repository.owner/<span class="strong">@repository.name</span></a>
}
</div>
@defining(5){ max =>
@userRepositories.zipWithIndex.map { case (repository, i) =>
<div class="box-content-row repo-link" style="@if(i > max - 1){display:none;}">
@helper.html.repositoryicon(repository, false)
@if(repository.owner == loginAccount.get.userName){
<a href="@url(repository)"><span class="strong">@repository.name</span></a>
} else {
<a href="@url(repository)">@repository.owner/<span class="strong">@repository.name</span></a>
}
</div>
}
@if(userRepositories.size > max){
<div class="box-content-row show-more">
<a href="javascript:void(0);" id="show-more-repos">Show more @{userRepositories.size - max} pages...</a>
</div>
}
}
</div>
}
}
<div class="box-header">
Recent updated repositories
<span class="strong">Recent updated repositories</span>
</div>
@if(recentRepositories.isEmpty){
<div class="box-content-bottom">
@@ -70,3 +77,11 @@
</div>
</div>
}
<script>
$(function(){
$('#show-more-repos').click(function(e){
$('div.repo-link').show();
$(e.target).parents('div.show-more').remove();
});
});
</script>

View File

@@ -6,7 +6,7 @@
<a href="@path/register" class="btn btn-mini">Create new account</a>
</div>
}
Sign in
<span class="strong">Sign in</span>
</div>
<div class="box-content-bottom">
<form action="@path/signin" method="POST" validate="true">

View File

@@ -21,7 +21,7 @@
</ul>
<form action="@url(repository)/wiki/@if(page.isEmpty){_new} else {_edit}" method="POST" validate="true">
<span id="error-pageName" class="error"></span>
<input type="text" name="pageName" value="@pageName" style="width: 850px; font-weight: bold;" placeholder="Input a page name."/>
<input type="text" name="pageName" value="@pageName" style="width: 910px; font-weight: bold;" placeholder="Input a page name."/>
@helper.html.preview(
repository = repository,
content = page.map(_.content).getOrElse(""),
@@ -29,11 +29,11 @@
enableRefsLink = false,
enableTaskList = false,
hasWritePermission = false,
style = "width: 850px; height: 400px;",
style = "width: 910px; height: 400px;",
styleClass = "monospace",
placeholder = ""
)
<input type="text" name="message" value="" style="width: 850px;" placeholder="Write a small message here explaining this change. (Optional)"/>
<input type="text" name="message" value="" style="width: 910px;" placeholder="Write a small message here explaining this change. (Optional)"/>
<input type="hidden" name="currentPageName" value="@pageName"/>
<input type="hidden" name="id" value="@page.map(_.id)"/>
<input type="submit" value="Save" class="btn btn-success">

View File

@@ -25,20 +25,23 @@
</li>
</ul>
<div style="width: 200px;" class="pull-right">
<table class="table table-bordered">
<tr>
<th class="metal">Pages <span class="label">@pages.length</span></th>
</tr>
<tr>
<td>
<ul style="margin-left: 0px; margin-bottom: 0px; word-break: break-all; width: 182px;">
@pages.map { page =>
<li style="margin-left:0px; list-style-type: none;"><a href="@url(repository)/wiki/@urlEncode(page)">@page</a></li>
}
</ul>
</td>
</tr>
</table>
@defining(15){ max =>
<div class="box-header">
<span class="strong">Pages</span> <span class="label">@pages.length</span>
</div>
<div class="box-content-bottom" style="padding: 0px;">
@pages.zipWithIndex.map { case (page, i) =>
<div class="box-content-row page-link" style="border: none; @if(i > max - 1){display:none;}">
<a href="@url(repository)/wiki/@urlEncode(page)" class="strong">@page</a>
</div>
}
@if(pages.size > max){
<div class="box-content-row show-more">
<a href="javascript:void(0);" id="show-more-pages">Show more @{pages.size - max} pages...</a>
</div>
}
</div>
}
<div class="small">
<strong>Clone this wiki locally</strong>
</div>
@@ -58,9 +61,14 @@
</div>
}
}
@if(settings.ssh && loginAccount.isDefined){
<script>
$(function(){
<script>
$(function(){
$('#show-more-pages').click(function(e){
$('div.page-link').show();
$(e.target).parents('div.show-more').remove();
});
@if(settings.ssh && loginAccount.isDefined){
$('#repository-url-http').click(function(){
$('#repository-url').val('@httpUrl(repository)');
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
@@ -69,6 +77,6 @@
$('#repository-url').val('@sshUrl(repository, settings, loginAccount.get.userName)');
$('#repository-url-copy').attr('data-clipboard-text', $('#repository-url').val());
});
});
</script>
}
}
});
</script>

View File

@@ -200,6 +200,15 @@ a.omit:hover {
background-color: #aaa;
}
div.show-more {
text-align: center;
border-top: 1px solid silver;
}
div.show-more a {
color: #7aa1d3;
}
span.count-right {
float: right;
font-weight: bold;