You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/05/03 23:58:11 UTC
[41/50] git commit: [#5773] ticket:328 refactored log widget
[#5773] ticket:328 refactored log widget
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/cf331123
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/cf331123
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/cf331123
Branch: refs/heads/db/6007
Commit: cf33112318ea778be43d46fa1827a26c016b75a6
Parents: d7bcc22
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Wed May 1 14:50:55 2013 +0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu May 2 20:37:05 2013 +0000
----------------------------------------------------------------------
Allura/allura/config/app_cfg.py | 1 +
Allura/allura/lib/helpers.py | 6 +++++-
Allura/allura/nf/allura/css/allura.css | 3 +++
Allura/allura/templates/widgets/repo/log.html | 16 ++++++++--------
Allura/allura/tests/test_helpers.py | 4 ++++
5 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cf331123/Allura/allura/config/app_cfg.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/app_cfg.py b/Allura/allura/config/app_cfg.py
index f6b11e4..86c65b4 100644
--- a/Allura/allura/config/app_cfg.py
+++ b/Allura/allura/config/app_cfg.py
@@ -101,6 +101,7 @@ class ForgeConfig(AppConfig):
extensions=['jinja2.ext.do', 'jinja2.ext.i18n'])
jinja2_env.install_gettext_translations(pylons.i18n)
jinja2_env.filters['filesizeformat'] = helpers.do_filesizeformat
+ jinja2_env.filters['datetimeformat'] = helpers.datetimeformat
jinja2_env.globals.update({'hasattr': hasattr})
config['pylons.app_globals'].jinja2_env = jinja2_env
# Jinja's unable to request c's attributes without strict_c
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cf331123/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 29cf44e..9d97c02 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -701,4 +701,8 @@ def get_first(d, key):
v = d.get(key)
if isinstance(v, list):
return v[0] if len(v) > 0 else None
- return v
\ No newline at end of file
+ return v
+
+
+def datetimeformat(value, format='%Y-%m-%d %H:%M:%S'):
+ return value.strftime(format)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cf331123/Allura/allura/nf/allura/css/allura.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/allura.css b/Allura/allura/nf/allura/css/allura.css
index d468b1a..7b0471c 100644
--- a/Allura/allura/nf/allura/css/allura.css
+++ b/Allura/allura/nf/allura/css/allura.css
@@ -211,3 +211,6 @@ b.ico.ico-vote-down { background-image: url('../images/vote_down.png'); }
.pagination_size {
height: 40px;
}
+tr.rev div.markdown_content p {
+ padding: 0;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cf331123/Allura/allura/templates/widgets/repo/log.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/repo/log.html b/Allura/allura/templates/widgets/repo/log.html
index bdeeda2..50affe6 100644
--- a/Allura/allura/templates/widgets/repo/log.html
+++ b/Allura/allura/templates/widgets/repo/log.html
@@ -33,10 +33,16 @@
{% for commit in value %}
<tr class="rev">
<td>
- <div class="grid-14">
+ <div>
{%if is_file%}
<div class="grid-1"><input type="checkbox" class="revision" revision="{{commit._id.split(':')[-1]}}" url_commit="{{commit.url()}}"></div>
{%endif%}
+ <a href="{{c.app.repo.url_for_commit(commit)}}">{{commit.shorthand_id()}}</a>
+ {% if c.app.repo.symbolics_for_commit(commit)[1] %}
+ ({% for tag in c.app.repo.symbolics_for_commit(commit)[1] -%}
+ <a href="{{c.app.repo.url_for_commit(tag)}}">{{tag}}</a>{% if not loop.last %} {% endif %}
+ {%- endfor %})
+ {% endif %}
{% if commit.committed.email != commit.authored.email %}
{% if commit.committer_url %}
<a href="{{commit.committer_url}}">{{email_gravatar(commit.committed.email, title=commit.committed.name, size=16)}}
@@ -47,12 +53,6 @@
pushed
{% endif %}
{% endif %}
- <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
- {% if c.app.repo.symbolics_for_commit(commit)[1] %}
- ({% for tag in c.app.repo.symbolics_for_commit(commit)[1] -%}
- <a href="{{c.app.repo.url()}}ci/{{tag}}/tree{{request.params.get('path')}}">{{tag}}</a>{% if not loop.last %} {% endif %}
- {%- endfor %})
- {% endif %}
by
{{email_gravatar(commit.authored.email, title=commit.authored.name, size=16)}} {{commit.authored.name}}
{%if is_file%}
@@ -62,7 +62,7 @@
</div>
</td>
<td style="vertical-align: text-top">
- {% if commit.committed.date %}{{commit.committed.date}}{% endif %}
+ {% if commit.committed.date %}{{commit.committed.date|datetimeformat}}{% endif %}
</td>
<td style="text-align: left; vertical-align: text-top">
<a href="{{commit.url()}}tree{{request.params.get('path')}}">
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cf331123/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index ed40cfc..40c0e96 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -238,3 +238,7 @@ def test_inject_user(context):
context.user = Mock(username='*anonymous')
result = inject_user('reported_by_s:$USER OR assigned_to_s:$USER')
assert_equals(result, 'reported_by_s:"*anonymous" OR assigned_to_s:"*anonymous"')
+
+def test_datetimeformat():
+ from datetime import date
+ assert h.datetimeformat(date(2013, 01, 01)) == '2013-01-01 00:00:00'