Guest User

Untitled

a guest
Jan 11th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. User.prototype.urlRoot = GtwModel.url('/users');
  2. User.prototype.jsonAttr = ["name", "email", "email_confirmation", "city", "state", "password", "password_confirmation", "accepts_policy", "avatar_url", "positions", "grades", "subjects", "years_teaching"];
  3. User.prototype.replies = function () {
  4. return this.hasMany(ReplyCollection, 'replies_url');
  5. };
  6. User.prototype.favorites = function () {
  7. return this.hasMany(ReplyCollection, 'favorite_replies_url');
  8. };
  9. User.prototype.authenticate = function (email, password, methods) {
  10. var data, options;
  11. options = arguments[2] || {};
  12. data = {
  13. username: email,
  14. password: password
  15. };
  16. return $.ajax({
  17. type: "POST",
  18. data: data,
  19. url: GtwModel.url('/login'),
  20. success: options['success'],
  21. error: options['failure']
  22. });
  23. };
  24. User.prototype.getPublicName = function () {
  25. var abbreviatedName, firstName, firstNamePrefix, lastName, lastNamePrefix, name, _ref;
  26. name = this.get('name');
  27. if ((name != null) && name !== '') {
  28. _ref = name.split(' ', 2), firstName = _ref[0], lastName = _ref[1];
  29. /* THIS IS CHAR 914 */firstNamePrefix = firstName[0].toUpperCase();
  30. try {
  31. lastNamePrefix = lastName[0].toUpperCase();
  32. } catch (e) {
  33. lastNamePrefix = null;
  34. }
Add Comment
Please, Sign In to add comment