ocaml.org icon indicating copy to clipboard operation
ocaml.org copied to clipboard

Add Reference to Learning Resources

Open 0xrotense opened this issue 11 months ago • 9 comments

Fixes: #2041

Sure!

One possible way to go is to define another category of served data. This would allow defining a tile-base UI (like this one https://ocaml.org/jobs). We'd have one tile per learn resource. Learn-OCaml would be one. There's also this:

https://github.com/gs0510/ofronds https://github.com/sudha247/learn-ocaml-workshop https://github.com/kayceesrk/cs3100_f19 I suspect there's even more.

This implies creating a new kind of served data. Folowing-up with the jobs example, this file: data/jobs entails the jobs page.

In tool/ood-gen/lib/job.ml there's the Yaml parser. It translates into OCaml sources which are compiled and linked (ocaml.org runs from memory). In src/ocamlorg_frontend/pages/jobs.eml there's the HTML template which is turned into the paged served with the Yaml data In src/ocamlorg_web/lib/handler.ml and src/ocamlorg_web/lib/router.ml there's the bits that glues everything together. There's also some stuff in src/ocamlorg_data/lib/data.ml That's the overall logic. @Clairevanden will think of the design.

Regarding the Yaml data we probably need fields for:

Title Short description Long description Image Online Url Source Url License This whole thing would allow displaying the tiles either in the exercises, in the community or anywhere else.

Proposed Designs by @sabine: https://www.figma.com/file/7hmoWkQP9PgLTfZCqiZMWa/OCaml-Community-Pages?type=design&node-id=152%3A386&mode=dev&t=kePoh4Cvcc35Nemo-1

To Do:

  • [x] Create a new kind of served data, e.g., data/resources.yml, that will entail the new resources page. These are the fields needed for the YAML DATA: ddfb90f - Title - Short description - Long description - Image - Online Url - Source Url - License
  • [x] Create and add the YAML parser to tool/ood-gen/lib/resource.ml. It translates into OCaml sources which are compiled and linked (ocaml.org runs from memory). 78ab3bd
  • [ ] Create and add the HTML Template to src/ocamlorg_frontend/pages/resources.eml. There's the HTML template which is turned into the paged served with the Yaml data.
  • [ ] Lastly, Glue everything together in the following: - src/ocamlorg_web/lib/handler.ml - src/ocamlorg_web/lib/router.ml - src/ocamlorg_data/lib/data.ml

0xrotense avatar Mar 13 '24 12:03 0xrotense

Hello, @cuihtlauac, @shakthimaan and @SaySayo ,

Please help me review this to see if I'm on the right track.

Regards.

0xrotense avatar Mar 13 '24 12:03 0xrotense

Please help me review the second task I just pushed.

@cuihtlauac, @shakthimaan and @SaySayo

Regards.

0xrotense avatar Mar 13 '24 16:03 0xrotense

Hello @cuihtlauac @SaySayo ,

I got this error when I added the resource handler to src/ocamlorg_web/lib/handler.ml and running dune build

Screenshot 2024-03-14 182426

Please what does the error mean and how do i go about it? or is it because I have not updated the src/ocamlorg_data/lib/data.ml ?

Regards.

0xrotense avatar Mar 14 '24 17:03 0xrotense

Hello @cuihtlauac @SaySayo ,

I got this error when I added the resource handler to src/ocamlorg_web/lib/handler.ml and running dune build

Screenshot 2024-03-14 182426 Please what does the error mean and how do i go about it? or is it because I have not updated the [src/ocamlorg_data/lib/data.ml](https://github.com/ocaml/ocaml.org/blob/main/src/ocamlorg_data/data.ml) ?

Regards.

kindly help review this @cuihtlauac

0xrotense avatar Mar 15 '24 14:03 0xrotense

@0xrotense Sorry I missed your message yesterday.

That's because you haven't added the type resource in src/ocamlorg_data/data.ml and src/ocamlorg_date/data.mli. Look into those files how Jobs are handled. You need something similar for resources.

cuihtlauac avatar Mar 15 '24 14:03 cuihtlauac

@0xrotense Sorry I missed your message yesterday.

That's because you haven't added the type resource in src/ocamlorg_data/data.ml and src/ocamlorg_date/data.mli. Look into those files how Jobs are handled. You need something similar for resources.

okay, thanks will look into that.

0xrotense avatar Mar 15 '24 14:03 0xrotense

image

This is resources handler in handler.ml .

Screenshot 2024-03-15 162425

The type resource in data.ml

image

The Error I got just now after running dune build.

image

The module interface in data.mli

@cuihtlauac

0xrotense avatar Mar 15 '24 15:03 0xrotense

image

This is resources handler in handler.ml .

Screenshot 2024-03-15 162425

The type resource in data.ml

image

The Error I got just now after running dune build.

image

The module interface in data.mli

@cuihtlauac

Hi @cuihtlauac , Please help look into this.

Thanks

0xrotense avatar Mar 17 '24 20:03 0xrotense

@0xrotense

You must edit the files src/ocamlorg_data/data.ml and src/ocamlorg_data/data.mli.

Essentially, the type defined in the tool/ood-gen/lib/ressource.ml must be copied in both places. With the wrapping into a submodule.

cuihtlauac avatar Mar 25 '24 08:03 cuihtlauac