Powered by SmartDoc

Reusable Components

CKFrame

CKFrame generates frame tag in HTML.

Required attributes: pageor srcor value

Attributes of CKFrame
Attribute Type Description
name String nameattribute of HTML's <frame>tag.
page String Name of component that supplies the content for the frame.
src String You specify the URL or file for the frame.
value CKComponent Method that supplies the content. The parent of this element must have the specified method.

To use frames, ready components that include framesets and CKFrame elements for frame components.

<frameset cols="200,*">
<cgikit name=Index></cgikit>
<cgikit name=Contents></cgikit>
</frameset>
Index : CKFrame {
  name = "Index";
  page = "IndexPage";
}

Contents : CKFrame {
  name = "Contents";
  page = "IntroductionPage";
}

CKComponent

You can use one component in another component like elements. It means that it is possible to nest components with specifying in binding files.

OtherComponent : MainPage {}

Components has no attributes like elements. Instead of this, components' instance variables are as attributes.

class MainPage < CKComponent
  attr_accessor :title
end
OtherComponent : MainPage {
  title = "Example for CKComponent";
}

MainPage component's titleattribute is substituted "Example for CKComponent".

CKPartsMaker

You can write a component which converts itself to a part of a web page. In some cases, a web page is composed of these components. These components are called parts component. Parts componente is recommended to include CKPartsMaker. A component which includes CKPartsMaker isn't displayed even if its name is set to the CKApplication#target.

A name of parts component is recommended to have "Parts" or ?Component? at the end of the name to distinguish it from page component.

Object attributes of CKPartsMaker module
Object attribute Description
substitute_page When CGIKit recieves requests to show component parts, CGIKit shows the page specified by this attribute. A main page of an application is displayed when the value is not defined.

CKContent

CKContent is used in nested components. This element tag in the template is replaced with a part of the template of its grandparent component. CKContent has no attributes.

<cgikit name=OtherComponent>Content of parent</cgikit>
OtherComponent : MainPage {}
<b><cgikit name=Content></cgikit></b>
Content : CKContent {}
<b>Content of parent</b>

CKGenericElement

CKGenericElement generates generic HTML tags.

Required attribute: tag

Attributes of CKGenericElement
Attribute Type Description
tag String Name of the HTML tag. If the attribute is nil, body enclosed by the element or stringattribute are displayed.
enabled true/false Enables or disables the tag. If the attribute is false, body enclosed by the element or stringattribute are displayed.
string String String to display if body enclosed by the element isn't exist.
option String String to append for the open tag. For example, checkedor selected.
form_value String If the element is form, the attribute is setted form datas as a string.
form_values Array If the element is form, the attribute is setted form datas as an array.
invoke_action CKComponent If the element is executable (hyperlink, button, etc.), the method is called when clicked.

You can define other voluntary attributes. The attributes is appended to the tag in format as "attribute=value".