Merge lp:~sinzui/launchpad/answers-portlets into lp:launchpad
- answers-portlets
- Merge into devel
Proposed by
Curtis Hovey
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | not available | ||||
Proposed branch: | lp:~sinzui/launchpad/answers-portlets | ||||
Merge into: | lp:launchpad | ||||
Diff against target: | None lines | ||||
To merge this branch: | bzr merge lp:~sinzui/launchpad/answers-portlets | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Eleanor Berger (community) | Approve | ||
Review via email: mp+9862@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote : | # |
Revision history for this message
Eleanor Berger (intellectronica) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/answers/browser/configure.zcml' | |||
2 | --- lib/lp/answers/browser/configure.zcml 2009-07-13 18:15:02 +0000 | |||
3 | +++ lib/lp/answers/browser/configure.zcml 2009-08-07 15:27:51 +0000 | |||
4 | @@ -281,7 +281,13 @@ | |||
5 | 281 | permission="zope.Public" | 281 | permission="zope.Public" |
6 | 282 | template="../templates/faq-listing.pt" | 282 | template="../templates/faq-listing.pt" |
7 | 283 | /> | 283 | /> |
9 | 284 | 284 | <browser:page | |
10 | 285 | for="lp.answers.interfaces.faqcollection.IFAQCollection" | ||
11 | 286 | class=".faqcollection.SearchFAQsView" | ||
12 | 287 | name="+portlet-listfaqs" | ||
13 | 288 | permission="zope.Public" | ||
14 | 289 | template="../templates/faqcollection-portlet-faqs.pt" | ||
15 | 290 | /> | ||
16 | 285 | <browser:page | 291 | <browser:page |
17 | 286 | name="+createfaq" | 292 | name="+createfaq" |
18 | 287 | for="lp.answers.interfaces.faqtarget.IFAQTarget" | 293 | for="lp.answers.interfaces.faqtarget.IFAQTarget" |
19 | 288 | 294 | ||
20 | === modified file 'lib/lp/answers/browser/faqcollection.py' | |||
21 | --- lib/lp/answers/browser/faqcollection.py 2009-06-24 23:10:46 +0000 | |||
22 | +++ lib/lp/answers/browser/faqcollection.py 2009-08-07 21:43:36 +0000 | |||
23 | @@ -12,14 +12,18 @@ | |||
24 | 12 | 12 | ||
25 | 13 | from urllib import urlencode | 13 | from urllib import urlencode |
26 | 14 | 14 | ||
27 | 15 | from canonical.cachedproperty import cachedproperty | ||
28 | 15 | from canonical.launchpad import _ | 16 | from canonical.launchpad import _ |
32 | 16 | from canonical.launchpad.interfaces import ( | 17 | from lp.answers.interfaces.faqcollection import ( |
33 | 17 | IFAQCollection, ISearchFAQsForm, QUESTION_STATUS_DEFAULT_SEARCH, | 18 | IFAQCollection, ISearchFAQsForm, FAQSort) |
34 | 18 | QuestionSort) | 19 | from lp.answers.interfaces.questionenums import QuestionSort |
35 | 20 | from lp.answers.interfaces.questioncollection import ( | ||
36 | 21 | QUESTION_STATUS_DEFAULT_SEARCH) | ||
37 | 19 | from canonical.launchpad.webapp import ( | 22 | from canonical.launchpad.webapp import ( |
38 | 20 | action, ApplicationMenu, canonical_url, LaunchpadFormView, Link, | 23 | action, ApplicationMenu, canonical_url, LaunchpadFormView, Link, |
39 | 21 | safe_action) | 24 | safe_action) |
40 | 22 | from canonical.launchpad.webapp.batching import BatchNavigator | 25 | from canonical.launchpad.webapp.batching import BatchNavigator |
41 | 26 | from canonical.launchpad.webapp.menu import enabled_with_permission | ||
42 | 23 | 27 | ||
43 | 24 | 28 | ||
44 | 25 | class FAQCollectionMenu(ApplicationMenu): | 29 | class FAQCollectionMenu(ApplicationMenu): |
45 | @@ -27,7 +31,7 @@ | |||
46 | 27 | 31 | ||
47 | 28 | usedfor = IFAQCollection | 32 | usedfor = IFAQCollection |
48 | 29 | facet = 'answers' | 33 | facet = 'answers' |
50 | 30 | links = ['list_all'] | 34 | links = ['list_all', 'create_faq'] |
51 | 31 | 35 | ||
52 | 32 | def list_all(self): | 36 | def list_all(self): |
53 | 33 | """Return a Link to list all FAQs.""" | 37 | """Return a Link to list all FAQs.""" |
54 | @@ -36,7 +40,14 @@ | |||
55 | 36 | # which an adapter exists that gives the proper context. | 40 | # which an adapter exists that gives the proper context. |
56 | 37 | collection = IFAQCollection(self.context) | 41 | collection = IFAQCollection(self.context) |
57 | 38 | url = canonical_url(collection, rootsite='answers') + '/+faqs' | 42 | url = canonical_url(collection, rootsite='answers') + '/+faqs' |
59 | 39 | return Link(url, 'List all FAQs') | 43 | return Link(url, 'List all FAQs', icon='info') |
60 | 44 | |||
61 | 45 | @enabled_with_permission('launchpad.Moderate') | ||
62 | 46 | def create_faq(self): | ||
63 | 47 | """Return a Link to create a new FAQ.""" | ||
64 | 48 | collection = IFAQCollection(self.context) | ||
65 | 49 | url = canonical_url(collection, rootsite='answers') + '/+createfaq' | ||
66 | 50 | return Link(url, 'Create a new FAQ', icon='add') | ||
67 | 40 | 51 | ||
68 | 41 | 52 | ||
69 | 42 | class SearchFAQsView(LaunchpadFormView): | 53 | class SearchFAQsView(LaunchpadFormView): |
70 | @@ -81,6 +92,23 @@ | |||
71 | 81 | faqs = self.context.searchFAQs(search_text=self.search_text) | 92 | faqs = self.context.searchFAQs(search_text=self.search_text) |
72 | 82 | return BatchNavigator(faqs, self.request) | 93 | return BatchNavigator(faqs, self.request) |
73 | 83 | 94 | ||
74 | 95 | @property | ||
75 | 96 | def portlet_action(self): | ||
76 | 97 | """The action URL of the portlet form.""" | ||
77 | 98 | return canonical_url( | ||
78 | 99 | self.context, view_name='+faqs', rootsite='answers') | ||
79 | 100 | |||
80 | 101 | @cachedproperty | ||
81 | 102 | def latest_faqs(self): | ||
82 | 103 | """Return the latest faqs created for this target. | ||
83 | 104 | |||
84 | 105 | This is used by the +portlet-listfaqs view. | ||
85 | 106 | """ | ||
86 | 107 | quantity = 5 | ||
87 | 108 | faqs = self.context.searchFAQs( | ||
88 | 109 | search_text=self.search_text, sort=FAQSort.NEWEST_FIRST) | ||
89 | 110 | return faqs[:quantity] | ||
90 | 111 | |||
91 | 84 | @safe_action | 112 | @safe_action |
92 | 85 | @action(_('Search'), name='search') | 113 | @action(_('Search'), name='search') |
93 | 86 | def search_action(self, action, data): | 114 | def search_action(self, action, data): |
94 | 87 | 115 | ||
95 | === modified file 'lib/lp/answers/browser/questiontarget.py' | |||
96 | --- lib/lp/answers/browser/questiontarget.py 2009-06-24 23:10:46 +0000 | |||
97 | +++ lib/lp/answers/browser/questiontarget.py 2009-08-07 15:27:51 +0000 | |||
98 | @@ -108,6 +108,11 @@ | |||
99 | 108 | """View used to display the latest questions on a question target.""" | 108 | """View used to display the latest questions on a question target.""" |
100 | 109 | 109 | ||
101 | 110 | @cachedproperty | 110 | @cachedproperty |
102 | 111 | def latest_questions_url(self): | ||
103 | 112 | """The link to the latest questions.""" | ||
104 | 113 | return canonical_url(self.context, rootsite='answers') | ||
105 | 114 | |||
106 | 115 | @cachedproperty | ||
107 | 111 | def getLatestQuestions(self, quantity=5): | 116 | def getLatestQuestions(self, quantity=5): |
108 | 112 | """Return <quantity> latest questions created for this target. This | 117 | """Return <quantity> latest questions created for this target. This |
109 | 113 | is used by the +portlet-latestquestions view. | 118 | is used by the +portlet-latestquestions view. |
110 | 114 | 119 | ||
111 | === modified file 'lib/lp/answers/browser/tests/faq-views.txt' | |||
112 | --- lib/lp/answers/browser/tests/faq-views.txt 2009-03-24 12:43:49 +0000 | |||
113 | +++ lib/lp/answers/browser/tests/faq-views.txt 2009-08-07 21:43:36 +0000 | |||
114 | @@ -1,10 +1,67 @@ | |||
118 | 1 | = Answer Tracker FAQ Pages = | 1 | Answer Tracker FAQ Pages |
119 | 2 | 2 | ======================== | |
120 | 3 | >>> from canonical.launchpad.interfaces import ILaunchBag, IProductSet | 3 | |
121 | 4 | >>> from lp.registry.interfaces.product import IProductSet | ||
122 | 5 | |||
123 | 4 | >>> firefox = getUtility(IProductSet).getByName('firefox') | 6 | >>> firefox = getUtility(IProductSet).getByName('firefox') |
127 | 5 | 7 | >>> login_person(firefox.owner) | |
125 | 6 | >>> login('foo.bar@canonical.com') | ||
126 | 7 | >>> foo_bar = getUtility(ILaunchBag).user | ||
128 | 8 | >>> firefox_faq = firefox.newFAQ( | 8 | >>> firefox_faq = firefox.newFAQ( |
131 | 9 | ... foo_bar, 'A FAQ', 'FAQ for test purpose') | 9 | ... firefox.owner, 'A FAQ', 'FAQ for test purpose') |
132 | 10 | 10 | ||
133 | 11 | |||
134 | 12 | Latest FAQs portlet | ||
135 | 13 | ------------------- | ||
136 | 14 | |||
137 | 15 | The latest FAQs portlet allows an `IFAQTarget` to show the latest FAQs. | ||
138 | 16 | It's view provided latest_faqs to get the FAQs to display. | ||
139 | 17 | |||
140 | 18 | >>> from canonical.launchpad.testing.pages import ( | ||
141 | 19 | ... extract_text, find_tag_by_id) | ||
142 | 20 | |||
143 | 21 | >>> view = create_initialized_view( | ||
144 | 22 | ... firefox, '+portlet-listfaqs', principal=firefox.owner) | ||
145 | 23 | >>> for faq in view.latest_faqs: | ||
146 | 24 | ... print faq.title | ||
147 | 25 | A FAQ | ||
148 | 26 | What's the keyboard shortcut for [random feature]? | ||
149 | 27 | How do I install plugins (Shockwave, QuickTime, etc.)? | ||
150 | 28 | How do I troubleshoot problems with extensions/themes? | ||
151 | 29 | How do I install Extensions? | ||
152 | 30 | |||
153 | 31 | >>> content = find_tag_by_id(view.render(), 'portlet-latest-faqs') | ||
154 | 32 | >>> print content.h2 | ||
155 | 33 | <h2>...FAQs for Mozilla Firefox </h2> | ||
156 | 34 | |||
157 | 35 | >>> print extract_text(content.ul) | ||
158 | 36 | A FAQ | ||
159 | 37 | What's the keyboard shortcut for [random feature]?... | ||
160 | 38 | |||
161 | 39 | Each FAQ is linked. | ||
162 | 40 | |||
163 | 41 | >>> print content.find('a', {'class': 'sprite question'}) | ||
164 | 42 | <a class="..." href="http://answers.../firefox/+faq/...">A FAQ</a> | ||
165 | 43 | |||
166 | 44 | The portlet has a form to search FAQs. The view provides the action URL so | ||
167 | 45 | that the form works from any page. | ||
168 | 46 | |||
169 | 47 | >>> print view.portlet_action | ||
170 | 48 | http://answers.launchpad.dev/firefox/+faqs | ||
171 | 49 | |||
172 | 50 | >>> print content.form['action'] | ||
173 | 51 | http://answers.launchpad.dev/firefox/+faqs | ||
174 | 52 | |||
175 | 53 | The portlet provides a link to create a faq when the user that has moderate | ||
176 | 54 | permission such as the project owner. | ||
177 | 55 | |||
178 | 56 | >>> print content.find('a', {'class': 'menu-link-create_faq sprite add'}) | ||
179 | 57 | <a href=".../firefox/+createfaq" class="...">Create a new FAQ</a> | ||
180 | 58 | |||
181 | 59 | Other users do not see the link. | ||
182 | 60 | |||
183 | 61 | >>> user = factory.makePerson(name='a-user') | ||
184 | 62 | >>> login_person(user) | ||
185 | 63 | >>> view = create_initialized_view( | ||
186 | 64 | ... firefox, '+portlet-listfaqs', principal=user) | ||
187 | 65 | >>> content = find_tag_by_id(view.render(), 'portlet-latest-faqs') | ||
188 | 66 | >>> print content.find('a', {'class': 'menu-link-create_faq sprite add'}) | ||
189 | 67 | None | ||
190 | 11 | 68 | ||
191 | === modified file 'lib/lp/answers/stories/question-overview.txt' | |||
192 | --- lib/lp/answers/stories/question-overview.txt 2009-06-02 08:20:49 +0000 | |||
193 | +++ lib/lp/answers/stories/question-overview.txt 2009-08-07 18:20:14 +0000 | |||
194 | @@ -165,14 +165,15 @@ | |||
195 | 165 | 165 | ||
196 | 166 | >>> user_browser.open('http://launchpad.dev/mozilla') | 166 | >>> user_browser.open('http://launchpad.dev/mozilla') |
197 | 167 | 167 | ||
206 | 168 | >>> questions = find_portlet(user_browser.contents, 'Latest questions') | 168 | >>> questions = find_tag_by_id( |
207 | 169 | >>> print extract_text( | 169 | ... user_browser.contents, 'portlet-latest-questions') |
208 | 170 | ... questions.find('div')).encode('ASCII', 'backslashreplace') | 170 | >>> print extract_text(questions).encode('ASCII', 'backslashreplace') |
209 | 171 | [Open] Problemas de Impress\xe3o no Firefox | 171 | Latest questions |
210 | 172 | [Answered] Newly installed plug-in doesn't seem to be used | 172 | Problemas de Impress\xe3o no Firefox ... |
211 | 173 | [Open] Firefox loses focus and gets stuck | 173 | Newly installed plug-in doesn't seem to be used ... |
212 | 174 | [Open] Problem showing the SVG demo on W3C site | 174 | Firefox loses focus and gets stuck ... |
213 | 175 | [Open] Firefox cannot render Bank Site | 175 | Problem showing the SVG demo on W3C site ... |
214 | 176 | Firefox cannot render Bank Site ... | ||
215 | 176 | 177 | ||
216 | 177 | >>> user_browser.getLink('Ask a question').click() | 178 | >>> user_browser.getLink('Ask a question').click() |
217 | 178 | >>> print user_browser.title | 179 | >>> print user_browser.title |
218 | 179 | 180 | ||
219 | === added file 'lib/lp/answers/templates/faqcollection-portlet-faqs.pt' | |||
220 | --- lib/lp/answers/templates/faqcollection-portlet-faqs.pt 1970-01-01 00:00:00 +0000 | |||
221 | +++ lib/lp/answers/templates/faqcollection-portlet-faqs.pt 2009-08-07 21:43:36 +0000 | |||
222 | @@ -0,0 +1,34 @@ | |||
223 | 1 | <div | ||
224 | 2 | xmlns:tal="http://xml.zope.org/namespaces/tal" | ||
225 | 3 | class="portlet" id="portlet-latest-faqs" | ||
226 | 4 | tal:define="faqs view/latest_faqs" | ||
227 | 5 | tal:condition="faqs"> | ||
228 | 6 | <h2> | ||
229 | 7 | <span class="see-all"><a | ||
230 | 8 | tal:replace="structure view/menu:answers/list_all/fmt:link" /></span> | ||
231 | 9 | FAQs for <tal:name replace="context/displayname" /> | ||
232 | 10 | </h2> | ||
233 | 11 | |||
234 | 12 | <form id="question-search-form" method="get" accept-charset="UTF-8" | ||
235 | 13 | tal:attributes="action view/portlet_action"> | ||
236 | 14 | <p> | ||
237 | 15 | <tal:searchbox replace="structure view/widgets/search_text" /> | ||
238 | 16 | <input tal:replace="structure view/search_action/render" /> | ||
239 | 17 | </p> | ||
240 | 18 | </form> | ||
241 | 19 | |||
242 | 20 | <ul tal:condition="faqs"> | ||
243 | 21 | <li tal:repeat="faq faqs"> | ||
244 | 22 | <a class="sprite question" | ||
245 | 23 | tal:attributes="href faq/fmt:url" | ||
246 | 24 | tal:content="faq/title">How do I do this?</a> | ||
247 | 25 | </li> | ||
248 | 26 | </ul> | ||
249 | 27 | |||
250 | 28 | <ul class="horizontal" | ||
251 | 29 | tal:condition="context/required:launchpad.Moderate"> | ||
252 | 30 | <li> | ||
253 | 31 | <a tal:replace="structure view/menu:answers/create_faq/fmt:link" /> | ||
254 | 32 | </li> | ||
255 | 33 | </ul> | ||
256 | 34 | </div> | ||
257 | 0 | 35 | ||
258 | === modified file 'lib/lp/answers/templates/questiontarget-portlet-latestquestions.pt' | |||
259 | --- lib/lp/answers/templates/questiontarget-portlet-latestquestions.pt 2009-07-17 17:59:07 +0000 | |||
260 | +++ lib/lp/answers/templates/questiontarget-portlet-latestquestions.pt 2009-08-07 22:14:06 +0000 | |||
261 | @@ -1,15 +1,27 @@ | |||
276 | 1 | <div class="portlet" id="portlet-latest-questions" | 1 | <div |
277 | 2 | tal:condition="view/getLatestQuestions"> | 2 | xmlns:tal="http://xml.zope.org/namespaces/tal" |
278 | 3 | <h2>Latest questions</h2> | 3 | class="portlet" id="portlet-latest-questions" |
279 | 4 | <div class="portletBody portletContent"> | 4 | tal:define="questions view/getLatestQuestions" |
280 | 5 | 5 | tal:condition="questions"> | |
281 | 6 | <ul> | 6 | <h2> |
282 | 7 | <li tal:repeat="question view/getLatestQuestions"> | 7 | <span class="see-all" tal:condition="nothing"><a |
283 | 8 | <span tal:attributes="class string:questionstatus${question/status/name} ${question/image:sprite_css}" | 8 | tal:attributes="href view/latest_questions_url">All questions</a></span> |
284 | 9 | >[<tal:block tal:replace="structure question/status/title" />]</span> | 9 | Latest questions |
285 | 10 | <a tal:content="question/title/fmt:shorten/80" | 10 | </h2> |
286 | 11 | tal:attributes="href question/fmt:url">question title</a> | 11 | |
287 | 12 | </li> | 12 | <ul tal:condition="questions"> |
288 | 13 | </ul> | 13 | <li tal:repeat="question questions"> |
289 | 14 | </div> | 14 | <a |
290 | 15 | tal:attributes="class string: ${question/image:sprite_css}; | ||
291 | 16 | href question/fmt:url;" | ||
292 | 17 | tal:content="question/title/fmt:shorten/80">question title</a> | ||
293 | 18 | <br />Posted <tal:when replace="question/datecreated/fmt:displaydate" /> | ||
294 | 19 | </li> | ||
295 | 20 | </ul> | ||
296 | 21 | |||
297 | 22 | <tal:comment condition="nothing"> | ||
298 | 23 | # XXX sinzui 2009-08-07 bug=410501: Remove this link and enable the | ||
299 | 24 | # see all link when the distribution source package index page is 3.0. | ||
300 | 25 | </tal:comment> | ||
301 | 26 | <a tal:attributes="href view/latest_questions_url">All questions</a> | ||
302 | 15 | </div> | 27 | </div> |
303 | 16 | 28 | ||
304 | === modified file 'lib/lp/registry/stories/announcements/xx-announcements.txt' | |||
305 | --- lib/lp/registry/stories/announcements/xx-announcements.txt 2009-08-01 02:04:55 +0000 | |||
306 | +++ lib/lp/registry/stories/announcements/xx-announcements.txt 2009-08-07 17:29:08 +0000 | |||
307 | @@ -90,8 +90,8 @@ | |||
308 | 90 | >>> print latest_news(priv_browser.contents).encode( | 90 | >>> print latest_news(priv_browser.contents).encode( |
309 | 91 | ... 'ascii', 'backslashreplace') | 91 | ... 'ascii', 'backslashreplace') |
310 | 92 | Announcements | 92 | Announcements |
313 | 93 | 20...: Apache announcement headline | 93 | Apache announcement headline... |
314 | 94 | ...More announcements | 94 | More announcements |
315 | 95 | Make announcement | 95 | Make announcement |
316 | 96 | 96 | ||
317 | 97 | Add another one, this time specifying a date in the past, which should | 97 | Add another one, this time specifying a date in the past, which should |
318 | @@ -115,9 +115,9 @@ | |||
319 | 115 | >>> print latest_news(priv_browser.contents).encode( | 115 | >>> print latest_news(priv_browser.contents).encode( |
320 | 116 | ... 'ascii', 'backslashreplace') | 116 | ... 'ascii', 'backslashreplace') |
321 | 117 | Announcements | 117 | Announcements |
325 | 118 | 20...: Apache announcement headline | 118 | Apache announcement headline ... |
326 | 119 | 2007-11-24: Tomcat announcement headline | 119 | Tomcat announcement headline on 2007-11-24 ... |
327 | 120 | ...More announcements | 120 | More announcements |
328 | 121 | Make announcement | 121 | Make announcement |
329 | 122 | 122 | ||
330 | 123 | Let's make sure that the announcement is presented as a link. | 123 | Let's make sure that the announcement is presented as a link. |
331 | 124 | 124 | ||
332 | === modified file 'lib/lp/registry/stories/standalone/xx-karmacontext-topcontributors.txt' | |||
333 | --- lib/lp/registry/stories/standalone/xx-karmacontext-topcontributors.txt 2009-04-17 10:32:16 +0000 | |||
334 | +++ lib/lp/registry/stories/standalone/xx-karmacontext-topcontributors.txt 2009-08-07 15:47:52 +0000 | |||
335 | @@ -56,7 +56,7 @@ | |||
336 | 56 | >>> print find_portlet( | 56 | >>> print find_portlet( |
337 | 57 | ... anon_browser.contents, 'Top contributors').renderContents() | 57 | ... anon_browser.contents, 'Top contributors').renderContents() |
338 | 58 | <BLANKLINE> | 58 | <BLANKLINE> |
340 | 59 | <h2>Top contributors</h2> | 59 | <h2> Top contributors </h2> |
341 | 60 | ...Sample Person... | 60 | ...Sample Person... |
342 | 61 | ...Mark Shuttleworth... | 61 | ...Mark Shuttleworth... |
343 | 62 | ...Foo Bar... | 62 | ...Foo Bar... |
344 | @@ -92,7 +92,7 @@ | |||
345 | 92 | >>> print find_portlet( | 92 | >>> print find_portlet( |
346 | 93 | ... anon_browser.contents, 'Top contributors').renderContents() | 93 | ... anon_browser.contents, 'Top contributors').renderContents() |
347 | 94 | <BLANKLINE> | 94 | <BLANKLINE> |
349 | 95 | <h2>Top contributors</h2> | 95 | <h2> Top contributors </h2> |
350 | 96 | ...Sample Person... | 96 | ...Sample Person... |
351 | 97 | ...Mark Shuttleworth... | 97 | ...Mark Shuttleworth... |
352 | 98 | ...Foo Bar... | 98 | ...Foo Bar... |
353 | 99 | 99 | ||
354 | === modified file 'lib/lp/registry/templates/hasannouncements-portlet-latest.pt' | |||
355 | --- lib/lp/registry/templates/hasannouncements-portlet-latest.pt 2009-07-17 17:59:07 +0000 | |||
356 | +++ lib/lp/registry/templates/hasannouncements-portlet-latest.pt 2009-08-07 22:14:06 +0000 | |||
357 | @@ -4,36 +4,43 @@ | |||
358 | 4 | xmlns:i18n="http://xml.zope.org/namespaces/i18n" | 4 | xmlns:i18n="http://xml.zope.org/namespaces/i18n" |
359 | 5 | omit-tag=""> | 5 | omit-tag=""> |
360 | 6 | <tal:news define="announcements view/latest_announcements; | 6 | <tal:news define="announcements view/latest_announcements; |
361 | 7 | has_announcements announcements/count; | ||
362 | 7 | overview_menu context/menu:overview"> | 8 | overview_menu context/menu:overview"> |
371 | 8 | <div | 9 | <div id="portlet-latest-announcements" class="portlet announcements"> |
372 | 9 | class="portlet" | 10 | <h2> |
373 | 10 | id="portlet-latest-announcements"> | 11 | <span style="float: right;"><a title="Atom 1.0 feed" |
374 | 11 | <h2>Announcements</h2> | 12 | tal:attributes="href view/feed_url"><img src="/@@/rss.png"/></a></span> |
375 | 12 | <div class="portletBody portletContent"> | 13 | Announcements |
376 | 13 | <a title="Atom 1.0 feed" | 14 | </h2> |
377 | 14 | tal:attributes="href view/feed_url"> | 15 | |
378 | 15 | </a> | 16 | <p tal:condition="not: has_announcements"> |
379 | 17 | <tal:name replace="context/displayname" /> has no announcements. | ||
380 | 18 | </p> | ||
381 | 19 | |||
382 | 20 | <tal:announcements condition="has_announcements"> | ||
383 | 16 | <ul> | 21 | <ul> |
390 | 17 | <li tal:repeat="announcement announcements" class="news"> | 22 | <li tal:repeat="announcement announcements"> |
391 | 18 | <img src="/@@/warning" alt="[Not published]" | 23 | <div class="latest-announcement" |
392 | 19 | title="This is not yet a public announcement" | 24 | tal:omit-tag="not: repeat/announcement/start"> |
393 | 20 | tal:condition="not: announcement/published" /> | 25 | <img src="/@@/warning" alt="[Not published]" |
394 | 21 | <a tal:attributes="href announcement/fmt:url"> | 26 | title="This is not yet a public announcement" |
395 | 22 | <span | 27 | tal:condition="not: announcement/published" /> |
396 | 28 | <a tal:attributes="href announcement/fmt:url" | ||
397 | 29 | tal:content="announcement/title" /> | ||
398 | 30 | <strong | ||
399 | 23 | tal:condition="announcement/date_announced" | 31 | tal:condition="announcement/date_announced" |
403 | 24 | tal:replace="string:${announcement/date_announced/fmt:date}:" /> | 32 | tal:content="announcement/date_announced/fmt:displaydate" /> |
404 | 25 | <span tal:replace="announcement/title" /> | 33 | <br /> <tal:extract replace="announcement/summary/fmt:shorten/80" /> |
405 | 26 | </a> | 34 | </div> |
406 | 27 | </li> | 35 | </li> |
407 | 28 | </ul> | 36 | </ul> |
416 | 29 | <div | 37 | |
417 | 30 | tal:content="structure overview_menu/announcements/render" | 38 | <div class="see-all" |
418 | 31 | /> | 39 | tal:content="structure overview_menu/announcements/render" /> |
419 | 32 | <div | 40 | </tal:announcements> |
420 | 33 | class="actions" | 41 | |
421 | 34 | tal:content="structure overview_menu/announce/render" | 42 | <div class="actions" |
422 | 35 | /> | 43 | tal:content="structure overview_menu/announce/render" /> |
415 | 36 | </div> | ||
423 | 37 | </div> | 44 | </div> |
424 | 38 | </tal:news> | 45 | </tal:news> |
425 | 39 | </tal:root> | 46 | </tal:root> |
426 | 40 | 47 | ||
427 | === modified file 'lib/lp/registry/templates/karmacontext-portlet-top-contributors.pt' | |||
428 | --- lib/lp/registry/templates/karmacontext-portlet-top-contributors.pt 2009-07-17 17:59:07 +0000 | |||
429 | +++ lib/lp/registry/templates/karmacontext-portlet-top-contributors.pt 2009-08-07 22:14:06 +0000 | |||
430 | @@ -1,27 +1,30 @@ | |||
431 | 1 | <div | 1 | <div |
432 | 2 | xmlns:tal="http://xml.zope.org/namespaces/tal" | 2 | xmlns:tal="http://xml.zope.org/namespaces/tal" |
433 | 3 | xmlns:metal="http://xml.zope.org/namespaces/metal" | ||
434 | 4 | xmlns:i18n="http://xml.zope.org/namespaces/i18n" | 3 | xmlns:i18n="http://xml.zope.org/namespaces/i18n" |
435 | 5 | class="portlet" id="portlet-top-contributors" | 4 | class="portlet" id="portlet-top-contributors" |
457 | 6 | tal:condition="view/getTopFiveContributors"> | 5 | tal:define="contributors view/getTopFiveContributors" |
458 | 7 | <h2>Top contributors</h2> | 6 | tal:condition="contributors"> |
459 | 8 | 7 | <h2> | |
460 | 9 | <table> | 8 | <span class="see-all" tal:condition="nothing"><a |
461 | 10 | <tr tal:repeat="contributor view/getTopFiveContributors"> | 9 | tal:replace="structure context/menu:overview/top_contributors/fmt:link" /></span> |
462 | 11 | <td> | 10 | Top contributors |
463 | 12 | <a tal:replace="structure contributor/person/fmt:link"> | 11 | </h2> |
464 | 13 | Guilherme Salgado | 12 | |
465 | 14 | </a> | 13 | <dl> |
466 | 15 | </td> | 14 | <tal:contributor tal:repeat="contributor contributors"> |
467 | 16 | <td align="right"> | 15 | <dt> |
468 | 17 | <span tal:replace="contributor/karmavalue" /> points | 16 | <a tal:replace="structure contributor/person/fmt:link"> |
469 | 18 | </td> | 17 | Guilherme Salgado</a> |
470 | 19 | </tr> | 18 | <strong> |
471 | 20 | </table> | 19 | <tal:karma replace="contributor/karmavalue" /> points |
472 | 21 | 20 | </strong> | |
473 | 22 | <div | 21 | </dt> |
474 | 23 | tal:define="link context/menu:overview/top_contributors" | 22 | </tal:contributor> |
475 | 24 | tal:content="structure link/render" | 23 | </dl> |
476 | 25 | class="actions" | 24 | |
477 | 26 | /> | 25 | <tal:comment condition="nothing"> |
478 | 26 | # XXX sinzui 2009-08-07 bug=410491: Remove this link and enable the | ||
479 | 27 | # see all link when the distribution index page is 3.0. | ||
480 | 28 | </tal:comment> | ||
481 | 29 | <a tal:replace="structure context/menu:overview/top_contributors/fmt:link" /> | ||
482 | 27 | </div> | 30 | </div> |
483 | 28 | 31 | ||
484 | === modified file 'lib/lp/registry/templates/sourcepackage-index.pt' | |||
485 | --- lib/lp/registry/templates/sourcepackage-index.pt 2009-07-17 17:59:07 +0000 | |||
486 | +++ lib/lp/registry/templates/sourcepackage-index.pt 2009-08-07 22:14:06 +0000 | |||
487 | @@ -19,7 +19,6 @@ | |||
488 | 19 | </metal:leftportlets> | 19 | </metal:leftportlets> |
489 | 20 | 20 | ||
490 | 21 | <metal:rightportlets fill-slot="portlets_two"> | 21 | <metal:rightportlets fill-slot="portlets_two"> |
491 | 22 | <div tal:replace="structure context/@@+portlet-latestquestions" /> | ||
492 | 23 | <div tal:replace="structure context/@@+portlet-releases" /> | 22 | <div tal:replace="structure context/@@+portlet-releases" /> |
493 | 24 | <div tal:replace="structure context/@@+portlet-upstream" /> | 23 | <div tal:replace="structure context/@@+portlet-upstream" /> |
494 | 25 | </metal:rightportlets> | 24 | </metal:rightportlets> |
495 | 26 | 25 | ||
496 | === modified file 'lib/lp/registry/templates/team-index.pt' | |||
497 | --- lib/lp/registry/templates/team-index.pt 2009-07-17 17:59:07 +0000 | |||
498 | +++ lib/lp/registry/templates/team-index.pt 2009-08-07 15:29:15 +0000 | |||
499 | @@ -328,8 +328,6 @@ | |||
500 | 328 | replace="structure overview_menu/received_invitations/fmt:link" /> | 328 | replace="structure overview_menu/received_invitations/fmt:link" /> |
501 | 329 | </p> | 329 | </p> |
502 | 330 | </div> | 330 | </div> |
503 | 331 | |||
504 | 332 | <div tal:replace="structure context/@@+portlet-latestquestions" /> | ||
505 | 333 | </div> | 331 | </div> |
506 | 334 | </body> | 332 | </body> |
507 | 335 | </html> | 333 | </html> |
508 | 336 | 334 |
This is my branch to update portlets used by pillars to UI 3.0.
lp:~sinzui/launchpad/answers-portlets /bugs.launchpad .net/bugs/ answers- portlets question- overview| xx-announcement s|xx-karmaconte xt-topcontribut ors" implementation: beuno
Diff size: 508
Launchpad bug: https:/
Test command: ./bin/test -vv \
-t "faq-views|
Pre-
Target release: 2.2.8
= Update portlets used by pillars to UI 3.0 =
There are several portlets that need updating to the new project UI.
These portlets will also be used by Distributions and ProjectGroups: top
contributors, announcements, and latest questions. They also need a new
portlet to show the latest FAQs.
== Rules ==
* Create an FAQ portlet. rcePackage.
* Update the latest questions portlet.
* Remove it from teams, they cannot ask questions.
* Remove it from SourcePackages, the questions really belong
to the DistributionSou
* Update the top contributors portlet.
* Update the announcements portlet.
== QA ==
Describe the steps to verify that the project behaves correctly
== Lint ==
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: answers/ browser/ configure. zcml answers/ browser/ faqcollection. py answers/ browser/ questiontarget. py answers/ browser/ tests/faq- views.txt answers/ stories/ question- overview. txt answers/ templates/ faqcollection- portlet- faqs.pt answers/ templates/ questiontarget- portlet- latestquestions .pt registry/ stories/ announcements/ xx-announcement s.txt registry/ stories/ standalone/ xx-karmacontext -topcontributor s.txt registry/ templates/ hasannouncement s-portlet- latest. pt registry/ templates/ karmacontext- portlet- top-contributor s.pt registry/ templates/ sourcepackage- index.pt registry/ templates/ team-index. pt
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
== Test ==
* lib/lp/ answers/ browser/ tests/faq- views.txt answers/ stories/ question- overview. txt registry/ stories/ announcements/ xx-announcement s.txt registry/ stories/ standalone/ xx-karmacontext -topcontributor s.txt
* Added a test to verify that latest faqs portlet works.
* The original test did not make sense. There are already model
tests for creating an FAQ. I think this was an incomplete test
that was committed. I repurposed it to do a real view test.
* lib/lp/
* Updated the test to verify the information presented in the
latest questions portlet.
* lib/lp/
* Revised the test to verify the layout of the links.
* lib/lp/
* Revised the test because the headings changed for 3.0.
== Implementation ==
* lib/lp/ answers/ browser/ configure. zcml answers/ browser/ faqcollection. py answers/ browser/ questiontarget. py
* Registered +portlet-listfaqs on the existing SearchFAQsView.
* lib/lp/
* Added a create_faq link. The templates were/are making this link.
They can be updated when they are converted to 3.0
* Added 2 properties to SearchFAQsView to support it's reuse as a
portlet.
* lib/lp/
* Added a property to the LatestQuestio...