mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-25 14:50:29 +00:00
[home_starred] show file name instead of 'formatted_path' and clean code
This commit is contained in:
@@ -106,7 +106,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="icon-container"><img src="{{ MEDIA_URL }}img/file/{{ sfile.path|file_icon_filter }}" alt="{% trans "icon" %}" /></td>
|
<td class="icon-container"><img src="{{ MEDIA_URL }}img/file/{{ sfile.path|file_icon_filter }}" alt="{% trans "icon" %}" /></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{% url 'repo_view_file' sfile.repo.id %}?p={{ sfile.path|urlencode }}">{{ sfile.formatted_path }}</a>
|
<a href="{% url 'repo_view_file' sfile.repo.id %}?p={{ sfile.path|urlencode }}">{{ sfile.name }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ sfile.repo.name }}</td>
|
<td>{{ sfile.repo.name }}</td>
|
||||||
<td>{{ sfile.last_modified|translate_seahub_time }}</td>
|
<td>{{ sfile.last_modified|translate_seahub_time }}</td>
|
||||||
|
12
utils.py
12
utils.py
@@ -502,16 +502,6 @@ class StarredFile(object):
|
|||||||
path = path[:-1]
|
path = path[:-1]
|
||||||
return path.replace('/', ' / ')
|
return path.replace('/', ' / ')
|
||||||
|
|
||||||
def __init__(self, org_id, repo, path, is_dir, last_modified):
|
|
||||||
# always 0 for non-org repo
|
|
||||||
self.org_id = org_id
|
|
||||||
self.repo = repo
|
|
||||||
self.path = path
|
|
||||||
self.formatted_path = self.format_path()
|
|
||||||
self.is_dir = is_dir
|
|
||||||
# always 0 for dir
|
|
||||||
self.last_modified = last_modified
|
|
||||||
|
|
||||||
def __init__(self, org_id, repo, path, is_dir, last_modified, size):
|
def __init__(self, org_id, repo, path, is_dir, last_modified, size):
|
||||||
# always 0 for non-org repo
|
# always 0 for non-org repo
|
||||||
self.org_id = org_id
|
self.org_id = org_id
|
||||||
@@ -522,6 +512,8 @@ class StarredFile(object):
|
|||||||
# always 0 for dir
|
# always 0 for dir
|
||||||
self.last_modified = last_modified
|
self.last_modified = last_modified
|
||||||
self.size = size;
|
self.size = size;
|
||||||
|
if not is_dir:
|
||||||
|
self.name = path.split('/')[-1]
|
||||||
|
|
||||||
|
|
||||||
# org_id > 0: get starred files in org repos
|
# org_id > 0: get starred files in org repos
|
||||||
|
Reference in New Issue
Block a user