Browse Source

Merge pull request #24 from dryabov/master

add tox and bitmessage fields to profile
master
iHedgehog 11 years ago
parent
commit
42f79f7d8e
  1. 18
      css/profile.css
  2. 2
      home.html
  3. 2
      js/twister_actions.js
  4. 20
      js/twister_io.js
  5. 6
      js/twister_user.js
  6. 2
      profile-edit.html

18
css/profile.css

@ -195,6 +195,12 @@
display: inline-block; display: inline-block;
margin-top: 10px; margin-top: 10px;
} }
.forEdition .profile-card-main .input-tox,
.forEdition .profile-card-main .input-bitmessage
{
width: 90%;
margin-top: 10px;
}
.profile-edition-buttons .profile-edition-buttons
{ {
padding: 10px; padding: 10px;
@ -239,6 +245,18 @@
.profile-modal .profile-location { .profile-modal .profile-location {
color: #48577d; color: #48577d;
} }
.profile-modal .profile-tox:before {
content: "Tox: ";
}
.profile-modal .profile-tox:empty {
display: none;
}
.profile-modal .profile-bitmessage:before {
content: "Bitmessage: ";
}
.profile-modal .profile-bitmessage:empty {
display: none;
}
.profile-modal .profile-data .profile-modal .profile-data
{ {

2
home.html

@ -448,6 +448,8 @@ $(".userMenu-dhtindicator").hide();
</div> </div>
<div class="profile-bio"> <div class="profile-bio">
</div> </div>
<div class="profile-tox"></div>
<div class="profile-bitmessage"></div>
</div> </div>
<ul class="module profile-data"> <ul class="module profile-data">
<li><a href="#"><span class="posts-count">&nbsp;</span><span class="label">Posts</span></a></li> <li><a href="#"><span class="posts-count">&nbsp;</span><span class="label">Posts</span></a></li>

2
js/twister_actions.js

@ -170,6 +170,8 @@ function updateProfileData(profileModalContent, username) {
getLocation( username, profileModalContent.find(".profile-location") ); getLocation( username, profileModalContent.find(".profile-location") );
getWebpage( username, profileModalContent.find(".profile-url") ); getWebpage( username, profileModalContent.find(".profile-url") );
getBio( username, profileModalContent.find(".profile-bio") ); getBio( username, profileModalContent.find(".profile-bio") );
getTox( username, profileModalContent.find(".profile-tox") );
getBitmessage( username, profileModalContent.find(".profile-bitmessage") );
getAvatar( username, profileModalContent.find(".profile-card-photo") ); getAvatar( username, profileModalContent.find(".profile-card-photo") );
getPostsCount( username, profileModalContent.find(".posts-count") ); getPostsCount( username, profileModalContent.find(".posts-count") );
getFollowers( username, profileModalContent.find(".followers-count") ); getFollowers( username, profileModalContent.find(".followers-count") );

20
js/twister_io.js

@ -219,6 +219,26 @@ function getBio( username, item ){
getProfileResource( username, "bio", item); getProfileResource( username, "bio", item);
} }
// get tox address and store it in item.text
function getTox( username, item ){
getProfileResource( username, "tox", false, function(item, text){
item.empty();
if(text) {
item.append($('<a></a>').attr('href', 'tox:'+text).text(text));
}
}, item);
}
// get bitmessage address and store it in item.text
function getBitmessage( username, item ){
getProfileResource( username, "bitmessage", false, function(item, text){
item.empty();
if(text) {
item.append($('<a></a>').attr('href', 'bitmsg:'+text).text(text));
}
}, item);
}
// get location and store it in item.text // get location and store it in item.text
function getLocation( username, item ){ function getLocation( username, item ){
getProfileResource( username, "location", item); getProfileResource( username, "location", item);

6
js/twister_user.js

@ -247,6 +247,10 @@ function loadProfileForEdit() {
$(".input-city").val(profile.location); $(".input-city").val(profile.location);
if( "url" in profile) if( "url" in profile)
$(".input-website").val(profile.url); $(".input-website").val(profile.url);
if( "tox" in profile)
$(".input-tox").val(profile.tox);
if( "bitmessage" in profile)
$(".input-bitmessage").val(profile.bitmessage);
} }
}, {} ); }, {} );
} }
@ -258,6 +262,8 @@ function saveProfile(e)
profile["bio"] = $(".input-description").val(); profile["bio"] = $(".input-description").val();
profile["location"] = $(".input-city").val(); profile["location"] = $(".input-city").val();
profile["url"] = $(".input-website").val(); profile["url"] = $(".input-website").val();
profile["tox"] = $(".input-tox").val();
profile["bitmessage"] = $(".input-bitmessage").val();
dhtput( defaultScreenName, "profile", "s", dhtput( defaultScreenName, "profile", "s",
profile, defaultScreenName, ++profileSeqNum ); profile, defaultScreenName, ++profileSeqNum );
var avatarData = $(".profile-card-photo.forEdition").attr("src"); var avatarData = $(".profile-card-photo.forEdition").attr("src");

2
profile-edit.html

@ -77,6 +77,8 @@ if (theme=='calm') {
<input type="text" class="input-description" placeholder="Describe yourself"/> <input type="text" class="input-description" placeholder="Describe yourself"/>
<input type="text" class="input-city" placeholder="Location"/> <input type="text" class="input-city" placeholder="Location"/>
<input type="text" class="input-website" placeholder="website"/> <input type="text" class="input-website" placeholder="website"/>
<input type="text" class="input-tox" placeholder="Tox address"/>
<input type="text" class="input-bitmessage" placeholder="Bitmessage address"/>
</div> </div>
<div class="profile-edition-buttons"> <div class="profile-edition-buttons">
<button class="toggle-priv-key" style="float: left" href="#">Secret key</button> <button class="toggle-priv-key" style="float: left" href="#">Secret key</button>

Loading…
Cancel
Save