1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 04:48:03 +00:00

review again

This commit is contained in:
zming
2017-12-13 13:58:22 +08:00
parent d246ce70d0
commit b82c141afe
5 changed files with 28 additions and 18 deletions

View File

@@ -7,20 +7,20 @@
<h3>{% trans "Search Link"%}</h3> <h3>{% trans "Search Link"%}</h3>
<form id="search-link-form" method="get" action="."> <form id="search-link-form" method="get" action=".">
<label>{% trans "Token" %}</label><input type="text" name="token" class="input" value="{{token}}" placeholder="{% trans "please input at least 3 characters" %}" title="{% trans "please input at least 3 characters" %}"/><br /> <label>{% trans "Token" %}</label><input type="text" name="token" class="input" value="{{token}}" placeholder="{% trans "please input at least 3 characters" %}" title="{% trans "please input at least 3 characters" %}" /><br />
<input type="submit" value="{% trans "Submit" %}" class="submit" /> <input type="submit" value="{% trans "Submit" %}" class="submit" />
</form> </form>
<div class="ovhd">
<h3 class="fleft">{% trans "Result"%}</h3> <h3>{% trans "Result" %}</h3>
</div>
{% if publinks %} {% if publinks %}
<table> <table>
<tr> <tr>
<th width="25%">{% trans "Name" %}</th> <th width="25%">{% trans "Name" %}</th>
<th width="25%">{% trans "Owner" %}</th> <th width="25%">{% trans "Owner" %}</th>
<th width="20%"><a href="#">{% trans "Create At" %}</a></th> <th width="20%">{% trans "Create At" %}</th>
<th width="12%"><a href="#">{% trans "Count" %}</a></th> <th width="12%">{% trans "Count" %}</th>
<th width="18%">{% trans "Operations" %}</th> <th width="18%"></th>
</tr> </tr>
{% for publink in publinks %} {% for publink in publinks %}
<tr> <tr>
@@ -61,6 +61,7 @@ $('.rm-link').click(function() {
beforeSend: prepareCSRFToken, beforeSend: prepareCSRFToken,
success: function() { success: function() {
_this.closest('tr').remove(); _this.closest('tr').remove();
feedback("{% trans "Successfully deleted the link." %}", 'success');
}, },
error: ajaxErrorHandler error: ajaxErrorHandler
}); });

View File

@@ -28,7 +28,7 @@
<th width="25%">{% trans "Owner" %}</th> <th width="25%">{% trans "Owner" %}</th>
<th width="20%"><a class="table-sort-op by-time" href="#">{% trans "Create At" %} {% if sort_by == 'time_down' %}<span class="sort-icon icon-caret-down"></span>{% elif sort_by == 'time_up' %}<span class="sort-icon icon-caret-up"></span>{% endif %}</a></th> <th width="20%"><a class="table-sort-op by-time" href="#">{% trans "Create At" %} {% if sort_by == 'time_down' %}<span class="sort-icon icon-caret-down"></span>{% elif sort_by == 'time_up' %}<span class="sort-icon icon-caret-up"></span>{% endif %}</a></th>
<th width="12%"><a class="table-sort-op by-count" href="#">{% trans "Count" %} {% if sort_by == 'count_down' %}<span class="sort-icon icon-caret-up"></span>{% elif sort_by == 'count_up' %}<span class="sort-icon icon-caret-down"></span>{% endif %}</a></th> <th width="12%"><a class="table-sort-op by-count" href="#">{% trans "Count" %} {% if sort_by == 'count_down' %}<span class="sort-icon icon-caret-up"></span>{% elif sort_by == 'count_up' %}<span class="sort-icon icon-caret-down"></span>{% endif %}</a></th>
<th width="18%">{% trans "Operations" %}</th> <th width="18%"></th>
</tr> </tr>
{% for publink in publinks %} {% for publink in publinks %}
<tr> <tr>

View File

@@ -22,7 +22,7 @@
<th width="25%">{% trans "Owner" %}</th> <th width="25%">{% trans "Owner" %}</th>
<th width="20%"><a class="table-sort-op by-time" href="#">{% trans "Create At" %} {% if sort_by == 'time' %}<span class="sort-icon icon-caret-down"></span>{% elif sort_by == '-time' %}<span class="sort-icon icon-caret-up"></span>{% endif %}</a></th> <th width="20%"><a class="table-sort-op by-time" href="#">{% trans "Create At" %} {% if sort_by == 'time' %}<span class="sort-icon icon-caret-down"></span>{% elif sort_by == '-time' %}<span class="sort-icon icon-caret-up"></span>{% endif %}</a></th>
<th width="12%"><a class="table-sort-op by-count" href="#">{% trans "Visits" %} {% if sort_by == 'count' %}<span class="sort-icon icon-caret-up"></span>{% elif sort_by == '-count' %}<span class="sort-icon icon-caret-down"></span>{% endif %}</a></th> <th width="12%"><a class="table-sort-op by-count" href="#">{% trans "Visits" %} {% if sort_by == 'count' %}<span class="sort-icon icon-caret-up"></span>{% elif sort_by == '-count' %}<span class="sort-icon icon-caret-down"></span>{% endif %}</a></th>
<th width="18%">{% trans "Operations" %}</th> <th width="18%"></th>
</tr> </tr>
{% for uploadlink in uploadlinks %} {% for uploadlink in uploadlinks %}
<tr> <tr>

View File

@@ -1618,9 +1618,11 @@ def sys_upload_link_remove(request):
@login_required @login_required
@sys_staff_required @sys_staff_required
def link_search(request): def link_search(request):
sort_by = request.GET.get('sort_by', 'time_up')
token = request.GET.get('token', '') token = request.GET.get('token', '')
if len(token) < 3:
publinks = []
else:
publinks = FileShare.objects.filter(token__startswith=token) publinks = FileShare.objects.filter(token__startswith=token)
for l in publinks: for l in publinks:
@@ -1632,7 +1634,6 @@ def link_search(request):
return render_to_response( return render_to_response(
'sysadmin/link_search.html', { 'sysadmin/link_search.html', {
'publinks': publinks, 'publinks': publinks,
'sort_by': sort_by,
'token': token 'token': token
}, },
context_instance=RequestContext(request)) context_instance=RequestContext(request))

View File

@@ -55,3 +55,11 @@ class AdminSearchShareLinkText(BaseTestCase):
resp = self.client.get(url) resp = self.client.get(url)
self.assertEqual(200, resp.status_code) self.assertEqual(200, resp.status_code)
self.assertEqual(0, len(resp.context['publinks'])) self.assertEqual(0, len(resp.context['publinks']))
def test_search_file_share_link_info_by_short_token(self):
self.login_as(self.admin)
url = reverse('link_search') + '?token=' + 'i'
resp = self.client.get(url)
self.assertEqual(200, resp.status_code)
self.assertEqual(0, len(resp.context['publinks']))