public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/templatetags/, gpackages/templates/
@ 2012-07-06 23:09 Slava Bacherikov
  0 siblings, 0 replies; 3+ messages in thread
From: Slava Bacherikov @ 2012-07-06 23:09 UTC (permalink / raw
  To: gentoo-commits

commit:     82f2e2611bf0a63e5baf19fe20f45d20eaa05699
Author:     Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Fri Jul  6 21:31:13 2012 +0000
Commit:     Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Fri Jul  6 21:31:13 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=82f2e261

Add recent_ebuilds tag

---
 gpackages/apps/packages/templatetags/packages.py |   11 ++++++++++-
 gpackages/templates/base.html                    |    1 +
 gpackages/templates/recent_ebuilds.html          |   12 ++++++++++++
 3 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/gpackages/apps/packages/templatetags/packages.py b/gpackages/apps/packages/templatetags/packages.py
index 1a6d24a..542be0b 100644
--- a/gpackages/apps/packages/templatetags/packages.py
+++ b/gpackages/apps/packages/templatetags/packages.py
@@ -3,7 +3,7 @@ from django import template
 
 register = template.Library()
 
-from ..models import RepositoryModel
+from ..models import RepositoryModel, EbuildModel
 
 @register.inclusion_tag('last_updated.html')
 def last_updated():
@@ -25,3 +25,12 @@ def text_sincode(text):
     return mark_safe(''.join(text_l))
 
 register.filter('obfuscate', text_sincode)
+
+@register.inclusion_tag('recent_ebuilds.html')
+def recent_ebuilds(num = 10):
+    query = EbuildModel.objects.order_by('-updated_datetime').all().\
+        select_related('package',
+                       'package__virtual_package',
+                       'package__virtual_package__category'). \
+                       prefetch_related('package__repository')[:num]
+    return {'ebuilds': query}

diff --git a/gpackages/templates/base.html b/gpackages/templates/base.html
index d0726df..a557f4c 100644
--- a/gpackages/templates/base.html
+++ b/gpackages/templates/base.html
@@ -150,6 +150,7 @@ Text
                             {% active_link 'global_uses' 'Global Use Flags' %}
                         </ul>
                        </div>
+                       {% recent_ebuilds %}
             </div> <!-- span3 --><!--}}}-->
 
         <div class="row-fluid"><!--{{{-->

diff --git a/gpackages/templates/recent_ebuilds.html b/gpackages/templates/recent_ebuilds.html
new file mode 100644
index 0000000..831874d
--- /dev/null
+++ b/gpackages/templates/recent_ebuilds.html
@@ -0,0 +1,12 @@
+<div class="well">
+    <ul class="nav nav-list" style="padding: 2px;">
+        <li class="nav-header">Recent Ebuilds</li>
+        {% for ebuild in ebuilds %}
+            <li>
+            <a href="{{ ebuild.package.get_absolute_url }}" style="font-size: 12px;">
+            {{ ebuild.cpvr }}
+            </a>
+            </li>
+        {% endfor %}
+    </ul>
+</div>



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/templatetags/, gpackages/templates/
@ 2012-07-12 22:16 Slava Bacherikov
  0 siblings, 0 replies; 3+ messages in thread
From: Slava Bacherikov @ 2012-07-12 22:16 UTC (permalink / raw
  To: gentoo-commits

commit:     55e599dcb44029eaa49a00064f1dc0f2960a9a4a
Author:     Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Thu Jul 12 22:05:18 2012 +0000
Commit:     Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Thu Jul 12 22:05:18 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=55e599dc

Fix bug with obfuscate template filter and None value

---
 gpackages/apps/packages/templatetags/packages.py |    2 ++
 gpackages/templates/repository.html              |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/gpackages/apps/packages/templatetags/packages.py b/gpackages/apps/packages/templatetags/packages.py
index 542be0b..bd2e6d1 100644
--- a/gpackages/apps/packages/templatetags/packages.py
+++ b/gpackages/apps/packages/templatetags/packages.py
@@ -21,6 +21,8 @@ def render_keywords_table(obj, arch_list):
     return {'arches': arch_list, 'ebuilds' : ebuilds}
 
 def text_sincode(text):
+    if not text:
+        return ''
     text_l = map(lambda x: '&#%s;' % ord(x), text)
     return mark_safe(''.join(text_l))
 

diff --git a/gpackages/templates/repository.html b/gpackages/templates/repository.html
index 52ac7e6..11f7dde 100644
--- a/gpackages/templates/repository.html
+++ b/gpackages/templates/repository.html
@@ -28,10 +28,12 @@
                     <td>{{ repository.owner_name }}</td>
                 </tr>
                 {% endif %}
+                {% if repository.owner_email %}
                 <tr>
                     <td class="nowrap">Owner email</td>
                     <td><a href="{{ 'mailto:'|add:repository.owner_email|obfuscate }}">{{ repository.owner_email|obfuscate }}</a></td>
                 </tr>
+                {% endif %}
                 <tr>
                     <td>Homepage</td>
                     <td><a href="{{ repository.homepage }}">{{ repository.homepage }}</a></td>



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/templatetags/, gpackages/templates/
@ 2012-08-02 23:18 Slava Bacherikov
  0 siblings, 0 replies; 3+ messages in thread
From: Slava Bacherikov @ 2012-08-02 23:18 UTC (permalink / raw
  To: gentoo-commits

commit:     48314399228f6e8852537b85100d80b49d168f72
Author:     Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Thu Aug  2 23:14:56 2012 +0000
Commit:     Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Thu Aug  2 23:14:56 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=48314399

More correct use flag table generation

---
 gpackages/apps/packages/templatetags/packages.py   |   16 ++++++++--------
 ...packages_use_flag.html => ebuild_use_flag.html} |    0
 gpackages/templates/package.html                   |    4 +++-
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/gpackages/apps/packages/templatetags/packages.py b/gpackages/apps/packages/templatetags/packages.py
index 08a7098..d0d8835 100644
--- a/gpackages/apps/packages/templatetags/packages.py
+++ b/gpackages/apps/packages/templatetags/packages.py
@@ -84,17 +84,17 @@ def filtering_modal(context):
     form = FilteringForm(initial = initial)
     return {'form': form }
 
-def use_flag_table_key(package):
-    if package.latest_ebuild:
-        return 'use_flag_table_ebuild' + str(package.latest_ebuild.pk)
+def use_flag_table_key(ebuild):
+    if ebuild:
+        return 'use_flag_table_ebuild' + str(ebuild.pk)
     else:
-        return 'use_flag_table_package' + str(package.pk)
+        return 'use_flag_table_ebuild' + str(ebuild)
 
-@inclusion_cached_tag('packages_use_flag.html', register, use_flag_table_key,
+@inclusion_cached_tag('ebuild_use_flag.html', register, use_flag_table_key,
                                                         time_zone = False)
-def use_flag_table(package):
+def use_flag_table(ebuild):
     use_flags = []
-    if package.latest_ebuild:
-        use_flags = package.latest_ebuild.use_flags_with_descr()
+    if ebuild is not None:
+        use_flags = ebuild.use_flags_with_descr()
 
     return {'use_flags': use_flags}

diff --git a/gpackages/templates/packages_use_flag.html b/gpackages/templates/ebuild_use_flag.html
similarity index 100%
rename from gpackages/templates/packages_use_flag.html
rename to gpackages/templates/ebuild_use_flag.html

diff --git a/gpackages/templates/package.html b/gpackages/templates/package.html
index d1d4640..992629a 100644
--- a/gpackages/templates/package.html
+++ b/gpackages/templates/package.html
@@ -7,14 +7,16 @@
     <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>
+      {% if package.latest_ebuild.license %}
       <li><a href="#tab3" data-toggle="tab">Licenses</a></li>
+      {% endif %}
     </ul>
     <div class="tab-content">
         <div class="tab-pane active" id="tab1">
             {{ package.highlighted_changelog }}
         </div>
         <div class="tab-pane" id="tab2">
-            {% use_flag_table package %}
+            {% use_flag_table package.latest_ebuild %}
         </div>
         <div class="tab-pane" id="tab3">
             {{ package.latest_ebuild.license|license_urlize }}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-02 23:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-12 22:16 [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/templatetags/, gpackages/templates/ Slava Bacherikov
  -- strict thread matches above, loose matches on Subject: below --
2012-08-02 23:18 Slava Bacherikov
2012-07-06 23:09 Slava Bacherikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox