Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Remove Date row / How to get longer filenames ? #133

Open
ghost opened this issue Apr 11, 2022 · 5 comments
Open

How to Remove Date row / How to get longer filenames ? #133

ghost opened this issue Apr 11, 2022 · 5 comments

Comments

@ghost
Copy link

ghost commented Apr 11, 2022

Hey folks,

first off I really like this nginx extension, I've implemented it with OpenResty, and it almost works like a charm :D
But still, there are two things I was not able to answer myself, especially because I'm not a C developer I guess.

  1. Is there any way to remove the "Date" row from the HTML view at the browser? I'm working with a Cashed remote File system in the background, so I always see the last timestamp of the updated cache, every file gets the same date, which makes sense but looks ugly ;)
  2. Some of my files have quite long names, and it seems that this extension does a cutoff according to the filenames character-length. Can I change this to a higher value?

It would also be awesome to understand the difference between template.h and template.html

Thanks in advance

@ghost ghost changed the title 2 Questions I was not able to figure out myself How to Remove Date row / How to get longer filenames ? Apr 11, 2022
@ryandesign
Copy link
Contributor

  1. Is there any way to remove the "Date" row from the HTML view at the browser? I'm working with a Cashed remote File system in the background, so I always see the last timestamp of the updated cache, every file gets the same date, which makes sense but looks ugly ;)

I don't think you can configure ngx-fancyindex not to send this column. You can configure the date/time format to make it send an empty date:

fancyindex_time_format "";

And you can use a custom stylesheet to hide the column in the browser. The date cells helpfully have the date css class so you'd think you could just do:

#list .date { display: none; }

And you can, except that the header cell doesn't have this class so it remains visible. I might consider that a bug: the headers should have classes too so that they can be addressed more easily. However, failing that, a workaround is to just hide the third column, assuming that the third column will always be the date column:

#list td:nth-of-type(3), #list th:nth-of-type(3) { display: none; }

The widths of the remaining columns will technically be wrong at that point, since they were specified as percentages in the html, but you could adjust the column widths in css if needed.

  1. Some of my files have quite long names, and it seems that this extension does a cutoff according to the filenames character-length. Can I change this to a higher value?

With the latest released version of ngx-fancyindex (0.5.2), the default is to truncate file names at 50 characters but you can increase it like this:

fancyindex_name_length 255;

With the next version that will be released after that (0.6.0 or 1.0.0), this option has been removed and the full name will always be sent.

@ryandesign
Copy link
Contributor

It would also be awesome to understand the difference between template.h and template.html

HACKING.md explains some of this already; I recommend reading it.

template.html is an HTML template that gets embedded into ngx-fancyindex when it is compiled. It uses parts extracted from this template when sending output to the browser.

ngx-fancyindex is written in the C programming language, and there isn't a mechanism in C to directly include an HTML file into a program. Therefore, template.html has to be converted to a form that can be included in a C program: namely, a C header file. That's what template.h is. Every time template.html is modified, template.h must be regenerated using the template.awk AWK script.

@ryandesign
Copy link
Contributor

I don't think you can configure ngx-fancyindex not to send this column.

The request to allow reordering of columns was previously made in #66. Allowing columns to be omitted would probably be easy to implement at the same time.

ryandesign added a commit to ryandesign/ngx-fancyindex that referenced this issue May 10, 2022
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 (aperezdc#66) or remove (aperezdc#133) columns.
@ghost
Copy link
Author

ghost commented May 13, 2022

Hey folks, thanks for your response, really appreciate that.
In the meantime, I have rebuilt the module the way I needed it. I now removed the CSS relevant stuff and also the generation of the Date information within the C code. It was kinda fuc***-up as I'm not familiar with C at all. Anyways, it was possible in the end and I now have a flawless working module, epic!

The background of all this was that I'm using FancyIndex together with an rclone mount that again uses a local cache and refreshes every 24 hrs. So I always had the same date information on all files, kinda ugly for the end user if you ask me.

So again thanks for all your great work onto this module!

@wilbert-vb
Copy link

The header cells don't have a helpful css class, though.

See: issue-1367131802

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants