1. 14 Dec, 2015 13 commits
    • Sean Hammond's avatar
      Separate updating view model from restoring draft · 803aaa6b
      Sean Hammond authored
      Separate updateViewModel() and restoreFromDrafts() into two separate functions.
      803aaa6b
    • Sean Hammond's avatar
      Lint · 6a7e7964
      Sean Hammond authored
      6a7e7964
    • Sean Hammond's avatar
      Make what's stored in drafts explicit · 743b28dc
      Sean Hammond authored
      Explicitly store `private` (boolean), `tags` (array of strings) and `text`
      (string) in drafts instead of a "black box" `changes` object.
      
      Also rename the updateDraft() function to saveToDrafts() and move it out of
      AnnotationController.
      743b28dc
    • Sean Hammond's avatar
      Extract domainModel<->vm tags translation · 3178f917
      Sean Hammond authored
      Extract the translation of tags in AnnotationController from domainModel.tags
      format to vm.tags format and vice-versa into functions.
      
      This is for clarity, and so that the transformations can be used in multiple
      places in the code without duplication.
      3178f917
    • Sean Hammond's avatar
      Be explicit about what goes into vm.annotation · 0e3d3921
      Sean Hammond authored
      Copy individual properties into vm.annotation explicitly, instead of blindly
      copying all of domainModel into it. This allows us to see what's in there and
      start making decisions about what should/shouldn't be in there.
      0e3d3921
    • Sean Hammond's avatar
      Fix AnnotationController permissions validation · 0fd89fbf
      Sean Hammond authored
      Since vm.annotation.permissions is (soon) no longer going to be used,
      don't validate it in validate(), validate model.permissions instead.
      0fd89fbf
    • Sean Hammond's avatar
      f70fa0b2
    • Sean Hammond's avatar
      Don't use vm.annotation.permissions · e149a3e3
      Sean Hammond authored
      The templates read vm.isPrivate() and vm.isShared() and call vm.setPrivacy()
      so vm.annotation.permissions just isn't needed.
      
      The controller modifies domainModel.permissions when the permissions need to
      change.
      
      vm.annotation.permissions is still there, we just don't use it anymore, in the
      future we should not copy it into vm.annotation at all.
      e149a3e3
    • Sean Hammond's avatar
      Don't use vm.annotation.group · 205efe04
      Sean Hammond authored
      The templates read vm.group() (which returns domainModel.group) and never write
      any group, so vm.annotation.group just isn't needed.
      
      The controller modifies domainModel.group is the focused group changes while
      creating a new annotation.
      
      vm.annotation.group is still there, we just don't use it anymore, in the future
      we should not copy it into vm.annotation at all.
      205efe04
    • Sean Hammond's avatar
      Rename model -> domainModel · 9cce6a0b
      Sean Hammond authored
      9cce6a0b
    • Sean Hammond's avatar
      Rename viewModel -> vm · 8925ff91
      Sean Hammond authored
      8925ff91
    • Sean Hammond's avatar
      Remove some code duplication · 47d9024d
      Sean Hammond authored
      Clarify the pattern of using the presence or not of model.id to test
      whether an annotation is new in AnnotationController.
      47d9024d
    • Sean Hammond's avatar
      Don't change model.group on group change · 2f5b8bc1
      Sean Hammond authored
      Don't change model.group in AnnotationController when the currently focused
      group changes.
      
      model is supposed to be a read-only domain model, change vm.annotation instead.
      
      Changes to vm.annotation are copied over to model before saving model to the
      server.
      
      To make this work vm.group() should return the current group of the annotation,
      accounting for any changes made to vm.annotation but not saved to model or to
      the server yet. It should return vm.annotation.group not model.group.
      
      Similarly vm.isShared() should be based on vm.annotation not on model.
      
      Also remove some code in thread.coffee that was deliberately hiding new
      annotations that don't belong to the focused group (see commit
      272b2432c48a2d6bf890daa863e92f3a678b27b5). This is no longer the desired
      behaviour - when changing groups any new annotations move to the new group with
      us (and the GROUP_FOCUSED listener in AnnotationController will update
      vm.annotation.group to match).
      2f5b8bc1
  2. 11 Dec, 2015 27 commits