kittoframework/kitto

Allow rendering of templates in subdirectories of templates_dir

Closed this issue · 0 comments

Feature

Allow rendering of templates in subdirectories of templates_dir

Rationale

Currently Kitto only allows rendering of templates within the top level of the templates_dir. It can get very cluttered when trying to organize different dashboards for numerous teams. Allowing the rendering of templates within subdirectories would allow for greater organization and make the development process for large organizations much cleaner.

Example

templates/
----project_a/
--------general.html.eex
--------performance.html.eex
----project_b/
--------services/
------------authentication.html.eex
------------payment_processing.html.eex

What needs to be fixed

# in /lib/kitto/view.ex

-- defp invalid_path?([h|t]), do: String.contains?(h, ["/", "\\", ":", "\0"]) or invalid_path?(t)

++ defp invalid_path?([h|t]), do: String.contains?(h, ["\\", ":", "\0"]) or invalid_path?(t)

Next steps

I will submit a PR soon for consideration