diff --git a/media/css/seahub.css b/media/css/seahub.css index ece9a0adfa..4e1480575e 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -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-info-keyword { - font-size: 18px; - font-weight: bold; -} - -.search-results { - margin-top: 10px; -} - +#search-results { + padding-top:15px; +} \ No newline at end of file diff --git a/media/js/base.js b/media/js/base.js index 9e7af79c7a..8d1eb1a643 100644 --- a/media/js/base.js +++ b/media/js/base.js @@ -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')}); } /* diff --git a/search.py b/search.py index 8ad26a2f7a..d5dd8007a7 100644 --- a/search.py +++ b/search.py @@ -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')) @@ -55,4 +55,4 @@ def search(request): 'prev_page': current_page - 1, 'next_page': current_page + 1, 'per_page': per_page, - }, context_instance=RequestContext(request)) \ No newline at end of file + }, context_instance=RequestContext(request)) diff --git a/templates/base.html b/templates/base.html index 6138733c71..359d71c739 100644 --- a/templates/base.html +++ b/templates/base.html @@ -88,8 +88,9 @@ {% block nav %}{% endblock %} {% if request.user.is_authenticated %} -
- + + +
{% endif %} diff --git a/templates/search_results.html b/templates/search_results.html index 55c8b97a9d..f532be6168 100644 --- a/templates/search_results.html +++ b/templates/search_results.html @@ -4,68 +4,66 @@ {% load url from future %} {% block right_panel %} -

- {% trans 'Search results for' %} "{{ keyword }}" -

-{% if not results %} -

- {% trans 'No search result found' %} -

-{% else %} -

{% trans 'Found' %} {{ total }} {% trans 'results' %}

- - - - - - - - {% for file in results %} - - - - - - - {% endfor %} -
{% trans 'Name' %}{% trans 'Library' %}{% trans 'Owner' %}
- {% trans - - {{ file.name }} - ({{ file.score }}) - - {{ file.repo.name }} - - {% avatar file.repo.owner 20 %} - {{ file.repo.owner|email2nickname }} -
-
- {% if current_page != 1 %} - {% trans "Previous"%} - {% endif %} - {% if has_more %} - {% trans "Next"%} - {% endif %} -{% if current_page != 1 or has_more %} -| -{% endif %} - {% trans "Per page: "%} - {% if per_page == 25 %} - 25 - {% else %} - 25 - {% endif %} - {% if per_page == 50 %} - 50 - {% else %} - 50 - {% endif %} - {% if per_page == 100 %} - 100 - {% else %} - 100 - {% endif %} +
+
+ + +
+
+{% if not results %} +

{% trans 'No result found' %}

+{% else %} +

{% blocktrans count counter=total %}{{ total }} result{% plural %}{{ total }} results{% endblocktrans%}

+ + + + + + + + {% for file in results %} + + + + + + + {% endfor %} +
{% trans 'Name' %}{% trans 'Library' %}{% trans 'Owner' %}
{% trans {{ file.name }}{{ file.repo.name }} + {% avatar file.repo.owner 20 %} + {{ file.repo.owner|email2nickname }} +
+ {% if total > 25 %} +
+ {% if current_page != 1 %} + {% trans "Previous"%} + {% endif %} + {% if has_more %} + {% trans "Next"%} + {% endif %} + {% if current_page != 1 or has_more %} + | + {% endif %} + {% trans "Per page: "%} + {% if per_page == 25 %} + 25 + {% else %} + 25 + {% endif %} + {% if per_page == 50 %} + 50 + {% else %} + 50 + {% endif %} + {% if per_page == 100 %} + 100 + {% else %} + 100 + {% endif %} +
+ {% endif %} {% endif %} +
{% endblock %}