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"> <div class="pull-right">
<a href="@path/new" class="btn btn-success btn-mini">New repository</a> <a href="@path/new" class="btn btn-success btn-mini">New repository</a>
</div> </div>
Your repositories (@userRepositories.size) <span class="strong">Your repositories</span> <span class="label">@userRepositories.size</span>
</div> </div>
@if(userRepositories.isEmpty){ @if(userRepositories.isEmpty){
<div class="box-content-bottom"> <div class="box-content-bottom">
@@ -36,21 +36,28 @@
</div> </div>
} else { } else {
<div class="box-content-bottom" style="padding: 0px;"> <div class="box-content-bottom" style="padding: 0px;">
@userRepositories.map { repository => @defining(5){ max =>
<div class="box-content-row"> @userRepositories.zipWithIndex.map { case (repository, i) =>
@helper.html.repositoryicon(repository, false) <div class="box-content-row repo-link" style="@if(i > max - 1){display:none;}">
@if(repository.owner == loginAccount.get.userName){ @helper.html.repositoryicon(repository, false)
<a href="@url(repository)"><span class="strong">@repository.name</span></a> @if(repository.owner == loginAccount.get.userName){
} else { <a href="@url(repository)"><span class="strong">@repository.name</span></a>
<a href="@url(repository)">@repository.owner/<span class="strong">@repository.name</span></a> } else {
} <a href="@url(repository)">@repository.owner/<span class="strong">@repository.name</span></a>
</div> }
</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>
} }
} }
<div class="box-header"> <div class="box-header">
Recent updated repositories <span class="strong">Recent updated repositories</span>
</div> </div>
@if(recentRepositories.isEmpty){ @if(recentRepositories.isEmpty){
<div class="box-content-bottom"> <div class="box-content-bottom">
@@ -70,3 +77,11 @@
</div> </div>
</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> <a href="@path/register" class="btn btn-mini">Create new account</a>
</div> </div>
} }
Sign in <span class="strong">Sign in</span>
</div> </div>
<div class="box-content-bottom"> <div class="box-content-bottom">
<form action="@path/signin" method="POST" validate="true"> <form action="@path/signin" method="POST" validate="true">

View File

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

View File

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

View File

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