kittoframework / kitto

Kitto is a framework for interactive dashboards written in Elixir
http://kitto.io/dashboards/sample
MIT License
955 stars 58 forks source link

Allow rendering of templates in subdirectories of templates_dir #127

Closed MatthewNielsen27 closed 6 years ago

MatthewNielsen27 commented 6 years ago

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