mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 17:02:47 +00:00
[file search] modified ui
This commit is contained in:
@@ -41,7 +41,7 @@ textarea {
|
|||||||
}
|
}
|
||||||
input {
|
input {
|
||||||
height:22px;
|
height:22px;
|
||||||
line-height:22px;
|
/*line-height:22px;*/
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
margin:3px 0;
|
margin:3px 0;
|
||||||
}
|
}
|
||||||
@@ -376,13 +376,13 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
width:100%;
|
width:100%;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
overflow:hidden;
|
|
||||||
border-bottom:1px solid #ddd;
|
border-bottom:1px solid #ddd;
|
||||||
margin-bottom:25px;
|
margin-bottom:25px;
|
||||||
}
|
}
|
||||||
#header-inner {
|
#header-inner {
|
||||||
width:950px;
|
width:950px;
|
||||||
margin:0 auto;
|
margin:0 auto;
|
||||||
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
#main {
|
#main {
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
@@ -537,6 +537,9 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
height:21px;
|
height:21px;
|
||||||
margin:0 14px;
|
margin:0 14px;
|
||||||
}
|
}
|
||||||
|
.ru #header .nav li {
|
||||||
|
margin:0 11px;
|
||||||
|
}
|
||||||
#header .nav a,
|
#header .nav a,
|
||||||
#header .nav a:visited {
|
#header .nav a:visited {
|
||||||
color:#8A948F;
|
color:#8A948F;
|
||||||
@@ -1915,7 +1918,6 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
height: 30px;
|
height: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* wiki page */
|
/* wiki page */
|
||||||
#wiki-area.article {
|
#wiki-area.article {
|
||||||
padding: 0 0;
|
padding: 0 0;
|
||||||
@@ -1927,54 +1929,48 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
color:red;
|
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 {
|
#search-form {
|
||||||
float: right;
|
width:426px;
|
||||||
margin-top: 5px;
|
*width:430px;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
#search-form .search-input {
|
||||||
#search-keyword {
|
width:392px;
|
||||||
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-container {
|
||||||
.search-info {
|
padding:7px 5px;
|
||||||
font-size: 16px;
|
background:#f7f7f8;
|
||||||
border-bottom: 1px solid #8A948F;
|
border-radius:2px;
|
||||||
padding-bottom: 3px;
|
|
||||||
}
|
}
|
||||||
|
#search-results {
|
||||||
.search-result-count {
|
padding-top:15px;
|
||||||
font-size: 13px;
|
}
|
||||||
color: #999;
|
|
||||||
line-height: 35px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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);
|
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
|
//highlight the tr when mouse hover on it
|
||||||
$("table tr:gt(0), .checkbox-label").hover(
|
$("table tr:gt(0), .checkbox-label").hover(
|
||||||
function() {
|
function() {
|
||||||
@@ -56,6 +63,7 @@ if ($.browser.msie) {
|
|||||||
$('button, input[type="checkbox"], input[type="radio"], input[type="submit"]').focus(function() {
|
$('button, input[type="checkbox"], input[type="radio"], input[type="submit"]').focus(function() {
|
||||||
$(this).blur();
|
$(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
|
@login_required
|
||||||
def search(request):
|
def search(request):
|
||||||
keyword = request.GET['keyword']
|
keyword = request.GET['q']
|
||||||
current_page = int(request.GET.get('page', '1'))
|
current_page = int(request.GET.get('page', '1'))
|
||||||
per_page= int(request.GET.get('per_page', '25'))
|
per_page= int(request.GET.get('per_page', '25'))
|
||||||
|
|
||||||
@@ -55,4 +55,4 @@ def search(request):
|
|||||||
'prev_page': current_page - 1,
|
'prev_page': current_page - 1,
|
||||||
'next_page': current_page + 1,
|
'next_page': current_page + 1,
|
||||||
'per_page': per_page,
|
'per_page': per_page,
|
||||||
}, context_instance=RequestContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
|
@@ -88,8 +88,9 @@
|
|||||||
{% block nav %}{% endblock %}
|
{% block nav %}{% endblock %}
|
||||||
|
|
||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
<form id="search-form" method="GET" action="{% url 'search' %}">
|
<form id="top-search-form" method="get" action="{% url 'search' %}" class="search-form fright">
|
||||||
<input id="search-keyword" name="keyword" placeholder="{% trans 'Search Seafile' %}" />
|
<input class="search-input" name="q" placeholder="{% trans 'Search Files' %}" value="{{ keyword }}" />
|
||||||
|
<input type="submit" value="" class="search-submit" />
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -4,68 +4,66 @@
|
|||||||
{% load url from future %}
|
{% load url from future %}
|
||||||
|
|
||||||
{% block right_panel %}
|
{% block right_panel %}
|
||||||
<p class="search-info">
|
<div id="search-form-container">
|
||||||
{% trans 'Search results for' %} <span class="search-info-keyword">"{{ keyword }}"</span>
|
<form method="get" action="{% url 'search' %}" class="search-form" id="search-form">
|
||||||
</p>
|
<input class="search-input" name="q" placeholder="{% trans 'Search Files' %}" value="{{ keyword }}" />
|
||||||
{% if not results %}
|
<input type="submit" value="" class="search-submit" />
|
||||||
<p class="search-results-empty">
|
</form>
|
||||||
{% trans 'No search result found' %}
|
|
||||||
</p>
|
|
||||||
{% else %}
|
|
||||||
<p class="search-result-count">{% trans 'Found' %} {{ total }} {% trans 'results' %} </p>
|
|
||||||
<table class="search-results">
|
|
||||||
<tr>
|
|
||||||
<th width="10%"></th> <!-- icon -->
|
|
||||||
<th width="40%">{% trans 'Name' %}</th>
|
|
||||||
<th width="30%">{% trans 'Library' %}</th>
|
|
||||||
<th width="20%">{% 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>
|
|
||||||
{% avatar file.repo.owner 20 %}
|
|
||||||
<a class="name" href="{% url 'profile.views.user_profile' file.repo.owner %}">{{ file.repo.owner|email2nickname }}</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
<div id="paginator">
|
|
||||||
{% if current_page != 1 %}
|
|
||||||
<a href="?keyword={{ 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>
|
|
||||||
{% 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>
|
|
||||||
{% 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>
|
|
||||||
{% 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>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="search-results">
|
||||||
|
{% if not results %}
|
||||||
|
<p>{% trans 'No result found' %}</p>
|
||||||
|
{% else %}
|
||||||
|
<p class="tip">{% blocktrans count counter=total %}{{ total }} result{% plural %}{{ total }} results{% endblocktrans%}</p>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<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 }}" 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 %}" target="_blank">{{ file.repo.owner|email2nickname }}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% if total > 25 %}
|
||||||
|
<div id="paginator">
|
||||||
|
{% if current_page != 1 %}
|
||||||
|
<a href="?q={{ keyword|urlencode }}&page={{ prev_page }}&per_page={{ per_page }}">{% trans "Previous"%}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if has_more %}
|
||||||
|
<a href="?q={{ keyword|urlencode }}&page={{ next_page }}&per_page={{ per_page }}">{% trans "Next"%}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if current_page != 1 or has_more %}
|
||||||
|
|
|
||||||
|
{% endif %}
|
||||||
|
<span>{% trans "Per page: "%}</span>
|
||||||
|
{% if per_page == 25 %}
|
||||||
|
<span> 25 </span>
|
||||||
|
{% else %}
|
||||||
|
<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="?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="?q={{ keyword|urlencode }}&page={{ current_page }}&per_page=100" class="per-page">100</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Reference in New Issue
Block a user