Reorganizing UI, adding TimelineListView.
This commit is contained in:
parent
302bc9ccdd
commit
f4fe5559b1
9
Makefile
9
Makefile
@ -3,22 +3,23 @@ BEAMS = $(MODS:src/%.erl=ebin/%.beam)
|
|||||||
TEST_MODS = $(wildcard test/*.erl)
|
TEST_MODS = $(wildcard test/*.erl)
|
||||||
TEST_BEAMS = $(TEST_MODS:test/%.erl=test/%.beam)
|
TEST_BEAMS = $(TEST_MODS:test/%.erl=test/%.beam)
|
||||||
TS_ROOT=/usr/lib/yaws/jdb-labs/timestamper
|
TS_ROOT=/usr/lib/yaws/jdb-labs/timestamper
|
||||||
|
CWD = `pwd`
|
||||||
|
|
||||||
default: compile
|
default: compile
|
||||||
|
|
||||||
all : compile test
|
all : compile test
|
||||||
|
|
||||||
compile : $(BEAMS)
|
compile : init $(BEAMS)
|
||||||
|
|
||||||
compile-test : $(TEST_BEAMS)
|
compile-test : init $(TEST_BEAMS)
|
||||||
|
|
||||||
test : start-test-server run-test stop-test-server
|
test : start-test-server run-test stop-test-server
|
||||||
|
|
||||||
test-shell : compile compile-test
|
test-shell : compile compile-test config-yaws-dev
|
||||||
@echo Starting an interactive YAWS shell with test paths loaded.
|
@echo Starting an interactive YAWS shell with test paths loaded.
|
||||||
@yaws -i --pa test --id test_inst
|
@yaws -i --pa test --id test_inst
|
||||||
|
|
||||||
run-test : compile compile-test
|
run-test : compile compile-test config-yaws-dev
|
||||||
@erl -pa ./ebin -pa ./test -run timestamper_api_tests test -run init stop -noshell
|
@erl -pa ./ebin -pa ./test -run timestamper_api_tests test -run init stop -noshell
|
||||||
|
|
||||||
start-test-server :
|
start-test-server :
|
||||||
|
@ -19,9 +19,9 @@ UserView
|
|||||||
Data Dependencies
|
Data Dependencies
|
||||||
-----------------
|
-----------------
|
||||||
UserModel: none
|
UserModel: none
|
||||||
TimelineModel: UserModel
|
TimelineModel: none
|
||||||
TimelineListModel: UserModel
|
TimelineListModel: UserModel
|
||||||
EntryModel: TimelineModel
|
EntryModel: none
|
||||||
EntryListModel: TimelineModel
|
EntryListModel: TimelineModel
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
|
|
||||||
<script id="timelineLink" type="text/html">
|
<script id="timelineLink" type="text/html">
|
||||||
<li><a href="#">{{id}}</a></li>
|
<li class="timeline-link"><a href="#">{{id}}</a></li>
|
||||||
</script>
|
</script>
|
||||||
<script id="entry" type="text/html">
|
<script id="entry" type="text/html">
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
@ -65,6 +65,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="entry-list">
|
||||||
<div id="new-entry">
|
<div id="new-entry">
|
||||||
<input id="new-entry-input" class="mark-input"
|
<input id="new-entry-input" class="mark-input"
|
||||||
placeholder="Start a new task..." type="text" />
|
placeholder="Start a new task..." type="text" />
|
||||||
@ -80,6 +81,7 @@
|
|||||||
<div class="notes">Some notes should go here, but they should be hidden by default</div>
|
<div class="notes">Some notes should go here, but they should be hidden by default</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
Copyright 2011 <a href="http://www.jdb-labs.com"><span class="logo">JDB Labs</span> LLC.</a>
|
Copyright 2011 <a href="http://www.jdb-labs.com"><span class="logo">JDB Labs</span> LLC.</a>
|
||||||
|
51
www/js/ts.js
51
www/js/ts.js
@ -71,6 +71,10 @@ $(document).ready(function(){
|
|||||||
_.bindAll(this, 'url');
|
_.bindAll(this, 'url');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
comparator: function(timeline) {
|
||||||
|
return timeline.get('id');
|
||||||
|
},
|
||||||
|
|
||||||
url: function() {
|
url: function() {
|
||||||
return "/ts_api/timelines/" + this.user.get('id');
|
return "/ts_api/timelines/" + this.user.get('id');
|
||||||
}
|
}
|
||||||
@ -93,7 +97,8 @@ $(document).ready(function(){
|
|||||||
},
|
},
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
_.bindAll(this, 'render', 'close');
|
_.bindAll(this, 'render', 'close', 'editTImestamp',
|
||||||
|
'editMark', 'updateOnEnter');
|
||||||
this.model.bind('change', this.render);
|
this.model.bind('change', this.render);
|
||||||
this.model.view = this;
|
this.model.view = this;
|
||||||
},
|
},
|
||||||
@ -129,21 +134,33 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
TS.EntryListView = Backbone.View.extend({
|
TS.EntryListView = Backbone.View.extend({
|
||||||
|
|
||||||
el: $("#entries"),
|
el: $("#entry-list"),
|
||||||
|
|
||||||
|
events: {
|
||||||
|
"#new-entry" : "createNewEntry"
|
||||||
|
},
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
_.bindAll(this, 'addOne', 'render');
|
_.bindAll(this, 'addOne', 'createNewEntry', 'render');
|
||||||
this.collection.bind('add', this.addOne);
|
this.collection.bind('add', this.addOne);
|
||||||
this.collection.bind('refresh', this.render);
|
this.collection.bind('refresh', this.render);
|
||||||
this.collection.view = this;
|
this.collection.view = this;
|
||||||
|
this.entryContainer = this.$("#entries")
|
||||||
},
|
},
|
||||||
|
|
||||||
addOne: function(entry) {
|
addOne: function(entry) {
|
||||||
$(this.el).append(entry.view.render().el);
|
if (!entry.view) { new TS.EntryView({model: entry}); }
|
||||||
|
this.entryContainer.prepend(entry.view.render().el);
|
||||||
|
},
|
||||||
|
|
||||||
|
createNewEntry: function() {
|
||||||
|
var entryMark = this.$("#new-entry-input").val();
|
||||||
|
var newEntry = TS.EntryModel({mark: entryMark});
|
||||||
|
this.collection.create({mark: entryMark}).fetch();
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
$(this.el).empty();
|
this.entryContainer.empty();
|
||||||
this.collection.each(this.addOne);
|
this.collection.each(this.addOne);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -199,6 +216,30 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
TS.TimelineListView = Backbone.View.extend({
|
||||||
|
el: $("#timeline .drop-menu-items"),
|
||||||
|
|
||||||
|
collection: TS.TimelineList,
|
||||||
|
|
||||||
|
initialize: function() {
|
||||||
|
_.bindAll(this, 'render', 'renderOne');
|
||||||
|
this.collection.bind('add', this.renderOne);
|
||||||
|
this.collection.bind('refresh', this.render);
|
||||||
|
this.collection.view = this;
|
||||||
|
},
|
||||||
|
|
||||||
|
renderOne: function(timeline) {
|
||||||
|
if (!timeline.view) { new TS.TimelineView(timeline); }
|
||||||
|
$(this.el).append(ich.timelineLink(timeline.toJSON()));
|
||||||
|
},
|
||||||
|
|
||||||
|
render: function() {
|
||||||
|
$(this.el).remove(".timeline-link");
|
||||||
|
this.collection.each(this.renderOne);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
TS.UserView = Backbone.View.extend({
|
TS.UserView = Backbone.View.extend({
|
||||||
|
|
||||||
el: $("#user"),
|
el: $("#user"),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ebin_dir = /home/jdbernard/projects/jdb-labs/timestamper/web-app/ebin
|
ebin_dir = T:/projects/jdb-labs/timestamper/web-app/ebin
|
||||||
#include_dir = /home/jdbernard/projects/timestamper/web-app/src
|
#include_dir = /home/jdbernard/projects/timestamper/web-app/src
|
||||||
|
|
||||||
runmod = timestamper_dev
|
runmod = timestamper_dev
|
||||||
@ -6,6 +6,6 @@ runmod = timestamper_dev
|
|||||||
<server timestamper-local>
|
<server timestamper-local>
|
||||||
port = 8000
|
port = 8000
|
||||||
listen = 127.0.0.1
|
listen = 127.0.0.1
|
||||||
docroot = /home/jdbernard/projects/jdb-labs/timestamper/web-app/www
|
docroot = T:/projects/jdb-labs/timestamper/web-app/www
|
||||||
appmods = ts_api
|
appmods = ts_api
|
||||||
</server>
|
</server>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user