diff --git a/docs/guides/Working_With_Genie_Apps.md b/docs/guides/Working_With_Genie_Apps.md index 53cf53bc0..5e8318eac 100644 --- a/docs/guides/Working_With_Genie_Apps.md +++ b/docs/guides/Working_With_Genie_Apps.md @@ -154,7 +154,7 @@ We create the `views/` folder in `app/resources/books/`. We provide the full pat Usually each controller method will have its own rendering logic – hence, its own view file. Thus, it's a good practice to name the view files just like the methods, so that we can keep track of where they're used. At the moment, Genie supports HTML and Markdown view files, as well as plain Julia. Their type is identified by file extension so that's an important part. -The HTML views use a `.jl.html` extension while the Markdown files go with `.jl.md` and the Julia ones by `flax.jl`. +The HTML views use a `.jl.html` extension while the Markdown files go with `.jl.md` and the Julia ones by `.jl`. ### HTML views diff --git a/files/new_app/build/.gitkeep b/files/new_app/build/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/files/new_app/cache/.gitkeep b/files/new_app/cache/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/files/new_app/sessions/.gitkeep b/files/new_app/sessions/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/files/new_app/tasks/.gitkeep b/files/new_app/tasks/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/Renderer.jl b/src/Renderer.jl index 4d5602b52..3018e6ae7 100755 --- a/src/Renderer.jl +++ b/src/Renderer.jl @@ -11,7 +11,6 @@ const DEFAULT_CONTENT_TYPE = :html const DEFAULT_LAYOUT_FILE = "app" const VIEWS_FOLDER = "views" -const LAYOUTS_FOLDER = "layouts" const BUILD_NAME = "GenieViews" diff --git a/src/renderers/Html.jl b/src/renderers/Html.jl index 0bd0d5423..3db2663c7 100644 --- a/src/renderers/Html.jl +++ b/src/renderers/Html.jl @@ -8,6 +8,9 @@ import Genie.Renderer: @vars Reexport.@reexport using HttpCommon +const DEFAULT_LAYOUT_FILE = :app +const LAYOUTS_FOLDER = "layouts" + const HTML_FILE_EXT = [".flax.jl", "html.jl"] const TEMPLATE_EXT = [".flax.html", ".jl.html"] const MARKDOWN_FILE_EXT = [".md", ".jl.md"] @@ -319,8 +322,8 @@ end """ function html(resource::Genie.Renderer.ResourcePath, action::Genie.Renderer.ResourcePath; layout::Genie.Renderer.ResourcePath = DEFAULT_LAYOUT_FILE, context::Module = @__MODULE__, status::Int = 200, headers::Genie.Renderer.HTTPHeaders = Genie.Renderer.HTTPHeaders(), vars...) :: Genie.Renderer.HTTP.Response - html(Path(joinpath(Genie.config.path_resources, string(resource), VIEWS_FOLDER, string(action))); - layout = Path(joinpath(Genie.config.path_app, LAYOUTS_FOLDER, string(layout))), + html(Genie.Renderer.Path(joinpath(Genie.config.path_resources, string(resource), Renderer.VIEWS_FOLDER, string(action))); + layout = Genie.Renderer.Path(joinpath(Genie.config.path_app, LAYOUTS_FOLDER, string(layout))), context = context, status = status, headers = headers, vars...) end @@ -362,7 +365,7 @@ end html(viewfile::FilePath; layout::Union{Nothing,FilePath} = nothing, context::Module = @__MODULE__, status::Int = 200, headers::HTTPHeaders = HTTPHeaders(), vars...) :: HTTP.Response -Parses and renders the HTML `viewfile`, optionally rendering it within the `layout` file. Valid file formats are `.html.jl` and `.flax.jl`. +Parses and renders the HTML `viewfile`, optionally rendering it within the `layout` file. Valid file format is `.html.jl`. # Arguments - `viewfile::FilePath`: filesystem path to the view file as a `Renderer.FilePath`, ie `Renderer.FilePath("/path/to/file.html.jl")` diff --git a/src/renderers/Js.jl b/src/renderers/Js.jl index 7ef974bdb..8f68fe3d4 100644 --- a/src/renderers/Js.jl +++ b/src/renderers/Js.jl @@ -13,7 +13,7 @@ const JSString = String const NBSP_REPLACEMENT = (" "=>"!!nbsp;;") -export JSString, js +export js """ diff --git a/src/renderers/Json.jl b/src/renderers/Json.jl index 21d3170ab..f6d955069 100644 --- a/src/renderers/Json.jl +++ b/src/renderers/Json.jl @@ -43,7 +43,7 @@ end """ function json(resource::Genie.Renderer.ResourcePath, action::Genie.Renderer.ResourcePath; context::Module = @__MODULE__, status::Int = 200, headers::Genie.Renderer.HTTPHeaders = Genie.Renderer.HTTPHeaders(), vars...) :: Genie.Renderer.HTTP.Response - json(Path(joinpath(Genie.config.path_resources, string(resource), VIEWS_FOLDER, string(action) * JSON_FILE_EXT)); + json(Genie.Renderer.Path(joinpath(Genie.config.path_resources, string(resource), VIEWS_FOLDER, string(action) * JSON_FILE_EXT)); context = context, status = status, headers = headers, vars...) end