Fixed deploy target, new entry creation.

* Modified make target `deploy` to require the `build` target first.
* When creating a new timestamp entry we no longer refresh the collection from
  the server. Now we use the `success` callback to set the server-supplied
  values on the model.
This commit is contained in:
Jonathan Bernard 2013-10-22 16:46:34 +00:00
parent a3c55e918e
commit f4eeb91d1a
2 changed files with 10 additions and 8 deletions

@ -48,7 +48,7 @@ build: compile
cp src/ts_db_records.hrl build/include cp src/ts_db_records.hrl build/include
cp yaws.prod.conf build/yaws.conf cp yaws.prod.conf build/yaws.conf
deploy: compile deploy: build
@service yaws stop @service yaws stop
@echo Removing existing artifacts. @echo Removing existing artifacts.
- @rm -r $(TS_ROOT) - @rm -r $(TS_ROOT)

@ -351,11 +351,13 @@ $(document).ready(function(){
var entryMark = this.$("#new-entry-input").val(); var entryMark = this.$("#new-entry-input").val();
// create the mark. Immediately fetch to get server-side timestamp // create the mark. Immediately fetch to get server-side timestamp
this.collection.create({mark: entryMark, this.collection.create(
notes: '', {mark: entryMark,
timestamp: new Date()}); notes: '',
timestamp: new Date()},
this.collection.fetch(); {wait: true,
success: function(model, resp, options) {
model.set(resp); }});
// clear the input for the next entry // clear the input for the next entry
this.$("#new-entry-input").val(""); } }, this.$("#new-entry-input").val(""); } },
@ -623,10 +625,10 @@ $(document).ready(function(){
this.user.model.set({last_timeline: tl.get('id')}); this.user.model.set({last_timeline: tl.get('id')});
this.user.model.save(); this.user.model.save();
// refresh TimelineListView // re-render the TimelineListView
this.timelines.view.render(); this.timelines.view.render();
// refresh EntryList records // fetch the new EntryList records
this.entries.collection.fetch() } } }); this.entries.collection.fetch() } } });
TS.LoginView = Backbone.View.extend({ TS.LoginView = Backbone.View.extend({