</head>
<body>
- <div class="container">
+ <div class="container">
<div id="application"></div>
</div> <!-- container -->
+ <!-- initial template of our application; it just installs the outlet. -->
+ <script type="text/x-handlebars" data-template-name="application">
+ <div class="navbar navbar-inverse">
+ <div class="navbar-inner">
+ <ul class="nav">
+ <li><a {{action showArtists href=true}}>Artists</a></li>
+ </ul>
+ </div>
+ </div>
+
+ {{outlet library}}
+ </script>
+
+ <script type="text/x-handlebars" data-template-name="artists">
+ </script>
+
<script src="lib/cowhide.js"></script>
+ <script src="lib/handlebars-1.0.rc.1.js"></script>
+ <script src="lib/ember-latest.js"></script>
+
+ <script src="javascripts/app/app.js"></script>
+ <script src="javascripts/app/router.js"></script>
+ <script src="javascripts/app/store.js"></script>
+
+ <script src="javascripts/app/models/artistModel.js"></script>
+
+ <script src="javascripts/app/controllers/applicationController.js"></script>
+ <script src="javascripts/app/controllers/artistsController.js"></script>
+
+ <script src="javascripts/app/views/artistsView.js"></script>
</body>
</html>
--- /dev/null
+(function(win) {
+ 'use strict';
+
+ win.Hoofbeats = window.Ember.Application.create({
+ VERSION: '0.1',
+ rootElement: '#application'
+ });
+})(window);
--- /dev/null
+(function(app, Ember) {
+ 'use strict';
+
+ var ApplicationController = Ember.Controller.extend({});
+
+ app.ApplicationController = ApplicationController;
+})(window.Hoofbeats, window.Ember);
--- /dev/null
+(function(app, Ember, _) {
+ 'use strict';
+
+ var ArtistsController = Ember.ArrayController.extend({
+ content: [],
+ });
+
+ app.ArtistsController = ArtistsController;
+ app.artistsController = ArtistsController.create();
+})(window.Hoofbeats, window.Ember);
--- /dev/null
+(function(app, Ember) {
+ 'use strict';
+
+ var Artist = Ember.Object.extend({
+ id: null,
+ firstName: null,
+ lastName: null,
+ bandName: null,
+
+ name: function() {
+ var ret = "";
+ if (this.get('firstName') && this.get('lastName')) {
+ ret = "%@, %@".fmt(this.get('lastName', this.get('firstName')));
+ if(this.get('bandName')) {
+ ret += " (%@)".fmt(this.get('bandName'));
+ }
+ } else {
+ ret = this.get('bandName');
+ }
+
+ return ret;
+ }.property('firstName', 'lastName', 'bandName'),
+
+ isBandOnly: function() {
+ if (this.get('firstName') === null &&
+ this.get('lastName') === null &&
+ this.get('bandName') !== null) {
+ return true;
+ }
+ return false;
+ }.property('firstName', 'lastName', 'bandName')
+ });
+
+
+ Artist.reopenClass({
+ find: function() {
+ return app.Store.getArtists();
+ }
+ });
+
+ app.Artist = Artist;
+})(window.Hoofbeats, window.Ember);
--- /dev/null
+(function(app, Ember) {
+ 'use strict';
+
+ var Router = Ember.Router.extend({
+ location: 'none',
+
+ showArtists: Ember.Route.transitionTo('artists'),
+
+ root: Ember.Route.extend({
+ index: Ember.Route.extend({
+ route: '/',
+ redirectsTo: 'artists'
+ }),
+
+ artists: Ember.Route.extend({
+ route: '/artists',
+ connectOutlets: function(router) {
+ var controller = router.get('applicationController');
+ controller.connectOutlet('library', 'artists', app.Artist.find());
+ }
+ })
+ })
+ });
+
+ app.Router = Router;
+})(window.Hoofbeats, window.Ember);
--- /dev/null
+(function(app) {
+ 'use strict';
+
+ var Store = function() {}
+
+ Store.prototype = {
+ getArtists: function() {
+ var artists = [];
+ return artists;
+ }
+ };
+
+ app.Store = new Store();
+})(window.Hoofbeats);
--- /dev/null
+(function(app, Ember) {
+ 'use strict';
+
+ var ArtistsView = Ember.View.extend({
+ templateName: 'artists',
+ tagName: 'ul',
+ classNames: ['artists']
+ });
+
+ app.ArtistsView = ArtistsView;
+})(window.Hoofbeats, window.Ember);
],
'dist/examples/hoofbeats/lib/': [
'dist/cowhide-default.css',
- 'dist/cowhide.js'
+ 'dist/cowhide.js',
+ 'lib/handlebars-1.0.rc.1.js',
+ 'lib/ember-latest.js'
]
}
}