Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- User.prototype.urlRoot = GtwModel.url('/users');
- User.prototype.jsonAttr = ["name", "email", "email_confirmation", "city", "state", "password", "password_confirmation", "accepts_policy", "avatar_url", "positions", "grades", "subjects", "years_teaching"];
- User.prototype.replies = function () {
- return this.hasMany(ReplyCollection, 'replies_url');
- };
- User.prototype.favorites = function () {
- return this.hasMany(ReplyCollection, 'favorite_replies_url');
- };
- User.prototype.authenticate = function (email, password, methods) {
- var data, options;
- options = arguments[2] || {};
- data = {
- username: email,
- password: password
- };
- return $.ajax({
- type: "POST",
- data: data,
- url: GtwModel.url('/login'),
- success: options['success'],
- error: options['failure']
- });
- };
- User.prototype.getPublicName = function () {
- var abbreviatedName, firstName, firstNamePrefix, lastName, lastNamePrefix, name, _ref;
- name = this.get('name');
- if ((name != null) && name !== '') {
- _ref = name.split(' ', 2), firstName = _ref[0], lastName = _ref[1];
- /* THIS IS CHAR 914 */firstNamePrefix = firstName[0].toUpperCase();
- try {
- lastNamePrefix = lastName[0].toUpperCase();
- } catch (e) {
- lastNamePrefix = null;
- }
Add Comment
Please, Sign In to add comment