https://github.com/mojotech/marionette-ui
UI Toolkit built on Marionette
https://github.com/mojotech/marionette-ui
Last synced: 10 months ago
JSON representation
UI Toolkit built on Marionette
- Host: GitHub
- URL: https://github.com/mojotech/marionette-ui
- Owner: mojotech
- Created: 2013-11-01T17:49:25.000Z (almost 13 years ago)
- Default Branch: aes/live-input
- Last Pushed: 2013-12-13T17:49:01.000Z (over 12 years ago)
- Last Synced: 2024-10-15T00:43:51.917Z (almost 2 years ago)
- Language: CSS
- Size: 294 KB
- Stars: 3
- Watchers: 7
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
*Working Understanding*
By including marionette-ui all we protypically extend Marionette.View to support widgets.
On any view you should be able to define a widgets hash as follows:
widgets:
sumbitButton:
selector: '.submit'
type: "Button"
Where selector is css selector that is present in your view's template. And type is the widget type. By default
the widget will use the current view's model/collection. If the current view is a composite view it will use the model
unless specified.
When a view is rendered, if it has widgets all widgets will be shown in that view's onShow method.
Widgets can then be accessed similar to the ui hash as follows:
@widgets.submitButton.disable()
*Marionette.UI.Button*
The button widget can take either a hardcoded content string or a contentAttribute. A content attribute will bind the display text of the button to that attribute of the model. If the model's attribute changes, the display will be updated accordingly. If you do not want the display text to be a property of the model, no problem just set the content attribute to a string. If both content and contentAttribute are filled in, content will take priority.
widgets:
sumbitButton:
selector: '.submit'
type: "Button"
content: "A hardcoded string"
contentAttribute: 'name'
Public methods:
disable: Enable the button
disable: Disable the button
onClick: fired when the button is clicked
state: returns either Enabled or Disabled
enabled: returns true if the button is enabled
Widget Manager
Widgets
Button
Segmented Control
Modal