mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 16:31:13 +00:00
[file search] modified ui
This commit is contained in:
@@ -41,7 +41,7 @@ textarea {
|
||||
}
|
||||
input {
|
||||
height:22px;
|
||||
line-height:22px;
|
||||
/*line-height:22px;*/
|
||||
border: 1px solid #ddd;
|
||||
margin:3px 0;
|
||||
}
|
||||
@@ -376,13 +376,13 @@ textarea:-moz-placeholder {/* for FF */
|
||||
width:100%;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
overflow:hidden;
|
||||
border-bottom:1px solid #ddd;
|
||||
margin-bottom:25px;
|
||||
}
|
||||
#header-inner {
|
||||
width:950px;
|
||||
margin:0 auto;
|
||||
overflow:hidden;
|
||||
}
|
||||
#main {
|
||||
min-height: 400px;
|
||||
@@ -537,6 +537,9 @@ textarea:-moz-placeholder {/* for FF */
|
||||
height:21px;
|
||||
margin:0 14px;
|
||||
}
|
||||
.ru #header .nav li {
|
||||
margin:0 11px;
|
||||
}
|
||||
#header .nav a,
|
||||
#header .nav a:visited {
|
||||
color:#8A948F;
|
||||
@@ -1915,7 +1918,6 @@ textarea:-moz-placeholder {/* for FF */
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
|
||||
/* wiki page */
|
||||
#wiki-area.article {
|
||||
padding: 0 0;
|
||||
@@ -1927,54 +1929,48 @@ textarea:-moz-placeholder {/* for FF */
|
||||
color:red;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
padding-left:5px;
|
||||
height:28px;
|
||||
border:1px solid #ddd;
|
||||
border-radius:3px;
|
||||
background:#fff;
|
||||
overflow:hidden;/*for some chromium*/
|
||||
}
|
||||
|
||||
#top-search-form {
|
||||
width:214px;
|
||||
*width:218px;
|
||||
margin-top:1px;
|
||||
}
|
||||
.search-input,
|
||||
.search-form .search-submit {
|
||||
height:28px;
|
||||
border:0;
|
||||
margin:0;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.search-input {
|
||||
width:180px;
|
||||
outline:0;
|
||||
}
|
||||
.search-form .search-submit {
|
||||
width:30px;
|
||||
padding:0;
|
||||
background:#fff url('../img/search.png') no-repeat scroll 50% 50%;
|
||||
}
|
||||
#search-form {
|
||||
float: right;
|
||||
margin-top: 5px;
|
||||
width: 200px;
|
||||
height: 24px;
|
||||
border: 2px solid #CDCDCD;
|
||||
border-color: #9A9A9A #CDCDCD #CDCDCD #9A9A9A;
|
||||
border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-ms-border-radius: 3px;
|
||||
-o-border-radius: 3px;
|
||||
box-shadow: 0 0 0 #000,inset 0px 3px 3px #eee;
|
||||
-moz-box-shadow: 0 0 0 #000,inset 0px 3px 3px #eee;
|
||||
-webkit-box-shadow: 0 0 0 #000,inset 0px 3px 3px #eee;
|
||||
width:426px;
|
||||
*width:430px;
|
||||
}
|
||||
|
||||
#search-keyword {
|
||||
margin: 0;
|
||||
width: 180px;
|
||||
height: 20px;
|
||||
padding: 2px;
|
||||
padding-left: 18px;
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
background: url('../img/search.png') no-repeat scroll left center;
|
||||
#search-form .search-input {
|
||||
width:392px;
|
||||
}
|
||||
|
||||
.search-info {
|
||||
font-size: 16px;
|
||||
border-bottom: 1px solid #8A948F;
|
||||
padding-bottom: 3px;
|
||||
#search-form-container {
|
||||
padding:7px 5px;
|
||||
background:#f7f7f8;
|
||||
border-radius:2px;
|
||||
}
|
||||
|
||||
.search-result-count {
|
||||
font-size: 13px;
|
||||
color: #999;
|
||||
line-height: 35px;
|
||||
#search-results {
|
||||
padding-top:15px;
|
||||
}
|
||||
|
||||
.search-info-keyword {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.search-results {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
|
@@ -13,6 +13,13 @@ if ($('.messages')[0]) {
|
||||
setTimeout(function() { $('.messages').addClass('hide'); }, 10000);
|
||||
}
|
||||
|
||||
// search: disable submit when input nothing
|
||||
$('.search-form').submit(function() {
|
||||
if (!$.trim($(this).find('.search-input').val())) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//highlight the tr when mouse hover on it
|
||||
$("table tr:gt(0), .checkbox-label").hover(
|
||||
function() {
|
||||
@@ -56,6 +63,7 @@ if ($.browser.msie) {
|
||||
$('button, input[type="checkbox"], input[type="radio"], input[type="submit"]').focus(function() {
|
||||
$(this).blur();
|
||||
});
|
||||
$('.search-input').css({'line-height':$('.search-input').css('height')});
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -33,7 +33,7 @@ from seahub.utils import search_file_by_name
|
||||
|
||||
@login_required
|
||||
def search(request):
|
||||
keyword = request.GET['keyword']
|
||||
keyword = request.GET['q']
|
||||
current_page = int(request.GET.get('page', '1'))
|
||||
per_page= int(request.GET.get('per_page', '25'))
|
||||
|
||||
|
@@ -88,8 +88,9 @@
|
||||
{% block nav %}{% endblock %}
|
||||
|
||||
{% if request.user.is_authenticated %}
|
||||
<form id="search-form" method="GET" action="{% url 'search' %}">
|
||||
<input id="search-keyword" name="keyword" placeholder="{% trans 'Search Seafile' %}" />
|
||||
<form id="top-search-form" method="get" action="{% url 'search' %}" class="search-form fright">
|
||||
<input class="search-input" name="q" placeholder="{% trans 'Search Files' %}" value="{{ keyword }}" />
|
||||
<input type="submit" value="" class="search-submit" />
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@@ -4,68 +4,66 @@
|
||||
{% load url from future %}
|
||||
|
||||
{% block right_panel %}
|
||||
<p class="search-info">
|
||||
{% trans 'Search results for' %} <span class="search-info-keyword">"{{ keyword }}"</span>
|
||||
</p>
|
||||
<div id="search-form-container">
|
||||
<form method="get" action="{% url 'search' %}" class="search-form" id="search-form">
|
||||
<input class="search-input" name="q" placeholder="{% trans 'Search Files' %}" value="{{ keyword }}" />
|
||||
<input type="submit" value="" class="search-submit" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="search-results">
|
||||
{% if not results %}
|
||||
<p class="search-results-empty">
|
||||
{% trans 'No search result found' %}
|
||||
</p>
|
||||
<p>{% trans 'No result found' %}</p>
|
||||
{% else %}
|
||||
<p class="search-result-count">{% trans 'Found' %} {{ total }} {% trans 'results' %} </p>
|
||||
<table class="search-results">
|
||||
<p class="tip">{% blocktrans count counter=total %}{{ total }} result{% plural %}{{ total }} results{% endblocktrans%}</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th width="10%"></th> <!-- icon -->
|
||||
<th width="40%">{% trans 'Name' %}</th>
|
||||
<th width="30%">{% trans 'Library' %}</th>
|
||||
<th width="20%">{% trans 'Owner' %}</th>
|
||||
<th width="5%"></th>
|
||||
<th width="45%">{% trans 'Name' %}</th>
|
||||
<th width="22%">{% trans 'Library' %}</th>
|
||||
<th width="28%">{% trans 'Owner' %}</th>
|
||||
</tr>
|
||||
{% for file in results %}
|
||||
<tr>
|
||||
<td>
|
||||
<img src="{{ MEDIA_URL }}img/file/{{ file.name|file_icon_filter }}" alt="{% trans "File"%}" />
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'repo_view_file' repo_id=file.repo.id %}?p={{ file.fullpath|urlencode }}">{{ file.name }}</a>
|
||||
({{ file.score }})
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'repo' repo_id=file.repo.id %}">{{ file.repo.name }}</a>
|
||||
</td>
|
||||
<td><img src="{{ MEDIA_URL }}img/file/{{ file.name|file_icon_filter }}" alt="{% trans "File"%}" /></td>
|
||||
<td><a href="{% url 'repo_view_file' repo_id=file.repo.id %}?p={{ file.fullpath|urlencode }}" target="_blank">{{ file.name }}</a></td>
|
||||
<td><a href="{% url 'repo' repo_id=file.repo.id %}" target="_blank">{{ file.repo.name }}</a></td>
|
||||
<td>
|
||||
{% avatar file.repo.owner 20 %}
|
||||
<a class="name" href="{% url 'profile.views.user_profile' file.repo.owner %}">{{ file.repo.owner|email2nickname }}</a>
|
||||
<a class="name" href="{% url 'profile.views.user_profile' file.repo.owner %}" target="_blank">{{ file.repo.owner|email2nickname }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<div id="paginator">
|
||||
</table>
|
||||
{% if total > 25 %}
|
||||
<div id="paginator">
|
||||
{% if current_page != 1 %}
|
||||
<a href="?keyword={{ keyword|urlencode }}&page={{ prev_page }}&per_page={{ per_page }}">{% trans "Previous"%}</a>
|
||||
<a href="?q={{ keyword|urlencode }}&page={{ prev_page }}&per_page={{ per_page }}">{% trans "Previous"%}</a>
|
||||
{% endif %}
|
||||
{% if has_more %}
|
||||
<a href="?keyword={{ keyword|urlencode }}&page={{ next_page }}&per_page={{ per_page }}">{% trans "Next"%}</a>
|
||||
<a href="?q={{ keyword|urlencode }}&page={{ next_page }}&per_page={{ per_page }}">{% trans "Next"%}</a>
|
||||
{% endif %}
|
||||
{% if current_page != 1 or has_more %}
|
||||
|
|
||||
{% endif %}
|
||||
{% if current_page != 1 or has_more %}
|
||||
|
|
||||
{% endif %}
|
||||
<span>{% trans "Per page: "%}</span>
|
||||
{% if per_page == 25 %}
|
||||
<span> 25 </span>
|
||||
{% else %}
|
||||
<a href="?keyword={{ keyword|urlencode }}&page={{ current_page }}&per_page=25" class="per-page">25</a>
|
||||
<a href="?q={{ keyword|urlencode }}&page={{ current_page }}&per_page=25" class="per-page">25</a>
|
||||
{% endif %}
|
||||
{% if per_page == 50 %}
|
||||
<span> 50 </span>
|
||||
{% else %}
|
||||
<a href="?keyword={{ keyword|urlencode }}&page={{ current_page }}&per_page=50" class="per-page">50</a>
|
||||
<a href="?q={{ keyword|urlencode }}&page={{ current_page }}&per_page=50" class="per-page">50</a>
|
||||
{% endif %}
|
||||
{% if per_page == 100 %}
|
||||
<span> 100 </span>
|
||||
{% else %}
|
||||
<a href="?keyword={{ keyword|urlencode }}&page={{ current_page }}&per_page=100" class="per-page">100</a>
|
||||
<a href="?q={{ keyword|urlencode }}&page={{ current_page }}&per_page=100" class="per-page">100</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user