ckan / ckan

CKAN is an open-source DMS (data management system) for powering data hubs and data portals. CKAN makes it easy to publish, share and use data. It powers catalog.data.gov, open.canada.ca/data, data.humdata.org among many other sites.
https://ckan.org/
Other
4.41k stars 1.98k forks source link

Incorporate new theme to current development branch #8420

Open amercader opened 2 weeks ago

amercader commented 2 weeks ago

The new design is taking shape nicely (the preview site needs to be updated but will have the new theme soon) and it's time to start bringing it over to the current master branch.

There is a mechanism in environment.py to switch the base public and template folders, and for now we can just reuse that. We just need to add the new allowed values:

diff --git a/ckan/config/environment.py b/ckan/config/environment.py
index 9de9e7cf0..c35840989 100644
--- a/ckan/config/environment.py
+++ b/ckan/config/environment.py
@@ -40,7 +40,7 @@ def load_environment(conf: Union[Config, CKANConfig]):
     """
     os.environ['CKAN_CONFIG'] = cast(str, conf['__file__'])

-    valid_base_public_folder_names = ['public']
+    valid_base_public_folder_names = ['public', 'public-{suffix}']
     static_files = conf.get('ckan.base_public_folder', 'public')
     conf['ckan.base_public_folder'] = static_files

@@ -188,7 +188,7 @@ def update_config() -> None:
     helpers.load_plugin_helpers()

     # Templates and CSS loading from configuration
-    valid_base_templates_folder_names = ['templates']
+    valid_base_templates_folder_names = ['templates', 'templates-{suffix}']
     templates = config.get('ckan.base_templates_folder')
     config['ckan.base_templates_folder'] = templates

Then we need to copy the public and templates folders of the new theme next to the current ones with a different name, eg:

ckan/
    public
    public-{suffix}
    templates
    templates-{suffix}

The -{suffix} folder should contain the new theme for now. When it's ready to go we will switch and make it the default but for now, to use it you will have to set these config options:

ckan.base_public_folder = public-{suffix}
ckan.base_templates_folder = templates-{suffix}

Now for the hard part, the name to replace -{suffix} :) Let's not call it "new", "v2", "3.0" or anything that will eventually get outdated, just a code name. Maybe something related to the color like cobalt, blue jay, ocean or whatever.

So the first pull request should include:

  1. The changes in environment.py above
  2. The new templates-{suffix} and public-{suffix} folders
  3. Whatever initial changes you think make sense to get an initial feeling and validate that the assets are loading fine etc. Can be the homepage, just the header/footer, etc

After that we can move forward with PRs that focus on pages, functionalities etc.

Does this make sense @aleeexgreeen ?

aleeexgreeen commented 2 weeks ago

@amercader makes total sense, I'll get started on this, thanks!!