From: "Slava Bacherikov" <slava@bacherikov.org.ua>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/apps/packages/templatetags/, ...
Date: Mon, 30 Jul 2012 23:30:19 +0000 (UTC) [thread overview]
Message-ID: <1343691011.e2729e6cbb3e938bc676d844a7be27ee16970966.bacher09@gentoo> (raw)
commit: e2729e6cbb3e938bc676d844a7be27ee16970966
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Mon Jul 30 23:30:11 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Mon Jul 30 23:30:11 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=e2729e6c
Add extra data to package view
---
gpackages/apps/packages/models.py | 3 +++
gpackages/apps/packages/templatetags/packages.py | 9 ++++++++-
gpackages/templates/package.html | 20 +++++++++++++++++---
gpackages/templates/packages_use_flag.html | 21 +++++++++++++++++++++
4 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/gpackages/apps/packages/models.py b/gpackages/apps/packages/models.py
index 238e864..7207ad9 100644
--- a/gpackages/apps/packages/models.py
+++ b/gpackages/apps/packages/models.py
@@ -687,6 +687,9 @@ class EbuildModel(AbstractDateTimeModel):
l.append(ko)
self.keyword_set.add(*l)
+ def use_flags_with_descr(self):
+ return self.use_flags.all().prefetch_package_descr(self.package)
+
@property
def cp(self):
return self.package.cp
diff --git a/gpackages/apps/packages/templatetags/packages.py b/gpackages/apps/packages/templatetags/packages.py
index 764f5ab..5f0f3f0 100644
--- a/gpackages/apps/packages/templatetags/packages.py
+++ b/gpackages/apps/packages/templatetags/packages.py
@@ -5,7 +5,7 @@ from package_info.generic_metadata.changelog_highlight import changelog_highligh
register = template.Library()
-from ..models import RepositoryModel, EbuildModel
+from ..models import RepositoryModel, EbuildModel, UseFlagDescriptionModel
from ..views import arches
from ..forms import ArchChoiceForm, FilteringForm
from generic.utils import inclusion_cached_tag
@@ -81,3 +81,10 @@ def filtering_modal(context):
form = FilteringForm(initial = initial)
return {'form': form }
+
+@register.inclusion_tag('packages_use_flag.html')
+def use_flag_table(package):
+ if package.latest_ebuild:
+ use_flags = package.latest_ebuild.use_flags_with_descr()
+
+ return {'use_flags': use_flags}
diff --git a/gpackages/templates/package.html b/gpackages/templates/package.html
index fcc03e3..2b6760c 100644
--- a/gpackages/templates/package.html
+++ b/gpackages/templates/package.html
@@ -3,8 +3,22 @@
{% block content %}
{% include 'package_object.html' %}
- <div class="changelog">
- <h4>Changelog</h4>
- {{ package.changelog|changelog_highlight }}
+ <div class="tabbable">
+ <ul class="nav nav-tabs">
+ <li class="active"><a href="#tab1" data-toggle="tab">Changelog</a></li>
+ <li><a href="#tab2" data-toggle="tab">Use flags</a></li>
+ <li><a href="#tab3" data-toggle="tab">Licenses</a></li>
+ </ul>
+ <div class="tab-content">
+ <div class="tab-pane active" id="tab1">
+ {{ package.changelog|changelog_highlight }}
+ </div>
+ <div class="tab-pane" id="tab2">
+ {% use_flag_table package %}
+ </div>
+ <div class="tab-pane" id="tab3">
+ {{ package.latest_ebuild.license }}
+ </div>
+ </div>
</div>
{% endblock content %}
diff --git a/gpackages/templates/packages_use_flag.html b/gpackages/templates/packages_use_flag.html
new file mode 100644
index 0000000..103e51a
--- /dev/null
+++ b/gpackages/templates/packages_use_flag.html
@@ -0,0 +1,21 @@
+{% load url from future %}
+<table class='table table-striped table-hover'>
+ <colgroup>
+ <col class="span1" >
+ <col class="span8" >
+ </colgroup>
+ <thead>
+ <tr>
+ <th>Use flag</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for use_flag in use_flags %}
+ <tr>
+ <td><a href="{% url 'packages' use=use_flag.name %}">{{ use_flag.name }}</a></td>
+ <td>{{ use_flag.descr|urlize }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
next reply other threads:[~2012-07-30 23:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-30 23:30 Slava Bacherikov [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-08-02 22:44 [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/apps/packages/templatetags/, Slava Bacherikov
2012-07-31 14:22 Slava Bacherikov
2012-07-31 14:22 Slava Bacherikov
2012-07-18 23:03 Slava Bacherikov
2012-06-28 23:59 Slava Bacherikov
2012-06-27 22:52 Slava Bacherikov
2012-06-15 23:28 Slava Bacherikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343691011.e2729e6cbb3e938bc676d844a7be27ee16970966.bacher09@gentoo \
--to=slava@bacherikov.org.ua \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox