Merge lp:~elachuni/ubuntu-webcatalog/hib-widget into lp:ubuntu-webcatalog

Proposed by Anthony Lenton
Status: Merged
Approved by: Natalia Bidart
Approved revision: 132
Merged at revision: 129
Proposed branch: lp:~elachuni/ubuntu-webcatalog/hib-widget
Merge into: lp:ubuntu-webcatalog
Diff against target: 73 lines (+23/-0)
4 files modified
src/webcatalog/schema.py (+2/-0)
src/webcatalog/templates/webcatalog/application_detail.html (+6/-0)
src/webcatalog/tests/test_views.py (+12/-0)
src/webcatalog/views.py (+3/-0)
To merge this branch: bzr merge lp:~elachuni/ubuntu-webcatalog/hib-widget
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+108228@code.launchpad.net

Commit message

Added a little HIB widget for HIB apps.

Description of the change

This branch adds a little HIB widget for HIB apps.

To post a comment you must log in.
129. By Anthony Lenton

Added tests for the hib widget.

130. By Anthony Lenton

Added a bit of padding.

131. By Anthony Lenton

Small template improvements.

132. By Anthony Lenton

Margin fix.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good! Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/webcatalog/schema.py'
2--- src/webcatalog/schema.py 2012-05-30 22:39:39 +0000
3+++ src/webcatalog/schema.py 2012-05-31 21:29:18 +0000
4@@ -61,6 +61,8 @@
5 number_top_rated_apps = schema.IntOption(default=8)
6 screenshots_base_url = schema.StringOption(
7 default='http://screenshots.ubuntu.com/')
8+ hib_apps = schema.ListOption(item=schema.StringOption(),
9+ default=[])
10
11 class google(schema.Section):
12 google_analytics_id = schema.StringOption()
13
14=== modified file 'src/webcatalog/templates/webcatalog/application_detail.html'
15--- src/webcatalog/templates/webcatalog/application_detail.html 2012-05-29 07:49:06 +0000
16+++ src/webcatalog/templates/webcatalog/application_detail.html 2012-05-31 21:29:18 +0000
17@@ -109,6 +109,12 @@
18 <p>{{ application.description|htmlize_package_description }}</p>
19 <div class="install-button">{% install_options application %}</div>
20 </div>
21+ {% if display_hib_widget %}
22+ <div id="hib-widget" style="width: 652px; padding:24px 16px 8px; clear:both">
23+ <p>{{ application.name }} is currently also available as part of the <a href="http://www.humblebundle.com/?utm_source=ubuntu">Humble Bundle</a></p>
24+ <iframe style="display: block; margin:0 auto; border:none;" src="http://www.humblebundle.com/_widget/html" width="410" height="150"></iframe>
25+ </div>
26+ {% endif %}
27 <div class="license">
28 <table>
29 <tr>
30
31=== modified file 'src/webcatalog/tests/test_views.py'
32--- src/webcatalog/tests/test_views.py 2012-05-29 07:49:06 +0000
33+++ src/webcatalog/tests/test_views.py 2012-05-31 21:29:18 +0000
34@@ -196,6 +196,18 @@
35 self.assertContains(response, "Tweet</a>")
36 self.assertContains(response, "https://twitter.com/share")
37
38+ def test_hib_widget_is_present_for_hib_apps(self):
39+ with patch_settings(HIB_APPS=['pkgfoo']):
40+ response, app = self.get_app_and_response()
41+
42+ self.assertContains(response, '<div id="hib-widget"')
43+
44+ def test_hib_widget_not_present_for_non_hib_apps(self):
45+ with patch_settings(HIB_APPS=['something', 'different']):
46+ response, app = self.get_app_and_response()
47+
48+ self.assertNotContains(response, '<div id="hib-widget"')
49+
50 def test_twitter_link_does_not_contain_none(self):
51 app = self.factory.make_application()
52
53
54=== modified file 'src/webcatalog/views.py'
55--- src/webcatalog/views.py 2012-05-25 07:43:26 +0000
56+++ src/webcatalog/views.py 2012-05-31 21:29:18 +0000
57@@ -209,6 +209,8 @@
58
59 debtags = None if not app.debtags else json.loads(app.debtags)
60
61+ hib_apps = getattr(settings, 'HIB_APPS', [])
62+
63 atts = {'application': app,
64 'available_distroseries': app.available_distroseries(),
65 'breadcrumbs': app.crumbs(),
66@@ -217,6 +219,7 @@
67 reverse('wc-package-detail', args=[package_name])),
68 'email_form': form,
69 'debtags': debtags,
70+ 'display_hib_widget': app.package_name in hib_apps
71 }
72
73 return render_to_response(

Subscribers

People subscribed via source and target branches