summaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
authorScott Ostler <sostler@deathmachine.local>2010-02-25 20:13:46 -0500
committerScott Ostler <sostler@deathmachine.local>2010-02-25 20:13:46 -0500
commitf3b32cefcec1db03b2fb27a7ece322eccf125927 (patch)
treebc57d8b010f16d05417a27fe0ec745f9ca7cc68f /static/js
parent1a543c1a104e885567f1adb296859ead3d098ea4 (diff)
Split apart enableProfileEdit
Diffstat (limited to 'static/js')
-rwxr-xr-xstatic/js/pichat.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/static/js/pichat.js b/static/js/pichat.js
index d348d93..b847f58 100755
--- a/static/js/pichat.js
+++ b/static/js/pichat.js
@@ -61,7 +61,6 @@ function buildMessageDiv(msg, isLoading) {
}
function buildUserDiv(user) {
- console.warn(user);
if (user.avatar) {
return '<div class="username">'
+ '<a href="/u/' + escapeHtml(user.nick) + '" target="_blank">'
@@ -166,7 +165,6 @@ function updateUI(msgs, users) {
}
if (users !== null) {
var flattened = flattenUserJson(users);
- console.log(flattened);
if (!('userlist' in cache) || flattened != cache.userlist) {
$("#userList").html($.map(users, buildUserDiv).join(''));
}
@@ -245,11 +243,11 @@ function makePlainText() {
j.text(j.text());
}
-function enableProfileEdit() {
+function activateProfileEditable() {
var onSubmit = function(attr, newVal, oldVal) {
newVal = $.trim(newVal);
if (newVal == oldVal) { return oldVal };
-
+
$.ajax({
type: "POST",
timeout: 5000,
@@ -267,29 +265,30 @@ function enableProfileEdit() {
return escapeHtml(newVal);
};
- $('#avatar-editing').show();
-
- var avatarOpts = { 'default_text': 'Enter here!',
+ var avatarOpts = { 'default_text': 'Paste URL here!',
'callback': onSubmit,
'field_type': 'text',
'callbackShowErrors': false };
- $('#avatar.editable').editInPlace(avatarOpts);
-
- if ($('#upload').length > 0) {
+ if ($('#avatar.editable').length > 0) {
+ $('#avatar.editable').editInPlace(avatarOpts);
setupUploadAvatar('upload');
}
var textareaOpts = { 'default_text': 'Enter here!',
'callback': onSubmit,
'field_type': 'textarea',
- 'callbackShowErrors': false };
- $('#contact, #bio')
- .addClass('editable')
+ 'callbackShowErrors': false };
+ $('#contact.editable, #bio.editable')
.editInPlace(textareaOpts)
.each(makePlainText);
+}
+function enableProfileEdit() {
+ $('#contact, #bio, #avatar').addClass('editable');
+ $('#avatar-editing').show();
var resetPage = function() { location.reload() };
$('#edit-toggle a').text('--> Done editing <--').click(resetPage);
+ activateProfileEditable();
}
function initProfile() {
@@ -299,6 +298,7 @@ function initProfile() {
});
$('#edit-toggle').click(enableProfileEdit);
+ activateProfileEditable();
$('.logged-dump .content').each(function() {
var t = $(this);