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
=== modified file 'src/webcatalog/schema.py'
--- src/webcatalog/schema.py 2012-05-30 22:39:39 +0000
+++ src/webcatalog/schema.py 2012-05-31 21:29:18 +0000
@@ -61,6 +61,8 @@
61 number_top_rated_apps = schema.IntOption(default=8)61 number_top_rated_apps = schema.IntOption(default=8)
62 screenshots_base_url = schema.StringOption(62 screenshots_base_url = schema.StringOption(
63 default='http://screenshots.ubuntu.com/')63 default='http://screenshots.ubuntu.com/')
64 hib_apps = schema.ListOption(item=schema.StringOption(),
65 default=[])
6466
65 class google(schema.Section):67 class google(schema.Section):
66 google_analytics_id = schema.StringOption()68 google_analytics_id = schema.StringOption()
6769
=== modified file 'src/webcatalog/templates/webcatalog/application_detail.html'
--- src/webcatalog/templates/webcatalog/application_detail.html 2012-05-29 07:49:06 +0000
+++ src/webcatalog/templates/webcatalog/application_detail.html 2012-05-31 21:29:18 +0000
@@ -109,6 +109,12 @@
109 <p>{{ application.description|htmlize_package_description }}</p>109 <p>{{ application.description|htmlize_package_description }}</p>
110 <div class="install-button">{% install_options application %}</div>110 <div class="install-button">{% install_options application %}</div>
111 </div>111 </div>
112 {% if display_hib_widget %}
113 <div id="hib-widget" style="width: 652px; padding:24px 16px 8px; clear:both">
114 <p>{{ application.name }} is currently also available as part of the <a href="http://www.humblebundle.com/?utm_source=ubuntu">Humble Bundle</a></p>
115 <iframe style="display: block; margin:0 auto; border:none;" src="http://www.humblebundle.com/_widget/html" width="410" height="150"></iframe>
116 </div>
117 {% endif %}
112 <div class="license">118 <div class="license">
113 <table>119 <table>
114 <tr>120 <tr>
115121
=== modified file 'src/webcatalog/tests/test_views.py'
--- src/webcatalog/tests/test_views.py 2012-05-29 07:49:06 +0000
+++ src/webcatalog/tests/test_views.py 2012-05-31 21:29:18 +0000
@@ -196,6 +196,18 @@
196 self.assertContains(response, "Tweet</a>")196 self.assertContains(response, "Tweet</a>")
197 self.assertContains(response, "https://twitter.com/share")197 self.assertContains(response, "https://twitter.com/share")
198198
199 def test_hib_widget_is_present_for_hib_apps(self):
200 with patch_settings(HIB_APPS=['pkgfoo']):
201 response, app = self.get_app_and_response()
202
203 self.assertContains(response, '<div id="hib-widget"')
204
205 def test_hib_widget_not_present_for_non_hib_apps(self):
206 with patch_settings(HIB_APPS=['something', 'different']):
207 response, app = self.get_app_and_response()
208
209 self.assertNotContains(response, '<div id="hib-widget"')
210
199 def test_twitter_link_does_not_contain_none(self):211 def test_twitter_link_does_not_contain_none(self):
200 app = self.factory.make_application()212 app = self.factory.make_application()
201213
202214
=== modified file 'src/webcatalog/views.py'
--- src/webcatalog/views.py 2012-05-25 07:43:26 +0000
+++ src/webcatalog/views.py 2012-05-31 21:29:18 +0000
@@ -209,6 +209,8 @@
209209
210 debtags = None if not app.debtags else json.loads(app.debtags)210 debtags = None if not app.debtags else json.loads(app.debtags)
211211
212 hib_apps = getattr(settings, 'HIB_APPS', [])
213
212 atts = {'application': app,214 atts = {'application': app,
213 'available_distroseries': app.available_distroseries(),215 'available_distroseries': app.available_distroseries(),
214 'breadcrumbs': app.crumbs(),216 'breadcrumbs': app.crumbs(),
@@ -217,6 +219,7 @@
217 reverse('wc-package-detail', args=[package_name])),219 reverse('wc-package-detail', args=[package_name])),
218 'email_form': form,220 'email_form': form,
219 'debtags': debtags,221 'debtags': debtags,
222 'display_hib_widget': app.package_name in hib_apps
220 }223 }
221224
222 return render_to_response(225 return render_to_response(

Subscribers

People subscribed via source and target branches