Documentation ¶
Index ¶
- Constants
- func BootstrapAlert(form page.FormI, message string, buttons interface{}) control.DialogI
- func NavbarSelectEvent() *page.Event
- type BackgroundColorClass
- type Button
- func (b *Button) Deserialize(d page.Decoder) (err error)
- func (b *Button) DrawingAttributes(ctx context.Context) html.Attributes
- func (b *Button) Init(self page.ControlI, parent page.ControlI, id string)
- func (b *Button) Serialize(e page.Encoder) (err error)
- func (b *Button) SetButtonSize(size ButtonSize) ButtonI
- func (b *Button) SetButtonStyle(style ButtonStyle) ButtonI
- func (b *Button) SetIsPrimary(isPrimary bool) ButtonI
- type ButtonCreator
- type ButtonI
- type ButtonSize
- type ButtonStyle
- type Checkbox
- func (c *Checkbox) Deserialize(d page.Decoder) (err error)
- func (c *Checkbox) DrawTag(ctx context.Context) (ctrl string)
- func (c *Checkbox) DrawingAttributes(ctx context.Context) html.Attributes
- func (c *Checkbox) GetDrawingLabelAttributes() html.Attributes
- func (c *Checkbox) Serialize(e page.Encoder) (err error)
- func (c *Checkbox) SetInline(v bool) *Checkbox
- type CheckboxCreator
- type CheckboxList
- func (l *CheckboxList) DrawingAttributes(ctx context.Context) html.Attributes
- func (l *CheckboxList) Init(self CheckboxListI, parent page.ControlI, id string)
- func (l *CheckboxList) RenderItem(item *control.ListItem) (h string)
- func (l *CheckboxList) SetCellClass(c string)
- func (l *CheckboxList) SetIsInline(i bool)
- type CheckboxListCreator
- type CheckboxListI
- type ContainerClass
- type DataPager
- func (d *DataPager) Deserialize(dec page.Decoder) (err error)
- func (l *DataPager) DrawingAttributes(ctx context.Context) html.Attributes
- func (d *DataPager) Init(self page.ControlI, parent page.ControlI, id string, ...)
- func (d *DataPager) NextButtonsHtml() string
- func (d *DataPager) PageButtonsHtml(i int) string
- func (d *DataPager) PreviousButtonsHtml() string
- func (d *DataPager) Serialize(e page.Encoder) (err error)
- type DataPagerCreator
- type DataPagerI
- type DateTextbox
- type DateTextboxCreator
- type DateTextboxI
- type EmailTextbox
- type EmailTextboxCreator
- type EmailTextboxI
- type FloatTextbox
- type FloatTextboxCreator
- type FloatTextboxI
- type FormFieldset
- func (c *FormFieldset) DrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- func (c *FormFieldset) DrawingAttributes(ctx context.Context) html.Attributes
- func (c *FormFieldset) Init(self page.ControlI, parent page.ControlI, id string)
- func (c *FormFieldset) InstructionAttributes() html.Attributes
- func (c *FormFieldset) LegendAttributes() html.Attributes
- func (c *FormFieldset) SetAsRow(r bool) FormFieldsetI
- func (c *FormFieldset) SetInstructions(instructions string) FormFieldsetI
- type FormFieldsetCreator
- type FormFieldsetI
- type FormGroup
- func (c *FormGroup) ChildValidationChanged()
- func (c *FormGroup) DrawTag(ctx context.Context) string
- func (c *FormGroup) DrawingAttributes(ctx context.Context) html.Attributes
- func (c *FormGroup) Init(self control.FormFieldWrapperI, parent page.ControlI, id string)
- func (c *FormGroup) InnerDivAttributes() html.Attributes
- func (c *FormGroup) SetUseTooltips(use bool) FormGroupI
- func (c *FormGroup) UseTooltips() bool
- func (c *FormGroup) Validate(ctx context.Context) bool
- type FormGroupCreator
- type FormGroupI
- type IntegerTextbox
- type IntegerTextboxCreator
- type IntegerTextboxI
- type ItemDirection
- type ListGroup
- type ListGroupCreator
- type ListGroupI
- type Modal
- func (d *Modal) AddButton(label string, id string, options *control.DialogButtonOptions)
- func (d *Modal) AddCloseButton(label string) ModalI
- func (d *Modal) AddTitlebarClass(class string)
- func (d *Modal) Close()
- func (d *Modal) DrawTemplate(ctx context.Context, buf *bytes.Buffer) (err error)
- func (d *Modal) DrawingAttributes(ctx context.Context) html.Attributes
- func (d *Modal) Init(self page.ControlI, parent page.ControlI, id string)
- func (d *Modal) Open()
- func (d *Modal) PrivateAction(ctx context.Context, a page.ActionParams)
- func (d *Modal) PutCustomScript(ctx context.Context, response *page.Response)
- func (d *Modal) RemoveAllButtons()
- func (d *Modal) RemoveButton(id string)
- func (d *Modal) SetBackdrop(b ModalBackdropType)
- func (d *Modal) SetButtonStyle(id string, a html.Style) ModalI
- func (d *Modal) SetButtonVisible(id string, visible bool) ModalI
- func (d *Modal) SetDialogStyle(style control.DialogStyle)
- func (d *Modal) SetHasCloseBox(h bool)
- func (d *Modal) SetTitle(t string)
- func (d *Modal) Title() string
- type ModalBackdropType
- type ModalButtonCreator
- type ModalCreator
- type ModalI
- type Navbar
- func (b *Navbar) DrawTemplate(ctx context.Context, buf *bytes.Buffer) (err error)
- func (b *Navbar) DrawingAttributes(ctx context.Context) html.Attributes
- func (b *Navbar) Init(self page.ControlI, parent page.ControlI, id string)
- func (b *Navbar) SetBackgroundClass(c BackgroundColorClass) NavbarI
- func (b *Navbar) SetBrandPlacement(p NavbarCollapsedBrandPlacement) NavbarI
- func (b *Navbar) SetExpand(e NavbarExpandClass) NavbarI
- func (b *Navbar) SetHeaderAnchor(a string) NavbarI
- func (b *Navbar) SetNavbarStyle(style NavbarStyle) NavbarI
- type NavbarCollapsedBrandPlacement
- type NavbarCreator
- type NavbarExpandClass
- type NavbarI
- type NavbarList
- func (l *NavbarList) Deserialize(dec page.Decoder) (err error)
- func (l *NavbarList) DrawInnerHtml(ctx context.Context, buf *bytes.Buffer) (err error)
- func (l *NavbarList) DrawTag(ctx context.Context) string
- func (l *NavbarList) DrawingAttributes(ctx context.Context) html.Attributes
- func (l *NavbarList) Init(self NavbarListI, parent page.ControlI, id string)
- func (l *NavbarList) ItemProxy() *control.Proxy
- func (l *NavbarList) OnSelect(action action.ActionI) page.ControlI
- func (l *NavbarList) Serialize(e page.Encoder) (err error)
- type NavbarListCreator
- type NavbarListI
- type NavbarStyle
- type RadioButton
- type RadioButtonCreator
- type RadioButtonI
- type RadioList
- type RadioListCreator
- type RadioListI
- type SelectList
- type SelectListCreator
- type SelectListI
- type Tabs
- type TabsCreator
- type TabsI
- type TextColorClass
- type Textbox
- type TextboxCreator
- type TextboxI
- type TitleBar
Constants ¶
const ( ButtonStylePrimary ButtonStyle = "btn-primary" ButtonStyleSecondary = "btn-secondary" ButtonStyleSuccess = "btn-success" ButtonStyleInfo = "btn-info" ButtonStyleWarning = "btn-warning" ButtonStyleDanger = "btn-danger" ButtonStyleLight = "btn-light" ButtonStyleDark = "btn-dark" ButtonStyleLink = "btn-link" ButtonStyleOutlinePrimary = "btn-outline-primary" ButtonStyleOutlineSecondary = "btn-outline-secondary" ButtonStyleOutlineSuccess = "btn-outline-success" ButtonStyleOutlineInfo = "btn-outline-info" ButtonStyleOutlineWarning = "btn-outline-warning" ButtonStyleOutlineDanger = "btn-outline-danger" ButtonStyleOutlineLight = "btn-outline-light" ButtonStyleOutlineDark = "btn-outline-dark" )
const ( ButtonSizeLarge ButtonSize = "btn-lg" ButtonSizeMedium = "" ButtonSizeSmall = "btn-sm" )
const ( TextColorPrimary TextColorClass = "text-primary" TextColorSecondary = "text-secondary" TextColorDanger = "text-danger" TextColorWarning = "text-warning" TextColorInfo = "text-info" TextColorLight = "text-light" TextColorDark = "text-dark" TextColorBody = "text-body" TextColorMuted = "text-muted" TextColorWhite = "text-white" TextColorWhite50 = "text-white-50" TextColorBlack50 = "text-black-50" )
const ( BackgroundColorPrimary BackgroundColorClass = "bg-primary" BackgroundColorSecondary = "bg-secondary" BackgroundColorSuccess = "bg-danger" BackgroundColorDanger = "bg-danger" BackgroundColorWarning = "bg-warning" BackgroundColorInfo = "bg-info" BackgroundColorLight = "bg-light" BackgroundColorDark = "bg-dark" BackgroundColorWhite = "bg-white" BackgroundColorTransparent = "bg-transparent" BackgroundColorNone = "" // utility to allow custom background colors for components )
const ( ButtonClick = iota + 3000 DialogClosing DialogClosed )
event codes
const ()
const (NavbarExpandNone = "" )
const ButtonBlock = "btn-block"
Add ButtonBlock as a class to a button to make it span a full block
const ButtonClass = "btn"
Variables ¶
This section is empty.
Functions ¶
func BootstrapAlert ¶
* Alert creates a message dialog.
If you specify no buttons, a close box in the corner will be created that will just close the dialog. If you specify just a string in buttons, or just one string as a slice of strings, one button will be shown that will just close the message.
If you specify more than one button, the first button will be the default button (the one pressed if the user presses the return key). In this case, you will need to detect the button by adding a On(event.DialogButton(), action) to the dialog returned. You will also be responsible for calling "Close()" on the dialog after detecting a button in this case.
func NavbarSelectEvent ¶
Types ¶
type BackgroundColorClass ¶
type BackgroundColorClass string
type Button ¶
func GetButton ¶ added in v0.2.4
GetButton is a convenience method to return the button with the given id from the page.
func (*Button) DrawingAttributes ¶
func (b *Button) DrawingAttributes(ctx context.Context) html.Attributes
func (*Button) SetButtonSize ¶
func (b *Button) SetButtonSize(size ButtonSize) ButtonI
SetButtonsSize sets the size class of the button.
func (*Button) SetButtonStyle ¶
func (b *Button) SetButtonStyle(style ButtonStyle) ButtonI
SetButtonStyle will set the button's style to one of the predefined bootstrap styles.
func (*Button) SetIsPrimary ¶
type ButtonCreator ¶ added in v0.2.0
type ButtonCreator struct { // ID is the control id ID string // Text is the text displayed in the button Text string // OnSubmit is the action to take when the button is submitted. Use this specifically // for buttons that move to other pages or processes transactions, as it debounces the button // and waits until all other actions complete OnSubmit action.ActionI // OnClick is an action to take when the button is pressed. Do not specify both // a OnSubmit and OnClick. OnClick action.ActionI Style ButtonStyle Size ButtonSize IsPrimary bool ValidationType page.ValidationType page.ControlOptions }
ButtonCreator is the initialization structure for declarative creation of buttons
type ButtonI ¶
type ButtonI interface { grctl.ButtonI SetButtonStyle(style ButtonStyle) ButtonI SetButtonSize(size ButtonSize) ButtonI SetIsPrimary(isPrimary bool) ButtonI }
type ButtonSize ¶
type ButtonSize string
type ButtonStyle ¶
type ButtonStyle string
type Checkbox ¶
func GetCheckbox ¶ added in v0.2.0
GetCheckbox is a convenience method to return the checkbox with the given id from the page.
func (*Checkbox) DrawingAttributes ¶
func (c *Checkbox) DrawingAttributes(ctx context.Context) html.Attributes
func (*Checkbox) GetDrawingLabelAttributes ¶ added in v0.4.0
func (c *Checkbox) GetDrawingLabelAttributes() html.Attributes
type CheckboxCreator ¶ added in v0.2.0
type CheckboxCreator struct { // ID is the id of the control ID string // Text is the text of the label displayed right next to the checkbox. Text string // Checked will initialize the checkbox in its checked state. Checked bool // LabelMode specifies how the label is drawn with the checkbox. LabelMode html.LabelDrawingMode // LabelAttributes are additional attributes placed on the label tag. LabelAttributes html.Attributes // SaveState will save the value of the checkbox and restore it when the page is reentered. SaveState bool // Set inline when drawing this checkbox inline or wrapped by an inline FormGroup Inline bool page.ControlOptions }
type CheckboxList ¶
type CheckboxList struct { control.CheckboxList // contains filtered or unexported fields }
CheckboxList is a multi-select control that presents its choices as a list of checkboxes. Styling is provided by divs and spans that you can provide css for in your style sheets. The goradd.css file has default styling to handle the basics. It wraps the whole thing in a div that can be set to scroll as well, so that the final structure can be styled like a multi-table table, or a single-table scrolling list much like a standard html select list.
func GetCheckboxList ¶ added in v0.2.0
func GetCheckboxList(c page.ControlI, id string) *CheckboxList
GetCheckboxList is a convenience method to return the control with the given id from the page.
func NewCheckboxList ¶
func NewCheckboxList(parent page.ControlI, id string) *CheckboxList
func (*CheckboxList) DrawingAttributes ¶
func (l *CheckboxList) DrawingAttributes(ctx context.Context) html.Attributes
DrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
func (*CheckboxList) Init ¶
func (l *CheckboxList) Init(self CheckboxListI, parent page.ControlI, id string)
func (*CheckboxList) RenderItem ¶ added in v0.4.0
func (l *CheckboxList) RenderItem(item *control.ListItem) (h string)
RenderItem is called by the framework to render a single item in the list.
func (*CheckboxList) SetCellClass ¶ added in v0.2.0
func (l *CheckboxList) SetCellClass(c string)
SetColumnClass sets a string that is applied to every cell. This is useful for setting responsive breakpoints
func (*CheckboxList) SetIsInline ¶
func (l *CheckboxList) SetIsInline(i bool)
type CheckboxListCreator ¶ added in v0.2.0
type CheckboxListCreator struct { ID string // Items is a static list of labels and values that will be in the list. Or, use a DataProvider to dynamically generate the items. Items []control.ListValue // DataProvider is the control that will dynamically provide the data for the list and that implements the DataBinder interface. DataProvider control.DataBinder // DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface. DataProviderID string // ColumnCount specifies how many columns to show ColumnCount int // LayoutDirection determines how the items are arranged in the columns LayoutDirection control.LayoutDirection // LabelDrawingMode specifies how the labels on the radio buttons will be associated with the buttons LabelDrawingMode html.LabelDrawingMode // IsScrolling will give the inner div a vertical scroll style. You will need to style the height of the outer control to have a fixed style as well. IsScrolling bool // RowClass is the class assigned to each row RowClass string // Value is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control. Value string // SaveState saves the selected value so that it is restored if the form is returned to. SaveState bool page.ControlOptions }
func (CheckboxListCreator) Create ¶ added in v0.2.0
Create is called by the framework to create a new control from the Creator. You do not normally need to call this.
func (CheckboxListCreator) Init ¶ added in v0.2.0
func (c CheckboxListCreator) Init(ctx context.Context, ctrl CheckboxListI)
type CheckboxListI ¶
type CheckboxListI interface { control.CheckboxListI }
type ContainerClass ¶
type ContainerClass string
const ( Container ContainerClass = "container" ContainerFluid = "container-fluid" )
type DataPager ¶
type DataPager struct { control.DataPager ButtonStyle ButtonStyle HighlightStyle ButtonStyle }
DataPager is a toolbar designed to aid scrolling through a large set of data. It is implemented using Aria design best practices. It is designed to be paired with a Table or DataRepeater to aid in navigating through the data. It is similar to a Paginator, but a paginator is for navigating through a whole series of pages and not just for data on one override.
func NewDataPager ¶
func (*DataPager) DrawingAttributes ¶
func (l *DataPager) DrawingAttributes(ctx context.Context) html.Attributes
func (*DataPager) NextButtonsHtml ¶
func (*DataPager) PageButtonsHtml ¶
func (*DataPager) PreviousButtonsHtml ¶
type DataPagerCreator ¶ added in v0.2.0
type DataPagerCreator struct { // ID is the control id ID string // MaxPageButtons is the maximum number of page buttons to display in the pager MaxPageButtons int // ObjectName is the name of the object being displayed in the table ObjectName string // ObjectPluralName is the plural name of the object being displayed ObjectPluralName string // LabelForNext is the text to use in the Next button LabelForNext string // LabelForPrevious is the text to use in the Previous button LabelForPrevious string // PagedControl is the id of the control that will be paged by the pager PagedControl string page.ControlOptions // ButtonStyle is the style that will be used to draw the standard buttons ButtonStyle ButtonStyle // HighlightStyle is the style that will be used to draw the highlighted buttons HighlightStyle ButtonStyle }
DataPagerCreator is the initialization structure for declarative creation of data pagers
func (DataPagerCreator) Create ¶ added in v0.2.0
Create is called by the framework to create a new control from the Creator. You do not normally need to call this.
func (DataPagerCreator) Init ¶ added in v0.2.0
func (c DataPagerCreator) Init(ctx context.Context, ctrl DataPagerI)
Init is called by implementations of Buttons to initialize a control with the creator. You do not normally need to call this.
type DataPagerI ¶
type DataPagerI interface { control.DataPagerI }
type DateTextbox ¶
type DateTextbox struct {
control.DateTextbox
}
func GetDateTextbox ¶ added in v0.2.0
func GetDateTextbox(c page.ControlI, id string) *DateTextbox
GetEmailTextbox is a convenience method to return the control with the given id from the page.
func NewDateTextbox ¶
func NewDateTextbox(parent page.ControlI, id string) *DateTextbox
func (*DateTextbox) DrawingAttributes ¶
func (t *DateTextbox) DrawingAttributes(ctx context.Context) html.Attributes
type DateTextboxCreator ¶ added in v0.2.0
type DateTextboxCreator struct { // ID is the control id of the html widget and must be unique to the page ID string // Placeholder is the placeholder attribute of the textbox and shows as help text inside the field Placeholder string // Type is the type attribute of the textbox Type string // MinLength is the minimum number of characters that the user is required to enter. If the // length is less than this number, a validation error will be shown. MinLength int // MaxLength is the maximum number of characters that the user is required to enter. If the // length is more than this number, a validation error will be shown. MaxLength int // ColumnCount is the number of characters wide the textbox will be, and becomes the width attribute in the tag. // The actual width is browser dependent. For better control, use a width style property. ColumnCount int // ReadOnly sets the readonly attribute of the textbox, which prevents it from being changed by the user. ReadOnly bool // SaveState will save the text in the textbox, to be restored if the user comes back to the page. // It is particularly helpful when the textbox is being used to filter the results of a query, so that // when the user comes back to the page, he does not have to type the filter text again. SaveState bool // Text is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control. Text string // Format is the time.format string to use to decode the text into a date. Format string page.ControlOptions }
Use DateTextboxCreator to create an email textbox. Pass it to AddControls of a control, or as a Child of a FormFieldWrapper.
func (DateTextboxCreator) Init ¶ added in v0.2.0
func (c DateTextboxCreator) Init(ctx context.Context, ctrl DateTextboxI)
type DateTextboxI ¶ added in v0.2.0
type DateTextboxI interface { control.DateTextboxI }
type EmailTextbox ¶
type EmailTextbox struct {
control.EmailTextbox
}
func GetEmailTextbox ¶ added in v0.2.0
func GetEmailTextbox(c page.ControlI, id string) *EmailTextbox
GetEmailTextbox is a convenience method to return the control with the given id from the page.
func NewEmailTextbox ¶
func NewEmailTextbox(parent page.ControlI, id string) *EmailTextbox
func (*EmailTextbox) DrawingAttributes ¶
func (t *EmailTextbox) DrawingAttributes(ctx context.Context) html.Attributes
type EmailTextboxCreator ¶ added in v0.2.0
type EmailTextboxCreator struct { // ID is the control id of the html widget and must be unique to the page ID string // Placeholder is the placeholder attribute of the textbox and shows as help text inside the field Placeholder string // Type is the type attribute of the textbox Type string // MinLength is the minimum number of characters that the user is required to enter. If the // length is less than this number, a validation error will be shown. MinLength int // MaxLength is the maximum number of characters that the user is required to enter. If the // length is more than this number, a validation error will be shown. MaxLength int // ColumnCount is the number of characters wide the textbox will be, and becomes the width attribute in the tag. // The actual width is browser dependent. For better control, use a width style property. ColumnCount int // ReadOnly sets the readonly attribute of the textbox, which prevents it from being changed by the user. ReadOnly bool // SaveState will save the text in the textbox, to be restored if the user comes back to the page. // It is particularly helpful when the textbox is being used to filter the results of a query, so that // when the user comes back to the page, he does not have to type the filter text again. SaveState bool // Text is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control. Text string // MaxItemCount is the maximum number of email addresses allowed to be entered, separated by commas // By default it allows only 1. MaxItemCount int page.ControlOptions }
Use EmailTextboxCreator to create an email textbox. Pass it to AddControls of a control, or as a Child of a FormFieldWrapper.
func (EmailTextboxCreator) Init ¶ added in v0.2.0
func (c EmailTextboxCreator) Init(ctx context.Context, ctrl EmailTextboxI)
type EmailTextboxI ¶ added in v0.2.0
type EmailTextboxI interface { control.EmailTextboxI }
type FloatTextbox ¶
type FloatTextbox struct {
control.FloatTextbox
}
func GetFloatTextbox ¶ added in v0.2.0
func GetFloatTextbox(c page.ControlI, id string) *FloatTextbox
GetFloatTextbox is a convenience method to return the control with the given id from the page.
func NewFloatTextbox ¶
func NewFloatTextbox(parent page.ControlI, id string) *FloatTextbox
func (*FloatTextbox) DrawingAttributes ¶
func (t *FloatTextbox) DrawingAttributes(ctx context.Context) html.Attributes
type FloatTextboxCreator ¶ added in v0.2.0
type FloatTextboxCreator struct { // ID is the control id of the html widget and must be unique to the page ID string // Placeholder is the placeholder attribute of the textbox and shows as help text inside the field Placeholder string // Type is the type attribute of the textbox Type string // MinLength is the minimum number of characters that the user is required to enter. If the // length is less than this number, a validation error will be shown. MinLength int // MaxLength is the maximum number of characters that the user is required to enter. If the // length is more than this number, a validation error will be shown. MaxLength int // ColumnCount is the number of characters wide the textbox will be, and becomes the width attribute in the tag. // The actual width is browser dependent. For better control, use a width style property. ColumnCount int // RowCount creates a multi-line textarea with the given number of rows. By default the // textbox will expand vertically by this number of lines. Use a height style property for // better control of the height of a textbox. RowCount int // ReadOnly sets the readonly attribute of the textbox, which prevents it from being changed by the user. ReadOnly bool // SaveState will save the text in the textbox, to be restored if the user comes back to the page. // It is particularly helpful when the textbox is being used to filter the results of a query, so that // when the user comes back to the page, he does not have to type the filter text again. SaveState bool // MinValue is the minimum value the user can enter. If the user does not // enter at least this amount, or enters something that is not an integer, it will fail validation // and the FormFieldWrapper will show an error. MinValue *control.FloatLimit // MaxValue is the maximum value the user can enter. If the user enter more // than this amount, or enters something that is not an integer, it will fail validation // and the FormFieldWrapper will show an error. MaxValue *control.FloatLimit // Value is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control. Value interface{} page.ControlOptions }
Use FloatTextboxCreator to create a textbox that only accepts numbers. Pass it to AddControls of a control, or as a Child of a FormFieldWrapper.
func (FloatTextboxCreator) Create ¶ added in v0.2.0
Create is called by the framework to create a new control from the Creator. You do not normally need to call this.
func (FloatTextboxCreator) Init ¶ added in v0.2.0
func (c FloatTextboxCreator) Init(ctx context.Context, ctrl FloatTextboxI)
Init is called by implementations of Textboxes to initialize a control with the creator. You do not normally need to call this.
type FloatTextboxI ¶ added in v0.2.0
type FloatTextboxI interface { control.FloatTextboxI }
type FormFieldset ¶ added in v0.2.0
FormFieldset is a FormGroup kind of wrapper that is specific to using a fieldset as a wrapper. See https://getbootstrap.com/docs/4.3/components/forms/#horizontal-form. You will need to coordinate with whatever you are drawing internally to get the formatting right.
func GetFormFieldset ¶ added in v0.2.0
func GetFormFieldset(c page.ControlI, id string) *FormFieldset
GetFormFieldset is a convenience method to return the fieldset with the given id from the page.
func NewFormFieldset ¶ added in v0.2.0
func NewFormFieldset(parent page.ControlI, id string) *FormFieldset
func (*FormFieldset) DrawInnerHtml ¶ added in v0.4.0
func (*FormFieldset) DrawingAttributes ¶ added in v0.4.0
func (c *FormFieldset) DrawingAttributes(ctx context.Context) html.Attributes
func (*FormFieldset) InstructionAttributes ¶ added in v0.2.0
func (c *FormFieldset) InstructionAttributes() html.Attributes
func (*FormFieldset) LegendAttributes ¶ added in v0.2.0
func (c *FormFieldset) LegendAttributes() html.Attributes
func (*FormFieldset) SetAsRow ¶ added in v0.2.0
func (c *FormFieldset) SetAsRow(r bool) FormFieldsetI
func (*FormFieldset) SetInstructions ¶ added in v0.2.0
func (c *FormFieldset) SetInstructions(instructions string) FormFieldsetI
type FormFieldsetCreator ¶ added in v0.2.0
type FormFieldsetCreator struct { // ID is the control id on the html form. ID string // Legend is the text that will be in the html label tag associated with the Child control. Legend string // Child is should be a panel, or a control that draws a group of controls, // like a RadioList or CheckboxList Child page.Creator // LegendAttributes are additional attributes to add to the label tag. LegendAttributes html.Attributes // Instructions is help text that accompanies the control Instructions string // Set AsRow to true to put the legend on the same row as the content AsRow bool // ControlOptions are additional options for the wrapper tag ControlOptions page.ControlOptions }
Use FormFieldsetCreator to create a bootstrap fieldset, which wraps a control group with a fieldset. The Child item should be a panel or a control that groups other controls, like a RadioList or CheckboxList
func (FormFieldsetCreator) Init ¶ added in v0.2.0
func (f FormFieldsetCreator) Init(ctx context.Context, c FormFieldsetI)
type FormFieldsetI ¶ added in v0.2.0
type FormFieldsetI interface { control.PanelI LegendAttributes() html.Attributes SetAsRow(r bool) FormFieldsetI SetInstructions(instructions string) FormFieldsetI }
type FormGroup ¶
type FormGroup struct { control.FormFieldWrapper // contains filtered or unexported fields }
FormGroup is a Goradd control that wraps other controls, and provides common companion functionality like a form label, validation state display, and help text.
func GetFormGroup ¶ added in v0.2.0
GetFormGroup is a convenience method to return the form group with the given id from the page.
func (*FormGroup) ChildValidationChanged ¶ added in v0.2.5
func (c *FormGroup) ChildValidationChanged()
func (*FormGroup) DrawingAttributes ¶ added in v0.4.0
func (c *FormGroup) DrawingAttributes(ctx context.Context) html.Attributes
func (*FormGroup) InnerDivAttributes ¶ added in v0.2.0
func (c *FormGroup) InnerDivAttributes() html.Attributes
func (*FormGroup) SetUseTooltips ¶ added in v0.2.0
func (c *FormGroup) SetUseTooltips(use bool) FormGroupI
SetUseTooltips sets whether to use tooltips to display validation messages.
func (*FormGroup) UseTooltips ¶ added in v0.2.0
type FormGroupCreator ¶ added in v0.2.0
type FormGroupCreator struct { // ID is the optional control id on the html form. If you do not specify this, it // will create on for you that is the ID of the child control + "-fg" ID string // Label is the text that will be in the html label tag associated with the Child control. Label string // Child is the creator of the child control you want to wrap Child page.Creator // Instructions is help text that will follow the control and that further describes its purpose or use. Instructions string // For specifies the id of the control that the label is for, and that is the control that we are wrapping. // You normally do not need to specify this, as it will default to the first child control, but if for some reason // that control is wrapped, you should explicitly specify the For control id here. For string // LabelAttributes are additional attributes to add to the label tag. LabelAttributes html.Attributes // ErrorAttributes are additional attributes to add to the tag that displays the error. ErrorAttributes html.Attributes // InstructionAttributes are additional attributes to add to the tag that displays the instructions. InstructionAttributes html.Attributes // Set IsInline to true to use a "span" instead of a "div" in the wrapping tag. IsInline bool // ControlOptions are additional options for the wrapper tag ControlOptions page.ControlOptions // InnerDivAttributes are the attributes for the additional div wrapper of the control // To achieve certain effects, Bootstrap needs this addition div. To display the div, you // must specify its attributes here. Otherwise no inner div will be displayed. InnerDivAttributes html.Attributes // UseTooltips will cause validation errors to be displayed with tooltips, a specific // feature of Bootstrap UseTooltips bool }
Use FormGroupCreator to create a FormGroup, which wraps a control with a div or span that also has a label, validation error text and optional instructions. Pass the creator of the control you are wrapping as the Child item.
func (FormGroupCreator) Create ¶ added in v0.2.0
Create is called by the framework to create the control. You do not normally need to call it.
func (FormGroupCreator) Init ¶ added in v0.2.0
func (f FormGroupCreator) Init(ctx context.Context, c FormGroupI)
Init is called by implementations of a FormFieldWrapper to initialize the creator. You do not normally need to call this.
type FormGroupI ¶ added in v0.2.0
type FormGroupI interface { control.FormFieldWrapperI SetUseTooltips(use bool) FormGroupI UseTooltips() bool InnerDivAttributes() html.Attributes }
type IntegerTextbox ¶
type IntegerTextbox struct {
control.IntegerTextbox
}
func GetIntegerTextbox ¶ added in v0.2.0
func GetIntegerTextbox(c page.ControlI, id string) *IntegerTextbox
GetIntegerTextbox is a convenience method to return the control with the given id from the page.
func NewIntegerTextbox ¶
func NewIntegerTextbox(parent page.ControlI, id string) *IntegerTextbox
func (*IntegerTextbox) DrawingAttributes ¶
func (t *IntegerTextbox) DrawingAttributes(ctx context.Context) html.Attributes
type IntegerTextboxCreator ¶ added in v0.2.0
type IntegerTextboxCreator struct { // ID is the control id of the html widget and must be unique to the page ID string // Placeholder is the placeholder attribute of the textbox and shows as help text inside the field Placeholder string // Type is the type attribute of the textbox Type string // MinLength is the minimum number of characters that the user is required to enter. If the // length is less than this number, a validation error will be shown. MinLength int // MaxLength is the maximum number of characters that the user is required to enter. If the // length is more than this number, a validation error will be shown. MaxLength int // ColumnCount is the number of characters wide the textbox will be, and becomes the width attribute in the tag. // The actual width is browser dependent. For better control, use a width style property. ColumnCount int // RowCount creates a multi-line textarea with the given number of rows. By default the // textbox will expand vertically by this number of lines. Use a height style property for // better control of the height of a textbox. RowCount int // ReadOnly sets the readonly attribute of the textbox, which prevents it from being changed by the user. ReadOnly bool // SaveState will save the text in the textbox, to be restored if the user comes back to the page. // It is particularly helpful when the textbox is being used to filter the results of a query, so that // when the user comes back to the page, he does not have to type the filter text again. SaveState bool // MinValue is the minimum value the user can enter. If the user does not // enter at least this amount, or enters something that is not an integer, it will fail validation // and the FormFieldWrapper will show an error. MinValue *control.IntegerLimit // MaxValue is the maximum value the user can enter. If the user enter more // than this amount, or enters something that is not an integer, it will fail validation // and the FormFieldWrapper will show an error. MaxValue *control.IntegerLimit // Value is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control. Value interface{} page.ControlOptions }
Use IntegerTextboxCreator to create an integer textbox. Pass it to AddControls of a control, or as a Child of a FormFieldWrapper.
func (IntegerTextboxCreator) Create ¶ added in v0.2.0
Create is called by the framework to create a new control from the Creator. You do not normally need to call this.
func (IntegerTextboxCreator) Init ¶ added in v0.2.0
func (c IntegerTextboxCreator) Init(ctx context.Context, ctrl IntegerTextboxI)
Init is called by implementations of Textboxes to initialize a control with the creator. You do not normally need to call this.
type IntegerTextboxI ¶ added in v0.2.0
type IntegerTextboxI interface { control.IntegerTextboxI }
type ItemDirection ¶
type ItemDirection int
const ( HorizontalItemDirection ItemDirection = 0 VerticalItemDirection = 1 )
type ListGroup ¶
type ListGroup struct {
control.UnorderedList
}
A ListGroup implements the Bootstrap ListGroup control. Since just a static list isn't all that interesting, this is a dynamic list whose individual items are considered clickable. To conform with the html standard and accessibility rules, items should appear as anchors if they link to another page, but as buttons if they cause a different action, like popping up a dialog.
Use the data provider to AddItems to the list, assigning attributes as needed to produce the items you want. You can also use a proxy control to create the attributes.
func GetListGroup ¶ added in v0.2.0
GetListGroup is a convenience method to return the control with the given id from the page.
type ListGroupCreator ¶ added in v0.2.0
type ListGroupCreator struct { ID string // Items is a static list of labels and values that will be in the list. Or, use a DataProvider to dynamically generate the items. Items []control.ListValue // DataProvider is the control that will dynamically provide the data for the list and that implements the DataBinder interface. DataProvider control.DataBinder // DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface. DataProviderID string page.ControlOptions // ItemTag is the tag of the items. It defaults to "a" tags. ItemTag string }
func (ListGroupCreator) Create ¶ added in v0.2.0
Create is called by the framework to create a new control from the Creator. You do not normally need to call this.
func (ListGroupCreator) Init ¶ added in v0.2.0
func (c ListGroupCreator) Init(ctx context.Context, ctrl ListGroupI)
type ListGroupI ¶ added in v0.2.0
type ListGroupI interface { control.UnorderedListI }
type Modal ¶
Modal is a bootstrap modal dialog. To use a custom template in a bootstrap modal, add a Panel child element or subclass of a panel child element. To use the grid system, add the container-fluid class to that embedded panel.
func GetModal ¶ added in v0.2.3
GetListGroup is a convenience method to return the control with the given id from the page.
func (*Modal) AddButton ¶
func (d *Modal) AddButton( label string, id string, options *control.DialogButtonOptions, )
AddButton adds a button to the modal. Buttons should be added in the order to appear. Styling options you can include in options.Options:
style - ButtonStyle value size - ButtonSize value
func (*Modal) AddCloseButton ¶
AddCloseButton adds a button to the list of buttons with the given label, but this button will trigger the DialogCloseEvent instead of the DialogButtonEvent. The button will also close the dialog (by hiding it).
func (*Modal) AddTitlebarClass ¶
func (*Modal) DrawTemplate ¶
func (*Modal) DrawingAttributes ¶
func (d *Modal) DrawingAttributes(ctx context.Context) html.Attributes
func (*Modal) PrivateAction ¶
func (d *Modal) PrivateAction(ctx context.Context, a page.ActionParams)
func (*Modal) PutCustomScript ¶
func (*Modal) RemoveAllButtons ¶
func (d *Modal) RemoveAllButtons()
func (*Modal) RemoveButton ¶
func (*Modal) SetBackdrop ¶
func (d *Modal) SetBackdrop(b ModalBackdropType)
func (*Modal) SetButtonStyle ¶
SetButtonStyle sets css styles on a button that is already in the dialog
func (*Modal) SetDialogStyle ¶ added in v0.0.3
func (d *Modal) SetDialogStyle(style control.DialogStyle)
func (*Modal) SetHasCloseBox ¶
type ModalBackdropType ¶
type ModalBackdropType int
const ( ModalBackdrop ModalBackdropType = iota ModalNoBackdrop ModalStaticBackdrop )
type ModalButtonCreator ¶ added in v0.2.3
type ModalButtonCreator struct { Label string ID string Validates bool ConfirmationMessage string PushLeft bool IsClose bool Options map[string]interface{} }
func ModalButtons ¶ added in v0.2.3
func ModalButtons(buttons ...ModalButtonCreator) []ModalButtonCreator
type ModalCreator ¶ added in v0.2.3
type ModalCreator struct { ID string Title string TitlebarClass string HasCloseBox bool Style control.DialogStyle Backdrop ModalBackdropType Buttons []ModalButtonCreator OnButton action.ActionI page.ControlOptions Children []page.Creator }
type Navbar ¶
type Navbar struct { // contains filtered or unexported fields }
Navbar is a bootstrap navbar object. Use SetText() to set the logo text of the navbar, and SetTextIsHtml() to true to turn off encoding if needed. Add child controls to populate it.
func GetNavbar ¶ added in v0.2.0
GetNavbar is a convenience method to return the control with the given id from the page.
func (*Navbar) DrawTemplate ¶
func (*Navbar) DrawingAttributes ¶
func (b *Navbar) DrawingAttributes(ctx context.Context) html.Attributes
func (*Navbar) SetBackgroundClass ¶
func (b *Navbar) SetBackgroundClass(c BackgroundColorClass) NavbarI
func (*Navbar) SetBrandPlacement ¶
func (b *Navbar) SetBrandPlacement(p NavbarCollapsedBrandPlacement) NavbarI
SetBrandPlacement places the brand left, right, or hidden (meaning inside the collapse area). The expand button location will be affected by the placement
func (*Navbar) SetExpand ¶ added in v0.2.0
func (b *Navbar) SetExpand(e NavbarExpandClass) NavbarI
func (*Navbar) SetHeaderAnchor ¶
func (*Navbar) SetNavbarStyle ¶
func (b *Navbar) SetNavbarStyle(style NavbarStyle) NavbarI
type NavbarCollapsedBrandPlacement ¶
type NavbarCollapsedBrandPlacement int
NavbarCollapsedBrandPlacement controls the location of the brand when the navbar is collapsed
const ( NavbarCollapsedBrandPlacement = iota NavbarCollapsedBrandRight NavbarCollapsedBrandHidden )NavbarCollapsedBrandLeft
type NavbarCreator ¶ added in v0.2.0
type NavbarCreator struct {}
type NavbarExpandClass ¶
type NavbarExpandClass string
type NavbarList ¶
type NavbarList struct { // contains filtered or unexported fields }
func GetNavbarList ¶ added in v0.2.0
func GetNavbarList(c page.ControlI, id string) *NavbarList
GetNavbarList is a convenience method to return the control with the given id from the page.
func NewNavbarList ¶
func NewNavbarList(parent page.ControlI, id string) *NavbarList
func (*NavbarList) Deserialize ¶ added in v0.3.0
func (l *NavbarList) Deserialize(dec page.Decoder) (err error)
func (*NavbarList) DrawInnerHtml ¶
func (*NavbarList) DrawingAttributes ¶
func (l *NavbarList) DrawingAttributes(ctx context.Context) html.Attributes
DrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
func (*NavbarList) Init ¶
func (l *NavbarList) Init(self NavbarListI, parent page.ControlI, id string)
func (*NavbarList) ItemProxy ¶ added in v0.2.0
func (l *NavbarList) ItemProxy() *control.Proxy
type NavbarListCreator ¶ added in v0.2.0
type NavbarListCreator struct { string Items []control.ListValue DataProvider control.DataBinder // DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface. OnSelect action.ActionI }ID
func (NavbarListCreator) Init ¶ added in v0.2.0
func (c NavbarListCreator) Init(ctx context.Context, ctrl NavbarListI)
type NavbarListI ¶
type RadioButton ¶
type RadioButton struct { control.RadioButton // contains filtered or unexported fields }
func GetRadioButton ¶ added in v0.2.0
func GetRadioButton(c page.ControlI, id string) *RadioButton
GetRadioButton is a convenience method to return the radio button with the given id from the page.
func NewRadioButton ¶
func NewRadioButton(parent page.ControlI, id string) *RadioButton
func (*RadioButton) DrawingAttributes ¶
func (c *RadioButton) DrawingAttributes(ctx context.Context) html.Attributes
func (*RadioButton) GetDrawingLabelAttributes ¶ added in v0.4.0
func (c *RadioButton) GetDrawingLabelAttributes() html.Attributes
func (*RadioButton) SetInline ¶ added in v0.0.4
func (c *RadioButton) SetInline(v bool) *RadioButton
type RadioButtonCreator ¶ added in v0.2.0
type RadioButtonCreator struct { // ID is the id of the control ID string // Text is the text of the label displayed right next to the checkbox. Text string // Checked will initialize the checkbox in its checked state. Checked bool // LabelMode specifies how the label is drawn with the checkbox. LabelMode html.LabelDrawingMode // LabelAttributes are additional attributes placed on the label tag. LabelAttributes html.Attributes // SaveState will save the value of the checkbox and restore it when the page is reentered. SaveState bool // Group is the name of the group that the button belongs to Group string // Inline draws the radio group inline. Specify this when drawing the // radio button inline or in an inline FormGroup. Inline bool page.ControlOptions }
type RadioButtonI ¶
type RadioButtonI interface { control.RadioButtonI }
type RadioList ¶
RadioList is a multi-select control that presents its choices as a list of checkboxes. Styling is provided by divs and spans that you can provide css for in your style sheets. The goradd.css file has default styling to handle the basics. It wraps the whole thing in a div that can be set to scroll as well, so that the final structure can be styled like a multi-table table, or a single-table scrolling list much like a standard html select list.
func GetRadioList ¶ added in v0.2.0
GetRadioList is a convenience method to return the control with the given id from the page.
func (*RadioList) DrawingAttributes ¶ added in v0.4.0
func (l *RadioList) DrawingAttributes(ctx context.Context) html.Attributes
DrawingAttributes retrieves the tag's attributes at draw time. You should not normally need to call this, and the attributes are disposed of after drawing, so they are essentially read-only.
func (*RadioList) RenderItem ¶ added in v0.4.0
RenderItem is called by the framework to render a single item in the list.
func (*RadioList) SetCellClass ¶ added in v0.2.0
SetColumnClass sets a string that is applied to every cell. This is useful for setting responsive breakpoints
func (*RadioList) SetIsInline ¶ added in v0.2.0
type RadioListCreator ¶ added in v0.2.0
type RadioListCreator struct { ID string // Items is a static list of labels and values that will be in the list. Or, use a DataProvider to dynamically generate the items. Items []control.ListValue // DataProvider is the control that will dynamically provide the data for the list and that implements the DataBinder interface. DataProvider control.DataBinder // DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface. DataProviderID string // ColumnCount specifies how many columns to show ColumnCount int // LayoutDirection determines how the items are arranged in the columns LayoutDirection control.LayoutDirection // LabelDrawingMode specifies how the labels on the radio buttons will be associated with the buttons LabelDrawingMode html.LabelDrawingMode // IsScrolling will give the inner div a vertical scroll style. You will need to style the height of the outer control to have a fixed style as well. IsScrolling bool // RowClass is the class assigned to each row RowClass string // Value is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control. Value string // SaveState saves the selected value so that it is restored if the form is returned to. SaveState bool page.ControlOptions }
func (RadioListCreator) Create ¶ added in v0.2.0
Create is called by the framework to create a new control from the Creator. You do not normally need to call this.
func (RadioListCreator) Init ¶ added in v0.2.0
func (c RadioListCreator) Init(ctx context.Context, ctrl RadioListI)
type RadioListI ¶
type RadioListI interface { control.RadioListI }
type SelectList ¶
type SelectList struct {
control.SelectList
}
func GetSelectList ¶ added in v0.2.0
func GetSelectList(c page.ControlI, id string) *SelectList
GetSelectList is a convenience method to return the control with the given id from the page.
func NewSelectList ¶
func NewSelectList(parent page.ControlI, id string) *SelectList
func (*SelectList) DrawingAttributes ¶
func (t *SelectList) DrawingAttributes(ctx context.Context) html.Attributes
type SelectListCreator ¶ added in v0.2.0
type SelectListCreator struct { ID string // Items is a static list of labels and values that will be in the list. Or, use a DataProvider to dynamically generate the items. Items []control.ListValue // NilItem is a helper to add an item at the top of the list with a nil value. This is often // used to specify no selection, or a message that a selection is required. NilItem string // DataProvider is the control that will dynamically provide the data for the list and that implements the DataBinder interface. DataProvider control.DataBinder // DataProviderID is the id of a control that will dynamically provide the data for the list and that implements the DataBinder interface. DataProviderID string // Size specifies how many items to show, and turns the list into a scrolling list Size int // Value is the initial value of the textbox. Often its best to load the value in a separate Load step after creating the control. Value string // SaveState saves the selected value so that it is restored if the form is returned to. SaveState bool page.ControlOptions }
func (SelectListCreator) Init ¶ added in v0.2.0
func (c SelectListCreator) Init(ctx context.Context, ctrl SelectListI)
type SelectListI ¶ added in v0.2.0
type SelectListI interface { control.SelectListI }
type Tabs ¶
A Tabs pane draws its child controls as a set of tabs. The labels of the children serve as the tab labels. This currently draws everything at once, with the current panel visible, but everything else has hidden html.
func GetTabs ¶ added in v0.2.0
GetTabs is a convenience method to return the control with the given id from the page.
func (*Tabs) DrawTemplate ¶
func (*Tabs) DrawingAttributes ¶
func (c *Tabs) DrawingAttributes(ctx context.Context) html.Attributes
type TabsCreator ¶ added in v0.2.0
type TabsCreator struct { // ID is the control id of the html widget and must be unique to the page ID string page.ControlOptions Children []page.Creator }
type TextColorClass ¶
type TextColorClass string
type Textbox ¶
func GetTextbox ¶ added in v0.2.3
GetTextbox is a convenience method to return the control with the given id from the page.
func (*Textbox) DrawingAttributes ¶
func (t *Textbox) DrawingAttributes(ctx context.Context) html.Attributes
type TextboxCreator ¶ added in v0.2.0
type TextboxCreator struct { // ID is the control id of the html widget and must be unique to the page ID string // Placeholder is the placeholder attribute of the textbox and shows as help text inside the field Placeholder string // Type is the type attribute of the textbox Type string // MinLength is the minimum number of characters that the user is required to enter. If the // length is less than this number, a validation error will be shown. MinLength int // MaxLength is the maximum number of characters that the user is required to enter. If the // length is more than this number, a validation error will be shown. MaxLength int // ColumnCount is the number of characters wide the textbox will be, and becomes the width attribute in the tag. // The actual width is browser dependent. For better control, use a width style property. ColumnCount int // RowCount creates a multi-line textarea with the given number of rows. By default the // textbox will expand vertically by this number of lines. Use a height style property for // better control of the height of a textbox. RowCount int // ReadOnly sets the readonly attribute of the textbox, which prevents it from being changed by the user. ReadOnly bool // SaveState will save the text in the textbox, to be restored if the user comes back to the page. // It is particularly helpful when the textbox is being used to filter the results of a query, so that // when the user comes back to the page, he does not have to type the filter text again. SaveState bool // Text is the initial value of the textbox. Generally you would not use this, but rather load the value in a separate Load step after creating the control. Text string page.ControlOptions }
Use TextboxCreator to create a textbox. Pass it to AddControls of a control, or as a Child of a FormGroup.
Source Files ¶
- button.go
- checkbox.go
- const.go
- data_pager.go
- form_fieldset.go
- form_group.go
- list_checkbox.go
- list_group.go
- list_radio.go
- list_select.go
- modal.go
- modal.tpl.go
- navbar.go
- navbar.tpl.go
- navbar_list.go
- radioButton.go
- tabs.go
- tabs.tpl.go
- textbox.go
- textbox_date.go
- textbox_email.go
- textbox_float.go
- textbox_integer.go