// Generated by CoffeeScript 1.6.2 (function() { var __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; define(['app', 'utils', 'moment', 'marionette', 'vent', 'app.lib/editableView', 'models/user/userItem', 'text!/tpl/UserProfileView', 'ace-editable', 'wysiwyg'], function(App, utils, moment, Marionette, vent, EditableView, UserItem, Template) { var UserProfileView, _ref; UserProfileView = (function(_super) { __extends(UserProfileView, _super); function UserProfileView() { _ref = UserProfileView.__super__.constructor.apply(this, arguments); return _ref; } UserProfileView.prototype.template = _.template(Template); UserProfileView.prototype.templateHelpers = { humanise: function(date) { return moment(date).fromNow(); } }; UserProfileView.prototype.onDomRefresh = function() { var _this = this; console.log("UserProfileView: initialize"); this.setupImageEditable({ el: $("#avatar", this.el), url: "/ajax/upload_avatar_image/", chooseMessage: "Choose mix image" }); $.fn.editable.defaults.mode = "inline"; $.fn.editableform.loading = "
"; $.fn.editableform.buttons = "" + ""; if (utils.isMe(this.model.get("id"))) { $("#about", this.el).editable({ mode: "inline", type: "wysiwyg", name: "about", wysiwyg: {}, css: { 'max-width': '300px' }, success: function(response, newValue) { console.log("Update model with new value"); return _this.model.save('description', newValue, { patch: true }); } }); } return $(".usereditable").attr('class', utils.isMe(this.model.get("id")) ? "editable editable-click" : "user-info"); }; return UserProfileView; })(EditableView); return UserProfileView; }); }).call(this);