module
UI::ScreenHelpers
Overview
Controller mixin. Include in ApplicationController so every
controller in the app can call #compute_screen_html(ScreenClass)
before render("action.ecr").
class ApplicationController < Amber::Controller::Base
include UI::ScreenHelpers
LAYOUT = "application.ecr"
end
class SignInController < ApplicationController
def index
compute_screen_html(SignInScreen)
render("index.ecr")
end
end
The shim template at src/views/sign_in/index.ecr is one line:
<%= @screen_html %>
Use bin/asset_pipeline_amber generate <controller> <action> to
create the shim file mechanically.
Defined in:
asset_pipeline/amber_integration.crInstance Method Summary
-
#compute_screen_html(screen_class : UI::Screen.class) : String
Build a
UI::ScreenContext::Webfrom the current controller's request, instantiatescreen_class, build the view tree, render to HTML viaUI::Web::Renderer, and assign to@screen_html.
Instance Method Detail
Build a UI::ScreenContext::Web from the current controller's
request, instantiate screen_class, build the view tree, render
to HTML via UI::Web::Renderer, and assign to @screen_html.
Returns the rendered HTML string as a convenience.
The renderer's design_tokens are seeded from
UI::AmberConfig.design_tokens so apps that configured a brand
override at boot pick it up automatically.