mirror of
https://github.com/haiwen/seahub.git
synced 2025-04-28 03:10:45 +00:00
[header] removed 'search & avatar, account info' on the top right corner (#4596)
* cleaned up code & files
This commit is contained in:
parent
3b9e43f442
commit
5c0484dfed
@ -1,57 +1,3 @@
|
||||
$(function() {
|
||||
$('.account-toggle').on('click', function() {
|
||||
var popup = $('#user-info-popup');
|
||||
popup.toggleClass('hide');
|
||||
if (!popup.hasClass('hide')) {
|
||||
var loading_tip = $('.loading-tip', popup),
|
||||
space_traffic = $('#space-traffic');
|
||||
loading_tip.show();
|
||||
space_traffic.addClass('hide');
|
||||
$('.error', popup).addClass('hide');
|
||||
$.ajax({
|
||||
url: space_traffic.data('url'),
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
success: function(data) {
|
||||
loading_tip.hide();
|
||||
space_traffic.html(data['html']).removeClass('hide');
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) {
|
||||
if (xhr.responseText) {
|
||||
var error = JSON.parse(xhr.responseText).error;
|
||||
loading_tip.hide();
|
||||
if ($('.error', popup).length == 0) {
|
||||
loading_tip.after('<p class="error alc">' + error + '</p>');
|
||||
} else {
|
||||
$('.error', popup).removeClass('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', function(e) {
|
||||
var target = e.target || event.srcElement;
|
||||
var closePopup = function(popup, popup_switch) {
|
||||
if (!popup.hasClass('hide') && !popup.is(target) && !popup.find('*').is(target) && !popup_switch.is(target) && !popup_switch.find('*').is(target) ) {
|
||||
popup.addClass('hide');
|
||||
}
|
||||
};
|
||||
closePopup($('#user-info-popup'), $('.account-toggle'));
|
||||
});
|
||||
|
||||
// search: disable submit when input nothing
|
||||
$('.search-form').on('submit', function() {
|
||||
if (!$(this).find('.search-input').val().trim()) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('table').on('mouseenter', 'tr:gt(0)', function() {
|
||||
if (app.ui.currentDropDown || app.ui.freezeItemHightlight) {
|
||||
return;
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% load seahub_tags avatar_tags group_avatar_tags i18n staticfiles %}
|
||||
{% load seahub_tags i18n staticfiles %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ LANGUAGE_CODE }}">
|
||||
@ -39,48 +39,8 @@
|
||||
<span class="sf2-icon-menu side-nav-toggle hidden-md-up hide" title="{% trans "Side Nav Menu" %}" id="js-toggle-side-nav" aria-label="{% trans "Side Nav Menu" %}"></span>
|
||||
|
||||
{% block header_right %}
|
||||
{% if request.user.is_authenticated %}
|
||||
<div class="d-flex">
|
||||
{% block top_search %}
|
||||
{% if has_file_search %}
|
||||
{% include 'snippets/search_form.html' %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
<div id="account">
|
||||
<a id="my-info" href="#" class="account-toggle no-deco hidden-sm-down" aria-label="{% trans "View profile and more" %}">
|
||||
{% avatar request.user 32 %} <span class="icon-caret-down vam"></span>
|
||||
</a>
|
||||
<span class="account-toggle sf2-icon-more mobile-icon hidden-md-up" aria-label="{% trans "View profile and more" %}"></span>
|
||||
<div id="user-info-popup" class="account-popup sf-popover hide">
|
||||
<div class="outer-caret up-outer-caret"><div class="inner-caret"></div></div>
|
||||
<div class="sf-popover-con">
|
||||
<div class="item ovhd">
|
||||
{% avatar request.user 36 %}
|
||||
<div class="txt">
|
||||
{{ request.user.username|email2nickname }}
|
||||
</div>
|
||||
</div>
|
||||
<span class="loading-icon loading-tip"></span>
|
||||
<div id="space-traffic" class="hide"></div>
|
||||
<a class="item" href="{{ SITE_ROOT }}profile/">{% trans "Settings" %}</a>
|
||||
{% block admin_link %}
|
||||
{% if request.user.is_staff %}
|
||||
<a href="{% url 'sys_info' %}" title="{% trans "System Admin" %}" class="item">{% trans "System Admin" %}</a>
|
||||
{% endif %}
|
||||
{% if request.user.org and request.user.org.is_staff %}
|
||||
<a href="{% url 'org_user_admin'%}" title="{% trans "Admin" %}" class="item">{% trans "Organization Admin" %}</a>
|
||||
{% endif %}
|
||||
{% if request.user.inst_admin %}
|
||||
<a href="{% url "institutions:useradmin" %}" title="{% trans "Admin" %}" class="item">{% trans "Admin" %}</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
<a href="{{ SITE_ROOT }}accounts/logout/" class="item" id="logout">{% trans "Log out" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %} {# for non-logged-in user #}
|
||||
{% if not request.user.is_authenticated %}
|
||||
{# for non-logged-in user #}
|
||||
<div id="lang">
|
||||
<a href="#" id="lang-context" data-lang="{{ LANGUAGE_CODE }}">{{ LANGUAGE_CODE|language_name_local|capfirst }} <span class="icon-caret-down"></span></a>
|
||||
<div id="lang-context-selector" class="sf-popover hide">
|
||||
@ -183,10 +143,6 @@ $('#info-bar .close').on('click', function() {
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
{% if has_file_search %}
|
||||
{% include 'snippets/search_js.html' %}
|
||||
{% endif %}
|
||||
|
||||
{% else %} {# for non-logged-in user #}
|
||||
(function() {
|
||||
var lang_context = $('#lang-context'),
|
||||
|
@ -27,7 +27,3 @@ input[type=password] {
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block header_right %}
|
||||
{# removed the content on the top right corner #}
|
||||
{% endblock %}
|
||||
|
@ -1,79 +0,0 @@
|
||||
{% load i18n %}
|
||||
<a href="{% url 'search' %}" class="hidden-md-up top-search-link"><span class="icon-search"></span></a>
|
||||
|
||||
<form id="top-search-form" method="get" action="{% url 'search' %}" class="hidden-sm-down search-form">
|
||||
{% if search_repo_id %}
|
||||
<input type="text" class="search-input" name="q" placeholder="{% if search_wiki %}{% trans "Search files in this wiki" %}{% else %}{% trans "Search files in this library" %}{% endif %}" title="{% if search_wiki %}{% trans "Search files in this wiki" %}{% else %}{% trans "Search files in this library" %}{% endif %}" aria-label="{% if search_wiki %}{% trans "Search files in this wiki" %}{% else %}{% trans "Search files in this library" %}{% endif %}" value="{{ keyword }}" />
|
||||
<input type="hidden" name="search_repo" value="{{ search_repo_id }}" />
|
||||
{% else %}
|
||||
<input type="text" class="search-input" name="q" placeholder="{% trans "Search Files" %}" title="{% trans "Search Files" %}" aria-label="{% trans "Search Files" %}" value="{{ keyword }}" />
|
||||
{% endif %}
|
||||
<!--span class="icon-caret-down" title="{% trans "advanced" %}"></span--><button type="submit" class="search-submit" aria-label="{% trans "Submit" %}"><span class="icon-search"></span></button>
|
||||
</form>
|
||||
|
||||
<form id="advanced-search-form" method="get" action="{% url 'search' %}" class="search-form hide">
|
||||
<input type="text" class="search-input" name="q" placeholder="{% trans 'Search Files' %}" value="{{ keyword }}" />
|
||||
<div class="search-scales">
|
||||
<div class="search-repos">
|
||||
{% if search_repo_id %}
|
||||
<label class="item"><input type="radio" name="search_repo" value="all" class="vam" /> <span class="vam">{% trans "In all libraries" %}</span></label>
|
||||
<label class="item"><input type="radio" name="search_repo" checked="checked" value="{{ search_repo_id }}" class="vam" /> <span class="vam">{% if search_wiki %}{% trans "In this wiki" %}{% else %}{% trans "In this library" %}{% endif %}</span></label>
|
||||
{% else %}
|
||||
{% if search_repo and repo %}
|
||||
<label class="item"><input type="radio" name="search_repo" value="all" class="vam" /> <span class="vam">{% trans "In all libraries" %}</span></label>
|
||||
<label class="item"><input type="radio" name="search_repo" value="{{repo.id}}" checked="checked" class="vam" /> <span class="vam">{% blocktrans with name=repo.name %}in {{name }}{% endblocktrans %}</span></label>
|
||||
{% else %}
|
||||
<label class="item"><input type="radio" name="search_repo" value="all" checked="checked" class="vam" /> <span class="vam">{% trans "In all libraries" %}</span></label>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="search-filetypes">
|
||||
{% if search_ftypes != 'custom' %}
|
||||
<label class="item"><input type="radio" name="search_ftypes" value="all" checked="checked" class="vam" /> <span class="vam">{% trans "All file types" %}</span></label>
|
||||
<label class="item"><input type="radio" name="search_ftypes" value="custom" class="vam" id="custom-search-ftypes" /> <span class="vam">{% trans "Custom file types" %}</span></label>
|
||||
{% else %}
|
||||
<label class="item"><input type="radio" name="search_ftypes" value="all" class="vam" /> <span class="vam">{% trans "All file types" %}</span></label>
|
||||
<label class="item"><input type="radio" name="search_ftypes" value="custom" checked="checked" class="vam" id="custom-search-ftypes" /> <span class="vam">{% trans "Custom file types" %}</span></label>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if search_ftypes != 'custom' %}
|
||||
<div class="custom-ftype-options hide">
|
||||
{% else %}
|
||||
<div class="custom-ftype-options">
|
||||
{% endif %}
|
||||
{# ftype value should be the same with utils/file_types.py #}
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" name="ftype" value="Text" class="vam" />
|
||||
<span class="vam">{% trans "Text files" %}</span>
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" name="ftype" value="Document" class="vam" />
|
||||
<span class="vam">{% trans "Documents" %}</span>
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" name="ftype" value="Image" class="vam" />
|
||||
<span class="vam">{% trans "Images" %}</span>
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" name="ftype" value="Video" class="vam" />
|
||||
<span class="vam">{% trans "Video" %}</span>
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" name="ftype" value="Audio" class="vam" />
|
||||
<span class="vam">{% trans "Audio" %}</span>
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" name="ftype" value="PDF" class="vam" />
|
||||
<span class="vam">{% trans "pdf" %}</span>
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" name="ftype" value="Markdown" class="vam" />
|
||||
<span class="vam">{% trans "markdown" %}</span>
|
||||
</label>
|
||||
<br/>
|
||||
<input type="text" value="{{ input_fileexts }}" name="input_fexts" placeholder="{% trans "Input file extensions here, separate with ','" %}" title="{% trans "Input file extensions here, separate with ','" %}" aria-label="{% trans "Input file extensions here, separate with ','" %}" class="input fileext-input" />
|
||||
<p class="error hide">{% trans "Please select at least one file type or input at least one file extension" %}</p>
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" value="{% trans "Submit" %}" class="submit" />
|
||||
</form>
|
@ -1,38 +0,0 @@
|
||||
// search-form: top-search-form, advanced-search-form, search-form in search result page
|
||||
$('.search-form').on('submit', function() {
|
||||
if (!$(this).find('.search-input').val().trim()) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$('#top-search-form .icon-caret-down').on('click', function() {
|
||||
var form = $(this).parent(),
|
||||
q = form.find('[name="q"]').val(),
|
||||
advanced_form = $('#advanced-search-form');
|
||||
$('#header-inner').css({'position':'relative'});
|
||||
advanced_form.css({'right': 0, 'top':form.outerHeight(true)}).toggleClass('hide');
|
||||
if (!advanced_form.hasClass('hide') && q) {
|
||||
advanced_form.find('.search-input').val(q);
|
||||
}
|
||||
});
|
||||
$('.search-filetypes .item:first-child').on('click', function() {
|
||||
$(this).parents('.search-form').find('.custom-ftype-options').addClass('hide');
|
||||
});
|
||||
$('.search-filetypes .item:last-child').on('click', function() {
|
||||
$(this).parents('.search-form').find('.custom-ftype-options').removeClass('hide');
|
||||
});
|
||||
$('#advanced-search-form').on('submit', function() {
|
||||
if ($('#custom-search-ftypes').attr('checked') &&
|
||||
$('.custom-ftype-options .checkbox-checked').length == 0 &&
|
||||
$('.custom-ftype-options .fileext-input').val().trim()) {
|
||||
$(this).find('.error').removeClass('hide');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$(document).on('click', function(e) {
|
||||
var target = e.target || event.srcElement,
|
||||
popup = $('#advanced-search-form'),
|
||||
popup_switch = $('#top-search-form .icon-caret-down');
|
||||
if (!popup.hasClass('hide') && !popup.is(target) && !popup.find('*').is(target) && !popup_switch.is(target)) {
|
||||
popup.addClass('hide');
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user