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

Add a Resources Page to the Community Section #2184

Merged
merged 7 commits into from May 15, 2024
Merged

Conversation

0xrotense
Copy link
Contributor

@0xrotense 0xrotense commented Mar 13, 2024

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:

  • 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
  • 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
Copy link
Contributor Author

0xrotense commented Mar 13, 2024

Hello, @cuihtlauac, @shakthimaan and @SaySayo ,

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

Regards.

data/resources.yml Outdated Show resolved Hide resolved
@0xrotense
Copy link
Contributor Author

Please help me review the second task I just pushed.

@cuihtlauac, @shakthimaan and @SaySayo

Regards.

@0xrotense
Copy link
Contributor Author

0xrotense commented Mar 14, 2024

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
Copy link
Contributor Author

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

@cuihtlauac
Copy link
Collaborator

@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.

@0xrotense
Copy link
Contributor Author

@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
Copy link
Contributor Author

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
Copy link
Contributor Author

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

data/resources.yml Outdated Show resolved Hide resolved
data/resources.yml Outdated Show resolved Hide resolved
@cuihtlauac
Copy link
Collaborator

@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.

Copy link
Collaborator

@sabine sabine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @0xrotense, thanks for starting this work with this contribution! ❤️

I took a moment and finished the rest of the tasks, so we can merge this now! ✨

@sabine sabine merged commit dc99a92 into ocaml:main May 15, 2024
3 checks passed
@sabine sabine changed the title Add Reference to Learning Resources Add a Resources Page to the Community Section May 15, 2024
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.

Update Data Model to Allow Recording Resources from the Community
5 participants