JSFiddle - React, Tailwind, and code Playground
by pjmorse
HTML
<link rel="stylesheet" href="http://flamejs.github.com/flame-address-book/css/flame.css">
<script src="http://flamejs.github.com/flame-address-book/js/libs/flame_with_github_image_urls.min.js"></script>
<script src="https://github.com/downloads/emberjs/ember.js/ember-0.9.7.1.js"></script>
<script type="text/x-handlebars">
{{view App.RootView}}
</script>
JavaScript
// An example of using Flame.Panel and Flame.Popover.
App = Ember.Application.create();
App.viewController = Ember.Object.create({
panelWidth: 400
});
App.TestPanel = Flame.Panel.extend({
layout: { width: 400, height: 200, centerX: 0, centerY: -50 },
// Controls whether all other controls are obscured (i.e. blocked
// from any input while the panel is shown)
isModal: false,
// This controls the visual effect only, and works only if
// isModal is set to true
dimBackground: false,
// Set to false if you want to e.g. allow closing the panel only
// by clicking some button on the panel (has no effect if isModal
// is false)
allowClosingByClickingOutside: true,
// Allow moving by dragging on the title bar - default is false
allowMoving: true,
// Title is optional - if not defined, no title bar is shown
title: 'Test Panel',
// A Panel must have exactly one child view named contentView
contentView: Flame.LabelView.extend({
layout: { left: 20, top: 90, right: 20, bottom: 20 },
textAlign: Flame.ALIGN_CENTER,
value: 'This is a panel.'
})
});
App.RootView = Flame.RootView.extend({
childViews: ['button1', 'testpanel'],
button1: Flame.ButtonView.extend({
layout: { left: 20, top: 20, width: 100 },
title: 'Show Panel',
action: function() {
console.log('Here we go!');
App.viewController.set('panelWidth', 150);
console.log('Controller panelWidth is now ' + App.viewController.get('panelWidth'));
}
}),
testpanel: App.TestPanel.create({
updateLayout: function() {
this.set('layout', { width: 200, height: 200, centerX: 0, centerY: -50 });
}.observes('App.viewController.panelWidth')
})
});