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

Merge with ocaml.org styling and layout #113

Merged
merged 10 commits into from
Aug 24, 2014
Merged

Conversation

dsheets
Copy link
Contributor

@dsheets dsheets commented Aug 20, 2014

This patchset contains the necessary modifications to have the opam2web tool generate pages which fit into the styling and layout of ocaml.org.

The coordination between the two sites has been designed such that the server for opam.ocaml.org will checkout ocaml.org regularly and build the template that it requires to match the design of ocaml.org (ocaml/ocaml.org#512). This generated template will source assets via scheme-relative URLs off of ocaml.org. For this to work without mixed content warnings, ocaml/ocaml.org#399 is required.

These changes will demand a number of updates to the opam.ocaml.org runtime scripts to accommodate this new dependency on the ocaml.org repository.

May the force be with you.

When jQuery and bootstrap.min.js are loaded, the left side menus in
Documentation and Blog do not exert appropriate right pressure on the
main span9 content. This causes the content to jump (after the js load)
to overtop the left menu. This makes the page unusable.

After this change, the side menu no longer scrolls with the page
(position does not get changed to fixed by JS). It is possible to get
some of the previous functionality back by adding a height of >=25px to
the span/div first child of the span3 left sidebar element. This still
doesn't quite fix the issue as the menu elements then sometimes slightly
overlap the content. This patch disables all of the insane JS
modification of DOM element classes to set the menu position:
fixed. There is probably a way to get the effect we want without using
JavaScript. It would be nice to not have to load any JavaScript for a
simple static site...

Right now JavaScript is required for some of the package index search
features and the Documentation dropdown menu for some reason. The
package search should have a server-side fallback and the dropdown
should be achievable in pure CSS.

The gauntlet is laid! It is now your mission, young wanderer, to
discover what riddles wait in...

THE LAND OF WEB PAGE LAYOUT MAGIC

*fade to black*
@avsm
Copy link
Contributor

avsm commented Aug 20, 2014

Wonderful!

@samoht
Copy link
Contributor

samoht commented Aug 20, 2014

Yes!!!

@AltGr
Copy link
Contributor

AltGr commented Aug 20, 2014

A big thanks !
Whish I didn't get blind during the demo though...

@agarwal
Copy link

agarwal commented Aug 20, 2014

Thanks! This is great!!

@dsheets
Copy link
Contributor Author

dsheets commented Aug 23, 2014

To play at home, download and build this branch and clone the ocaml.org repo. Then:

ocaml.org$ make opam.ocaml.org_template
...

If you want to have the docs and the blog built, too, you'll need to do

ocaml.org$ cd opam.ocaml.org && ./link_blog_doc_ext.sh ../../opam-blog/ ../../opam.wiki/ ../../opam2web/ext/

Then:

opam2web$ src/_build/opam2web.native -c ../ocaml.org/opam.ocaml.org/ -o www
...

At this point, you should be able to view the site using something like:

opam2web$ ../ocaml-cohttp/cohttp_server_lwt.native www

Or, if you want to browse the files with the file: scheme, get webmaster and do:

opam2web$ webmaster relativize www --root www -o www_out
...
opam2web$ webmaster resolve --has-host --base https:// www_out --root www_out -f -o www_out
...

The biggest issue I've noticed so far is a large white top margin once the site goes into narrow-screen mode. I think this is probably related to the subnavbar stuff but I haven't investigated too far.

@samoht
Copy link
Contributor

samoht commented Aug 24, 2014

I've not been very far:

ocaml.org$ make opam.ocaml.org_template
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile.opam.ocaml.org
cd script && \
    ocamlfind ocamlopt -annot -o ../"script/md_preprocess" -package omd,str,netstring -linkpkg \
      utils.cmx code_types.cmx code.ml md_preprocess.ml
File "md_preprocess.ml", line 20, characters 5-74:
Error: The constructor Html_block expects 3 argument(s),
       but is applied here to 1 argument(s)

@samoht
Copy link
Contributor

samoht commented Aug 24, 2014

Ha, of course, need omd.0.9.7 and not omd.1.0.0

@samoht
Copy link
Contributor

samoht commented Aug 24, 2014

I managed to have a local website (with broken javascript) by following these "simple" recipe:

opam pin add omd 0.9.7
opam pin add opam-lib https://github.com/ocaml/opam.git
opam pin add opamfu https://github.com/ocamllabs/opamfu.git

opam install ocamlnet omd mpp uri ssl ocamlrss opamfu js_of_ocaml cow

git clone -b site-merge https://github.com/dsheets/opam2web.git opam2web-demo
(ocamlfind remove opam2web && cd opam2web-demo && make && make install)

git clone https://github.com/ocaml/ocaml.org.git ocaml.org-demo
(cd ocaml.org-demo && make opam.ocaml.org_template)

git clone https://github.com/ocaml/opam.wiki.git opam.wiki-demo
git clone https://github.com/ocaml/platform-blog.git opam-blog-demo

(cd ocaml.org-demo/opam.ocaml.org && ./link_blog_doc_ext.sh ../../opam-blog-demo/ ../../opam.wiki-demo/ ../../opam2web-demo/ext/)
(cd opam2web-demo && src/_build/opam2web.native -c ../ocaml.org-demo/opam.ocaml.org/ -o www)
(cd opam2web-demo && cp -R ext www/)

git clone https://github.com/dsheets/webmaster.git
opam pin add assemblage https://github.com/samoht/assemblage.git
(cd webmaster && assemblage setup && make && make install)

(cd opam2web-demo && webmaster relativize www --root www -o www_out)
(cd opam2web-demo && webmaster resolve --has-host --base https:// www_out --root www_out -f -o www_out)

@samoht
Copy link
Contributor

samoht commented Aug 24, 2014

Notes:

  • doesn't work on 4.02 because of ocamlnet which doesn't compile properly
  • the wiki files seems to be hard-coded, so cloning opam.wiki.git is mandatory
  • if you install webmaster it's currently hard to uninstall because of a bug in the META generation of assemblage (as there is a . in dsheets/webmaster@d3f333e#diff-f2d15237ccdccca502443c61217f46d7R27)

@dsheets
Copy link
Contributor Author

dsheets commented Aug 24, 2014

I've fixed the uninstall issue with dsheets/webmaster@ce12f8a.

@samoht
Copy link
Contributor

samoht commented Aug 24, 2014

@dsheets Seems there is a problem while moving the ext resources in opam2web:

$ src/_build/opam2web.native -c ../ocaml.org-demo/opam.ocaml.org/ -o www
=== Universe: current opam universe ===
[WARNING] Date retrieval for opam:default using
[WARNING] git log --name-only --diff-filter=A --reverse --pretty=format:%ct -- */opam
[WARNING] failed with:
# opam-version         1.2.0~beta4 (b20433ccd4fb06c854e7d9af73b8f310c42a6b5c)
# os                   darwin
# command              git log --name-only --diff-filter=A --reverse --pretty=format:%ct -- */opam
# path                 /Users/thomas/.opam/repo/default
# exit-code            128
# env-file             /Users/thomas/.opam/log/log-47299-42bb52.env
# stdout-file          /Users/thomas/.opam/log/log-47299-42bb52.out
# stderr-file          /Users/thomas/.opam/log/log-47299-42bb52.err
### stderr ###
# fatal: Not a git repository (or any of the parent directories): .git

[WARNING] Couldn't retrieve creation date for:
[WARNING] merlin.1.7.1
[WARNING] merlin.2.0.0
[WARNING] tptp.0.3.1
++ Building the package infos: 2573 /2573
++ Building the new stats from {}.
++ Building the package pages.
++ Building the documentation pages.
++ Building the blog.
[NOTE] Skipping /Users/thomas/git/ocaml.org-demo/opam.ocaml.org/blog/README.md: no header found
[NOTE] Skipping /Users/thomas/git/ocaml.org-demo/opam.ocaml.org/blog/CONTRIBUTING.md: no header found
Correctly parsed 8 blog entries:
  - turn-your-editor-into-an-ocaml-ide
  - opam-1-2-pin
  - opam-1-2-0-beta4
  - opam-1-1-1-released
  - opam-1-1-0-released
  - opam-1-1-0-release-candidate
  - opam-1-1-0-beta
  - opam-1-0-0-released
++ Building the package indexes.
++ Generating html files:
[599  /2594] packages/ppx_deriving_protobuf/ppx_deriving_protobuf.1.0.0/                                        [1596 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.5.3/                                      [1597 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.5.2/                                      [1598 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.5.1/                                      [1599 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.5/                                        [1600 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.4.8/                                      [1601 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.4.7/                                      [1602 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.4.6/                                      [1603 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.4.4/                                      [1604 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.4.3/                                      [1605 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.4.2/                                      [1606 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.4.1/                                      [1607 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.4/                                        [1608 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.3.4/                                      [1609 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.3.2/                                      [1610 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.3.1/                                      [1611 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.3/                                        [1612 /2594] packages/google-drive-ocamlfuse/google-drive-ocamlfuse.0.2.1/                                      [2594 /2594] packages/0install/0install.2.6.2/
blog/opam-1-2-0-beta4/: Add resource /Users/thomas/git/ocaml.org-demo/opam.ocaml.org/blog/opam-1-2-0-beta4/packages.png to www/blog/opam-1-2-0-beta4/packages.png
blog/opam-1-2-pin/: Add resource /Users/thomas/git/ocaml.org-demo/opam.ocaml.org/blog/opam-1-2-pin/camel-pin.jpg to www/blog/opam-1-2-pin/camel-pin.jpg
blog/turn-your-editor-into-an-ocaml-ide/: Add resource /Users/thomas/git/ocaml.org-demo/opam.ocaml.org/blog/turn-your-editor-into-an-ocaml-ide-merlin.png to www/blog/turn-your-editor-into-an-ocaml-ide/turn-your-editor-into-an-ocaml-ide-merlin.png
.: Add resource ../ocaml.org-demo/opam.ocaml.org/ext/img/opam.png to www/./ext/img/opam.png

It it supposed to move more resource (the css styles for instance).

@dsheets
Copy link
Contributor Author

dsheets commented Aug 24, 2014

Ah, there is a final step:

opam2web$ cp -R ext www/

There is no resource copying, in general, afaik. You have to place the ext stuff yourself for now.

Sorry.

@samoht
Copy link
Contributor

samoht commented Aug 24, 2014

ok, it works now. I've made a PR against your branch to fix the footer padding. I'm still not very happy with the Dependencies field: I find it verbose and confusing. We should not do things too clever here, look at what Hackage display for intance: https://hackage.haskell.org/package/Lucu

Same thing for the version numbers, it's way too much verbose.

I'm wondering if we could improve the header as well: having both headers is nice but it takes a lot of space on my limited screen.

I really like the integration though. I'll try to propose some styling changes later today.

@dsheets
Copy link
Contributor Author

dsheets commented Aug 24, 2014

I'm not sure I agree with you about the Dependencies field. Take a look at http://opam.ocaml.org/packages/ocaml-sqlexpr/ocaml-sqlexpr.0.3.0/ or http://opam.ocaml.org/packages/ocaml-sqlexpr/ocaml-sqlexpr.0.5.5/. The new project pages (getting pushed later today) have the project description at the top and package relations at the bottom which may help the verbosity. As for the versions, I've opened #116 to track that.

The header thing was the simplest that could work... I'd really love to get rid of it but the output of opam2web is not super-flexible so if we use some other kind of menu bar, we'll probably lose the ability to generate a stand-alone site for the near- to mid-future.

@samoht
Copy link
Contributor

samoht commented Aug 24, 2014

About the Dependencies:

  • | and & are operators with variable arity on the website and are binary in the opam files, which might be confusing.
  • the parenthesis in the opam files are transformed into some visual representation (using bounding boxes) on the website. That's an interesting transformation, but again it can be confusing.

I think what is important is to have the cross-refs right. Most people (including me) just look at the list of packages, and don't really care about the whole shape of the formula (but sometimes you want to be able to copy/paste it, that you can't do on the website at the moment).

@samoht
Copy link
Contributor

samoht commented Aug 24, 2014

About the header: Maybe that's sufficient to make it non sticky? So if you scroll down, it will simply disappear?

@dsheets
Copy link
Contributor Author

dsheets commented Aug 24, 2014

I think we should move the dependency discussion to another issue on opam2web (and I think I agree with you, though would like to retain the currently layout code).

I think we should move the integrated style issue to an ocaml.org issue as most likely the changes that need to be made will be against css/opam.ocaml.org.css in that repo.

I believe that there is no style change in this PR that will affect the current site. The only salient change if we keep the same server config is the different top toolbar labels. I propose we merge this PR, redeploy the site to check it still functions and make the deployment changes after we have hashed out the style issues on ocaml/ocaml.org.

After this is merged, the project page branch can be immediately merged.

@dsheets
Copy link
Contributor Author

dsheets commented Aug 24, 2014

The top-margin when narrow bug and bad menu style bugs are now tracked by ocaml/ocaml.org#521.

The Dependencies issue is #118.

Stacked navs are fat and ugly in ocaml/ocaml.org#522.

@samoht
Copy link
Contributor

samoht commented Aug 24, 2014

Thanks. Agree to merge the PR as well.

@dsheets dsheets merged commit 87963e9 into ocaml-opam:master Aug 24, 2014
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

Successfully merging this pull request may close these issues.

5 participants