Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Platform
Development
swh-web
Commits
39319e08
Commit
39319e08
authored
9 years ago
by
Antoine R. Dumont
Browse files
Options
Downloads
Patches
Plain Diff
Permit to display a visual difference in listing dir and files
TODO: define such style
parent
5556ff3b
Branches
directory-list
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
swh/web/ui/templates/directory.html
+1
-1
1 addition, 1 deletion
swh/web/ui/templates/directory.html
swh/web/ui/tests/test_utils.py
+6
-3
6 additions, 3 deletions
swh/web/ui/tests/test_utils.py
swh/web/ui/utils.py
+2
-2
2 additions, 2 deletions
swh/web/ui/utils.py
with
9 additions
and
6 deletions
swh/web/ui/templates/directory.html
+
1
−
1
View file @
39319e08
...
...
@@ -4,7 +4,7 @@
{{ message }}
{% if ls is not none %}
{% for e in files %}
<div><p><a
href=
"{{e.link}}"
>
{{ e.name }}
</a></p></div>
<div><p><a
class=
"link{{e.type}}"
href=
"{{e.link}}"
>
{{ e.name }}
</a></p></div>
{% endfor %}
{% endif %}
{% endblock %}
This diff is collapsed.
Click to expand it.
swh/web/ui/tests/test_utils.py
+
6
−
3
View file @
39319e08
...
...
@@ -105,11 +105,14 @@ class UtilsTestCase(unittest.TestCase):
'
name
'
:
'
some-other-dirname
'
}]
expected_output
=
[{
'
link
'
:
'
/path/to/url/dir/123
'
,
'
name
'
:
'
some-dir-name
'
},
'
name
'
:
'
some-dir-name
'
,
'
type
'
:
'
dir
'
},
{
'
link
'
:
'
/path/to/url/file/654
'
,
'
name
'
:
'
some-filename
'
},
'
name
'
:
'
some-filename
'
,
'
type
'
:
'
file
'
},
{
'
link
'
:
'
/path/to/url/dir/987
'
,
'
name
'
:
'
some-other-dirname
'
}]
'
name
'
:
'
some-other-dirname
'
,
'
type
'
:
'
dir
'
}]
# when
actual_outputs
=
utils
.
prepare_directory_listing
(
inputs
)
...
...
This diff is collapsed.
Click to expand it.
swh/web/ui/utils.py
+
2
−
2
View file @
39319e08
...
...
@@ -39,14 +39,14 @@ def prepare_directory_listing(files):
"""
ls
=
[]
for
entry
in
files
:
new_entry
=
{}
new_entry
=
{
'
name
'
:
entry
[
'
name
'
],
'
type
'
:
entry
[
'
type
'
]}
if
entry
[
'
type
'
]
==
'
dir
'
:
new_entry
[
'
link
'
]
=
flask
.
url_for
(
'
browse_directory
'
,
sha1_git
=
entry
[
'
target
'
])
else
:
new_entry
[
'
link
'
]
=
flask
.
url_for
(
'
show_content
'
,
q
=
entry
[
'
sha1
'
])
new_entry
[
'
name
'
]
=
entry
[
'
name
'
]
ls
.
append
(
new_entry
)
return
ls
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment