1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 01:12:03 +00:00

[file search] modified ui

This commit is contained in:
llj
2013-03-08 16:45:04 +08:00
committed by lins05
parent c22c31c80a
commit 2bb4532fb9
5 changed files with 118 additions and 115 deletions

View File

@@ -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 { .search-form {
float: right; padding-left:5px;
margin-top: 5px; height:28px;
width: 200px; border:1px solid #ddd;
height: 24px;
border: 2px solid #CDCDCD;
border-color: #9A9A9A #CDCDCD #CDCDCD #9A9A9A;
border-radius:3px; border-radius:3px;
-webkit-border-radius: 3px; background:#fff;
-moz-border-radius: 3px; overflow:hidden;/*for some chromium*/
-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-keyword { #top-search-form {
margin: 0; width:214px;
width: 180px; *width:218px;
height: 20px; margin-top:1px;
padding: 2px; }
padding-left: 18px; .search-input,
font-size: 12px; .search-form .search-submit {
line-height: 12px; height:28px;
border:0; border:0;
margin:0;
vertical-align:middle;
}
.search-input {
width:180px;
outline:0; outline:0;
background: url('../img/search.png') no-repeat scroll left center;
} }
.search-form .search-submit {
.search-info { width:30px;
font-size: 16px; padding:0;
border-bottom: 1px solid #8A948F; background:#fff url('../img/search.png') no-repeat scroll 50% 50%;
padding-bottom: 3px;
} }
#search-form {
.search-result-count { width:426px;
font-size: 13px; *width:430px;
color: #999;
line-height: 35px;
} }
#search-form .search-input {
.search-info-keyword { width:392px;
font-size: 18px;
font-weight: bold;
} }
#search-form-container {
.search-results { padding:7px 5px;
margin-top: 10px; background:#f7f7f8;
border-radius:2px;
}
#search-results {
padding-top:15px;
} }

View File

@@ -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')});
} }
/* /*

View File

@@ -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'))

View File

@@ -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>

View File

@@ -4,47 +4,44 @@
{% 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 }}" />
<input type="submit" value="" class="search-submit" />
</form>
</div>
<div id="search-results">
{% if not results %} {% if not results %}
<p class="search-results-empty"> <p>{% trans 'No result found' %}</p>
{% trans 'No search result found' %}
</p>
{% else %} {% else %}
<p class="search-result-count">{% trans 'Found' %} {{ total }} {% trans 'results' %} </p> <p class="tip">{% blocktrans count counter=total %}{{ total }} result{% plural %}{{ total }} results{% endblocktrans%}</p>
<table class="search-results"> <table>
<tr> <tr>
<th width="10%"></th> <!-- icon --> <th width="5%"></th>
<th width="40%">{% trans 'Name' %}</th> <th width="45%">{% trans 'Name' %}</th>
<th width="30%">{% trans 'Library' %}</th> <th width="22%">{% trans 'Library' %}</th>
<th width="20%">{% trans 'Owner' %}</th> <th width="28%">{% trans 'Owner' %}</th>
</tr> </tr>
{% for file in results %} {% for file in results %}
<tr> <tr>
<td> <td><img src="{{ MEDIA_URL }}img/file/{{ file.name|file_icon_filter }}" alt="{% trans "File"%}" /></td>
<img src="{{ MEDIA_URL }}img/file/{{ file.name|file_icon_filter }}" alt="{% trans "File"%}" /> <td><a href="{% url 'repo_view_file' repo_id=file.repo.id %}?p={{ file.fullpath|urlencode }}" target="_blank">{{ file.name }}</a></td>
</td> <td><a href="{% url 'repo' repo_id=file.repo.id %}" target="_blank">{{ file.repo.name }}</a></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> <td>
{% avatar file.repo.owner 20 %} {% 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> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% if total > 25 %}
<div id="paginator"> <div id="paginator">
{% if current_page != 1 %} {% 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 %} {% endif %}
{% if has_more %} {% 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 %} {% endif %}
{% if current_page != 1 or has_more %} {% if current_page != 1 or has_more %}
| |
@@ -53,19 +50,20 @@
{% if per_page == 25 %} {% if per_page == 25 %}
<span> 25 </span> <span> 25 </span>
{% else %} {% 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 %} {% endif %}
{% if per_page == 50 %} {% if per_page == 50 %}
<span> 50 </span> <span> 50 </span>
{% else %} {% 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 %} {% endif %}
{% if per_page == 100 %} {% if per_page == 100 %}
<span> 100 </span> <span> 100 </span>
{% else %} {% 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 %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% endif %}
</div>
{% endblock %} {% endblock %}