Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.6/ember.min.js"></script>
  <script src="http://builds.emberjs.com.s3.amazonaws.com/ember-data-latest.js"></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
  <script type="text/x-handlebars" id="application">
    {{#linkTo "projects"}}Projects{{/linkTo}}
    {{outlet}}
</script>
<script type="text/x-handlebars" id="projects">
<div class="left">
        <ul><h2>Projects ({{projectCount}})</h2>
                    {{#each model}}
                    <li>{{#linkTo 'project' this}}{{alias}}{{/linkTo}}</li>
                    {{/each}}
                </ul>
    </div>
                <div class="workspace">
                    <h1>workspace</h1>
                    {{outlet}}
                </div>
  
</script>
    <script type="text/x-handlebars" data-template-name="projects/index">
        Select a project to work with.
    </script>
    <script type="text/x-handlebars" data-template-name="project">
        This is the model : {{name}}
    </script>
</head>
<body>
  
</body>
</html>
 
App = Ember.Application.create({
    LOG_TRANSITIONS:true,
    LOG_TRANSITIONS_INTERNAL:true,
    LOG_ACTIVE_GENERATION: true,
    LOG_VIEW_LOOKUPS:true,
    LOG_BINDINGS:true
});
var attr = DS.attr;
App.ReportSuite = DS.Model.extend({
    rsid: attr('string'),
    site_title: attr('string'),
    isActive:attr('boolean')
});
App.Store = DS.Store.extend({
    revision: 12,
  adapter: DS.RESTAdapter.create({
    url:"http://dev.layerspark.com/api"
  })
});
App.Project = DS.Model.extend({
    name:attr('string'),
    alias:attr('string'),
    date_created:attr('date'),
    date_modified:attr('date'),
    current_version:attr('number'),
    slug:attr('string')
});
App.Router.map(function(){
    this.resource("projects",function(){
        this.resource("project",{path:"/:slug"});
    });
});
//*******Routes********//
App.Router.map(function(){
    this.resource("projects",function(){
        this.resource("project",{path:"/:slug"});
    });
});
App.ProjectsRoute = Ember.Route.extend({
  setupConroller:function(controller,model){
      controller.set('model',model);
  },
    model:function(){
        return App.Project.find();
    },
    totalProjects:function(){
        return this.get('content').length;
    }.property('content')
});
App.ProjectRoute = Ember.Route.extend({
  setupConroller:function(controller,model){
      controller.set('model',model);
  },
    model:function(params){
        return App.Project.find({slug:params.slug});
    },
    serialize:function(model,params){
        return {slug : model.get('slug')};
    }
});
//*******Controllers********//
//*******Views********//
App.ProjectsView = Em.View.extend({
    projectSettings:function(){console.log('handled by view');}
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers