Commit Graph

236 Commits (8f1e66edee1b77ee6ff76385aed271d6d392e2e1)

Author SHA1 Message Date
Ryan Schmidt 8f1e66edee Add sort criterion and order classes to table tag
Add a class "sort-col-1", "sort-col-2", or "sort-col-3" to the table tag
to indicate by which column the data is sorted, and a class "asc" or
"desc" to indicate whether it is sorted in ascending or descending
order. This is intended to be useful for applying a style to the sorted
column or its header.

Modify the default template to slightly darken the sorted column.
2022-05-10 12:06:06 -05:00
Ryan Schmidt c07bc573d1 Add aria-sort attribute to the appropriate th
Add the aria-sort attribute to the th of the column by which the data is
sorted. This is conceivably useful to let screen readers know how the
table is sorted, but it also allows CSS styles to be applied, for
example to highlight the sorted column header or to change an icon in
the column header to indicate the sort direction.

This required breaking the start of the table into separate variables so
that the column headers can be addressed individually. This is a step
toward being able to reorder (#66) or remove (#133) columns.
2022-05-10 12:03:50 -05:00
Ryan Schmidt 4a6845348b Rename template variables to omit leading numbers
The quantity of template variables is about to increase and it's tedious
to renumber all subsequent variables just to keep them in numerical
order. One of the variables, t_parentdir_entry, already didn't have a
leading number, so this change makes the rest of the variables
consistent with that.
2022-05-10 12:02:38 -05:00
Anthony Ryan 5930c29d6a Remove `fancyindex_name_length` by offloading work to CSS
This is a backwards compatibility break, in that the `fancyindex_name_length` setting will now
prevent nginx from starting until removed. I do think though that most people will find the new
behavior preferable to that setting however.

There's two arguably unrelated CSS changes included in this pull request, so let me know if you
like one but not the other or vice versa I can split them up.

-----

We've introduced `table-layout: fixed;`. This is a performance optimization for browsers rendering
very large file lists.

The default mode (`table-layout: auto`) first needs to load the entire table, then calculates the
optimal column widths based on the contents of all cells in the table start to finish. This can be
a bit slow when directory listings contain tens of thousands of files or folders.

With `table-layout: fixed;` the width is determined based on the first row allowing the browser to
render to begin rendering the table immediately.

Technically, the widths of columns have changed slightly as a result of this, but we no longer need
to specify widths using style attributes, which makes it easier for custom CSS users to change the
widths.

.link was 55% wide, now 50%
.size was 20% wide, now 25%
.date was 25% wide, now 25%

-----

Rather than truncating string names server-side, we instead send the full name and tell the browser
to truncate file names with CSS. This has the advantage of always showing as much of the file name
as it can fit in a line. This has the benefit of avoiding line wraps on smaller screens (like
phones) and allowing people to resize their window larger to see more of the file name.

This reduces the code complexity server side and provides a optimal truncation on every device.
2021-10-28 22:37:48 +03:00
Adrian Perez de Castro 6cdffdb0af
Version 0.5.2 2021-10-28 22:28:07 +03:00
Adrian Perez de Castro b0e1fa83a8 CI: Move over to GitHub Actions 2021-10-26 01:12:26 +03:00
Anthony Ryan 2e9555e759 Always use ngx_escape_html to ensure we aren't rendering file names
as HTML tags.
2021-10-25 16:19:03 +03:00
Adrian Perez de Castro 391d2d5447
CI: Update mainline version to 1.19.3 2021-02-25 19:01:53 +02:00
Tim Gates 566ad22a61 docs: fix simple typo, configration -> configuration
There is a small typo in ngx_http_fancyindex_module.c.

Should read `configuration` rather than `configration`.
2020-12-21 17:20:44 +01:00
Adrian Perez de Castro 5ca7cb32af
Version 0.5.1 2020-10-26 22:45:29 +02:00
Adrian Perez de Castro c33b05af9e Fix check for arguments to fancyindex_{header,footer}
Closes #117
2020-10-26 22:41:38 +02:00
Adrian Perez de Castro 4fc6bb10d7
Version 0.5.0 2020-10-24 19:07:36 +03:00
Adrian Perez de Castro 618e2d154e
Add missing "use pup" command to t/07-directory-first.test 2020-10-24 18:53:53 +03:00
Adrian Perez de Castro f52bacea8f Add unit tests for local headers and footers 2020-10-24 18:52:58 +03:00
Adrian Perez de Castro 527511fbf8 Load local header and footer files when configuring
Make the configuration process load the local files specified with
'fancyindex_{header,footer} "foo" local', instead of loading them
on every request.

Additionally, change the syntax of the configuration directive to accept
an optional parameter indicating whether the header (or footer) is to be
loaded as a subrequest (default, for backwards compatibility) or a local
file (must be specified explicitly). This avoids the footgun of having
a local file which accidentally happens to match the subrequest that one
had the intention to do when configuring.
2020-10-24 18:52:58 +03:00
JoungKyun Kim 5ac161ccc3 fixed #82 fancyindex can't print list with auth-ldap module
- fixed signedness problems
- fixed gabage characters
2020-10-24 18:34:41 +03:00
Adrian Perez de Castro 140dcb7a8f Properly escape square brackets with old Nginx versions 2020-10-24 15:40:07 +03:00
Adrian Perez de Castro 6637a7afab Update to Nginx 0.8 as oldest supported version 2020-10-24 15:40:07 +03:00
Adrian Perez de Castro d3d7adc89d README: Update CI link to use travis-ci.com instead of .org 2020-10-24 14:08:56 +03:00
Adrian Perez de Castro 52a17b7a17 CI: Update Nginx mainline and stable versions 2020-10-24 14:08:56 +03:00
z4yx 63d19686df add a test of ngx_http_fancyindex_cmp_entries_dirs_first 2020-10-24 13:17:10 +03:00
z4yx b3e06fd31b remove ngx_http_fancyindex_cmp_entries_dirs_first 2020-10-24 13:17:10 +03:00
z4yx c0448985b6 ngx_int_t -> int 2020-10-24 13:17:10 +03:00
z4yx a05006e3c4 replace ngx_sort with ngx_qsort 2020-10-24 13:17:10 +03:00
Joshua Shaffer 56934db14c update readme 2020-05-26 16:14:09 +03:00
Joshua Shaffer 42e21c9153 Added test for show_dotfiles 2020-05-26 16:14:09 +03:00
Joshua Shaffer 7444208a36 t/* should be eol=lf so bash can run 2020-05-26 16:14:09 +03:00
Joshua Shaffer 94bb8164b2 Fixes #54. Adds configuration option 'fancyindex_show_dotfiles' to show dotfiles. 2020-05-26 16:14:09 +03:00
Adrian Perez de Castro 11101de198
make-dist: Add script to generate release tarballs
Because the source archives from GitHub tags may not always produce the
same tarball when fetching at different times. Having proper tarballs
for releases also allows signing them i.e. with PGP.
2020-02-19 13:05:55 +02:00
Adrian Perez de Castro 58fecc865d
Version 0.4.4 2020-02-19 12:56:12 +02:00
Anders Trier 21a084d61d Add CRLF after the 'Parent directory' line. This makes the output easier to parse. 2020-02-19 12:44:32 +02:00
kPherox fa13aef31b Add test for `fancyindex_hide_parent_dir on` 2018-10-15 11:28:09 +02:00
kPherox 47ce20d993 refs aperezdc/ngx-fancyindex#57 Add `fancyindex_hide_parent_dir` directive 2018-10-15 11:28:09 +02:00
Nicolas CARPi 7abb6e3693 Fix some issues in the README file
* fix nginx URL (.org not .net and HTTPS)
* fix protocol for die.net URL
* fix underline too short for fancyindex_show_path
* fix "module module" sentence
2018-10-15 02:10:55 +02:00
Adrian Perez de Castro 473c1de024 Properly encode filenames as URI components
Fixes #95
2018-08-30 00:12:47 +03:00
Adrian Perez de Castro a3929d7074 CI: Update Nginx mainline to version 1.15.2 2018-08-15 14:28:52 +02:00
David Beitey e6ddb517ca Mention awk fails on macOS and provide a solution 2018-07-13 01:22:48 +03:00
David Beitey aa0be2dcaa Fix encoding of & chars in table header 2018-07-13 01:11:20 +03:00
Adrian Perez de Castro d1b2f36738
Version 0.4.3 2018-07-03 02:53:45 +03:00
Adrian Perez de Castro a983c2c899
Add test case for sort order by file-size after
This tests the fix from PR #88 and by having it in the test suite
it will make sure that sorting by size dos not get broken again.
2018-07-03 02:41:13 +03:00
qjqqyy 2b2244551f Fix decreasing sort by file size
fixes #77
2018-07-03 02:39:57 +03:00
Adrian Perez de Castro 6f812eba8e Add a test case which uses pup to check a listing 2018-07-03 02:16:45 +03:00
Adrian Perez de Castro 604b43b336 Add pup() and use() function to allow skipping when pup is unavailable
The "use pup" construct will skip a test case that needs pup installed.
The pup() function ensures that the downloaded binary is used.
2018-07-03 02:16:45 +03:00
Adrian Perez de Castro 60f09e450d Allow skipping test cases
This defines a skip() function in the tests preamble which can
be used to skip tests. Skipped tests are counted, and a reason
for them being skipped printed after running the tests.
2018-07-03 02:16:45 +03:00
Adrian Perez de Castro 501f9bc63c CI: Add script to fetch and validate a binary build of pup
The script downloads and validates the download against a built-in
list of known checksums for the release ZIP files.

More on pup: https://github.com/ericchiang/pup/
2018-07-03 02:16:45 +03:00
Adrian Perez de Castro 5f265ab6eb
Add themes by @fraoustin and @alehaa
Closes #87
2018-07-03 01:01:31 +03:00
Adrian Perez de Castro df593a20f3 CI: Switch mainline Nginx to 0.15.0, update older versions
In particular, version 1.11.6 does not even appear in the main
download page. Of course the tarballs are still in the archives,
but not being listed seems like a good criteria to remove it from
the testing matrix. Also, change 1.10.2 to 1.10.3, which is the
latest minor release from the series.
2018-07-03 00:26:29 +03:00
Lilian Besson 5dd4ec3b3c Typo on code block formatting 2018-07-02 23:46:01 +03:00
Martchus 4ae6c87246 Test latest stable and mainline releases on Travis 2018-05-02 23:17:51 +03:00
Adrian Perez de Castro c5bf62212e
CI: Update mainline/stable Nginx versions
Only the minor version number is changed, so there is no need to
keep the older versions being tested as well in the test matrix.
2018-03-21 17:19:44 +00:00