Fixing problems introduced by the model change.

* Many calls to ``ts_ext_data:get_properties/1`` from ``ts_api`` were passing
  the record reference, not the record itself. Fixed.
* Created ``ts_api:put_user/2`` which updates a ``ts_user`` record. This is
  needed specifically for updating the ``liat_timeline`` extended data property.
* Removed unreachable code in ``ts_api:post_entry/3``
* Fixed return value of some ``ts_user`` functions to use the
  ``{Status, Value}`` convention. TODO: make sure all calls are using the same
  convention.
* Fixed error message formatting in ``ts_ext_data:set_property/3``.
* Added clauses to ``ts_json:ejson_to_record/2``,
  ``ts_json:ejson_to_record_strict/2`` and ``ts_json:construct_record/3`` to
  handle the ``ts_user`` record type.
* Added code to ``AppView.loadInitialData`` and ``AppView.selectTimeline`` to
  support the ``last_timeline`` extended data property.
This commit is contained in:
Jonathan Bernard
2011-06-15 16:50:38 -05:00
parent 3999e736be
commit cd182d54c3
16 changed files with 297 additions and 79 deletions

View File

@ -535,7 +535,10 @@ $(document).ready(function(){
url: '/ts_api/app/user_summary/' + username,
async: false}).responseText);
data.initialTimelineId = data.timelines[0].id;
// look for the last used timeline, default to first timeline
data.initialTimelineId =
data.user.last_timeline || data.timelines[0].id
data.entries = jQuery.parseJSON($.ajax({
url: '/ts_api/entries/' + username + '/' +
data.initialTimelineId,
@ -555,6 +558,10 @@ $(document).ready(function(){
// set the timeline on the EntryList
this.entries.collection.timeline = tl;
// update the last_timeline field of the user model
this.user.model.set('last_timeline', tl.get('id');
this.user.model.save();
// refresh TimelineListView
this.timelines.view.render();