Repository navigation
New jsviewer css - #2982
New jsviewer css#2982jfoster17 wants to merge 6 commits into
Conversation
|
cc @keflavich @astrofrog @kbarbary re: the question at the end |
There was a problem hiding this comment.
You might want to update this to [#2982] for this PR. Or [#2917, #2982]
|
Actually removing the default style: is causing the tests to fail (I ran the tests wrong prior to issuing this PR) because it's hard-coded in the write tests as well. I'm going to restore that for now so people can comment on the new style. |
|
I like the new style, but I was wondering if it would be possible to use a sans-serif font? It might make it look even more light-weight. We could even use the web font 'Source Sans Pro' which is used on the astropy website. |
|
@astrofrog, I certainly approve of using a sans-serif font for small font-sizes on a screen. In order to keep things simple, I just found I template I liked that was already hosted on a CDN, but I'd be all for modifying it. This raises a larger question, though, which was obliquely mentioned in the comments on PR #2875 but didn't get a full discussion. There are, as I see it, 5 different options for styling an HTML table.
I don't see a perfect choice among these different systems. Option 1 is certainly the least ideal from a coding perspective. The other options are not mutually exclusive -- we could have the page try to get a remote CSS file and, if that files, try to get a local copy (either in the current directory or in the astropy installation directory). |
|
Okay, so it seems pretty simple to have a fallback scheme whereby we try to find the CSS/JS
That should work in the largest number of cases. Additional commits to implement this are coming once I figure out where to host the modified CSS. @astrofrog, in #2875 you said: "If we find a style we like better, such as the one you pointed out, we can always host the CSS file ourselves if it doesn't already exist somewhere reliable." Where would we do this? On the astropy website? Would we just add a new CSS file to astropy.github.com? I just need to host a slightly modified version of the CSS to implement a better font and a few other cosmetic things. |
|
@jfoster17 - sorry I dropped the ball on this (this will need rebasing, presumably due to the changelog). Regarding your question, we could consider hosting the style on data.astropy.org but for now that infrastructure is still undergoing changes so we need to be patient on that front. +1 to the fallback scheme you mention (same directory, then remote, then astropy source tree). |
35fa150 to
dd79ec3
Compare
|
Okay, I've rebased, so this should be good-to-go. I'll wait on astropy.data.org before making the CSS/JS stuff have a robust fallback scheme. |
|
👍 from me on this. One quick question: in this PR, is the behavior 1) and if missing try 3) from above? I guess I'm not actually clear which (if any) of those options is in current master... |
|
In this PR and in the current master, there is essentially no fallback behavior. The written HTML file looks at a specified URL for the JS/CSS (option 2). If it is not found, there is some simple in-line HTML styling so that the table is legible, but you lose all the interactive JS-goodness. |
There was a problem hiding this comment.
As these classes are options of the DataTables stylesheet and can be combined in different ways, it would be great to have the possibility to specify this in the show_in_browser method. http://www.datatables.net/manual/styling/classes
|
What's the status on this ? I'm interested in using the table's HTML output in a web interface, so having a nice and flexible style would be great, and I could also have a look a #4058 but to avoid conflicts it would be better to finalize this PR first. Anything I can to do to help ? |
|
@saimn - I'm assigned to review this but have been swamped. Can I delegate testing this out and doing the final review to you? That would certainly help. I do note that this PR needs rebasing at this time. |
There was a problem hiding this comment.
I'm not sure why this comment is being removed here, perhaps it is a funny that is related to the required rebase.
There was a problem hiding this comment.
It seems it was removed in f2c1567 This should definitely be fixed.
It can be fixed by the following process:
- Run
$ git rebase -i master - In the text file that comes up, mark the commit f2c1567 as "edit" (that is, replace the word "pick" with "edit")
- Save the file; exit. The rebase will proceed until f2c1567 and then pause.
- Run
$ git reset HEAD^--this will basically undo that commit. Typing$ git statuswill show the changes in that commit as though it were not saved yet. - You can edit the commit manually to restore the removed line, or run
$ git checkout --patchto selectively undo edits (keep the added line, discard the change that removes the accidentally removed lines). - Save the new commit (with its original commit message) by running
$ git commit -C ORIG_HEAD - Complete the rebase:
$ git rebase --continue - Push the new changeset:
$ git push --force origin new-jsviewer-css - 🍻
|
I have tested and rebased the branch on master: https://github.com/saimn/astropy/commits/2982-rebased |
|
@saimn - it looks like you can take this over with your updated branch. Thanks! |
|
@taldcroft This one can be closed :-) |
In response to #2917, I have swapped in a lighter-weight CSS for the jsviewer table output. This also has some features like subtle row-highlighting (based on mouse-over) and column-highlighting (based on sort). Here's a short example (sorted on nobs and hovering over the 5th row).
The only problem is that I had to remove the in-line table styling jfoster17@c1ea7b7
in order to make this table style look nice, which means that if the CSS doesn't load from the remote server, the fallback styling is normally pretty bad (this is browser/configuration dependent). Perhaps someone else knows how to fix this?