-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
450 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
require "../src/app" | ||
|
||
root do | ||
raise "Oops" | ||
end | ||
|
||
scope "/foo" do | ||
scope "/bar" do | ||
root do | ||
|
2 changes: 1 addition & 1 deletion
2
spec/orion/router/concerns_spec.cr → spec/orion/dsl/concerns_spec.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/orion/router/constraints_spec.cr → spec/orion/dsl/constraints_spec.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/orion/router/helpers_spec.cr → spec/orion/dsl/helpers_spec.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/orion/router/methods_spec.cr → spec/orion/dsl/methods_spec.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/orion/router/resources_spec.cr → spec/orion/dsl/resources_spec.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
spec/orion/router/websockets_spec.cr → spec/orion/dsl/websockets_spec.cr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,58 @@ | ||
# The `Orion::Controller` module can be included in any struct or class to add | ||
# the various helpers methods to make constructing your application easier. | ||
module Orion::Controller | ||
@layout_rendered = false | ||
getter context : ::HTTP::Server::Context | ||
getter! websocket : ::HTTP::WebSocket | ||
delegate request, response, to: @context | ||
|
||
private macro layout(filename) | ||
private def render_layout(&block): Nil | ||
if @layout_rendered | ||
raise ::Orion::DoubleRenderError.new "cannot call render view more than once" | ||
end | ||
@layout_rendered = true | ||
Kilt.embed "src/views/layouts/{{ filename.id }}" | ||
end | ||
end | ||
|
||
private macro render(*, view, layout = true) | ||
{% if layout %} | ||
render_layout do | ||
Kilt.embed "src/views/{{ view.id }}" | ||
nil | ||
end | ||
{% else %} | ||
Kilt.embed "src/views/{{ view.id }}" | ||
nil | ||
{% end %} | ||
end | ||
|
||
private macro render(*, partial) | ||
Kilt.embed "src/views/partials/{{ partial.id }}" | ||
nil | ||
end | ||
|
||
private macro render(*, json) | ||
{{ json }}.to_json(response) | ||
nil | ||
end | ||
|
||
private macro render(*, text) | ||
response.puts({{ text }}) | ||
nil | ||
end | ||
|
||
def initialize(@context, @websocket = nil) | ||
end | ||
|
||
private def render_layout(&block) | ||
yield | ||
end | ||
|
||
private def __kilt_io__ | ||
response | ||
end | ||
end | ||
|
||
require "./controller/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
require "./helper" | ||
# :nodoc: | ||
abstract class Orion::Controller::Base | ||
include Helper | ||
include Orion::Controller | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.