[gitg] Improve author info layout
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Improve author info layout
- Date: Mon, 4 May 2015 17:14:13 +0000 (UTC)
commit 779bf56ad3e1ffdb091c0fafc4929dade0cf0f5a
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Mon May 4 19:13:49 2015 +0200
Improve author info layout
libgitg/resources/ui/diff-view/diff-view.css | 4 +-
libgitg/resources/ui/diff-view/diff-view.html | 4 +-
libgitg/resources/ui/diff-view/diff-view.js | 49 +++++++++++++++++++------
3 files changed, 41 insertions(+), 16 deletions(-)
---
diff --git a/libgitg/resources/ui/diff-view/diff-view.css b/libgitg/resources/ui/diff-view/diff-view.css
index 7eae61b..1bbdd54 100644
--- a/libgitg/resources/ui/diff-view/diff-view.css
+++ b/libgitg/resources/ui/diff-view/diff-view.css
@@ -49,8 +49,8 @@ img.avatar {
float: left;
margin-right: 10px;
border-radius: 10px 10px 10px 10px;
- min-width: 50px;
- min-height: 50px;
+ min-width: 60px;
+ min-height: 60px;
}
div.commit .parents .title {
diff --git a/libgitg/resources/ui/diff-view/diff-view.html b/libgitg/resources/ui/diff-view/diff-view.html
index d12e9fb..c96c09a 100644
--- a/libgitg/resources/ui/diff-view/diff-view.html
+++ b/libgitg/resources/ui/diff-view/diff-view.html
@@ -38,10 +38,10 @@
<div class="commit">
<div class="parent-chooser" data-id="parent_chooser">
</div>
- <img class="avatar" data-id="avatar" src="gitg-diff:/icon/avatar-default-symbolic?size=50"/>
+ <img class="avatar" data-id="avatar" src="gitg-diff:/icon/avatar-default-symbolic?size=60"/>
<div class="author-info">
<span class="author" data-id="author"></span><br/>
- <span class="date" data-id="date"></span>
+ <span class="date" data-id="date"></span><br/>
<div class="author committer" data-id="committed-by"></div>
</div>
<p class="message" data-id="message"></p>
diff --git a/libgitg/resources/ui/diff-view/diff-view.js b/libgitg/resources/ui/diff-view/diff-view.js
index f6b7dd4..b5c5b72 100644
--- a/libgitg/resources/ui/diff-view/diff-view.js
+++ b/libgitg/resources/ui/diff-view/diff-view.js
@@ -79,13 +79,21 @@ function get_commit_elements(content)
return commit_elements;
}
+var avatarLoader;
+
function write_avatar(avatar, commit)
{
var h = commit.author.email_md5;
+ var avc;
+
+ if (avatarLoader)
+ {
+ avatarLoader.cancelled = true;
+ }
if (h in avatar_cache)
{
- var avc = avatar_cache[h];
+ avc = avatar_cache[h];
if (avc != null && avatar.attr('src') != avc)
{
@@ -95,23 +103,40 @@ function write_avatar(avatar, commit)
return;
}
- var loader = $('<img/>');
- var gravatar = 'http://www.gravatar.com/avatar/' + h + '?d=404&s=50';
+ avatarLoader = {
+ image: $('<img/>'),
+ cancelled: false
+ };
- loader.on('load', function () {
- avatar_cache[h] = gravatar;
+ var gravatar = 'http://www.gravatar.com/avatar/' + h + '?d=404&s=60';
+
+ avc = 'gitg-diff:/icon/avatar-default-symbolic?size=60';
+
+ avatar.attr('src', avc);
+
+ avatarLoader.image.on('load', function () {
+ if (this.cancelled)
+ {
+ return;
+ }
+ avatar_cache[h] = gravatar;
avatar.attr('src', gravatar);
- });
- loader.on('error', function () {
- var avc = 'gitg-diff:/icon/avatar-default-symbolic?size=50';
+ avatarLoader = null;
+ }.bind(avatarLoader));
+
+ avatarLoader.image.on('error', function () {
+ if (this.cancelled)
+ {
+ return;
+ }
avatar_cache[h] = avc;
- avatar.attr('src', avc);
- });
+ avatarLoader = null;
+ }.bind(avatarLoader));
- loader.attr('src', gravatar);
+ avatarLoader.image.attr('src', gravatar);
}
function open_url(target)
@@ -187,7 +212,7 @@ function write_commit(content, commit)
}
else
{
- elems['committed-by'].html('');
+ elems['committed-by'].html(' <br> ');
}
// Date
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]