Made it possible to set a profile photo. Not well tested.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3866 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
d802c0023b
commit
11ad344e52
@ -1 +1 @@
|
||||
{"type":"tildefriends-app","files":{"app.js":"&nbY2UrHp+GcW1FrromCZRyJNg7in7InypXSaFNipTrs=.sha256","index.html":"&xCI4SATYvlJkVX5EdlRROoDSMWlajF+wDFrWSUYZqd8=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&kIpc5B2dt4oefsTgNASz2cVte3WRO0k2NCYJYRzu/MA=.sha256","tf.js":"&WvteLAg4G92YOUO3/B36kmar5lqFq8Pil4rsy7uFNDY=.sha256","commonmark.min.js":"&EP0OeR9zyLwZannz+0ga4s9AGES2RLvvIIQYHqqV6+k=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256","tf-shared.js":"&g17mCj0bfk0tw0sYk2VMU67Bt8Hdznjl44E01TxQF5Y=.sha256"}}
|
||||
{"type":"tildefriends-app","files":{"app.js":"&nbY2UrHp+GcW1FrromCZRyJNg7in7InypXSaFNipTrs=.sha256","index.html":"&oAZVhNbqs9mLhgZj6VLgRvmCYuiGjp9D+ZH3vFV/ViM=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&BwircO1usZwNmgxReG3COtztqg6bVYnVenTKsLhOeLI=.sha256","tf-message.js":"&TcKxV+QGU2LQ+yLtZbD1xdWfDSAPLRj47fBaydho3ts=.sha256","tf.js":"&ih5SgLokhC5wnL7VNnFhSD/t2mqs5gTFzUUFWBlMp3k=.sha256","commonmark.min.js":"&EP0OeR9zyLwZannz+0ga4s9AGES2RLvvIIQYHqqV6+k=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256","tf-shared.js":"&g17mCj0bfk0tw0sYk2VMU67Bt8Hdznjl44E01TxQF5Y=.sha256"}}
|
@ -12,6 +12,7 @@
|
||||
<script src="tf-user.js"></script>
|
||||
<script src="tf-message.js"></script>
|
||||
<script src="tf.js"></script>
|
||||
<base target="_top">
|
||||
</head>
|
||||
<body style="color: #fff">
|
||||
<div id="app">
|
||||
@ -111,6 +112,7 @@
|
||||
</md-card-header>
|
||||
<md-card-content>
|
||||
<div v-if="selected == whoami">
|
||||
<img v-if="edit_profile_image" :src="'/' + edit_profile_image + '/view'">
|
||||
<md-field>
|
||||
<label>Name</label>
|
||||
<md-input v-model="edit_profile_name"></md-input>
|
||||
@ -125,6 +127,9 @@
|
||||
<div v-html="markdown(users[selected].description)"></div>
|
||||
</template>
|
||||
<md-card-actions>
|
||||
<md-button class="md-icon-button" @click="attach('profile')">
|
||||
<md-icon>attach_file</md-icon>
|
||||
</md-button>
|
||||
<md-menu md-size="small" v-if="users[selected] && users[selected].followers">
|
||||
<md-button md-menu-trigger>{{Object.keys(users[selected].followers).length}} followers</md-button>
|
||||
<md-menu-content>
|
||||
|
@ -144,7 +144,7 @@ Vue.component('tf-message', {
|
||||
<md-chip md-clickable v-for="v in Object.keys(votes[message.id] || {})" v-bind:key="v" @click="vote">
|
||||
{{v + (votes[message.id][v].length > 1 ? ' (' + votes[message.id][v].length + ')' : '')}}
|
||||
<md-tooltip style="height: auto">
|
||||
<div v-for="vote in votes[message.id][v]" v-bind:key="vote.author">{{vote.author}}</div>
|
||||
<tf-user v-for="vote in votes[message.id][v]" :id="vote.author" :key="vote.author"></tf-user>
|
||||
</md-tooltip>
|
||||
</md-chip>
|
||||
<md-card-actions v-if="message.author">
|
||||
|
@ -18,8 +18,8 @@ Vue.component('tf-user', {
|
||||
window.parent.postMessage({action: 'setHash', hash: this.id}, '*');
|
||||
},
|
||||
},
|
||||
template: `<md-chip md-clickable :class="following ? 'md-accent' : ''" @click="show_user()">
|
||||
{{users[id] && users[id].name ? users[id].name : id}}
|
||||
template: `<md-chip :class="following ? 'md-accent' : ''">
|
||||
<a :href="'#' + id" style="color: #fff">{{users[id] && users[id].name ? users[id].name : id}}</a>
|
||||
<md-tooltip v-if="users[id] && users[id].name">{{id}}</md-tooltip>
|
||||
</md-chip>`,
|
||||
});
|
@ -20,6 +20,7 @@ var g_data = {
|
||||
selected: null,
|
||||
edit_profile_name: null,
|
||||
edit_profile_description: null,
|
||||
edit_profile_image: null,
|
||||
load_time: null,
|
||||
post_text: null,
|
||||
times: {},
|
||||
@ -33,6 +34,7 @@ var g_process_pending = false;
|
||||
function updateEditUser() {
|
||||
g_data.edit_profile_name = g_data.users[g_data.whoami] ? g_data.users[g_data.whoami].name : null;
|
||||
g_data.edit_profile_description = g_data.users[g_data.whoami] ? g_data.users[g_data.whoami].description : null;
|
||||
g_data.edit_profile_image = g_data.users[g_data.whoami] ? g_data.users[g_data.whoami].image : null;
|
||||
}
|
||||
|
||||
function processMessages() {
|
||||
@ -155,12 +157,16 @@ function processMessages() {
|
||||
}
|
||||
} else if (key == 'storeBlobComplete') {
|
||||
var blob = event.data.storeBlobComplete;
|
||||
g_data.post_text = (g_data.post_text || '') + `\n![${blob.name}](${blob.path.substring(1)})`;
|
||||
Vue.set(g_data.mentions, blob.path.substring(1), {
|
||||
link: blob.path.substring(1),
|
||||
name: blob.name,
|
||||
type: blob.type,
|
||||
});
|
||||
if (blob.context == 'profile') {
|
||||
g_data.edit_profile_image = blob.path.substring(1);
|
||||
} else {
|
||||
g_data.post_text = (g_data.post_text || '') + `\n![${blob.name}](${blob.path.substring(1)})`;
|
||||
Vue.set(g_data.mentions, blob.path.substring(1), {
|
||||
link: blob.path.substring(1),
|
||||
name: blob.name,
|
||||
type: blob.type,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
g_data[key] = event.data[key];
|
||||
}
|
||||
@ -226,12 +232,15 @@ window.addEventListener('load', function() {
|
||||
Vue.delete(g_data.mentions, link);
|
||||
},
|
||||
save_profile: function() {
|
||||
var message = {appendMessage: {
|
||||
type: 'about',
|
||||
about: g_data.selected,
|
||||
name: g_data.edit_profile_name,
|
||||
description: g_data.edit_profile_description,
|
||||
}};
|
||||
var message = {
|
||||
appendMessage: {
|
||||
type: 'about',
|
||||
about: g_data.selected,
|
||||
name: g_data.edit_profile_name,
|
||||
description: g_data.edit_profile_description,
|
||||
image: g_data.edit_profile_image,
|
||||
}
|
||||
};
|
||||
window.parent.postMessage(message, '*');
|
||||
},
|
||||
follow: function(id) {
|
||||
@ -257,7 +266,7 @@ window.addEventListener('load', function() {
|
||||
set_hash(hash) {
|
||||
window.parent.postMessage({action: 'setHash', hash: hash ? hash : '#'}, '*');
|
||||
},
|
||||
attach() {
|
||||
attach(context) {
|
||||
var input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
input.onchange = function(event) {
|
||||
@ -268,7 +277,8 @@ window.addEventListener('load', function() {
|
||||
name: file.name,
|
||||
type: file.type,
|
||||
buffer: buffer,
|
||||
}
|
||||
},
|
||||
context: context,
|
||||
}, '*');
|
||||
}).catch(function(e) {
|
||||
console.log('error', e);
|
||||
|
Loading…
Reference in New Issue
Block a user