/** @jsx m */

"use strict";

var _ = require("underscore");

var CurateBaseModel = require("./CurateBaseModel.js");

var AuthorModel = CurateBaseModel.extend({
  name: "Author",
  relations: ["Article", function() {
    return {
      "articles": {type: "many", model: require("./ArticleModel.js"), urlAction: "articles"}
    };
  }],
  defaults: {
    first_name: "John",
    last_name: "Smith",
    middle_name: "Rob",
    orcid: "",
    affiliation: "",
    email: "john.rob.smith@gmail.com",
    is_user: ""
  },
  computeds: {
    fullName: function() {
      return _.compact([this.get("first_name"), this.get("middle_name"), this.get("last_name")]).join(" ");
    }
  },
  pill: function() {
    return { label: this.get("fullName"), value: this };
  }
});

module.exports = AuthorModel;

@@ -364,12 +364,8 @@
 e: %22
-John
 %22,%0A 
@@ -383,13 +383,8 @@
 e: %22
-Smith
 %22,%0A 
@@ -404,11 +404,8 @@
 e: %22
-Rob
 %22,%0A 
@@ -426,79 +426,43 @@
     
-affiliation: %22%22,%0A    email: %22john.rob.smith@gmail.com%22,%0A    is_user: %22%22
+job_title: %22%22,%0A    affiliations: %5B%5D
 %0A  %7D
@@ -705,16 +705,69 @@
 s %7D;%0A  %7D
+,%0A  urlRoot: %22https://www.curatescience.org/authors%22,
 %0A%7D);%0A%0Amo

set up urlRoot and defaults