mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-06-27 16:00:04 +08:00
b4d3eab02c
Add foreman configuration for Heroku: - To test production configuration execute NODE_ENV=production foreman start - Database connection configuration now handles "use_env_variable" which should be defined as a environment variable such as "DATABASE_URL" with a proper database URI connection string, ie: postgres://user:password@db.example.com:5432/database - Added package.json configuration to run migrations and db seed after `npm install` Update frontend models to match sequelize definition. Update views to work according to the changes above. Handling isCompleted and parentId apropiately for PostgreSQL databases
51 lines
874 B
JavaScript
51 lines
874 B
JavaScript
define(
|
|
['jquery',
|
|
'backbone',
|
|
'collections/list',
|
|
'views/task'
|
|
],
|
|
|
|
function(
|
|
$,
|
|
Backbone,
|
|
List,
|
|
TaskView
|
|
) {
|
|
|
|
var ListView = Backbone.View.extend({
|
|
|
|
el: $("#main .children"),
|
|
|
|
events: {
|
|
'click #add': 'addTask'
|
|
},
|
|
|
|
initialize: function() {
|
|
Tasks = this.collection = new List();
|
|
this.collection.fetch();
|
|
this.listenTo(this.collection, 'add', this.renderTask);
|
|
},
|
|
|
|
render: function() {
|
|
this.collection.each(function(task) {
|
|
this.renderTask(task);
|
|
}, this);
|
|
},
|
|
|
|
renderTask: function(task) {
|
|
var taskView = new TaskView({
|
|
model: task
|
|
});
|
|
var a = taskView.render();
|
|
if (a.model.get('parentId')!=0)
|
|
a.$el.insertAfter($('*[data-id="'+a.model.get('parentId')+'"]').parents('li:first'));
|
|
else
|
|
this.$el.append(a.el);
|
|
}
|
|
|
|
});
|
|
|
|
return ListView;
|
|
|
|
});
|